Advertisement
berinkaq

Untitled

May 10th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. %include "io.inc"
  2.  
  3. section .data
  4. a dd 26
  5. arr db 'abcdefghijklmnopqrstuvwxyz',0
  6.  
  7. section .bss
  8. s resb 1
  9.  
  10. section .text
  11. global CMAIN
  12. CMAIN:
  13. mov ebp, esp; for correct debugging
  14. GET_DEC 4, edi
  15. GET_CHAR ecx
  16. GET_STRING s, 100
  17. xor ecx, ecx
  18. PRINT_STRING s
  19.  
  20. .loop:
  21. mov esi, s
  22. add esi, ecx
  23. cmp byte[esi], 0
  24. jz .end
  25. cmp byte[esi], 'a'
  26. jl .continue
  27. cmp byte[esi], 'z'
  28. jg .continue
  29. movzx eax, byte[esi]
  30. sub eax, 'a'
  31. add eax, edi
  32. xor edx, edx
  33. div dword[a]
  34. mov eax, edx
  35. mov edx, arr
  36. add edx, eax
  37. mov dl, [edx]
  38. mov byte[esi], dl
  39. .continue:
  40. inc ecx
  41. jmp .loop
  42.  
  43. .end:
  44. NEWLINE
  45. PRINT_STRING s
  46. xor eax, eax
  47. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement