Professional Documents
Culture Documents
to Microprocessor
• Performs only arithmetic
operations.
• Input should be data and
operation.
• Stores only two data and one
operation.
• Does not has memory to store
sequence of operations
Simple Calculator to
Microprocessor (Cont.)
15 8 7 0
AX AH AL Accumulator
BX BH BL Base
Data Group
CX CH CL Counter
DX DH DL Data
SP Stack Pointer
BP Base Pointer
Pointer and
Index Group
SI Source Index
DI Destination Index
General Purpose Registers
• General Purpose registers can be used to store 8-bit or 16-bit data during
program execution. In addition each register has the following function:
• AX/AL:
• It is used as a accumulator.
• It is used in the multiply,divide, and input/output operations, and in
some decimal and ASCII adjustment instructions.
• BX:
• It holds the offset address of a location in the memory.
General Purpose Registers
• CX/CL:
• CX is used to hold the count value while executing the
repeated string instruction and the LOOP instruction.
(REP/REPE/REPNE).
• CL- Used to hold the count value while executing the
shift/rotate instructions.
• DX:
• Used to hold a part of the result during a multiplication
operation and a part of the dividend before a division
operation.
• Used to hold the I/O device address while executing the IN
and OUT instructions.
Segment registers and default offset registers in the 8086
CS IP
+13=00001101
-9 =11110111 (2’s complement for -9 with sign bit
+4=100000100(Ignore Carry; Sign bit is 0 so result is positive)
+9 =00001001
-13=11110011 (2’s complement for -13 with sign bit
-4 = 11111100 sign bit is 1; negative)
00000011 Invert each bit
1( add 1)
00000100( -4; magnitude)
Flag Register
• If register AL=7FH and the instruction ADD AL,1
• Result:
• AL = 80H ; 7FH+1=80H
• CF = 0 ; No carry out of bit 7
• PF = 0 ; 80H has an odd no of logic 1’s
• AF = 1 ; Carry out of bit 3 into bit 4
• ZF = 0 ; Result is not 0
• SF = 1 ; Bit 7 is set
• OF = 1 ; Result(+128) exceeds the capacity of register AL
Immediate
mov al, 5
mov bl, 3
add bl, al
sub bl, 1
Register & Direct
Register
mov dh, bl
Direct
mov [5000h], al
10H*DS+5000H
Register Indirect
10H*DS+[bx]
Indexed
mov si, bx
10H*DS+[si]
Register Relative
mov 50h[bx], 2000h
10H*DS+[bx]+50
Base Index
mov [bx] [si], 9000h
10H*DS+[bx]+[si]
Relative Based Index
10H*DS+[bx]+[si]
Add
add ax, 1000h
add ax, bx
add [1000h], 5h
Increment
inc ax
inc [1000h]
Decrement
dec ax