汇编语言程序 99乘法表 急求
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了汇编语言程序 99乘法表 急求相关的知识,希望对你有一定的参考价值。
code segmentassume cs:code
org 100h
start:
push cs
pop ds
push cs
pop es
mov si,1
m0: mov di,1
m1: mov ax,si
call dispnum
call dispstar
mov ax,di
call dispnum
call dispequ
mov ax,si
mov bx,di
mul bl
call dispmul
mov dl,' '
mov ah,2
int 21h
mov dl,' '
mov ah,2
int 21h
inc di
; cmp di,9
cmp di,si
jle m1
call lfcr
call lfcr
inc si
cmp si,9
jle m0
mov ah,4ch
int 21h
;=================
lfcr proc near
push ax
push bx
push cx
push dx
push si
push di
pushf
mov ah,2
mov dl,10
int 21h
mov dl,13
int 21h
popf
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
lfcr endp
;======================
dispstar proc near
push ax
push bx
push cx
push dx
push si
push di
pushf
mov ah,2
mov dl,'*'
int 21h
popf
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
dispstar endp
;===================
dispequ proc near
push ax
push bx
push cx
push dx
push si
push di
pushf
mov ah,2
mov dl,'='
int 21h
popf
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
dispequ endp
;====================
dispnum proc near
; 将要显示的数据放入AL中
push ax
push bx
push cx
push dx
push si
push di
pushf
add al,30h
mov dl,al
mov ah,2
int 21h
popf
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
dispnum endp
;===============
dispmul proc near
; 将要显示的数据放入AL中
push ax
push bx
push cx
push dx
push si
push di
pushf
mov ah,0
mov cl,10
div cl
mov byte ptr[yy+1],ah ;保存个位
mov byte ptr[yy],al ;保存十位
mov al,byte ptr[yy]
add al,30h ;十位转ASC2
cmp al,30h
jne @2
mov al,' '
@2: mov byte ptr[yy],al
mov al,byte ptr[yy+1]
add al,30h ;个位转ASC2
mov byte ptr[yy+1],al
mov ah,9
lea dx,yy
int 21h
popf
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
yy db 0,0,'$'
dispmul endp
;===============
code ends
end start 参考技术A ;用汇编语言编一个九九乘法表,主要是要梯形结构,最好写一下简单的流程
;用MASM5.0编译通过,以下是运行结果
;E:\masm1>9X9
;
;1X1=1
;1X2=2 2X2=4
;1X3=3 2X3=6 3X3=9
;1X4=4 2X4=8 3X4=12 4X4=16
;1X5=5 2X5=10 3X5=15 4X5=20 5X5=25
;1X6=6 2X6=12 3X6=18 4X6=24 5X6=30 6X6=36
;1X7=7 2X7=14 3X7=21 4X7=28 5X7=35 6X7=42 7X7=49
;1X8=8 2X8=16 3X8=24 4X8=32 5X8=40 6X8=48 7X8=56 8X8=64
;1X9=9 2X9=18 3X9=27 4X9=36 5X9=45 6X9=54 7X9=63 8X9=72 9X9=81
;
;
data segment
L DB 31H,'X'
H DB 31H,'='
M1 DB 0
M2 DB 0
DB ' $'
M DB 0 ;乘积
CRLF DB 0DH,0AH,'$'
data ends
code segment
main proc far
assume cs:code,ds:data
start:
PUSH DS
XOR AX,AX
PUSH AX
MOV AX,DATA
MOV DS,AX
CALL CRLF_P
MOV AL,31H
MOV L,AL
MOV H,AL
NEXT_L:
CALL DISP
MOV AL,H
CMP AL,L
JE NEXT_H
INC L
JMP NEXT_L
NEXT_H:
CALL CRLF_P
INC H
MOV AL,31H
MOV L,AL
MOV AL,H
CMP AL,3AH
JE END9
JMP NEXT_L
END9:
RET
;INT 20H
main endp
;=====================
DISP PROC NEAR
MOV AL,H
MOV BL,L
SUB AL,30H
SUB BL,30H
MUL BL
MOV M,AL ;;乘积
MOV BL,10D
DIV BL
CMP AL,0
JE NO10
ADD AX,3030H
MOV M1,AL
MOV M2,AH
JMP DISP11
NO10:
ADD AH,30H
MOV M1,AH
MOV AL,' '
MOV M2,AL
DISP11:
MOV DX,OFFSET L
MOV AH,09
INT 21H
RET
DISP ENDP
;========================
CRLF_P PROC NEAR
MOV AH,09
MOV DX,OFFSET CRLF
INT 21H
RET
CRLF_P ENDP
code ends
end start
以上是关于汇编语言程序 99乘法表 急求的主要内容,如果未能解决你的问题,请参考以下文章