2 X 2 MATRIX MULTIPLICATION
ADDRESS
|
OPCODE
|
LABEL
|
MNEMONICS
|
OPERAND
|
COMMENT
|
8100
|
|
|
MVI
|
C, 00
|
Clear C reg.
|
8101
|
|
|
|
|
|
8102
|
|
|
LXI
|
H, 8500
|
Initialize HL reg. to
4500
|
8103
|
|
|
|
|
|
8104
|
|
|
|
|
|
8105
|
|
LOOP2
|
LXI
|
D, 8600
|
|
8106
|
|
|
|
|
|
8107
|
|
|
|
|
|
8108
|
|
|
CALL
|
MUL
|
Call subroutine MUL
|
8109
|
|
|
|
|
|
810A
|
|
|
|
|
|
810B
|
|
|
MOV
|
B,A
|
Move A to B reg.
|
810C
|
|
|
INX
|
H
|
Increment HL register pair .
|
810D
|
|
|
INX
|
D
|
|
810E
|
|
|
INX
|
D
|
|
810F
|
|
|
CALL
|
MUL
|
Call subroutine MUL
|
8110
|
|
|
|
|
|
8111
|
|
|
|
|
|
8112
|
|
|
ADD
|
B
|
Add [B] with [A]
|
8113
|
|
|
CALL
|
STORE
|
Call subroutine STORE
|
8114
|
|
|
|
|
|
8115
|
|
|
|
|
|
8116
|
|
|
DCX
|
H
|
|
8117
|
|
|
DCX
|
D
|
|
8118
|
|
|
CALL
|
MUL
|
Call subroutine MUL
|
8119
|
|
|
|
|
|
811A
|
|
|
|
|
|
811B
|
|
|
MOV
|
B,A
|
Transfer A reg content to B reg.
|
811C
|
|
|
INX
|
H
|
Increment HL register pair
|
811D
|
|
|
INX
|
D
|
|
811E
|
|
|
INX
|
D
|
|
811F
|
|
|
CALL
|
MUL
|
Call subroutine MUL
|
8120
|
|
|
|
|
|
8121
|
|
|
|
|
|
8122
|
|
|
ADD
|
B
|
Add A with B
|
8123
|
|
|
CALL
|
STORE
|
Call subroutine MUL
|
8124
|
|
|
|
|
|
8125
|
|
|
|
|
|
8126
|
|
|
MOV
|
A,C
|
Transfer C register content to Acc.
|
8127
|
|
|
CPI
|
04
|
Compare with 04 to check whether all
elements are multiplied.
|
8128
|
|
|
|
|
|
8129
|
|
|
JZ
|
LOOP1
|
If completed, go to loop1
|
812A
|
|
|
|
|
|
812B
|
|
|
|
|
|
812C
|
|
|
INX
|
H
|
Increment HL register Pair.
|
812D
|
|
|
JMP
|
LOOP2
|
Jump to LOOP2.
|
812E
|
|
|
|
|
|
812F
|
|
|
|
|
|
8130
|
|
LOOP1
|
HLT
|
|
Stop the program.
|
8131
|
|
MUL
|
LDAX
|
D
|
Load acc from the memory location pointed
by DE pair.
|
8132
|
|
|
MOV
|
D,A
|
Transfer acc content to D register.
|
8133
|
|
|
MOV
|
H,M
|
Transfer from memory to H register.
|
8134
|
|
|
DCR
|
H
|
Decrement H register.
|
8135
|
|
|
JZ
|
LOOP3
|
If H is zero go to LOOP3.
|
8136
|
|
|
|
|
|
8137
|
|
|
|
|
|
8138
|
|
LOOP4
|
ADD
|
D
|
Add Acc with D reg
|
8139
|
|
|
DCR
|
H
|
Decrement H register.
|
813A
|
|
|
JNZ
|
LOOP4
|
If H is not zero go to LOOP4.
|
813B
|
|
|
|
|
|
813C
|
|
|
|
|
|
813D
|
|
LOOP3
|
MVI
|
H,85
|
Transfer 85 TO H register.
|
813E
|
|
|
|
|
|
813F
|
|
|
MVI
|
D,86
|
Transfer 86 to D register.
|
8140
|
|
|
|
|
|
8141
|
|
|
RET
|
|
Return to main program.
|
8142
|
|
STORE
|
MVI
|
B,87
|
Transfer 87 to B register.
|
8143
|
|
|
|
|
|
8144
|
|
|
STAX
|
B
|
Load A from memory location pointed by BC
pair.
|
8145
|
|
|
INR
|
C
|
Increment C register.
|
8146
|
|
|
RET
|
|
Return to main program.
|
Comments
Post a Comment