;----------------------------
SATR1 DB 100 DUP (?)
SATR2 DB 100 DUP (?)
NATIJE DW 100 DUP (?)
; tedad khoroji
N EQU 3
; tol satr soton
;----------------------------
MAX DB 20
ACT DB ?
NUM DB 20 DUP (0)
TAB DB 9,'$'
ENTER DB 13,10,'$'
HEAD1 DB 'HELLO , WELCOME TO MY PROGRAM :$'
HEAD2 DB ' MULTIPLY MATRICES ( N*N ) .PLEASE CHANGE MAIN PROGRAM """N EQU 3""" """FOR YOUR HOW LONG YOU WANT TO BE YOUR COLUMN AND LINE ."""$'
HEAD3 DB 'PLEASE ENTER YOUR NUMBER IN THIS WAY :$'
HEAD4 DB '| x1 x2 x3 |$'
HEAD5 DB '| x4 x5 x6 |$'
HEAD6 DB '| x7 x8 x9 |$'
FOOT1 DB 'THIS PROGRAM IS BELONG TO ALIREZA DANIKOU $'
FOOT2 DB 'HAVE GOOD TIME $'
M DB N
MULT DW ?
LINE DB N
COLUMN DB N
COUNTER DB N
;----------------------------
X DW ?
P DB 0
;----------------------------
; |----------------------------------------|
; | SHOROE BARNAME |
; |----------------------------------------|
MAIN PROC NEAR
CALL HEADER
LEA SI,SATR1
MOV AX,N
MUL M
MOV CX,AX
L20:
PUSH CX
PUSH SI
CALL INPUT
POP SI
POP CX
MOV [SI],AX
ADD SI,1
LOOP L20
MOV AH,09H
LEA DX,ENTER
INT 21H
LEA SI,SATR2
MOV AX,N
MUL M
MOV CX,AX
L21:
PUSH CX
PUSH SI
CALL INPUT
POP SI
POP CX
MOV [SI],AX
ADD SI,1
LOOP L21
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV CX,0
MOV SI,OFFSET SATR1
MOV BX,OFFSET SATR2
MOV DI,OFFSET NATIJE
L1:
MOV CH,N
SUB CH,LINE
MOV COLUMN,N
L2:
MOV AL,ch
MOV X,N
MUL X
ADD SI,AX
MOV AH,0
MOV AL,P
ADD BX,AX
MOV COUNTER,N
MOV MULT,0
L3:
MOV AL,[SI]
MUL [BX]
ADD MULT,AX
INC SI
ADD BX,N
DEC COUNTER
JNZ L3
MOV AX,MULT
MOV [DI],AX
;--------------;
; Print ;
;--------------;
CMP AX,10
JB L4 ;
MOV DX,0
MOV BX,10
DIV BX
ADD AX, 30H
MOV AH, 0EH
INT 10H
MOV AX,DX
ADD AX, 30H
MOV AH, 0EH
INT 10H
JMP L8
JMP L5
L4:
ADD AX, 30H
MOV AH, 0EH
INT 10H
L8:
MOV AH,09H
LEA DX,TAB
INT 21H
DEC M
CMP M,0
JE L9
JMP L5
L9:
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV M,N
L5:
MOV AH,0
ADD DI,2
MOV SI,OFFSET SATR1
MOV BX,OFFSET SATR2
INC P
DEC COLUMN
JNZ L2
MOV P,0
DEC LINE
JNZ L1
CALL FOOTER
CALL WAITING
MOV AX,4C00H
INT 21H
MAIN ENDP
INPUT PROC
MOV AH,0AH
LEA DX,MAX
INT 21H
MOV AX,0
MOV CL,ACT
MOV CH,0
LEA SI,NUM
L50:
MOV BX,10
MUL BX
MOV DL,[SI]
SUB DL,48
MOV DH,0
ADD AX,DX
INC SI
LOOP L50
RET
INPUT ENDP
HEADER PROC
LEA DX,HEAD1
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
LEA DX,HEAD2
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
LEA DX,HEAD3
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
LEA DX,HEAD4
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
LEA DX,HEAD5
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
LEA DX,HEAD6
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
RET
HEADER ENDP
FOOTER PROC
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
LEA DX,FOOT1
MOV AH,09H
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,ENTER
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
MOV AH,09H
LEA DX,TAB
INT 21H
LEA DX,FOOT2
MOV AH,09H
INT 21H
RET
FOOTER ENDP
WAITING PROC
MOV AH,01H
INT 21H
RET
WAITING ENDP
CODESG ENDS
END START