我的目标是生成连续的菱形。我正确编写了代码,但运行时遇到问题。问题出在声明上
"program successfully executed. Press any key to continue"
显示在形状之间。如何解决?
.model small
.stack 100h
.code
main proc
Des:
mov ah,2
mov bh,0
mov dh,1
mov dl,1
int 10h
mov cx,7
mov count,6
local count:word=vars_room
Des2a:
dec cx ;moving downward
mov bl,dl
mov dl,'1'
int 21h
mov dl,bl
inc dl
inc dh
int 10h
cmp cx,0
jne Des2a
mov dh,0
mov cx,8
dec count
cmp count,0
jne Des2a
mov dl,'1'
int 21h
mov ah,2
mov bh,0
mov dh,9
mov dl,1
int 10h
mov count,6
mov cx,7
Des2b:
mov bl,dl
mov dl,'1'
int 21h
mov dl,bl
inc dl
dec dh
int 10h
dec cx
jnz Des2b
mov dh,10
mov cx,8
dec count
cmp count,0
jne Des2b
mov dl,'1'
int 21h
mov cx,9
mov ah,4ch
int 21h`
main endp
end main
i have included an image of my problem
最佳答案
我发现您正在使用 BIOS 函数 int 10h
,我假设用于光标移动。
您可能将光标留在形状中间的线上。
程序退出后,操作系统会在光标所在行之后的行上打印该文本。 如果您不希望它出现在形状的中间,请在退出之前将光标移动到底部。(或者以纯从上到下的顺序打印形状,以便光标在那里结束,而不是在每个字符之间移动它。)
(我没有详细阅读您的代码,只是查看了图像。但这似乎是一个不错的猜测。)
关于assembly - "program successfully executed"显示在我的程序显示的 ASCII 图形的中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57643571/