16bit C Progams?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
elderK

16bit C Progams?

Post by elderK »

Hey, I have a Bootloader Sector, Which seems to load the Stage2 Bootloader fine, except the Bootloader Stage 2 FAT12 Loader, isnt working correclty, and thus isnt loading the Kernel.

I was wondering, if I could make the Bootloader Stage 2 code, in C.

The problem is, I cant fit the 32bit Protected Mode setup stuff in the first sector, the FAT12 loader is just too big.

I cant even fit the code to print text.
Its FAT12 Loader, load boot stage 2. Thats it, and its 512bytes.

Crazy, eh?

Most of my problems are stemming from the fact that im not a Assembler Hacker guy, I know very little Assembler, putting a program into Assembly has a tendency to make my brain implode. Put it into C, no problem.

I figure, Itll be easier to make a FAT12 Loader, and such - Using BIOS Interrupts, through C code, than it will be to use Assembly.

But, GCC cant compile 16bit code, as far as I know. Ive found a compiler, called BCC, but the MAN entry doesnt seem to have any information for how to compile and link code, without stdlib and such.

Talking with Candy in realtime, has led me to see that the FAT12 loader, well, the LBA_CHS doesnt seem to be working correctly, atleast I think.

If it does that, how come the Bootloader Stage 2 is loading?
When Bootloader S1 and Bootloader S2 utilize the same FAT12 code?

Hmmm. Maybe because the S1 and S2 code are on the same head or something? I dont know.

Any information would help, Googling for FAT12 Bootloader, or FAT12 Bootloader Tutorials isnt yeilding much.

If I had some well commented code I could follow, I could probably follow it, and read over a few times until I understood it, but as of yet - the code im finding isnt very informative, and im still in the glee filled land of brain-imploding confusion.

Joy!
~Zeii.
Ryu

Re:16bit C Progams?

Post by Ryu »

zeii wrote: I figure, Itll be easier to make a FAT12 Loader, and such - Using BIOS Interrupts, through C code, than it will be to use Assembly.
...
How is it easier to call a BIOS interrupt service then it is in C? Thats very strange to me, basically what I'm thinking is you'll end up having to do inline assembly anyways. Through the entire post I have no clues what your talking about really, but it seems your just trying to avoid assembly which isn't going to happend. If you want to take shortcuts, for the first time I'll suggest you use GRUB or something which to my knowledge you'd minimize the need to write things in assembly and probably get you to 32bit code without having to find that one 16bit C compiler your longing for (but I'm not really sure).
Post Reply