section .data
    a db 9
    b db 3

    msg1 db "9 + 3 = "
    len1 equ $-msg1

    msg2 db 10,"9 - 3 = "
    len2 equ $-msg2

    msg3 db 10,"9 * 3 = "
    len3 equ $-msg3

    msg4 db 10,"9 / 3 = "
    len4 equ $-msg4

section .bss
    result resb 2

section .text
global _start

_start:

;=========================
; Tong
;=========================
    mov eax,4
    mov ebx,1
    mov ecx,msg1
    mov edx,len1
    int 0x80

    mov al,[a]
    add al,[b]          ; 12

    aam                 ; AH=1 AL=2
    add ax,3030h

    mov [result],ah
    mov [result+1],al

    mov eax,4
    mov ebx,1
    mov ecx,result
    mov edx,2
    int 0x80

;=========================
; Hieu
;=========================
    mov eax,4
    mov ebx,1
    mov ecx,msg2
    mov edx,len2
    int 0x80

    mov al,[a]
    sub al,[b]
    add al,'0'

    mov [result],al

    mov eax,4
    mov ebx,1
    mov ecx,result
    mov edx,1
    int 0x80

;=========================
; Tich
;=========================
    mov eax,4
    mov ebx,1
    mov ecx,msg3
    mov edx,len3
    int 0x80

    mov al,[a]
    mul byte [b]        ; 27

    aam
    add ax,3030h

    mov [result],ah
    mov [result+1],al

    mov eax,4
    mov ebx,1
    mov ecx,result
    mov edx,2
    int 0x80

;=========================
; Thuong
;=========================
    mov eax,4
    mov ebx,1
    mov ecx,msg4
    mov edx,len4
    int 0x80

    xor ah,ah
    mov al,[a]
    div byte [b]

    add al,'0'
    mov [result],al

    mov eax,4
    mov ebx,1
    mov ecx,result
    mov edx,1
    int 0x80

;=========================
; Xuống dòng cuối
;=========================
    mov eax,4
    mov ebx,1
    mov ecx,newline
    mov edx,1
    int 0x80

    mov eax,1
    xor ebx,ebx
    int 0x80

section .data
newline db 10