Advertisement

Inline ASM in g++?

Started by November 22, 2001 09:55 AM
3 comments, last by yottskry 23 years ago
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 ---------------------
"All the girls that turn me on (turn me down)"
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!]
Advertisement
http://www.chelograph.8m.com/html/djgpp/asm/att_asm.htm
http://www-106.ibm.com/developerworks/linux/library/l-ia.html?dwzone=linux
http://www.delorie.com/djgpp/doc/brennan/brennan_att_inline_djgpp.html
ReactOS - an Open-source operating system compatible with Windows NT apps and drivers
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
---------------------
"All the girls that turn me on (turn me down)"
It''s a protected-mode compiler which runs through a DPMI server. This means that you need to use a couple compiler-specific dpmi server commands to either dsisable the server before running that ASM nd then re-enabling it afterwards, or using the DPMI server to poke those values into memory for you. Many people use the latter approach; just run a search on google for ''Mode 13h DJGPP'' and I''m sure you''ll find all the information you''d need.

This topic is closed to new replies.

Advertisement