c++ - 将 int 21h 与内联汇编一起使用

标签 c++ winapi visual-c++ assembly inline-assembly

我在 Visual C++ 中使用内联汇编,几天来一直在尝试让 int 21h 与我的程序一起工作。其他中断工作(int 3)让我相信我调用 21h 是错误的,或者它以某种方式被阻止。我只在使用 int 21h 时遇到运行时错误。如果我将其注释掉,它可以很好地移动寄存器。

到目前为止,我已经把这些放在一起了:

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

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

最佳答案

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

您可以使用硬件中断,例如 int 1int 3

关于c++ - 将 int 21h 与内联汇编一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9524388/

相关文章:

c++ - 什么是取消点?

c++ - 具有许多成员的类(class)的最佳做法

c++ - 想要销毁我制作的堆栈

c++ - bcc32 中简单数组的初始值设定项错误太多

windows - 将窗口从后台进程带到前台

c - winapi FillConsoleOutputAttribute 程序崩溃

c++ - win32 CreateThread,如何将lpStartAddress参数作为c++类函数调用?

c++ - uninitialized_copy memcpy/memmove 优化

c++ - 在 Release模式下构建 Boost

c++ - 理解 C++ 中的引用和拷贝的问题