Skip to main content
gamedev.net
🔒 Locked

ASM in C

Started by MattCarpenter Jul 22, 2002 at 3:00 PM 9 replies 450+ views
Original Post
MattCarpenter
MattCarpenter
I have a problem using djgpp with the asm command. Here is my code: asm("mov %ah, 0"); asm("mov %al, 19"); asm("int 16"); when it goes to the int 16 function though, when i compile it it gives me an error that says "error: operands given don't match any known 386 instruction" although int 16 is suppose to be the correct command. Whats up here? /\/\att [edited by - mattcarpenter on July 22, 2002 4:00:52 PM]
//att
Xanth
Xanth
Maybe try...

asm("mov %ah, $0x0");
asm("mov %al, $0x19");
asm("int 16");

I''m not really familiar with the GCC Assembly syntax, I''ve only peaked at it.




"I thought Genius lived in bottles..." - Patrick Star
"I thought Genius lived in bottles..." - Patrick Star
Kars
Kars
is it asm("int 16"); (dec 16) or should it be asm("int 16h"); (hex 16)?

Kars
KarsQ: What do you get if you cross a tsetse fly with a mountain climber?A: Nothing. You can't cross a vector with a scalar.
MENTAL
MENTAL
it should either be asm("int 0x16"); or asm("int 16h"); - not sure which one djgcc uses (MSVC is 0x16)
Null and Void
Null and Void
Not to say this will actually work, but it will compile:

asm("mov $0, %ah\n"
"mov $19, %al\n"
"int $16\n");

In AT&T syntax the value of 'mov' goes on the left, and all constant values are in decimal and prefixed with a dollar sign.



[edited by - Null and Void on July 23, 2002 2:37:14 PM]
MattCarpenter
MattCarpenter
tanx, damn these mosquito bites ITCH! i just went camping for 3 days in the middle of the desert. Wenatchee Confluence State Park in Washington, actually.
//att
Ryanrk
Ryanrk
Washington here too

boxdot3
boxdot3
Washingtonian here too... Actually i live about 5 mins from matt...
LessBread
LessBread
My girlfriend in college was from Wenatchee.

Matt did those skeeters show you any cool asm tricks?
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.