如何在装配中打印笑脸?

发布于 2024-08-15 02:17:50 字数 340 浏览 3 评论 0原文

我用汇编程序编写了一个程序并编译了它。 它的目的是打印一个蓝色的笑脸,然后等待用户按下一个键才终止。它确实执行了最后一点,但它不打印笑脸。有人可以解释我做错了什么吗?

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

我用MASM16位链接器编译它

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遮了一弯 2024-08-22 02:17:51

如果您处于纯文本视频模式,则只能直接插入视频缓冲区。我猜您正在使用某种 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.

鹤舞 2024-08-22 02:17:51

自从我使用 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.

书间行客 2024-08-22 02:17:51

您的代码没问题,您只需要按照 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文