Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. @ numerals: print chars '0' through '9'
  2.  
  3. @ define my Raspberry Pi
  4. .cpu cortex-a53
  5. .fpu neon-fp-armv8
  6. .syntax unified
  7.  
  8. @ constants
  9. .equ STDOUT, 1
  10.  
  11. @ program
  12. .text
  13. .align 2
  14. .global main
  15. .type main, %function
  16.  
  17. main:
  18. @ save link register
  19. push { lr }
  20. @ init current char
  21. mov r0, '0
  22. push { r0 }
  23. 1:
  24. @ print current char
  25. mov r0, STDOUT
  26. mov r1, sp
  27. mov r2, 1
  28. bl write
  29. @ increment current char
  30. pop { r0 }
  31. add r0, r0, 1
  32. push { r0 }
  33. @ check loop condition
  34. cmp r0, '9
  35. ble 1b
  36. @ set return val
  37. mov r0, 0
  38. @ pop vals from stack
  39. pop { r1, pc }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement