-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.asm
57 lines (48 loc) · 1.03 KB
/
matrix.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
N EQU 3
M EQU 4
P EQU 2
.MODEL small
.STACK
.DATA
matA DB 4,-3,5,1,3,-5,0,11,-5,12,4,-5
matB DB -2,3,5,-1,4,3,9,-7
matC DW N*P DUP(?)
.CODE
.STARTUP
MOV CX, N ;3
loopN:
PUSH CX
MOV BP, N
SUB BP, CX
MOV AX, M
MUL BP
MOV BP, AX
XOR DI, DI
MOV CX, P ;2
loopP:
PUSH CX
MOV CX, M ;4
MOV SI, BP
loopM:
PUSH CX
XOR AX, AX
MOV AL, matA[SI]
MOV DL, matB[DI]
IMUL DL
ADD matC+BX, AX
ADD DI, P
INC SI
POP CX
LOOP loopM
POP CX
ADD BX, 2
MOV AH, M
MOV AL, P
MUL AH
SUB DI, AX
INC DI
LOOP loopP
POP CX
LOOP loopN
.EXIT
END