section .data
prompt1 db "Key in the first number : ", 20
prompt2 db "Key in the second number : ", 7
result1 db "The total is ", 140
result2 db "The division result is ", 2
result3 db "The remainder value is ", 6
newline db 10, 0
section .bss
num1 resb 2
num2 resb 2
section .text
global _start
_start:
; Display prompt for first number
mov eax, 4
mov ebx, 1
mov ecx, prompt1
mov edx, 23
int 0x80
; Read first number
mov eax, 3
mov ebx, 0
mov ecx, num1
mov edx, 2
int 0x80
; Display prompt for second number
mov eax, 4
mov ebx, 1
mov ecx, prompt2
mov edx, 24
int 0x80
; Read second number
mov eax, 3
mov ebx, 0
mov ecx, num2
mov edx, 2
int 0x80
; Convert first number to integer
mov al, [num1]
sub al, '0'
mov [num1], al
; Convert second number to integer
mov al, [num2]
sub al, '0'
mov [num2], al
; Calculate multiplication
mov al, [num1]
mul byte [num2]
mov [num1], al
; Display multiplication result
mov eax, 4
mov ebx, 1
mov ecx, result1
mov edx, 13
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
; Display newline
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
; Calculate division
mov al, [num1]
div byte [num2]
mov [num1], al
; Display division result
mov eax, 4
mov ebx, 1
mov ecx, result2
mov edx, 16
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
; Display newline
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
; Calculate remainder
mov al, [num1]
mov ah, 0
div byte [num2]
mov [num1], ah
; Display remainder
mov eax, 4
mov ebx, 1
mov ecx, result3
mov edx, 17
int 0x80
mov al, [num1]
add al, '0'
mov [num1], al
mov ecx, num1
mov edx, 1
int 0x80
; Display newline
mov eax, 4
mov ebx, 1
mov ecx, newline
mov edx, 1
int 0x80
; Exit program
mov eax, 1
xor ebx, ebx
int 0x80
c2VjdGlvbiAuZGF0YQogICAgcHJvbXB0MSBkYiAiS2V5IGluIHRoZSBmaXJzdCBudW1iZXIgO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0IHNlY29uZCBudW1iZXIgdG8gaW50ZWdlcgogICAgbW92IGFsLCBbbnVtMl0KICAgIHN1YiBhbCwgJzAnCiAgICBtb3YgW251bTJdLCBhbAoKICAgIDsgQ2FsY3VsYXRlIG11bHRpcGxpY2F0aW9uCiAgICBtb3YgYWwsIFtudW0xXQogICAgbXVsIGJ5dGUgW251bTJdCiAgICBtb3YgW251bTFdLCBhbAoKICAgIDsgRGlzcGxheSBtdWx0aXBsaWNhdGlvbiByZXN1bHQKICAgIG1vdiBlYXgsIDQKICAgIG1vdiBlYngsIDEKICAgIG1vdiBlY3gsIHJlc3VsdDEKICAgIG1vdiBlZHgsIDEzCiAgICBpbnQgMHg4MAoKICAgIG1vdiBhbCwgW251bTFdCiAgICBhZGQgYWwsICcwJwogICAgbW92IFtudW0xXSwgYWwKICAgIG1vdiBlY3gsIG51bTEKICAgIG1vdiBlZHgsIDEKICAgIGludCAweDgwCgogICAgOyBEaXNwbGF5IG5ld2xpbmUKICAgIG1vdiBlYXgsIDQKICAgIG1vdiBlYngsIDEKICAgIG1vdiBlY3gsIG5ld2xpbmUKICAgIG1vdiBlZHgsIDEKICAgIGludCAweDgwCgogICAgOyBDYWxjdWxhdGUgZGl2aXNpb24KICAgIG1vdiBhbCwgW251bTFdCiAgICBkaXYgYnl0ZSBbbnVtMl0KICAgIG1vdiBbbnVtMV0sIGFsCgogICAgOyBEaXNwbGF5IGRpdmlzaW9uIHJlc3VsdAogICAgbW92IGVheCwgNAogICAgbW92IGVieCwgMQogICAgbW92IGVjeCwgcmVzdWx0MgogICAgbW92IGVkeCwgMTYKICAgIGludCAweDgwCgogICAgbW92IGFsLCBbbnVtMV0KICAgIGFkZCBhbCwgJzAnCiAgICBtb3YgW251bTFdLCBhbAogICAgbW92IGVjeCwgbnVtMQogICAgbW92IGVkeCwgMQogICAgaW50IDB4ODAKCiAgICA7IERpc3BsYXkgbmV3bGluZQogICAgbW92IGVheCwgNAogICAgbW92IGVieCwgMQogICAgbW92IGVjeCwgbmV3bGluZQogICAgbW92IGVkeCwgMQogICAgaW50IDB4ODAKCiAgICA7IENhbGN1bGF0ZSByZW1haW5kZXIKICAgIG1vdiBhbCwgW251bTFdCiAgICBtb3YgYWgsIDAKICAgIGRpdiBieXRlIFtudW0yXQogICAgbW92IFtudW0xXSwgYWgKCiAgICA7IERpc3BsYXkgcmVtYWluZGVyCiAgICBtb3YgZWF4LCA0CiAgICBtb3YgZWJ4LCAxCiAgICBtb3YgZWN4LCByZXN1bHQzCiAgICBtb3YgZWR4LCAxNwogICAgaW50IDB4ODAKCiAgICBtb3YgYWwsIFtudW0xXQogICAgYWRkIGFsLCAnMCcKICAgIG1vdiBbbnVtMV0sIGFsCiAgICBtb3YgZWN4LCBudW0xCiAgICBtb3YgZWR4LCAxCiAgICBpbnQgMHg4MAoKICAgIDsgRGlzcGxheSBuZXdsaW5lCiAgICBtb3YgZWF4LCA0CiAgICBtb3YgZWJ4LCAxCiAgICBtb3YgZWN4LCBuZXdsaW5lCiAgICBtb3YgZWR4LCAxCiAgICBpbnQgMHg4MAoKICAgIDsgRXhpdCBwcm9ncmFtCiAgICBtb3YgZWF4LCAxCiAgICB4b3IgZWJ4LCBlYngKICAgIGludCAweDgw