Advertisement
Eternoseeker

procedure

Mar 22nd, 2023
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ASM (NASM) 0.49 KB | Source Code | 0 0
  1. %macro print 2
  2.  mov rax,1
  3.  mov rdi,1
  4.  mov rsi,%1
  5.  mov rdx,%2
  6.  syscall
  7. %endmacro
  8.  
  9. %macro exit 0
  10.  mov rax,60
  11.  mov rdi,0
  12.  syscall
  13. %endmacro
  14.  
  15. section .bss
  16.  char_ans resb 2
  17.  
  18. section .text
  19.  global _start
  20.  
  21. _start:
  22.  mov rax, 20
  23.  call display
  24.  exit
  25.  
  26. display:
  27.  mov rbx, 16
  28.  mov rcx, 2
  29.  mov rsi,char_ans+1
  30.  
  31. back:
  32.  mov rdx, 0
  33.  
  34. div rbx; rax/rbx
  35.  
  36. cmp dl, 09h
  37. jbe add30
  38. add dl, 07h
  39.  
  40. add30:
  41.  add dl, 30h
  42.  
  43. mov[rsi], dl
  44. dec rsi
  45. dec rcx
  46. jnz back
  47.  
  48. print char_ans, 2
  49. ret
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement