Experiment 1: Introduction to EMU8086 Environment
Objectives:
Familiarize with EMU8086 IDE, memory, registers, and simulator tools.
Learn to write, assemble, and execute 8086 programs.
Theory:
EMU8086 simulates 8086 CPU, memory, and I/O for programming practice without
hardware.
Allows step execution, register and memory inspection, and debugging.
Requirements:
EMU8086 software
PC (Windows)
Algorithm :
1. Open EMU8086.
2. Explore menus: New Project, Build, Run, Step.
3. Open registers and memory windows.
Execution / Observations:
Feature Observation
Editor Can type assembly code
Registers Window Shows AX, BX, CX, DX, SI, DI, FLAGS
Memory Window Can view memory at 100h+
Step Execution Step through instructions one by one
Result:
Successfully navigated EMU8086 and understood its functions.
Discussion:
Step execution is useful for debugging and understanding instruction behavior.
.
Experiment 2: Executing Simple Instructions
Objectives:
Learn basic instructions (MOV, ADD, SUB, INC, DEC) and observe their effect on registers.
Theory:
AL, BL, CL registers used to store 8-bit data.
Instructions perform arithmetic and data movement operations.
Requirements:
EMU8086 software
Algorithm:
1. Load AL = 05h, BL = 03h
2. Add BL to AL
3. Subtract 2 from AL
4. Increment AL
5. Decrement BL
6. Move AL to CL
7. Halt
Program:
ORG 100h
START:
MOV AL, 05h
MOV BL, 03h
ADD AL, BL
SUB AL, 02h
INC AL
DEC BL
MOV CL, AL
HLT
Flowchart:
START -> MOV AL,05 -> MOV BL,03 -> ADD AL,BL -> SUB AL,02 -> INC AL -> DEC BL
-> MOV AL->CL -> HLT
Step-by-Step Execution:
Step Instruction AL BL CL Description
Step Instruction AL BL CL Description
1 MOV AL,05h 05 - - Load 5 into AL
2 MOV BL,03h 05 03 - Load 3 into BL
3 ADD AL,BL 08 03 - Add AL + BL
4 SUB AL,02h 06 03 - Subtract 2 from AL
5 INC AL 07 03 - Increment AL
6 DEC BL 07 02 - Decrement BL
7 MOV CL,AL 07 02 07 Copy AL to CL
Observations:
AL = 07h, BL = 02h, CL = 07h
Result:
Instructions executed successfully in EMU8086
Discussion:
Step-by-step execution helps debug and verify correctness
Experiment 3: Parity Generation (Single Byte)
Objectives:
Calculate even/odd parity for a byte in EMU8086
Theory:
Parity bit ensures error detection in data transfer.
Even parity = total 1s even, Odd parity = total 1s odd
Algorithm:
1. Load a byte in AL
2. Count number of 1s in the byte
3. Set DL = 1 if odd parity, 0 if even
Program:
ORG 100h
START:
MOV AL,0B5h
MOV BL,AL
MOV CL,0
CHECK_BIT:
TEST BL,1
JZ SKIP
INC CL
SKIP:
SHR BL,1
CMP BL,0
JNZ CHECK_BIT
TEST CL,1
JZ EVEN
ODD:
MOV DL,01h
JMP DONE
EVEN:
MOV DL,00h
DONE:
HLT
Observations:
AL (Input) CL (# of 1s) DL (Parity) Comment
B5h 5 01h Odd parity
Result:
Parity successfully generated
Experiment 4: 8-bit CRC Simulation
Objectives:
Simulate 8-bit CRC calculation for error detection
Theory:
CRC uses polynomial division (XOR and shift operations)
Algorithm:
1. Load data in AL
2. Initialize CRC in BL
3. XOR AL with BL
4. Rotate BL 8 times
Program:
ORG 100h
START:
MOV AL,0B5h
MOV BL,0FFh
XOR BL,AL
MOV CL,8
CRC_LOOP:
ROL BL,1
LOOP CRC_LOOP
HLT
Observations:
BL contains CRC after execution
Experiment 5: 8255 Port Simulation
Objectives:
Simulate I/O using 8255 PPI
Theory:
8255 has Port A, B, C for data transfer
Program:
ORG 100h
START:
MOV DX,00h
MOV AL,0AAh
OUT DX,AL
MOV DX,01h
IN AL,DX
NOT AL
OUT DX,AL
HLT
Observations:
Port outputs and inputs simulated successfully
verified
Experiment 6: 8259 Interrupt Simulation
Objectives:
Demonstrate interrupt handling in EMU8086
Program:
ORG 100h
START:
MOV AX,0
INT 21h
HLT
Observations:
Software interrupt executed, AX updated
Experiment 7: 1kHz Square Wave Generation
Program:
ORG 100h
START:
MOV DX,0FFFAh
SQUARE_LOOP:
MOV AL,0FFh
OUT DX,AL
CALL DELAY
MOV AL,00h
OUT DX,AL
CALL DELAY
JMP SQUARE_LOOP
DELAY:
MOV CX,500
D1: DEC CX
JNZ D1
RET
Observations:
Port toggled to simulate 1kHz wave
Experiment 8: Stepper Motor Control Simulation
Program:
ORG 100h
START:
MOV DX,0
STEP1: MOV AL,01h
OUT DX,AL
CALL DELAY
STEP2: MOV AL,02h
OUT DX,AL
CALL DELAY
JMP STEP1
DELAY:
MOV CX,1000
D_LOOP: DEC CX
JNZ D_LOOP
RET
Observations:
Steps simulated via port output
Experiment 9: 500 µsec Delay
Program:
ORG 100h
START:
MOV CX,50
DELAY_LOOP:
NOP
LOOP DELAY_LOOP
HLT
Observations:
Delay simulated for desired time
Applications:
Timing and synchronization in embedded systems
Conclusion:
Accurate delay simulation achieved