Assignment 03-1
Assignment 03-1
Assignment 03-1
03
Mechatronics
uestion No.01
Write logical steps & assembly language program to subtract the two Hex numbers 48H and
32H. Both the numbers should be saved for the future use. Save the result in the accumulator.
Answer.
Logical Steps
First we do the subtraction by 2’s complement method
Subtrahend 32H = 00110010
Step 01
1’s Complement 11001101
Step 02
Add 01 to obtain + 1
To subtract 48H-32H
Add 48H to the 2’s Complement
11001111
+ 01001000
00010111
0 0 0 1 0 1 1 12=16H Answer
Now we have to write the assembly program for subtraction of two number
Prepared by Abdullah
Reg No.17JZMEC0176
Assignment No.03
Mechatronics
Question N0.02
Write 8085 programs to perform the multiplication of two 8-bit
numbers and store the result in register C for future use.
Answer:
We have to write a program to perform the multiplication of two 8-bit numbers and store the
result in register C.
If the first number is store in the memory location 8000H and the second is store in 8001H
machine
Address label Mnemonics comments
code
F000 21 LXI H,8000H Load first operand address
F001 0
F002 80
F003 46 MOV B, M Store first operand to B
F004 23 INX H Increase HL pair
F005 AF XRA A Clear accumulator
F006 4F MOV C, A Store 00H at register C
F007 86 LOOP ADD M Add memory element with Acc
F008 D2 JNC SKIP When Carry flag is 0, skip next task
F009 0C
F00A F0
F00B 0C INR C Increase C when carry is 1
F00C 5 SKIP DCR B Decrease B register
F00D C2 JNZ LOOP Jump to loop when Z flag is not 1
F00E 7
F00F F0
F010 21 LXI H,8050H Load Destination address
F011 80
F012 50
Prepared by Abdullah
Reg No.17JZMEC0176
Assignment No.03
Mechatronics
Prepared by Abdullah
Reg No.17JZMEC0176