fork download
  1. section .data
  2. prompt1 db "Key in the first number : ", 0
  3. prompt2 db "Key in the second number : ", 0
  4. result1 db "The total is ", 0
  5. result2 db "The division result is ", 0
  6. result3 db "The remainder value is ", 0
  7. newline db 10, 0
  8.  
  9. section .bss
  10. num1 resb 2
  11. num2 resb 2
  12.  
  13. section .text
  14. global _start
  15.  
  16. _start:
  17.  
  18. mov eax, 4
  19. mov ebx, 1
  20. mov ecx, prompt1
  21. mov edx, 23
  22. int 0x80
  23.  
  24.  
  25. mov eax, 3
  26. mov ebx, 0
  27. mov ecx, num1
  28. mov edx, 2
  29. int 0x80
  30.  
  31.  
  32. mov eax, 4
  33. mov ebx, 1
  34. mov ecx, prompt2
  35. mov edx, 24
  36. int 0x80
  37.  
  38.  
  39. mov eax, 3
  40. mov ebx, 0
  41. mov ecx, num2
  42. mov edx, 2
  43. int 0x80
  44.  
  45. mov al, [num1]
  46. sub al, '0'
  47. mov [num1], al
  48.  
  49.  
  50. mov al, [num2]
  51. sub al, '0'
  52. mov [num2], al
  53.  
  54.  
  55. mov al, [num1]
  56. mul byte [num2]
  57. mov [num1], al
  58.  
  59.  
  60. mov eax, 4
  61. mov ebx, 1
  62. mov ecx, result1
  63. mov edx, 13
  64. int 0x80
  65.  
  66. mov al, [num1]
  67. add al, '0'
  68. mov [num1], al
  69. mov ecx, num1
  70. mov edx, 1
  71. int 0x80
  72.  
  73.  
  74. mov eax, 4
  75. mov ebx, 1
  76. mov ecx, newline
  77. mov edx, 1
  78. int 0x80
  79.  
  80. mov al, [num1]
  81. div byte [num2]
  82. mov [num1], al
  83.  
  84.  
  85. mov eax, 4
  86. mov ebx, 1
  87. mov ecx, result2
  88. mov edx, 16
  89. int 0x80
  90.  
  91. mov al, [num1]
  92. add al, '0'
  93. mov [num1], al
  94. mov ecx, num1
  95. mov edx, 1
  96. int 0x80
  97.  
  98.  
  99. mov eax, 4
  100. mov ebx, 1
  101. mov ecx, newline
  102. mov edx, 1
  103. int 0x80
  104.  
  105.  
  106. mov al, [num1]
  107. mov ah, 0
  108. div byte [num2]
  109. mov [num1], ah
  110.  
  111.  
  112. mov eax, 4
  113. mov ebx, 1
  114. mov ecx, result3
  115. mov edx, 17
  116. int 0x80
  117.  
  118. mov al, [num1]
  119. add al, '0'
  120. mov [num1], al
  121. mov ecx, num1
  122. mov edx, 1
  123. int 0x80
  124.  
  125.  
  126. mov eax, 4
  127. mov ebx, 1
  128. mov ecx, newline
  129. mov edx, 1
  130. int 0x80
  131.  
  132. ; Exit program
  133. mov eax, 1
  134. xor ebx, ebx
  135. int 0x80
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
Key in the first numberKey in the second numberThe total is 
The division res
The remainder val