bcd_aaa.asm
来自「汇编语言 参考书 包含作业与答案 从入门到精通 通俗易懂」· 汇编 代码 · 共 53 行
ASM
53 行
; This example shows the use
; of AAA instruction (ASCII
; Adjust after Addition).
; It is used to add huge
; BCD numbers.
#make_COM#
ORG 100h
; first number '9':
MOV AH, 09h
; second number '5':
MOV AL, 05h
; AL = AL + AH =
; = 09h + 05h = 0Eh
; ('0D' - not BCD form):
ADD AL, AH
; clear tens byte of BCD
; result:
XOR AH, AH
; adjust result to BCD form,
; AH = 1, AL = 4 -> '14'
AAA
; print the result:
; store contents of
; AX register:
MOV DX, AX
; print first digit:
MOV AH, 0Eh
; convert to ascii:
OR DH, 30h
MOV AL, DH
INT 10h
; print second digit:
; convert to ascii:
OR DL, 30h
MOV AL, DL
INT 10h
RET
END
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?