问题描述
所以,我想制作一个简单的程序来在控制台上打印一个字符串,为了做到这一点,我创建了一个带内联汇编的简单函数,我的意思是,proint一个字符串而不使用windows lib或C / C ++函数,比如printf或cout ....所以,我知道VC ++的宏汇编程序编译器使用masm sintax ...所以,我有这样的:
So, i''m tring to make a simple program to print a string on console, to make this, I have created a simple function with inline assembly, my ideia is, proint a string without use a windows lib or C/C++ functions, like printf or cout.... so, I know the macro assembler compiler of VC++ use the masm sintax... so, I have maded this:
void print(char *msg)
{
__asm
{
mov ah, 9
mov dx, msg
int 21h
}
}
int main()
{
print("hello");
return 0;
}
BUt,我认为使用旧的DOS中断不能正常工作:(
所以,有一种方法,使用printf或cout或c / c ++函数,只需要C和汇编???
BUt, i think the use of old DOS interrupts not work fine :(
So, have a way to make this, whiout use printf or cout or c/c++ functions , just C and assembly ???
推荐答案
这篇关于内联装配控制台打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!