fork download
  1. bits 32
  2.  
  3. section .data
  4. num1 dd 250
  5. num2 dd 10
  6. num3 dd 5
  7. msg db "Result (lower byte): 0x", 0
  8. newline db 10
  9.  
  10. section .bss
  11. hex_digit resb 2
  12.  
  13. section .text
  14. global _start
  15.  
  16. _start:
  17. mov eax, [num1]
  18. mov ebx, [num2]
  19. mov ecx, [num3]
  20.  
  21. add eax, ebx
  22.  
  23. sub eax, ecx
  24. mov al, al
  25. and al, 0x0F
  26.  
  27. cmp al, 0x0A
  28. jl is_digit
  29. add al, 0x37
  30. jmp save_digit
  31.  
  32. is_digit:
  33. add al, 0x30
  34.  
  35. save_digit:
  36. mov [hex_digit], al
  37. mov byte [hex_digit+1], 0
  38.  
  39. mov eax, 4
  40. mov ebx, 1
  41. mov ecx, msg
  42. mov edx, 20
  43. int 0x80
  44.  
  45. mov eax, 4
  46. mov ebx, 1
  47. mov ecx, hex_digit
  48. mov edx, 1
  49. int 0x80
  50.  
  51. mov eax, 4
  52. mov ebx, 1
  53. mov ecx, newline
  54. mov edx, 1
  55. int 0x80
  56.  
  57. mov eax, 1
  58. xor ebx, ebx
  59. int 0x80
  60.  
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
Result (lower byte):F