在装配中打印刽子手的图

时间:2017-06-04 18:10:29

标签: assembly masm irvine32

有没有更好的方法来打印刽子手形象?

FIG0    DB 0DH,0AH,' +=======+',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG1    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG2    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/        |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG3    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/ \      |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG4    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG5    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG6    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'/        |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG7    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'/ \      |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH,'$'
FIG8    DB 0DH,0AH,' +=======+',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'   \O/   |',0DH,0AH,'    |    |',0DH,0AH,'    |    |',0DH,0AH,'   / \   |',0DH,0AH,' ========+',0DH,0AH,'$'

这是一个不错的人物。 https://youtu.be/e2S_POws3DQ?t=42s

如果你赢了比赛,当他跳起来时看起来很酷。我尝试使用调用Clrscr 并让他跳,但没有运气。

1 个答案:

答案 0 :(得分:1)

首先:不要改变你的环境(Windows,32位,Console,MASM,Irvine32)!你会遇到很多人建议你改变它(用BIOS,MS-DOS,Linux做。用GDI,OpenGL,DirectX等做。)等等。您可以使用其他环境更好地解决问题,但是您会遇到新问题,可以通过更改环境来解决。最后你将退出整个项目 - 未完成。

"$"是MS-DOS字符串的终止字符。在Windows / Irvine32中,您使用空终止处理。

即使Windows的控制台模式也很快。所以你需要Irvine的Delay函数才能看到动画:

INCLUDE Irvine32.inc

.DATA

FIG0    DB 0DH,0AH,' +=======+',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG1    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG2    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/        |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG3    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/ \      |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG4    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG5    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG6    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'/        |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG7    DB 0DH,0AH,' +=======+',0DH,0AH,' |       |',0DH,0AH,' O       |',0DH,0AH,'/|\      |',0DH,0AH,' |       |',0DH,0AH,'/ \      |',0DH,0AH,'         |',0DH,0AH,' ========+',0DH,0AH, 0
FIG8    DB 0DH,0AH,' +=======+',0DH,0AH,'         |',0DH,0AH,'         |',0DH,0AH,'   \O/   |',0DH,0AH,'    |    |',0DH,0AH,'    |    |',0DH,0AH,'   / \   |',0DH,0AH,' ========+',0DH,0AH, 0

.CODE

main PROC

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG0
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG1
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG2
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG3
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG4
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr
    lea edx, FIG5
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG6
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG7
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    mov eax, 1000                       ; 1000 milliseconds = 1 second
    call Delay                          ; Irvine32: Delay ECX milliseconds
    call ClrScr                         ; Irvine32; Clear Screen
    lea edx, FIG8
    call WriteString                    ; Irvine32: Write a string pointed to by EDX

    exit                                ; Irvine32: ExitProcess

main ENDP

END main

ClrScr不适合您的目的,因为它会清除整个屏幕,包括输入。使用欧文的GotoXY。通过书写空格删除旧图片。