User forums > General (but related to Code::Blocks)
ASM & CodeBlock
(1/1)
elvisdukaj:
How can I use asm inline in CodeBlock with GNU GCC Compiler? Why I can't do:
void SetGraphMode(char mode) {
_asm {
mov al, mode
mov ah, 0x0
int 0x10
}
}
JGM:
--- Quote from: elvisdukaj on June 30, 2007, 07:39:13 pm ---How can I use asm inline in CodeBlock with GNU GCC Compiler? Why I can't do:
void SetGraphMode(char mode) {
_asm {
mov al, mode
mov ah, 0x0
int 0x10
}
}
--- End quote ---
Well with the GCC compiler using c++ an example will be the following:
--- Code: ---int function(){
asm("movl $0, %eax\n\t");
}
--- End code ---
The assembly syntax utilized on GCC is the AT&T asm. Here is a nice page with good info: http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
Good enough for getting started...
byo:
--- Quote from: elvisdukaj on June 30, 2007, 07:39:13 pm ---How can I use asm inline in CodeBlock with GNU GCC Compiler? Why I can't do:
void SetGraphMode(char mode) {
_asm {
mov al, mode
mov ah, 0x0
int 0x10
}
}
--- End quote ---
One note: this code won't work when you use standard GCC or MinGW. It should change video mode but when it's called from DOS executable. When you create standard console application it's actually Win exe.
BYO
Navigation
[0] Message Index
Go to full version