; ; UFRGS - INF - M Johann - 2023 - johann@inf.ufrgs.br ; Writes first 14 numbers of the Fibonacci sequence: ; 0,1,1,2,3,5,8,13,21,34,55,89,144,233 ; ----- DATA org h80 screen: dab 0,1,0,0,0,0,0,0,0,0,0,0,0,0 ; ----- BEGIN MAIN CODE org 0 startup: LDR X,#screen+#1 ; index at second position LDR A,screen+1 ; first = sum in RA LDR B,#12 ; RB controls iterations loop: ADD A,-1,X ; adds previous position STR A,1,X ; stores at next position ADD X,#1 ; advance position SUB B,#1 ; decrement loop JZ finish JMP loop finish: HLT ; END OF FILE