• ### Popular Now

• 9
• 9
• 10
• 9
• 10

#### Archived

This topic is now archived and is closed to further replies.

# Inline ASM in g++?

This topic is 5994 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello all, Does g++ support inline assembler in the same way as borland turbo c++ does? I can''t find any information on it on the web, though from the errors I''m getting it looks as though it does but my syntax is incorrect. Cheers, Steve --------------------- Light of my life Fire of my loins. My sin, my soul LOLITA ---------------------

##### Share on other sites
quote:
Original post by yottskry
Does g++ support inline assembler in the same way as borland turbo c++ does?

Yes and no. It does support inline assembly, but it doesn''t support it the same way. Look for a tutorial on AT&T style inline assembly (Borland uses Intel style).

[Resist Windows XP''s Invasive Production Activation Technology!]

##### Share on other sites
OK, I''ve read the tutorial and it now recognises the asm and seems to assemble ok, but now I can''t seem to get the computer into mode 13h. I''m using the code (just as a test):

void main(void){
asm(
"movl $0x0013, %eax\n\t" "int$0x10"
);
getch();
asm(
"movl $0x0003, %eax\n\t" "int$0x10"
);
}

Which should stick it in 13h, wait for a keypress and then return to text mode but I just get access violations. I know some people have said you can''t just access interrupts and stuff directly from win 2K but I''ve been doing inline assembly in Pascal in win2k and it works fine...

...is there something I don''t know??

Cheers,

Steve

---------------------
Light of my life
Fire of my loins.
My sin, my soul
LOLITA
---------------------