为什么我的程序不能将12666居中显示?
assume ds:data,cs:codedata segment
db 10 dup(0)
data ends
code segment
start: mov ax,12666
mov bx,data
mov ds,bx
mov si,0H
call dtoc
mov dh,0cH
mov dl,25H
mov cl,02H
call show_str
mov ax,4c00H
int 21H
;名称:dtoc
;功能:将word型数据转变为表示十进制数的字符串,字符串以0结尾
;参数:(ax)=word型数据
; ds:si指向字符串首地址
;返回:无
dtoc: push ax
push bx
push cx
push dx
push si
push di
mov di,0H
mov bx,10
d0: mov dx,0H
div bx
add dx,30H
push dx
incdi
mov cx,ax
jcxz d1
jmp short d0
d1: mov cx,di
d2: pop dx
mov ,dl
inc si
loop d2
mov dl,0
mov ,dl
pop di
pop si
pop dx
pop cx
pop bx
pop ax
ret
;名称:show_str
;功能:在指定的位置,用指定的颜色,显示一个用0结束的字符串
;参数:(dh)=行号(取值范围0~24)
; (dl)=列号(取值范围0~79)
; (cl)=颜色
; ds:si指向字符串的首地址
;返回:无
show_str: mov ax,0b800H
mov es,ax
mov al,0a0H
mul dh
mov di,ax
mov al,02H
mul dl
mov bx,ax
mov al,cl
mov ch,0H
s0:mov cl,
jcxz s1
mov es:,cl
mov es:01H,al
inc si
add bx,02H
jmp short s0
s1:ret
code ends
end start
问题:我的程序无法居中显示12666?
:dizzy: 你调试的步骤是什么? 对你的代码没有任何改动的 复制粘贴然后运行 结果正常在屏幕中显示了 绿色12666
E:\TEST\1>ml 1.asm
Microsoft (R) Macro Assembler Version 6.15.8803
Patched for you by promethee in the year 2001 - enjoy
Copyright (C) Microsoft Corp 1981-2000.All rights reserved.
Assembling: 1.asm
12666
Microsoft (R) Segmented Executable LinkerVersion 5.60.339 Dec5 1994
Copyright (C) Microsoft Corp 1984-1993.All rights reserved.
Object Modules [.obj]: 1.obj
Run File : "1.exe"
List File : NUL
Libraries [.lib]:
Definitions File :
LINK : warning L4021: no stack segment
E:\TEST\1>1.exe
E:\TEST\1>
学习学习
页:
[1]