MATRIX MULTIPLICATION USING 8085
AIM:
To write and verify an ALP to perform matrix multiplication and to store the result in the memory location.
APPARATUS REQUIRED:
8085 kit, power chord
ALGORITHM:
1. Get the first matrix in memory location
2. Get the second matrix in memory location
3. Multiply the two matrices
4. Store the result in memory location
5. Stop the program
PROGRAM:
Address | Label | Opcode | Mnemonics | Operand |
4100 | | 21, 00, 42 | LXI | H, 4200H |
4103 | | 11, 00, 43 | LXI | D, 4300H |
4106 | | CD, 54, 41 | CALL | MUL |
4109 | | 32, 00, 45 | STA | 4500H |
410C | | 23 | INX | H |
410D | | 11,02,43 | LXI | D, 4302 |
410E | | CD, 54, 41 | CALL | MUL |
4111 | | 32, 01, 45 | STA | 4501H |
4114 | | 21, 00, 42 | LXI | H,4200H |
4117 | | 11, 01, 43 | LXI | D,4301H |
411A | | CD, 54, 41 | CALL | MUL |
411D | | 32, 02, 45 | STA | 4502 |
4120 | | 23 | INX | H |
4121 | | 11,03,43 | LXI | D,4303 |
4122 | | CD, 54, 41 | CALL | MUL |
4125 | | 32, 03, 45 | STA | 4503H |
4128 | | 21, 02, 42 | LXI | H, 4202H |
412B | | 11, 00, 43 | LXI | D, 4300H |
412E | | CD, 54, 41 | CALL | MUL |
4131 | | 32, 04, 45 | STA | 4504H |
4134 | | 23 | INX | H |
4135 | | 11,02,43 | LXI | D, 4302H |
4136 | | CD, 54, 41 | CALL | MUL |
4139 | | 32, 05, 45 | STA | 4505H |
413C | | 21, 02, 42 | LXI | H, 4202H |
413F | | 11,01 ,43 | LXI | D, 4301H |
4142 | | CD, 54, 41 | CALL | MUL |
4145 | | 32, 06, 45 | STA | 4506H |
4148 | | 23 | INX | H |
4149 | | 11,03,43 | LXI | D, 4303H |
414A | | CD, 54, 41 | CALL | MUL |
414D | | 32, 07, 45 | STA | 4507H |
4150 | | CD, 60, 41 | CALL | ADD |
4153 | | 76 | HLT | |
4154 | MUL | 7E | MOV | A,M |
4155 | | 4F | MOV | C,A |
4156 | | 1A | LDAX | D |
4157 | | 47 | MOV | B,A |
4158 | | 3E, 00 | MVI | A,00H |
415A | L1 | 80 | ADD | B |
415B | | OD | DCR | C |
415C | | C2, 5A, 41 | JNZ | L1 |
415F | | C9 | RET | |
4160 | ADD | 21, 00, 45 | LXI | H, 4500H |
4163 | | 7E | MOV | A, M |
4164 | | 23 | INX | H |
4165 | | 86 | ADD | M |
4166 | | 32, 00, 46 | STA | 4600H |
4169 | | 23 | INX | H |
416A | | 7E | MOV | A, M |
416B | | 23 | INX | H |
416C | | 86 | ADD | M |
416D | | 32, 01, 46 | STA | 4601H |
4170 | | 23 | INX | H |
4171 | | 7E | MOV | A, M |
4172 | | 23 | INX | H |
4173 | | 86 | ADD | M |
4174 | | 32, 02, 46 | STA | 4602H |
4177 | | 23 | INX | H |
4178 | | 7E | MOV | A, M |
4179 | | 23 | INX | H |
417A | | 86 | ADD | M |
417B | | 32, 03, 46 | STA | 4603H |
417E | | C9 | RET | |
INPUT: OUTPUT:
4200-1 4300-2 4600-4
4201-1 4301-2 4601-4
4202-1 4302-2 4602-4
4203-1 4303-2 4603-4
RESULT:
Thus the ALP for matrix multiplication was verified and result was stored in the memory.
1 comments:
how to do in TASM
Post a Comment