如何在装配中打印笑脸?
我用汇编程序编写了一个程序并编译了它。 它的目的是打印一个蓝色的笑脸,然后等待用户按下一个键才终止。它确实执行了最后一点,但它不打印笑脸。有人可以解释我做错了什么吗?
CSEG segment
org 100h
Begin:
mov ax,0B800h
mov es,ax
mov di,0
mov ah,31
mov al,1
mov es:[di],ax
mov ah,10h
int 16h
int 20h
CSEG ends
end Begin
我用MASM和16位链接器编译它
I wrote a program in assembler and compiled it. It is meant to print a blue smiley face and then wait for the user to press a key before it terminates. It does do that last bit but it doesn't print the smiley face. Can someone explain what have I done wrong ?
CSEG segment
org 100h
Begin:
mov ax,0B800h
mov es,ax
mov di,0
mov ah,31
mov al,1
mov es:[di],ax
mov ah,10h
int 16h
int 20h
CSEG ends
end Begin
I compiled it with MASM with a 16 bit linker
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您处于纯文本视频模式,则只能直接插入视频缓冲区。我猜您正在使用某种 Windows,但实际上并未启动 DOS,因此您可能处于图形模式。
您可能可以打开一个控制台窗口,然后AltEnter进入全屏文本模式。尝试在那里运行你的程序。
You can only poke the video buffer directly if you're in a text-only video mode. I'm guessing that you're using Windows of some kind and not actually booting DOS, so you probably are in a graphics mode.
What you may be able to do is open a console window and then AltEnter to go to a full-screen text mode. Try running your program there.
自从我使用 MASM 以来已经有大约一年了,我家里唯一的参考书是 MIPS,所以我承认我有点生疏,但是打印到屏幕需要系统中断(int 21h),但唯一的系统我看到的中断是键盘中断后的程序终止调用。
It's been about a year or so since I worked with MASM and the only reference book I have at home is MIPS, so I'm admittedly a bit rusty, however print to screen requires a system interrupt (int 21h), yet the only system interrupt I'm seeing is the program termination call after the keyboard interrupt.
您的代码没问题,您只需要按照 Greg Hewgill 建议的方式全屏运行,或者将命令窗口设置为使用旧的光栅字体(如 SYSTEM)。右键单击窗口的标题栏,然后查看“字体”选项卡。
Your code is ok, you just need to either run full-screen as Greg Hewgill suggested, or set up your command window to use an old raster font (like SYSTEM). Right click the title bar of the window and have a look at the Font tab.