.model small
.data
SUM dw 0
START dw 1234H
VAdd dw 3099H
VSub dw 2099H
.code
MOV ax,@data
MOV ds,ax
;-------------------- Addition
MOV DX,START ;load START
MOV BX,VADD ;load ValueAddition
MOV AL,BL ;sum BL with DL
ADD AL,DL
DAA ;adjust
MOV CL,AL ;answer to CL
MOV AL,BH ;sum BH, DH, and carry
ADC AL,DH
DAA ;adjust
MOV CH,AL ;answer to CH
;-------------------- Subtraction
MOV DX,Vsub ;load ValueAddition
MOV BX,CX ;load Answer of Addition
MOV AL,BL ;subtract DL from BL
SUB AL,DL
DAS ;adjust
MOV CL,AL ;answer to CL
MOV AL,BH ;subtract DH, and carry
SBB AL,DH
DAS ;adjust
MOV CH,AL ;answer to CH
MOV ax,4c00h
INT 21h
end
ไม่มีความคิดเห็น:
แสดงความคิดเห็น