TITLE "mp3.a skeleton by Douglas Jones" S START USE "hawk.macs" USE "monitor.h" COMMON STACK,#1000 PSTACK: W STACK ; ----------------- linkage ------------------ ; these lines provide a link to the data structures from mp1 EXT ITEM1 PITEM1: W ITEM1 ; these lines provide a link to the code in mp2test.o EXT PLOTROW EXT PLOTSTR PPLOTROW: W PLOTROW PPLOTSTR: W PLOTSTR ; -------- the structure of one item --------- NEXT = 0 ; pointer to next item in list X = 4 ; X coordinate of this item Y = 8 ; Y coordinate of this item WIDTH = 12 ; width of this item HEIGHT = 16 ; height of this item TEXT = 20 ; pointer to text of this item or null NULL = 0 ; value of null pointers SUBTITLE "main program" ; -------------------------------------------- START: LOAD R2,PSTACK ; set up the stack LOAD R1,PDSPINI JSRS R1,R1 ; initialize the display LOAD R3,PITEM1 ; parameter p = pitem1, points to an item JSR R1,SHOWITEM ; call showitem( p ) LOAD R1,PEXIT JSRS R1,R1 ; call monitor routine to stop! SUBTITLE "showitem" ; -------------------------------------------- RETAD = 0 R8SV = 4 ARSIZE = 8 SHOWITEM: ; expects R3 = p, pointer to one item STORES R1,R2 ; save return address STORE R8,R2,R8SV ; save register 8 MOVE R8,R3 ; move p so we can make some calls LOAD R3,R8,X ; parameter x = p->x LOAD R4,R8,Y ; parameter y = p->y LOAD R5,R8,WIDTH ; parameter len = p->width LIS R6,'+' ; parameter end = '+' LIS R7,'-' ; parameter fill = '-' ADDI R2,R2,ARSIZE LOAD R1,PPLOTROW JSRS R1,R1 ; call plotrow(x,y,len,end,fill) ADDI R2,R2,-ARSIZE LOAD R3,R8,X ; parameter x = p->x LOAD R4,R8,Y ; parameter y = ADDSI R4,1 ; p->y + 1 LOAD R5,R8,TEXT ; parameter str = p->text ADDI R2,R2,ARSIZE LOAD R1,PPLOTSTR JSRS R1,R1 ; call plotstr(x,y,str) ADDI R2,R2,-ARSIZE LOAD R8,R2,R8SV ; restore register 8 LOADS R1,R2 ; restore return address JSRS R1,R1 END