Guest User

Untitled

a guest
Jul 17th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. .text
  2. .align 2
  3. .global hexasc
  4.  
  5. hexasc:
  6. andi r8, r4, 0xf # Strips away all but the first 4 bits
  7. movi r9, 0x0a
  8. blt r8, r9, digit # If true it's a digit
  9. addi r2, r8, 0x37 # Adds 0x37 which gives the correct ASCII-code
  10. ret
  11. digit:
  12. addi r2, r8, 0x30 # Adds 0x30 so that it gives the correct ASCII-code
  13. ret
Add Comment
Please, Sign In to add comment