📄 lmul.asm
字号:
.model small
.data
xx db 20
db 0
x db 20 dup(0)
yy db 20
db 0
y db 20 dup(0)
zz db 42
db 0
z db 42 dup(0)
message1 db 'Please input one multiplicand:',13,10,'$'
message2 db 'Please input another multiplicand:',13,10,'$'
message db 'The result of the two multiplicand is:',13,10,'$'
messagee db 'The program is now executing:',13,10,'$'
lengthx dw 20
lengthy dw 20
sah db 0
temp db 0
.code
.startup
mov dx,@data
mov ds,dx
mov dx,offset message1
mov ah,09h
int 21h
mov bx,20
inputx:
mov ah,01h
int 21h
cmp al,2fh
js inputy
cmp al,3ah
jns inputy
sub al,30h
mov x[bx],al
dec bx
jnz inputx
inputy:
sub lengthx,bx
mov ah,02
mov dl,13
int 21h
mov dl,10
int 21h
;插入输出检验语句(开始)
; mov bx,20
;outptx:
; mov dl,x[bx]
; add dl,30h
; mov ah,02
; int 21h
; dec bx
; mov cx,20
; sub cx,bx
; cmp cx,lengthx
; jnz outptx
;插入输出检验语句(结束)
mov dx,offset message2
mov ah,09
int 21h
mov bx,20
iny:
mov ah,01
int 21h
cmp al,2fh
js multiply
cmp al,3ah
jns multiply
sub al,30h
mov y[bx],al
dec bx
jnz iny
multiply:
sub lengthy,bx
mov ah,02
mov dl,13
int 21h
mov dl,10
int 21h
;Y的输出校验语句(开始)
; mov bx,20
;outpty:
; mov dl,y[bx]
; add dl,30h
; mov ah,02
; int 21h
; dec bx
; mov cx,20
; sub cx,bx
; cmp cx,lengthy
; jnz outpty
;Y的输出校验语句(结束)
mov dx,offset message
mov ah,09h
int 21h
mov bx,20
sub bx,lengthy
add bx,1
realm:
mov cl,y[bx]
mov si,20
mov sah,0
sub si,lengthx
add si,1
rotates:
mov ah,0
mov al,x[si]
mul cl
aam
push ax
mov ah,0
add al,z[bx][si]
aaa
mov temp,ah
mov ah,0
add al,sah
aaa
add temp,ah
mov z[bx][si],al
; mov dl,al
; mov ah,02
; add dl,30h
; int 21h
pop ax
add temp,ah
mov ch,temp
mov sah,ch ;mov sah,temp
inc si
cmp si,21
jnz rotates
cmp sah,0
jz judge
mov ch,sah
mov z[bx][si],ch ;mov z[bx][si+1],sah
; mov dl,'*'
; mov ah,02h
; int 21h
; mov dl,z[bx][si+1]
; add dl,30h
; mov ah,02h
; int 21h
judge:
inc bx
cmp bx,21
jnz realm
output:
mov cx,40
cmp sah,0
jz continues
add cx,1
continues:
mov bx,cx
mov cx,40
sub cx,lengthx
sub cx,lengthy
add cx,1
outz:
mov dl,z[bx]
add dl,30h
mov ah,02h
int 21h
dec bx
cmp bx,cx
jnz outz
quit:
mov ax,4c00h
int 21h
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -