MICROPROCESSOR & MICROCONTROLLER LAB
NAME: PRITHWISH CHATERJEE
SEC: B ROLL: 59
UNIVERSITY ROLL : 10900318068
ELECTRONICS AND COMMUNICATION
ENGINEERING
2. Write an assembly language programme to substract two data stored in memory location
9801 H and 9801H. Store the result in 9802 .If borrow is generated store it in 9803 H.
Address HEX Codes Labels Mnemonics Comments
9000 0E, 00 MVI C,00H Clear C register
9002 21, 00, 80 LXI H,9801H Load initial address to get operand
9005 7E MOV A,M Load Acc with memory element
9006 23 INX H Point to next location
9007 46 MOV B, M Load B with second operand
9008 90 SUB B Subtract B from A
9009 D2, 0D, F0 JNC STORE When CY = 0, go to STORE
900C 0C INR C Increase C by 1
900D 21, 50, 80 STORE LXI H,9802H Load the destination address
9010 77 MOV M, A Store the result
9011 23 INX H Point to next location
9012 71 MOV M, C Store the borrow
9013 76 HLT Terminate the program
first INPUT
Address Data
8000 78
8001 5D
first OUTPUT
Address Data
8050 1B
8051 00
second INPUT
Address Data
8000 23
8001 CF
second output
Address Data
8050 54
8051 01
FLOWCHART :-
2. Write an assembly language programme to multiply two 8 bit data using successive additive
method.
Address HEX Codes Labels Mnemonics Comments
F000 21, 00, 80 LXI H,8000H Point to first operand
F003 5E MOV E,M Load the first operand to E
F004 16, 00 MVI D,00H Clear the register D
F006 23 INX H Point to next location
F007 7E MOV A,M Get the next operand
F008 0E, 08 MVI C,08H Initialize counter with 08H
F00A 21, 00, 00 LXI H, 0000H Clear the HL pair
F00D 0F LOOP RRC Rotate the acc content to right
F00E D2, 12, F0 JNC SKIP If carry flag is 0, jump to skip
F011 19 DAD D Add DE with HL
F012 EB SKIP XCHG Exchange DE and HL
F013 29 DAD H Add HL with HL itself
F014 EB XCHG Exchange again the contents of DE and
HL
F015 0D DCR C Decrease C register
F016 C2, 0D, F0 JNZ LOOP if Z = 0, jump to LOOP
F019 22, 50, 80 SHLD 8050H Store the result
F01C 76 HLT Terminate the program
Input:
Address Data
8000 25
8001 2A
Output:
Address Data
8050 12
8051 06
PTO
FLOWCHART :-