Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BRA main
- main INP R0
- INP R1
- PSH {R0, R1}
- JMS readArr
- JMS printArr
- HLT
- readArr MOV R2, #0 //i
- loopRead CMP R2, R0
- BEQ doneRead
- INP R4
- STR R4, [R1]
- ADD R1, #1
- ADD R2, #1
- BRA loopRead
- doneRead RET
- printArr POP {R0, R1}
- PSH {LR}
- MOV R2, #0
- MOV R3, R1
- loopPrint CMP R2, R0
- BEQ donePrint
- LDR R4, [R3]
- JMS isFib
- OUT R4
- ADD R3, #1
- ADD R2, #1
- BRA loopPrint
- donePrint POP {PC}
- isFib MOV R5, #0
- MOV R6, #1
- CMP R5, R4
- BEQ belong
- CMP R6, R4
- BEQ belong
- MOV R7, #0
- fibloop CMP R7, R4
- BHI nbelong
- BEQ belong
- ADD R7, R5, R6
- MOV R5, R6
- MOV R6, R7
- BRA fibloop
- belong MOV R4, #1
- RET
- nbelong MOV R4, #0
- RET
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement