|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
如果我要实现3*4的矩阵与4*2的矩阵相乘 最后结果为3*2的矩阵
有什么更简单易懂的写法,谢谢大家
N EQU 3
M EQU 4
P EQU 2
.MODEL small
.STACK
.DATA
ARR_A DW 4, -3, 5, 1, 3, -5, 0, 11, -5, 12, 4, -5
ARR_B DW -2, 3, 5, -1, 4, 3, 9, -7
ARR_C DW 6, 23, 68, -63, 41, 20
CHECK DW 0
point_i DW 0
point_j DW 0
point_i1 DW 0
point_j1 DW 0
point_add_cou DW 0
ARR_RES DW 6 DUP(0)
.CODE
.STARTUP
MOV CX, N
MOV DI, 0
OUTLOOP:
PUSH CX
MOV CX, P
MIDLOOP:
PUSH CX
MOV CX, M
MOV BX, 0
MOV AX, point_i1
MOV DL, M
MUL DL
MOV DI, AX
INNERLOOP:
MOV AX, point_i
MOV DL, P
MUL DL
ADD AX, point_j
MOV SI, AX
MOV AX, ARR_A[DI]
MUL ARR_B[SI]
ADD BX, AX
INC DI
INC DI
INC point_i
INC point_i
LOOP INNERLOOP
POP CX
MOV SI, point_add_cou
MOV ARR_RES[SI], BX
INC point_add_cou
INC point_add_cou
INC point_j
INC point_j
MOV AX, 0
MOV point_i, AX
LOOP MIDLOOP
POP CX
MOV AX, 0
MOV point_j, AX
INC point_i1
INC point_i1
LOOP OUTLOOP
MOV CX, 6
MOV SI, 0
OutputResult:
MOV AX, ARR_RES[SI]
MOV CHECK, AX
INC SI
INC SI
LOOP OutputResult
.EXIT
END
|
|