Page 1 of 1

Linking Turbo C and NASM

Posted: Wed Jan 11, 2006 12:15 pm
by zxmaster
I am writing a 16-bit OS (yeah you can laugh all you want ;)) ... To cut to the chase:
I want to link my Turbo C files with assembr files and produce com files. When I try to do it I get a: "Fixup owerflow error" from the linker. I am using Turbo C 2.01. Appereantly everything is fine if I try to produce a DOS exe file, but not when I try to make a com file. I assembled the asm file into OBJ before trying to link it.

Re:Linking Turbo C and NASM

Posted: Thu Jan 12, 2006 3:12 am
by Pype.Clicker
are you using the proper memory model (tiny, iirc) ?

There are also tools like "exe2com" (or is it exe2bin ? can't tell) which you can find helpful since i cannot remember whether TLINK can create .COM files ...

Re:Linking Turbo C and NASM

Posted: Thu Jan 12, 2006 8:58 am
by zxmaster
Yes I used the tiny memory model. I have also tried exe2bin to no avail. But if I do not find out how to do it I might as well write an exe-loader. Oh, and Tlink claims to be able to produce .com files.

Re:Linking Turbo C and NASM

Posted: Thu Jan 12, 2006 9:51 am
by Pype.Clicker
that 'fixup overflow' might come from addresses going over 16 bits ... not 100% sure, though.

if you're looking for .EXE bootloader, make sure you don't miss bootprog: it sounds to be _the_ reference here.

You may also try to write your own tool to modify .EXE into something more suitable to bootloading (you know: it's always easier to process complex fileformat from a complete OS than from bootsectors :) ), in which case, clicker freedosexe2bin sources might be handy.

<oops>
clicker's tool is mzexe ... not 'exe2bin'[/url]
</oops>

Re:Linking Turbo C and NASM

Posted: Mon Jan 16, 2006 4:00 pm
by zxmaster
Thanks a lot for the help.
I am not going to write an exe-bootloader though as most of the OS I have written until now is 100% assembly(yeah I know it's not that cool, just makes things harder) . I was just going to use it for loading programs, but it seems like it would be a good idea to write an exe-loader.

Re:Linking Turbo C and NASM

Posted: Tue Jan 17, 2006 2:58 pm
by zxmaster
On second thought I think I am going to re-write my OS to EXE-format because it makes it possible to write parts i C. And thx for the link to bootprog it looks really useful.