装配中子手的打印图 [英] Print figure of hangman in assembly
问题描述
有没有更好的方法来打印hang子手形象?
Is there a better way to print a hangman figure?
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
Here is some nice figure. https://youtu.be/e2S_POws3DQ?t=42s
如果你赢了比赛,他跳起来时看起来真的很酷.我尝试使用呼叫Clrscr 并让他跳,但没有运气.
Its look really cool when he jump if you win game. I try to use call Clrscr and make him jump, but no luck.
推荐答案
首先:不要更改您的环境(Windows,32位,控制台,MASM,Irvine32)!您会遇到很多建议您进行更改的人(使用BIOS,MS-DOS,Linux进行更改.使用GDI,OpenGL,DirectX进行更改.等等.).您可能会在其他环境中更好地解决问题,但是您会遇到新的问题,可以通过更改环境来解决.最后,您将退出整个项目-未完成.
First of all: Don't change your environment (Windows, 32-bit, Console, MASM, Irvine32)! You will meet a lot of people who suggest you to change it (Do it with BIOS, MS-DOS, Linux. Do it with GDI, OpenGL, DirectX. And so on.). You might solve a problem better with another environment, but you'll get new problems, which can be solved with changing the environment. At the end you'll quit the whole project - unfinished.
"$"
是MS-DOS字符串的终止字符.在Windows/Irvine32中,您使用空终止来处理.
"$"
is the termination character of a MS-DOS string. In Windows/Irvine32 you handle with a null-termination.
即使Windows的控制台模式也非常快.因此,您需要Irvine的 Delay
查看动画的功能:
Even the Console mode of Windows is quite quick. So you need Irvine's Delay
function to see an animation:
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
对于您的目的而言不是理想的选择,因为它会清除包括输入在内的整个屏幕.使用Irvine的 GotoXY
.通过写空格删除旧图片.
ClrScr
is not ideal for your purpose since it clears the whole screen including the inputs. Use Irvine's GotoXY
. Delete the old picture by writing spaces.
这篇关于装配中子手的打印图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!