Dept of Electronics Engineering,
IIT (BHU)
Odd Semester 2025-2026
EC-373
Microprocessor Engineering Lab
LAB RECORD-FILE
Name : Anoop Singh
Roll Number : 23095132
Program & Year : B. Tech. Part-3, 5th Semester
Department : ECE (Electronics Engineering)
Dept of Electronics Engineering, IIT (BHU)
Odd Semester 2025-2026
EC-373 Microprocessor Engineering Lab
SUBMISSION CERTIFICATE
I, Anoop Singh (Roll number: 23095132 ),
hereby certify that this record file is a bonafide work of academic-learning
through lab-experiments & lab-submissions, that I have pursued in
Microprocessor Engineering Lab course, during this semester. I, hereby, submit
this file to the department towards continuous-assessment evaluation for this lab
course.
Date : 1 7 / 0 9 / 2 5 Sincerely,
(Student’s Signature)
Verified by :
(Faculty’s Signature)
EC 373 Course-Convener
EC-373 Microprocessor Engineering Lab
INDEX PART-1
MICROPROCESSOR BASED SUBMISSIONS
S Date of Activity Pg Date of Marks Sign
No Activity No Submissi Awarded
-on
TOTAL SCORE:
EC-373 Microprocessor Engineering Lab
INDEX PART-2
MICROCONTROLLERS AND OTHER SUBMISSIONS
S Date of Activity Pg Date of Marks Sign
No Activity No Submissi Awarded
-on
TOTAL SCORE:
Faculty’s Signature
EC-373 Course-Convener
PART – D
Problem 1: Multiplication and Division
Problem Statement
Write an 8086 assembly language program to perform the multiplication and division of
two numbers.
• The numbers (12h and 32h) are loaded into AX and BX, respectively.
• Multiply them and store the lower and upper 16 bits of the result at consecutive
memory locations (1000h and 1002h).
• Then, divide the original AX by BX, and store the quotient and remainder
at 1004h and 1006h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op- Assembly Language Comments for the Program
Address Codes Program Code
Destination pointer DI =
01000h BF 10 00 mov di, 1000h 1000h
01003h B8 12 00 mov ax, 0012h AX = 12
01006h BB 32 00 mov bx, 0032h BX = 32
01009h 89 C1 mov cx, ax CX = AX (save for division)
0100Bh F7 E3 mul bx DX:AX = AX * BX
Store lower 16 bits of result
0100Dh 89 05 mov [di], ax at [DI]
Store upper 16 bits of result
0100Fh 89 55 02 mov [di+2], dx at [DI+2]
Restore AX from CX for
01012h 89 C8 mov ax, cx division
DX = 0 (clear remainder for
01014h 31 D2 mov dx, 0 DIV)
AX = quotient, DX =
01016h F7 F3 div bx remainder
01018h 89 45 04 mov [di+4], ax Store quotient at [DI+4]
0101Bh 89 55 06 mov [di+6], dx Store remainder at [DI+6]
Memory Op- Assembly Language Comments for the Program
Address Codes Program Code
0101Fh F4 hlt Halt
iv. Outputs:
- Before Execution:
• AX = 0012h, BX = 0032h
• Memory [1000h] = XX
- After Execution:
• [1000h]: lower word of 12*32 = 384 (0180h)
• [1002h]: upper word (should be 0)
• [1004h]: quotient = 12/32 = 0
• [1006h]: remainder = 12
Problem 2: Addition and Subtraction Operation
i. Problem Statement description
Write an 8086 assembly language program to add and subtract two 16-bit numbers. Store
the results in appropriate registers after each operation.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op- Assembly Language Program Comments for the
Address Codes Code Program
01000h B8 52 00 mov ax, 52h Load 0052h into AX
01003h BB 65 86 mov bx, 8665h Load 8665h into BX
01006h 89 D2 mov dx, ax Copy AX value to DX
01008h 03 C3 add ax, bx AX = AX + BX
0100Ah 89 C1 mov cx, ax Store addition result in CX
0100Ch 89 D0 mov ax, dx Restore AX from DX
0100Eh 2B C3 sub ax, bx AX = AX - BX
Store subtraction result in
01010h 89 D2 mov dx, ax DX
01012h F4 hlt Halt program
iv. ALP Outputs
- Before Execution:
• AX = 0052h
• BX = 8665h
• CX, DX: Undefined
- After Execution:
• CX = 86B7h (Result of 0052h + 8665h)
• DX = 81EDh (Result of 0052h – 8665h, two’s complement)
Problem 3: Fibonacci Series Generation
i. Problem Statement Description
Write an 8086 assembly language program to generate the first 10 terms of the Fibonacci
series and store them at consecutive memory locations starting from address 1000h.
[Link] Diagram
ii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Program Comments for the
Address Code Program
01000h B8 00 00 mov ax, 00h Initialize AX with 0
01003h BB 01 00 mov bx, 01h Initialize BX with 1
Set CX as address
01006h B9 02 00 mov cx, 02h increment
01009h BA 00 00 mov dx, 00h Initialize counter DX with 0
0100Ch BF 00 10 mov di, 1000h Set DI to store result
0100Fh 89 05 mov [di], ax Store 0 at [1000h]
01011h 89 5D 02 mov [di+2], bx Store 1 at [1002h]
01014h 01 D8 add ax, bx ax = ax + bx
01016h 89 45 02 mov [di+2], ax Store next term at [di+2]
01019h 93 xchg ax, bx Swap AX and BX
0101Ah 01 CF add di, cx Move DI to next location
0101Ch 83 C2 01 add dx, 01h Increment counter
81 FA 12
0101Fh 00 cmp dx, 12h Compare counter with 18
Memory Op-Codes Assembly Language Program Comments for the
Address Code Program
Repeat loop if not yet 18
01023h 75 EF jne fibonacci terms
01025h F4 hlt Stop program
iii. ALP Outputs
- Before Execution:
• [1000h] = ??, [1002h] = ??, ..., [1014h] = ??
• (All memory locations have garbage values)
- After Execution:
• [1000h] = 0000h
• [1002h] = 0001h
• [1004h] = 0001h
• [1006h] = 0002h
• [1008h] = 0003h
• [100Ah] = 0005h
• [100Ch] = 0008h
• [100Eh] = 000Dh
• [1010h] = 0015h
• [1012h] = 0022h
• [1014h] = 0037h
Problem 4: Factorial of Array—8086 Assembly
i. Problem Statement Description
Write an 8086 assembly program to store 8 numbers in consecutive memory locations from
1000h and compute the factorial of each number, storing the result in consecutive memory
locations starting from 2000h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
01003h C6 198 01 mov [si], 0001h Store 1 at [1000h]
01004h C4 404 mov [si+2], 0002h Store 2 at [1002h]
01005h C1 001 mov [si+4], 0003h Store 3 at [1004h]
01006h C6 198 04 mov [si+6], 0004h Store 4 at [1006h]
01007h C6 198 05 mov [si+8], 0005h Store 5 at [1008h]
01008h C6 198 06 mov [si+10], 0006h Store 6 at [100Ah]
01009h C6 198 07 mov [si+12], 0007h Store 7 at [100Ch]
0100Ah C6 198 08 mov [si+14], 0008h Store 8 at [100Eh]
BE
0100Bh 00002000 mov di, 2000h DI points to output array
0100Fh B9 0000h mov cx, 0 Initialize loop counter
01012h B8 0001h mov ax, 1 Clear AX before factorial
BX = current input
01015h 8B 1C mov bx, [si] number
01017h F7 E3 factorial: mul bx AX *= BX
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
01019h 4B dec bx BX--
0101Ah 83 FB 00 cmp bx, 0 compare BX with 0
if not zero, repeat
0101Dh 75 F8 jne factorial factorial
store result at output
0101Fh 89 05 mov [di], ax address
move DI to next output
01021h 83 C7 02 add di, 2 location
move SI to next input
01024h 83 C6 02 add si, 2 location
01027h 81 FE 1010h cmp si, 1010h check end of input array
if not end, repeat for next
0102Ah 75 E6 jne outer_loop num
0102Ch F4 hlt stop program
iv. ALP Outputs
- Before Execution:
• [1000h] to [100Eh]: 1, 2, 3, 4, 5, 6, 7, 8
• [2000h] to ...: undefined
- After Execution:
• [2000h] = 0001h (1!)
• [2002h] = 0002h (2!)
• [2004h] = 0006h (3!)
• [2006h] = 0018h (4!)
• [2008h] = 0078h (5!)
• [200Ah] = 02D0h (6!)
• [200Ch] = 13B0h (7!)
• [200Eh] = 9D80h (8!)
Problem 5: Compute s = ut + ½ at² (Velocity Equation in 8086 Assembly)
i. Problem Statement Description
Write an 8086 assembly language program to evaluate the equation s=ut+12at2s=ut+21at2,
where u,a,tu,a,t are stored in consecutive memory locations from 1000h. Store the result at
memory location 2000h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
01000h BE 1000h mov si, 1000h SI points to u, t, a
C6 06 00 1000
01003h 03 mov [si], 03h Store u = 3 at [1000h]
C6 06 02 1000
01008h 02 mov [si+2], 02h Store t = 2 at [1002h]
C6 06 04 1000
0100Dh 02 mov [si+4], 02h Store a = 2 at [1004h]
01012h 8B 1C mov bx, [si] BX = u
SI = SI + 2, now points
01014h 83 C6 02 add si, 2 to t
01017h 8B 0C mov cx, [si] CX = t
SI = SI + 2, now points
01019h 83 C6 02 add si, 2 to a
0101Ch B8 0001h mov ax, 1 AX = 1
0101Fh F7 E3 mul bx AX = AX * BX (u)
AX = AX * CX (t), result
01021h F7 E1 mul cx is ut
01023h 89 D3 mov bx, ax Store ut in BX
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
01025h 89 C8 mov ax, cx AX = t
01027h F7 E1 mul cx t²
01029h 89 C1 mov cx, ax CX = t²
0102Bh 8B 04 mov ax, [si] AX = a
0102Dh F7 E1 mul cx AX = a * t²
0102Fh B9 0002h mov cx, 2 For division by 2
01032h F7 F1 div cx AX = (a * t²) / 2
01034h 01 D8 add ax, bx s = ut + (1/2) a t²
01036h BF 2000h mov di, 2000h Result location
01039h 89 07 mov [di], ax Store result at 2000h
iii. ALP Outputs
- Before Execution:
• [1000h]=3 (u), [1002h]=2 (t), [1004h]=2 (a)
- After Execution:
• 2000h = 10 (final calculated s)
(Calculation: s = 3*2 + (1/2)24 = 6 + 4 = 10
Problem 6: Find Maximum in an Array
i. Problem Statement Description
Write an 8086 assembly language program to find the maximum value in an array of 10
numbers stored in consecutive memory locations starting from 1000h. Store the maximum
at memory location 2000h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Comments for the Program
Address Program Code
01000h BE 10 00 mov si, 1000h SI points to array start
DI points to where result will
01003h BF 20 00 mov di, 2000h go
Array element 1 = 20 (hex
01006h C6 04 14 mov [si], 14h 14h)
C6 44 02
01009h 18 mov [si+2], 18h Array element 2 = 24
C6 44 04
0100Eh 20 mov [si+4], 20h Array element 3 = 32
C6 44 06
01013h 22 mov [si+6], 22h Array element 4 = 34
C6 44 08
01018h 26 mov [si+8], 26h Array element 5 = 38
C6 44 0A
0101Dh 2A mov [si+10], 2Ah Array element 6 = 42
C6 44 0C
01022h 2D mov [si+12], 2Dh Array element 7 = 45
C6 44 0E
01027h 24 mov [si+14], 24h Array element 8 = 36
Memory Op-Codes Assembly Language Comments for the Program
Address Program Code
C6 44 10
0102Ch 21 mov [si+16], 21h Array element 9 = 33
C6 44 12
01031h 17 mov [si+18], 17h Array element 10 = 23
01036h 8B 04 mov ax, [si] First element as current max
01038h BB 00 00 mov bx, 00h Counter in BX = 0
CX as stride (2 bytes per
0103Bh B9 02 00 mov cx, 02h entry)
0103Eh 03 F1 maxima: add si, cx Next array location
Compare current max with
01040h 3B 04 cmp ax, [si] this element
01042h 73 03 jae no_update If AX >= [SI], skip update
Else, put [SI] into AX (new
01044h 8B 04 mov ax, [si] max)
Increment element counter
01046h 43 no_update: inc bx BX
Compare with 9 (for 10
01047h 83 FB 09 cmp bx, 09h numbers)
0104Ah 75 F2 jne maxima Loop if not all checked
Memory Op-Codes Assembly Language Comments for the Program
Address Program Code
0104Ch 89 07 mov [di], ax Store final max at 2000h
0104Eh F4 hlt Halt
Outputs:
- Before Execution:
• [1000h]–[1012h]: 14h, 18h, 20h, 22h, 26h, 2Ah, 2Dh, 24h, 21h, 17h
- After Execution:
• 2000h = 2Dh (maximum value: 45 decimal)
Problem 7: Bitwise NOT of AX and Flag Behavior
i. Problem Statement Description
Write an 8086 assembly program to (i) perform bitwise NOT operation on register AX and (ii)
observe the effect on processor status flags. Use the stack to save and restore original AX
value, and also demonstrate PUSHF and POPF instructions.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op- Assembly Language Program Comments for the
Address Codes Code Program
BD
01000h 1000h mov bp, 1000h Initialize BP as stack base
01002h 89 E5 mov sp, bp Set SP to BP
01004h 9C pushf Push flags onto stack
01005h 50 push ax Push AX onto stack
01006h F7 D0 not ax Bitwise NOT on AX
01008h 50 push ax Push result onto stack
01009h 9D popf Restore flags from stack
0100Ah F4 hlt Halt program
iii. ALP Outputs
- Before Execution:
• AX = 0000h (example)
• Stack contains undefined values
- After Execution:
• Stack (top): Bitwise-NOT(AX), previous AX, flags
• AX after NOT: FFFFh (if original was 0000h)
• Flags register: Restored to original
Problem 8: Odd/Even Number Detection
i. Problem Statement Description
Write an 8086 assembly program to check whether a number stored at memory location
1000h is odd or even. If the number is even, set CX to FFFFh; if it is odd, set CX to 0000h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
C6 06 00 10 Store 32h at 1000h (input
01000h 32 mov [1000h], 32h value)
01005h A1 00 10 mov ax, [1000h] Load input into AX
01008h A9 01 00 test ax, 1 Test LSB
0100Bh 75 04 jnz odd Jump if odd
0100Dh B9 FF FF mov cx, 0FFFFh Set CX to FFFFh if even
01010h F4 hlt Halt (end of even case)
01011h B9 00 00 odd: mov cx, 0 Set CX to 0 if odd
01014h F4 hlt Halt (end of odd case)
iv. ALP Outputs
- Before Execution:
• [1000h] = 32h
• AX, CX: undefined
- After Execution:
• If [1000h] is even (e.g., 32h): CX = FFFFh, program halts at 01010h
• If [1000h] is odd: CX = 0000h, program halts at 01014h
Problem 9: OR Operation on Two Numbers
i. Problem Statement Description
Write an 8086 assembly program to perform bitwise OR between two numbers stored at
memory locations 1000h and 1001h. Store the result at memory location 2000h.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op-Codes Assembly Language Comments for the
Address Program Code Program
01000h BF 20 00 mov di, 2000h Destination for result
C6 06 00 10 Store first number at
01003h 23 mov [1000h], 23h 1000h
C6 06 01 10 Store second number at
01008h AF mov [1001h], 0AFh 1001h
0100Dh A0 00 10 mov al, [1000h] Load first number into AL
Load second number into
01010h 8A 1E 01 10 mov bl, [1001h] BL
01014h 0B C3 or ax, bx OR AX and BX, save in AX
01016h 89 05 mov [di], ax Store result at 2000h
01018h F4 hlt Halt
iv. ALP Outputs
- Before Execution:
• [1000h] = 23h
• [1001h] = AFh
- After Execution:
• 2000h = 00AFh OR 0023h = 00AFh (bitwise OR of 23h and AFh)
Problem 10: Sort an Array in Ascending and Descending Order (8086 Assembly)
i. Problem Statement Description
Write an 8086 assembly language program to sort an array of 5 numbers (each 2 bytes, from
1000h to 1008h) in ascending order and store them at 2000h onward, then sort the array in
descending order and store at 3000h onward.
ii. Flowchart Diagram
iii. 8086 Assembly Language Program (ALP)
Memory Op- Assembly Language Comments for the Program
Address Codes Program Code
BE 10
01000h 00 mov si, 1000h SI points to source array
C7 04 F5
01003h F3 mov [si], 0f3f5h Store values into the array
C7 44
01007h 02 F2 FF mov [si+2], 0fff2h Storing array
C7 44
04 04
0100Ch 01 mov [si+4], 0104h Storing array
C7 44
06 42
01011h 08 mov [si+6], 0842h Storing array
C7 44
08 68
01016h 84 mov [si+8], 8468h Storing array
BF 20
0101Bh 00 mov di, 2000h DI for ascending result
0101Eh 89 D6 mov dx, si Save SI (source base for repopulation)
ascending_order: mov
01020h 8B 04 ax, [si] AX = array element to begin selection
01022h 89 EE mov bp, si BP = SI (pointer for comparison loop)
83 C5
01024h 02 add bp, 2 BP points to next element
81 FD
01027h 0A 10 cmp bp, 100ah End of array?
0102Ch 7D 17 jae exit_inner If so, done
0102Eh 8B 1D mov bx, [bp] Get element at BP
01030h 39 C3 cmp ax, bx Compare with current min
01032h 72 09 jb no_update If AX < BX, skip
01034h 87 D8 xchg ax, bx Swap if new min
89 5D
01036h 00 mov [bp], bx Store updated BX at BP
83 C5
01039h 02 no_update: add bp, 2 Next comparison element
81 FD
0103Ch 0A 10 cmp bp, 100ah End of comparison?
01041h 75 E5 jne inner_loop Continue if more elements left
01043h 89 05 exit_inner: mov [di], ax Store min at destination
83 C7
01045h 02 add di, 2 Move to next dest
83 C6
01048h 02 add si, 2 Move to next source
81 FE
0104Bh 0A 10 cmp si, 100ah All elements sorted?
01050h 75 CE jne ascending_order Loop for next position
BF 30
01052h 00 mov di, 3000h Prepare for descending
BE 10
01055h 00 mov si, 1000h Repopulate SI
C7 04 F5
01058h F3 mov [si], 0f3f5h Restore array
C7 44
0105Ch 02 F2 FF mov [si+2], 0fff2h Storing array
C7 44
04 04
01061h 01 mov [si+4], 0104h Storing array
C7 44
06 42
01066h 08 mov [si+6], 0842h Storing array
C7 44
08 68
0106Bh 84 mov [si+8], 8468h Storing array
Just one condition will change i.e. now
descending_order: swap ax and bx if ax is less than bx in order
01070h 8B 04 mov ax, [si] to have maximum value element in ax
iv. ALP Outputs
- Before Execution:
• Memory at [1000h]–[1008h]: f3f5h, fff2h, 0104h, 0842h, 8468h
• [2000h], [3000h]: undefined
- After Execution:
• [2000h]: Smallest value, then next smallest, ... (ascending sorted values)
• [3000h]: Largest value, then next largest, ... (descending sorted values)