求大神给出用80X86汇编语言写出来的九九乘法表格式如下
1*1=1
2*1=2 2*2=4
3*1=3 3*2=6 3*3=9
4*1=4 4*2=8 4*3=12 4*4=16
…………
求大神给出,一定要用80X86啊,一定给分!!!
------解决方案--------------------------------------------------------
是16位汇编程序呢还是32位汇编程序呢?
------解决方案--------------------------------------------------------
datasg segment
menuinfo db 'Menu',0ah,0dh,
'0 for print 9X9 multiplication table',0ah,0dh,
'1 for print ASCII table',0ah,0dh,'$'
errorinfo db 'illegal input,try again','$'
datasg ends
codesg segment
assume ds:datasg,cs:codesg
start:
mov ax,datasg
mov ds,ax
lea dx,menuinfo
mov ah,9
int 21h
mov ah,8
int 21h
cmp al,'0'
je Print99MultTable
cmp al,'1'
je PrintASCIITable
lea dx,errorinfo
mov ah,9
int 21h
exit:
mov ax,4c00h
int 21h
Print99MultTable:
mov bx,1
mov cx,1
s0:
mov ax,bx
push cx
mov cx,1
s3:
mov dl,bl
add dl,30h
mov ah,2
int 21h
mov dl,'*'
int 21h
mov dl,cl
add dl,30h
int 21h
mov dl,'='
int 21h
mov ax,bx
mov dl,bl
mul cl
call htod
mov ah,2
mov dl,20h
int 21h
inc cx
cmp cx,bx
jle s3
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
int 21h
pop cx
inc cx
cmp cx,10
inc bx
jb s0
jmp exit
PrintASCIITable:
xor dl,dl
mov cx,128
mov ah,2
s2:
int 21h
inc dl
loop s2
jmp exit
htod proc
push ax
push cx
push dx
push bx
xor cx,cx
mov bx,10
s:
xor dx,dx
div bx
inc cx
push dx
cmp ax,0
jne s
s1:
pop dx
add dl,30h
mov ah,2
int 21h
loop s1
pop bx
pop dx
pop cx
pop ax
ret
htod endp
codesg ends
end start
------解决方案--------------------------------------------------------
DSEG SEGMENT
DATA DB 1,2,3,4,5,6,7,8,9
DSEG ENDS
CSEG SEGMENT
ASSUME CS:CSEG,DS:DSEG
START: MOV AX,DSEG
MOV DS,AX
MOV BL,0 ;BL置为零
COL: INC BL ;BL+1
LEA SI,DATA ;设置目的操作数指针
MOV CH,BL
LINE: MOV AL,BL
MOV BH,[SI] ;[SI]为SI指向的内存单元
MUL BH ;BH与AL相乘
MOV DH,AL
MOV DL,BL
ADD DL,30H ;十进制显示第一个数
MOV AH,02H
INT 21H
MOV DL,'*' ;显示乘号
MOV AH,02H
INT 21H
MOV DL,BH
ADD DL,30H ;十进制显示乘后的结果
MOV AH,02H
INT 21H
MOV DL,'='
MOV AH,02H
INT 21H
MOV DL,DH
MOV CL,4 ;CL为计数器
SHR DL,CL ;逻辑右移四位
CMP DL,9 ;DL与9进行比较
ADD DL,30H
MOV AH,02H
INT 21H
MOV DL,DH
AND DL,0FH ;把无用位清零
CMP DL,9 ;两个数进行比较
JA M2 ;DL大于9跳转M2
JMP M4 ;否则无条件跳转M4
M2: ADD DL,7H ;DL的ASCII码加7
M4: ADD DL,30H ;DL的ASCII码加30
JMP OUT2 ;无条件跳转OUT2