x86程序集(masm32) - 我可以在windows xp上使用int 21h来打印东西吗?

Pro*_*rmr 1 x86 assembly winapi masm masm32

只是想知道,关于我的内置宏的替代方案,是否可以通过使用int 21h windows API 来避免使用StdOut宏?如:

.data
       msg dd 'This will be displayed'
;original macro usage:
invoke StdOut, addr msg
;what I want to know will work
push msg 
int 21h ; If this does what I think it does, it should print msg
Run Code Online (Sandbox Code Playgroud)

是否存在这样的事情(如使用int 21h打印东西),或者存在类似的东西,但不完全是21h.或者我完全错了.

有人可以为我澄清一下吗?

谢谢,

Progrmr

Adr*_*tti 7

中断21h是MS-DOS功能的入口点.

例如,要在stdout上打印一些东西,你必须:

mov ah, 09h  ; Required ms-dos function
mov dx, msg  ; Address of the text to print
int 21h      ; Call the MS-DOS API entry-point
Run Code Online (Sandbox Code Playgroud)

该字符串必须以'$'字符终止.

但:

  • 您不能在Windows桌面应用程序中使用中断(它们仅适用于设备驱动程序).
  • 如果需要调用MS-DOS函数,则必须编写16位应用程序.

然后......是的,您无法使用它来打印消息,不存在这样的情况:您必须调用OS函数来打印消息,并且它们不能通过中断获得.