TITLE "hello.a -- hello world program" ; this version repeats itself 5 times ; the code for the definite loop is not optimized ; each iteration outputs one character less of the string ; each iteration outputs one character over on the screen USE "hawk.macs" USE "monitor.h" EXT UNUSED S START ; ------- application constants begin here HELLO: ASCII "Hello World! ",0 ; ------- application constants end here ALIGN 2 START: LIL R2,UNUSED ; initialize stack pointer LIL R1,DSPINI JSRS R1,R1 ; call monitor's dspini routine ; ------- application code begins here LIS R8,1 ; i = 1; LIL R9,HELLO ; s = pointer to "Hello world!" LOOP: LIS R1,5 SUB R1,R8,R1 BGT QUIT ; while (i <= 5) do { ADDI R3,R8,-1 ; -- parameter x = i-1 MOVE R4,R3 ; -- parameter y = same LIL R1,DSPAT JSRS R1,R1 ; dspat(i-1,i-1) MOVE R3,R9 ; -- parameter s LIL R1,DSPST JSRS R1,R1 ; dspst(s) ADDSI R8,1 ; i = i + 1; ADDSI R9,1 ; s = s + 1; BR LOOP QUIT: ; } ; ------- application code ends here LIL R1,EXIT JSRS R1,R1 ; exit() END