In assembly language 8086 we use mnemonics in order to perform arithmetic operations like ADD/ADC in addition.
So, Let's dive deep into ADD and ADC ...Scroll Down for Program Code
ADD:- It adds number from source to destination without carry. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.
Syntax: ADD <destination> <source>
Operation: destination← destination + source
ADC:- It adds number from source to destination with carry i.e , adds carry flag into result of addition. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.
Syntax: ADC <destination> <source>
Operation: destination← destination + source + carry
Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .
data segment
So, Let's dive deep into ADD and ADC ...Scroll Down for Program Code
ADD:- It adds number from source to destination without carry. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.
Syntax: ADD <destination> <source>
Operation: destination← destination + source
ADC:- It adds number from source to destination with carry i.e , adds carry flag into result of addition. Source can be memory location or register or a number but destination should be register or a memory location(not immediate number). Remember that source and destination should be of same type and both shouldn't be memory locations.
Syntax: ADC <destination> <source>
Operation: destination← destination + source + carry
Which flags get affected?
Ans- OF , CF, PF , AF, SF , ZF .
data segment
no1 db 02h
no2 db 03h
ans db ?
data ends
code segment
start : assume cs :code, ds :data
mov ax ,data
mov ds , ax
mov al , no1
mov bl ,no2
ADD al, b1
mov ans ,al
mov ah ,4ch
int 21h
code ends
end start
end start
No comments:
Post a Comment