要不我发一个MASMPlus版本的你看看?
---
程序代码:
;#Mode=DOS
;MASMPlus
;--------------------------------------------------------------------
;--------------------------------------------------------------------
; program name: 9*9 Multiplication Table
; producer: yrjd
; program function: Show a 9*9 Multiplication Table
; produce data: 2012-10-11 Thursday
;--------------------------------------------------------------------
assume cs:code, ds:data, ss:stack
stack segment para stack 'stack'
db 128 dup (?)
stack ends
data segment
String db 128 dup ('$')
Multi db ?
RltPrompt db 'The result is : ', '$'
EndPrompt db 'Press any key to continue', '$'
data ends
code segment
start: ; Segment register initialize 段寄存器初始化
mov ax, stack
mov ss, ax
mov sp, 128
mov ax, data
mov ds, ax
; Prompt and Output the result 提示并输出结果
lea dx, RltPrompt
mov ah, 09h
int 21h
call crlf
call crlf
; Use two Loops to Show the Multiplication Table
; 用两个循环来计算并显示乘法表
mov cx, 9
mov al, 1
OuterLoop: mov si, 0
mov dl, 1
InnerLoop: mov ah, al
mov dh, dl
add ah, 30h
add dh, 30h
call MulAndStore
mov String[si], ah
mov String[si + 1], '*'
mov String[si + 2], dh
mov String[si + 3], '='
inc dl
add si, 8
cmp dl, al
jna InnerLoop
push ax
lea dx, String
mov ah, 09h
int 21h
pop ax
call crlf
add al, 1
loop OuterLoop
call crlf
; Output End Prompt 输出结束提示
lea dx, EndPrompt
mov ah, 09h
int 21h
; View the result and Return DOS 查看结果并返回DOS
mov ah, 01h
int 21h
mov ah, 4ch
int 21h
; Convert the multiplication to character
; 把乘积转换为字符
MulAndStore: push ax
push bx
push cx
push dx
push si
push di
mov ah, 0
mul dl
mov dl, 10
div dl
cmp al, 0
jz Single
jnz Pair
Single: add ah, 30h
mov String[si + 4], ah
mov String[si + 5], ' '
mov String[si + 6], ' '
mov String[si + 7], ' '
jmp OK
Pair: add al, 30h
mov String[si + 4], al
add ah, 30h
mov String[si + 5], ah
mov String[si + 6], ' '
mov String[si + 7], ' '
OK: pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
; The function of Carriage-Return Line-Feed 回车换行
crlf: push ax
push dx
mov dl, 0dh
mov ah, 02h
int 21h
mov dl, 0ah
mov ah, 02h
int 21h
pop dx
pop ax
ret
divdw: ; not overflow division 实施不溢出除法获取除10的余数
push si
push di
push ax
mov ax, dx
mov dx, 0
div cx
mov si, ax
pop ax
div cx
mov cx, dx
mov dx, si
pop di
pop si
ret
code ends
end start