TITLE "A Hello-World Program with home-made DSPST" S START USE "hawk.macs" USE "monitor.h" EXT UNUSED ; the program starts here! START: LIL R2,UNUSED ; set up the stack ; --- begin aplication code LIL R1,DSPINI JSRS R1,R1 ; initialize the display LIS R8,1 LOOP: ; for (R8=1; R8!=10; R8++) { LIS R9,10 CMP R8,R9 BEQ LOOPQ LIL R3,HELLO JSR R1,MYDSPST ; mydspst(HELLO) ; LIL R1,DSPST ; ----- replaced code ; JSRS R1,R1 ; ----- replaced code ADDSI R8,1 BR LOOP ; } LOOPQ: ; --- end aplication code LIL R1,EXIT JSRS R1,R1 ; stop! ; --- begin aplication constants HELLO: ASCII "Hello world! ",0 ALIGN 2 ; activation record for MYDSPST RETAD = 0 STRING = 4 ARSIZE = 8 MYDSPST: ; expects R3, s to point to the string ; wipes out R4-?? ; call dspch for each char in string STORE R1,R2,RETAD STORE R3,R2,STRING MYDSLP: ; for (;;) { LOAD R3,R2,STRING LOADS R4,R3 ; -- get word holding char EXTB R3,R4,R3 ; char = *string BZS MYDSQT ; if (char == NULL) exit; ADDI R2,R2,ARSIZE LIL R1,DSPCH JSRS R1,R1 ; dspch( char ) ADDI R2,R2,-ARSIZE LOAD R3,R2,STRING ADDSI R3,1 ; string++; STORE R3,R2,STRING BR MYDSLP ; -- stupid error! this was missing MYDSQT: ; } LOAD R1,R2,RETAD JUMPS R1 ; return END