将int 21h与内联汇编一起使用 [英] Using int 21h with inline assembly

查看:112
本文介绍了将int 21h与内联汇编一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual C ++中使用内联汇编,并且已经尝试了好几天了,以使int 21h可以与我的程序一起使用.其他中断工作(int 3)使我相信我打错21h或以某种方式被阻止.当我使用int 21h时,只会出现运行时错误.如果我注释掉它,可以很好地移动寄存器.

I am using inline assembly in Visual C++ and have been trying for days now to get int 21h to work with my program. Other interrupts work (int 3) which leads me to believe either I'm calling 21h wrong or it is blocked somehow. I only get a runtime error when I use int 21h. If I comment it out it can move registers fine.

到目前为止,我已经做到了:

So far I've gotten this together:

int _tmain(int argc, _TCHAR* argv[])
{
    __asm {
        mov ah, 1h
        int 21h

        mov dl, al
        mov ah, 2h
        int 21h
    }
}

推荐答案

您不能在Windows程序中使用DOS中断.他们是不同的平台

You can't use DOS interrupts in a windows program; they are different platforms

您可以使用诸如int 1int 3之类的硬件中断.

You can use hardware interrupts such as int 1 and int 3.

这篇关于将int 21h与内联汇编一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆