Page 1 of 1

Inline Assembly

Posted: Thu Mar 29, 2012 12:45 pm
by uSername
The 'int' command is not compiling using GCC Inline assembly. Here is my code:

Code: Select all

void uPrint(char uIn){
	__asm__ ("movb $0x0A, %ah\n\t"
		 "movb $uIn, %al\n\t"
		 "int 16");
}
void uMain(){
	uPrint('H');
}
Here is my error:

Code: Select all

operand size mismatch for `int'

Re: Inline Assembly

Posted: Thu Mar 29, 2012 2:13 pm
by Snake
Probably it wants

Code: Select all

int $16

Re: Inline Assembly

Posted: Mon Apr 02, 2012 9:38 am
by iansjack
Snake is right. Just using "int 16" refers to the address 16, not the constant 16. So you are trying to use a 32-bit or 64-bit (depending upon your OS) number with the "int" instruction, which just won't work.

Re: Inline Assembly

Posted: Mon Apr 16, 2012 5:34 am
by petergerko
Is this sign "$" used for both 32 and 64 systems?