我尝试了这段代码(使用中断),但它适用于DOS:
mov eax, 42 ; write 42 to console
mov ecx, 10 ; in decimal
out_int_loop:
xor edx, edx
div ecx
push eax
add dl, '0' ; one digit
mov ah, 2 ; 2 is code for writing character
int 21h
pop eax
cmp eax, 0
jnz out_int_loop
答案 0 :(得分:0)
我使用了来自winapi的WriteConsoleA
函数。
我还使用GetStdHandle
获取stdout
。
要导入此功能,您需要以下这些行:
extern __imp__GetStdHandle@4
extern __imp__WriteConsoleA@20