Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .global start
- start:
- MOV R0, #6 @ Number of elements
- LDR R1, =myNumber @ Get address of myNumber
- LDR R5, [R0] @ Get Large Number
- LDR R1, =array @ Load array address
- MOV R3, #1 @ Store Product
- MOV R4, #2 @ Current Element
- check:
- CMP R0, #1
- BNE loop
- B exit
- loop:
- STR R4, [R1], #4 @ Store element in array
- AND R6, R3, R5 @ R6 = R3 % R5
- AND R8, R4, R5 @ R8 = R4 % R5
- MUL R9, R6, R8 @ R9 = R6 * R8
- AND R4, R9, R5 @ R4 = R9 % R5
- MOV R3, R4
- ADD R4, R4, #1 @ R4 + 1
- AND R4, R4, R5 @ R4 % R5
- SUB R0, R0, #1 @ Number of elements--
- B check @ Return to check section
- exit:
- LDR R1, =array
- LDR R2, [R1] @ Load elements from array in registers to see their values
- LDR R3, [R1, #4] @ Load elements from array in registers to see their values
- LDR R4, [R1, #8] @ Load elements from array in registers to see their values
- LDR R5, [R1, #12] @ Load elements from array in registers to see their values
- LDR R6, [R1, #16] @ Load elements from array in registers to see their values
- LDR R8, [R1, #20] @ Load elements from array in registers to see their values
- MOV R7, #1 @ Terminate syscall with status 1
- SWI 0 @ Execute syscall
- largeNum:
- .word 1000000007
- .data
- array: .word 0, 0, 0, 0, 0, 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement