16-bit C with DJGPP (GCC)
RE:16-bit C with DJGPP (GCC)
It can generate 16bit/32bit mixed code that will run on a 386+ machine in real mode. The code will not run on a 286 or less. I'm actually using this for my boot loader. Before your 16bit code add:
__asm__ (
".code16 \n"
".code16gcc \n"
);
Then before your 32bit code add:
__asm__ (
".code32\n");
);
You will probably also want to turn off all alignment optimizations to avoid bogus code generation with some builds of GCC:
-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1
__asm__ (
".code16 \n"
".code16gcc \n"
);
Then before your 32bit code add:
__asm__ (
".code32\n");
);
You will probably also want to turn off all alignment optimizations to avoid bogus code generation with some builds of GCC:
-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1