我使用 devcpp 和 borland c 编译器......
asm {
mov ax,4 // (I/O Func.)
mov bx,1 // (Output func)
mov cx,&name // (address of the string)
mov dx,6 // (length of the string)
int 0x21 // system call
}
在上面的代码片段中,我想在汇编语言的帮助下打印一个字符串......
但我怎样才能把字符串的地址放入寄存器 cx....
代码有问题吗???
我手头没有 Borland 编译器,所以我可能记错了它的语法,但是你尝试过这个吗:
asm {
mov ax,4 // (I/O Func.)
mov bx,1 // (Output func)
lds cx,"Hello, world" // (address of the string)
mov dx,6 // (length of the string)
int 0x21 // system call
}
or this:
char msg[] = "Hello, world";
asm {
mov ax,4 // (I/O Func.)
mov bx,1 // (Output func)
lds cx, msg // (address of the string)
mov dx,6 // (length of the string)
int 0x21 // system call
}
edit:虽然这可以编译(现在我已经将 MOV 更改为 LDS),但它仍然会在运行时抛出错误。我会再尝试...
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)