16-BIT MULTIPLICATION
AIM:
To write an ALP for multiplication of two 16-bit Numbers.
APPARATUS REQUIRED:
8085 kit, power chord.
ALGORITHM:
1. Start the program
2. Load the data to HL pair register
3. Exchange the content of HL pair and DE
4. Load the data to HL pair register
5. Multiply the content of E register with accumulator
6. Store the content of accumulator to 5100
7. Move content of H reg to accumulator
8. Multiply the content of accumulator to 5101.
9. Stop the program
PROGRAM:
Address | Label | Opcode | Mnemonic | Operand | Comments |
4100 | 2A,00,42 | LHLD | 4200H | Load the data1 to hl register | |
4103 | F9 | SPHL | Save the 1st data in sp | ||
4104 | 2A 02 42 | LHLD | 4202H | Load the data2 in the hl pair | |
4107 | EB | XCHG | Save 2nd data in sp | ||
4108 | 21 00 00 | LXI | H, 0000H | Clear hl pair | |
410B | 21 00 00 | LXI | B, 0000H | Clear be pair | |
410E | Next | 39 | DAD | SP | Add sp to sum HL |
410F | D2 13 41 | JNC | AHEAD | Jump on no carry to address | |
4112 | D3 | INX | B | If carry=1 of BE pair | |
4113 | Ahead | 1B | DCX | D | Stop the process |
4114 | 7B | MOV | A,E | Move E-reg to A-reg | |
4115 | B2 | ORA | D | Check for zero in de pair and logically OR | |
4116 | C2 0E 41 | JNZ | NEXT | Jump on no carry to address | |
4119 | 22 04 42 | SHLD | 4204H | Store the result | |
411C | 69 | MOV | A,C | Move C-reg to A–reg | |
411D | 60 | MOV | H,B | Move B-reg to H-reg | |
411E | 22 06 42 | SHLD | 4206H | Store the result | |
4121 | 76 | HLT | Stop the process |
INPUT: 4200H: 05H 4201H:00H OUTPUT: 4204H: 0FH
RESULT:
Thus the assembly language program for 16-bit multiplication is executed and the results are verified.
0 comments:
Post a Comment