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