0% found this document useful (0 votes)
9 views2 pages

Cong 2 So Dung Bo Nho

The document is an assembly language program that prompts the user to input two single-digit numbers, A and B. It then calculates the sum of A and B, and displays the result on the screen. The program utilizes DOS interrupts for input and output operations.

Uploaded by

22a1701d0120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views2 pages

Cong 2 So Dung Bo Nho

The document is an assembly language program that prompts the user to input two single-digit numbers, A and B. It then calculates the sum of A and B, and displays the result on the screen. The program utilizes DOS interrupts for input and output operations.

Uploaded by

22a1701d0120
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

.

model small
.stack 100
.data
; khai bao bien, chuoi
nhap_a_msg db 13, 10, 'Nhap A:$'
nhap_b_msg db 13, 10, 'Nhap B:$'
ket_qua_msg db 13, 10, 'A+B = $'

A EQU [1000h]
B EQU [1001h]
.code
main proc
; khoi tao cho DS
mov ax, @data
mov ds, ax

; in ra thong bao nhap A


lea dx, nhap_a_msg
mov ah, 9
int 21h

; doc 1 ky tu tu ban phim


mov ah, 1
int 21h
; chuyen so dang ASCII sang so
sub al, '0'
mov A, al

; in ra thong bao nhap B


lea dx, nhap_b_msg
mov ah, 9
int 21h

; doc 1 ky tu tu ban phim


mov ah, 1
int 21h
; chuyen so dang ASCII sang so
sub al, '0'
mov B, al

xu_ly:
mov ah, 0
mov al, A
add al, B
jmp in_kq

in_kq:
; in ket qua AX ra man hinh
mov bl, 10
mov cx, 0
tiep_tuc_chia:
div bl ; lay ax / bl -> ket qua: al = thuong, ah = du
push ax
inc cx ; <=> add cx, 1
mov ah, 0
cmp al, 0
je xuat
jmp tiep_tuc_chia

xuat:
lea dx, ket_qua_msg
mov ah, 9
int 21h

in_tung_ky_tu:
pop ax
mov dl, ah
add dl, '0'
mov ah, 2
int 21h
;loop in_tung_ky_tu
dec cx
jne in_tung_ky_tu

; tro ve DOS
mov ah, 4ch
int 21h
main endp
end main

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy