.8086
.model small
.data
num1 dw 0aaaah ;Load aaaah to Num1
num2 db 0ffffh ;Load ffffh to Num2
ans dw ?
carry db ?
.code
Start:
mov ax , @data ;Copying the address of the data to AX.
mov ds , ax
mov ax , 0000h
mov ax , num1 ;Copies Num1 to AX.
mov bx , num2
sub cx , dx ;Subtracts DX from CX.
mov ah , 00h
mov ans,cx
lahf ;Loads all the flags to AH.
AND ah,01h
mov borrow , ah
mov ax , 4c00h
int 21h
end start
;Result
;DS:0000 0AAAA(NUM1)
;DS:0000 0FFFF(NUM2)
;ds:00008 0AAAB(ans)
;ds:00008 01 (borrow)
No comments:
Post a Comment