Professional Documents
Culture Documents
Copy of Finalexps3
Copy of Finalexps3
Aim: To subtract two 8-bit and two 16-bit numbers using the 8086 Microprocessor’s emulator.
Algorithm:-
Code:
; Subtraction of two 16-bit numbers
mov ax,
[1000h] mov
bx, [1002h]
sub ax, bx
jnc Goto1
not ax
add ax, 01h
Goto1:
mov [1009h], ax
mov ah,
[1100h] mov
bh, [1102h]
sub ah, bh
jnc Goto2
not ah
add ah, 01h
Goto2:
mov [1109h], ah
hlt
Results:
Conclusion: The numbers have been successfully and correctly subtracted using the program in 8086
Emulator.
EXPERIMENT: 3(a)
Multiplication Using 8086 Microprocessor
Aim: To multiply two 8-bit and two 16-bit numbers using the 8086 Microprocessor’s emulator.
Algorithm:-
mov ax,
[1000h] mov
bx, [1002h]
mul bx
mov [1004h],
ax mov
[1011h], dx
mov al,
[1006h] mov
bl, [1008h]
mul bl
mov [1009h],
al mov
[1013h], ah
hlt
Results:
Aim: To divide two 8-bit and two 16-bit numbers using the 8086 Microprocessor’s emulator.
Algorithm:-
mov ax,
[1000h] mov
bx, [1002h]
div bx
mov [1004h], ax
mov al,
[1006h] mov
bl, [1008h]
div bl
mov [1009h],
al hlt
Results:
Outputs: Quotient = 01
Algorithm:-
Load the data to register ‘a’ from the memory.
Code:
; Logical
Operations mov
AL, [1000h] mov
BL, [1002h] and
AL, BL
mov [1004h], AL
mov AL,
[1000h] or
AL, BL
mov [1006h], AL
xor AL, BL
mov [1008h], AL
not BL
mov [1010h],
BL hlt
Results:
Inputs: AE and 59
OR > FF
XOR > F7
NOT > A6
Conclusion: The numbers have been successfully and correctly operated logically using the program
in 8086 Emulator.
EXPERIMENT: 5
Operations on A Series Using 8086
Microprocessor
Aim: To perform following operations on a series of numbers using the 8086 Microprocessor’s
emulator:
Algorithm:-
(Continued)
Code:
mov ax,
00h mov cl,
0Ah mov SI,
1111h
L2:
mov bh,
[SI] AND
bh, 01h
JZ L1
add ah,
[SI] inc SI
DEC
cl
JNZ
L2 JZ
L3
L1:
Add al, [SI]
inc SI
DEC
cl JNZ
L2 JZ
L3
L3:
mov [1121h],
ah mov
[1122h], al
add al, ah
mov bl, 0Ah
mov ah, 00h
div bl
mov [1123h],
al hlt
Results:
Inputs: 05, 64, 11, 56, DF, 65, 78, 10, 2E, B8
Submitted To:-
DR. Anukul Pandey
INDEX
Theory:
8085 microprocessor was designed by Intel in 1976. 8086 microprocessor is an enhanced version of
8085 microprocessor having 16 data lines and 20 address lines that provide 1 Mb of memory space.
8086 processor was the first 16-bit processor having 16-bit ALU, 16-bit registers, internal data bus
and also 16-bit external data bus resulting in fast processing. It is available in 3 versions based on the
frequency of operation: 5 MHz, 8MHz and 10 MHz. It also supports pipelined architecture.
MOV- Loads the byte or word from the provided source to the provided destination.
IN− Reads a byte or word from the provided port to the accumulator.
OUT- Sends out a byte or word from the accumulator to the provided port.
ADD- This command adds the provided numbers either byte-to-byte or word-to-word and stores
result in the accumulator.
SUB- This command subtracts the provided numbers either byte-from-byte or word-from-word.
SBB-It is used to perform subtraction with borrow.
AND- ‘AND’ command is used for adding each bit in a byte/word with the corresponding bit in
another byte/word.
OR- This command is used to multiply each bit in a byte/word with the corresponding bit in another
byte/word.
XOR- It performs Exclusive-OR operation over each bit in a byte/word with the corresponding bit in
another byte/word.
JNC- “Jump if not carry” is used to jump to the specified address if there is no carry.
These are 16-bit registers and to use only 8-bit of them, we use ‘al’, ‘bl’, etc. To use complete 16-bits
of the register, we use ‘ax’, ‘bx’, etc. instead of ‘al’ and ‘bl’.
Comments in 8086 Emulator are added using semicolon. To specify memory addresses effectively,
write the memory location in square brackets and append an ‘h’ to it.
EXPERIMENT: 2
Addition Using 8086 Microprocessor
Aim: To add two 8-bit and two 16-bit numbers using the 8086 Microprocessor’s emulator.
Algorithm:-
mov ax,
[1000h] mov
bx, [1002h]
mov cl, 00h
add ax, bx
mov [1005h],
ax jnc Sensei
inc cl
Sensei:
mov [1009h], cl
; Addition of two 8-bit
numbers mov al, [1100h]
mov bl,
[1102h] mov
cl, 00h
add al, bl
mov
[1105h], al
jnc Senpai
inc cl
Senpai:
mov [1109h],
cl hlt
Results: