Sorry, I have no way to reproducve your problem, and I'm too busy/lazy to get a TC compiler to see what it generates. Are you using small or large memory model?
--
Mats
Sorry, I have no way to reproducve your problem, and I'm too busy/lazy to get a TC compiler to see what it generates. Are you using small or large memory model?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Use a debugger, put a breakpoint on main and then single step it until it looks like its about to go very very wrong.
Then adjust your code to take this into account.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I worked out all my problems with the functions, but i still need to find a way to make a flat binary image out of my c program. Can anyone tell me what i need to do to make a DOS 16 bit binary loadable at startup?
Well, you need something that is compatible with your boot sector. Unfortunately, each OS has it's own boot sector.
You may want to take an existing boot-loader, and then use the tools in the boot-loader to load your OS. Grub for example can load a "module" or "kernel" in a certain format that there are grub documentation on how that should be done.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Does anyone know of a simple bootloader that will be able to load a DOS 16 bit binary? I have no clue how to write one that will work. After i load the file into memory, given that i loaded the program at segment = a offset = b, i should just push a, push b, and retf to run the code, right? or is it more complicated than that with a DOS binary?
ok, does anyone happen to know how to get gcc to output a flat binary? I tried compiling as such:
gcc -c program.c
ld program.o -o program.bin --oformat=binary --Ttext=0x0
this told me that I could not perform PE operations on non-PE file program.bin. I also tried this:
gcc -c program.c
ld -o test.bin -Ttext 0x0 -e _main test.o
This gave me the error:
Undefined reference to _alloca
Undefined reference to __main
How do i specify the command line options to make the binary image? Also, if i cant use gcc, how can i use g++ to make the binary image?
Last edited by xixpsychoxix; 07-16-2008 at 06:32 PM.