TITLE "MP2 solved by Douglas Jones" ; a program to compute the Fibonacci series ; posted on the web, Feb. 27, 2012 USE "hawk.h" USE "monitor.h" ARSIZE = 4 INT MAIN S MAIN MAIN: STORES R1,R2 ADDI R2,R2,ARSIZE ; --- begin application code --- LIS R8,25 ; x = 25 -- loop counter LIS R9,0 ; i = 0 LIS R10,1 ; j = 1 LOOP: ; repeat MOVE R3,R9 ; -- parameter i - number to output LIS R4,1 ; -- parameter 1 - field width LIL R1,PUTDECU JSRS R1,R1 ; putdecu( i, 1 ) LIS R3,' ' ; -- parameter ' ' - character to output LIL R1,PUTCHAR JSRS R1,R1 ; putchar( ' ' ) ADD R11,R9,R10 ; k = i + j MOVE R9,R10 ; i = j MOVE R10,R11 ; j = k ADDSI R8,-1 ; x = x - 1 BGT LOOP ; until (x <= 0) ; --- end application code --- ADDI R2,R2,-ARSIZE LOADS R1,R2 JUMPS R1 END