TITLE "A Hello-World Program" ; modified to use MYPUTS instead of the Hawk monitor 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 --- LIL R3,HELLO JSR R1,MYPUTS ; myputs(HELLO) ; --- end aplication code --- ADDI R2,R2,-ARSIZE LOADS R1,R2 JUMPS R1 ; return ; --- begin aplication constants --- HELLO: ASCII "Hello world!",0 ALIGN 2 RETAD = 0 SVR8 = 4 ARSIZE = 8 MYPUTS: ; expect R3 point to string s STORES R1,R2 STORE R8,R2,SVR8 ADDI R2,R2,ARSIZE ; -- optimized MOVE R8,R3 ; -- s pointer is in R8 LOOP: LOADS R3,R8 EXTB R3,R3,R8 BZS QUIT ; while (*s != 0) { LIL R1,PUTCHAR JSRS R1,R1 ; putchar(*s) ADDSI R8,1 ; s++ BR LOOP QUIT: ; } ADDI R2,R2,-ARSIZE ; -- optimized LOAD R8,R2,SVR8 LOADS R1,R2 JUMPS R1 ; return END