TITLE "MP1.a by Douglas Jones" ; solution to MP1 USE "hawk.h" USE "monitor.h" ARSIZE = 4 INT MAIN S MAIN MAIN: ; entry point STORES R1,R2 ADDI R2,R2,ARSIZE ; --- begin aplication code --- LEA R8,LIST ; p = address of list LOOP: TESTR R8 ; while (p != NULL) { BZS XLOOP LOAD R3,R8,XCOORD LOAD R4,R8,YCOORD LIL R1,PUTAT JSRS R1,R1 ; putat( p->xcoord, p->ycoord ) LOAD R3,R8,TEXT LIL R1,PUTS JSRS R1,R1 ; puts( p->text ) LOAD R8,R8,NEXT ; p = p->next BR LOOP ; } XLOOP: ; --- end aplication code --- ADDI R2,R2,-ARSIZE LOADS R1,R2 JUMPS R1 ; return ; --- begin aplication constants --- ; value of null pointers NULL = 0 ; description of record structure of each list element XCOORD = 0 ; X coordinate where this string goes YCOORD = 4 ; Y coordinate where this string goes TEXT = 8 ; address of the text of the string NEXT = 12 ; pointer to next list element ALIGN 4 ; following list elements are word aligned ; head list element LIST: W 2,1 W HEADER W NAME1 ; list element to display first name NAME1: W 6,2 W DOUGLAS W NAME2 ; list element to display second name NAME2: W 14,2 W JONES W PROBLEM ; list element to display machine problem number PROBLEM:W 4,3 W MP1 W FINAL ; final list element FINAL: W 2,4 W HEADER W NULL ; string used in the head and final elements HEADER: ASCII "---------------------",0 ; strings added in solving the machine problem DOUGLAS:ASCII "Douglas",0 JONES: ASCII "Jones",0 MP1: ASCII "Machine Problem I",0 END