LongAddition.s 763 B

1234567891011121314151617181920212223242526
  1. @
  2. @ Example of 64-bit addition with
  3. @ the ADD/ADC instructions.
  4. @
  5. .global _start @ Provide program starting address
  6. @ Load the registers wit some data.
  7. @ First 64-bit number is 0x00000003FFFFFFFF
  8. _start:
  9. MOV R2, #0x00000003
  10. MOV R3, #0xFFFFFFFF @ as; will change to MVN
  11. @ Second 64-bit number is 0x0000000500000001
  12. MOV R4, #0x00000005
  13. MOV R5, #0x00000001
  14. ADDS R1, R3, R5 @ Lower order word
  15. ADC R0, R2, R4 @ Higher order word
  16. @ Set up the parameters to exit the program
  17. @ and then call Linux to do it.
  18. @ R0 is the return code and will be wha we
  19. @ calculated above.
  20. MOV R7, #1 @ Service command code 1
  21. SVC 0 @ Call Linux to terminate