Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .stack 100
- .data
- inputA db 'Nhap so A = $'
- inputB db 'Nhap so B = $'
- outputResult db 'Tong A + B = $'
- CLRF db 13, 10, '$'
- .code
- main proc
- mov ax, @data
- mov ds, ax
- mov ah, 9 ; hien thi "Nhap so A = "
- lea dx, inputA
- int 21h
- call inputDec ; goi CTC nhap so thu nhat he 10
- push ax ; luu ax da nhap lai
- call nextLine ; xuong dong
- mov ah, 9 ; lam tuong tu voi so thu hai
- lea dx, inputB
- int 21h
- call inputDec
- mov bl, al
- call nextLine
- pop ax ; goi ax tu Stack ra
- call sum ; goi ham tinh tong 2 so (trong ax va bx)
- push ax ; luu ax lai
- mov ah, 9 ; hien thi KQ
- lea dx, outputResult
- int 21h
- pop ax
- call outputDec ; goi CTC hien thi KQ
- mov ah, 4ch
- int 21h
- main endp
- sum proc ; CTC con tinh tong 2 so
- add ax, bx
- ret
- sum endp
- nextLine proc ; CTC xuong dong
- mov ah, 9
- lea dx, CLRF
- int 21h
- ret
- nextLine endp
- include include\inputDecProc.asm ; tep chua CTC nhap so he 10
- include include\outputDecProc.asm ; tep chua CTC hien thi so he 10
- end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement