程序显示的ASCII图形中间显示“程序成功执行”

时间:2019-08-25 05:47:43

标签: assembly dos x86-16 ascii-art

我的目标是生成连续的菱形。我正确编写了代码,但运行时遇到了问题。问题是语句

  

“程序已成功执行。按任意键继续”

显示在形状之间。如何解决?

.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

the image

2 个答案:

答案 0 :(得分:2)

我认为您正在使用BIOS功能int 10h,我想是为了移动光标。

您可能会将光标留在形状中间的线上。

程序退出后,操作系统会在光标所在的行之后的行上打印该文本。 如果您不想在形状的中间,请将光标移到底部,然后再退出。(或以纯正的从上到下的顺序打印形状,以使光标停在该位置,而不是在每个字符之间移动。)

(我没有详细阅读您的代码,只是看了一下图像。但这似乎是个不错的猜测。)

答案 1 :(得分:1)

如果您在屏幕上显示的图形不是从上到下和从左到右运行,则solution provided by Peter Cordes可能会工作良好。

如果将操作系统或仿真器硬连线以仅在屏幕中间显示这些消息,则将光标放置在任何位置都无济于事!

如果您的输出占据了整个屏幕,并且您希望不受干扰地凝视它,那么您可以通过等待额外的按键来推迟结束程序。只要不按下其他键,烦人的消息就不会出现。

mov ah, 01h    ;Wait for an extra key
int 21h
mov ax, 4C00h  ;Terminate program
int 21h