TITLE "MP2 by Douglas Jones, version a" ; calls SHOWITEM for each item in a linked list of items, ; where ITEM1 is the address of the first item, and ; each item begins with a pointer to the next item in the list S START USE "hawk.macs" USE "monitor.h" COMMON STACK,#1000 PSTACK: W STACK ; ----------------- linkage ------------------ EXT ITEM1 PITEM1: W ITEM1 ; link to the data structures from mp1 EXT SHOWITEM PSHOWITEM: W SHOWITEM; link to the code in mp2test.o SUBTITLE "main program" ; -------------------------------------------- START: LOAD R2,PSTACK ; set up the stack LOAD R1,PDSPINI JSRS R1,R1 ; initialize the display LOAD R8,PITEM1 ; p = pitem1, points to start of list MAINLP: ; for (;;) { TESTR R8 BZS MAINQ ; if (p == NULL) exit MOVE R3,R8 ; parameter p LOAD R1,PSHOWITEM JSRS R1,R1 ; call showitem( p ) LOADS R8,R8 ; p = p->next BR MAINLP ; } MAINQ: LOAD R1,PEXIT JSRS R1,R1 ; call monitor routine to stop! END