TITLE "mp2.a by Douglas W. Jones" ; Feb. 22, 2015 ; computes the first 30 triangular numbers" ; this code is based on the hello world skeleton 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 --- LIS R8,0 ; t = 0 -- initial triangular number LIS R9,0 ; i = 0 -- counts the sequence LOOP: CMPI R9,30 BGE QUIT ; while (i < 30) { ADD R8,R8,R9 ; t = t + i ADDSI R9,1 ; i = i + 1 MOVE R3,R8 ; -- parameter i LIS R4,8 ; -- parameter 8 LIL R1,PUTDECU JSRS R1,R1 ; putdecu( i, 8 ) BR LOOP QUIT: ; } ; --- end aplication code --- ADDI R2,R2,-ARSIZE LOADS R1,R2 JUMPS R1 ; return END