我試圖找到一個非常基本的C++內聯彙編x86-64的例子,與此類似:簡單X86-64 C++內聯彙編的 「Hello World」 的例子
a Simple "Hello World" Inline Assembly language Program in C/C++
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 // (lenght of the string)
int 0x21 // system call
}
這會工作與英特爾編譯器。有人可以幫忙嗎?
編輯關於操作系統我有Windows和Linux上的ICC - 讓我們說Linux!
什麼操作系統?通常情況下,您不要在x86-64代碼中使用「int 0x21」(DOS中斷)。 – nrz 2013-03-20 21:19:26
Google'intel編譯器內聯彙編' – 2013-03-20 21:20:59
如果您在Windows上,請嘗試[DosBox(x86模擬器)](http://www.dosbox.com/)以使用0x21中斷。 – deepmax 2013-03-20 21:23:39