16 bit c code to flat binary.

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
scsi
Posts: 14
Joined: Fri Nov 26, 2010 3:22 am

16 bit c code to flat binary.

Post by scsi »

what is the best way to produce flat binary from 16 bit c code.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: 16 bit c code to flat binary.

Post by Combuster »

Did you read your linker's manual?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
scsi
Posts: 14
Joined: Fri Nov 26, 2010 3:22 am

Re: 16 bit c code to flat binary.

Post by scsi »

Im asking about are there any usefull tools and how to use them.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: 16 bit c code to flat binary.

Post by Combuster »

First of all, there is no such thing as 16-bit C code.
Secondly, if you can not give an explicit reason that you need C code compiled to run real mode, you probably do not want it.

Thirdly, did you actually read my response? I could just copy it over again:
> any usefull tools
"your linker"
> how to use them.
"Did you read [the] manual?"

If that doesn't help, you may also want to read this and this since you failed at least one of them.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: 16 bit c code to flat binary.

Post by Casm »

scsi wrote:what is the best way to produce flat binary from 16 bit c code.
The Watcom compiler and linker can do most things, except produce 64 bit code. (If you are programming in a Windows environment that is.)
User avatar
bewing
Member
Member
Posts: 1401
Joined: Wed Feb 07, 2007 1:45 pm
Location: Eugene, OR, US

Re: 16 bit c code to flat binary.

Post by bewing »

The only real method, AFAIK, is to use a really old compiler. AFAIK, when the bochs guys compile their BIOS, they use bc. Alternately you could use something like Microsoft QuickC, V2.51.
scsi
Posts: 14
Joined: Fri Nov 26, 2010 3:22 am

Re: 16 bit c code to flat binary.

Post by scsi »

to Combuster:
First of all, there is no such thing as 16-bit C code.

Code: Select all

so what is turbo cpp 3.0 is doing.

[quote]Secondly, if you can not give an explicit reason that you need C code compiled to run real mode, you probably do not want it.[/quote][/quote]
im trying to write real mode kernel thats why i need it.

are you trying to prove yourself.if you are not interested in answering questions kindly dont write anything.no body forces you to write i guess.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: 16 bit c code to flat binary.

Post by Combuster »

There is no 16-bit C code, only 16-bit compilers and compilers that target a 16-bit platform. C as a language is platform independent.

Also, I know that giving the answers only help so much of the time, and the other half needs to be spent on teaching how to solve problems in general. I'm one for the long run, not for your 7-day plan. Ignore me if you think otherwise.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Casm
Member
Member
Posts: 221
Joined: Sun Oct 17, 2010 2:21 pm
Location: United Kingdom

Re: 16 bit c code to flat binary.

Post by Casm »

scsi wrote: im trying to write real mode kernel thats why i need it.

are you trying to prove yourself.if you are not interested in answering questions kindly dont write anything.no body forces you to write i guess.
If you are only interested in 16 bit, any ancient compiler will do. Turbo C is probably still available for download if you google it.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: 16 bit c code to flat binary.

Post by Brynet-Inc »

bewing wrote:The only real method, AFAIK, is to use a really old compiler. AFAIK, when the bochs guys compile their BIOS, they use bc. Alternately you could use something like Microsoft QuickC, V2.51.
I think you mean bcc, which stands for "Bruce Evans' C compiler".. Bruce was (..perhaps still is?) a FreeBSD developer, sadly no real official page exists for it these days, the source tarball is available online though.

It includes ld86 and as86, it's a full toolchain for compiling C programs for 16-bit real mode, but as has been said there really isn't much of a point in writing real mode code in C.

There is a "fork" called Dev86, as the original "bcc" archived was rolled in 1995.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: 16 bit c code to flat binary.

Post by gerryg400 »

I think bc is BorlandC.
If a trainstation is where trains stop, what is a workstation ?
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: 16 bit c code to flat binary.

Post by Brynet-Inc »

gerryg400 wrote:I think bc is BorlandC.
I'm aware, but it's probably not what Bochs uses for their BIOS images.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
f2
Member
Member
Posts: 311
Joined: Mon Jun 15, 2009 10:01 am
Location: France

Re: 16 bit c code to flat binary.

Post by f2 »

gerryg400 wrote: I think bc is BorlandC.
bcc both means Bruce's C Compiler and Borland C Compiler. That's a bit confusing.

@scsi: I think bin86 should interest you.
Brynet-Inc wrote: I'm aware, but it's probably not what Bochs uses for their BIOS images.
Nope. They use bin86 and also GCC.
"Open source seems to embrace the dark side of human nature." - Ville Turjanmaa
Fanael
Member
Member
Posts: 38
Joined: Fri Oct 16, 2009 9:20 am

Re: 16 bit c code to flat binary.

Post by Fanael »

berkus wrote:Joined: November 26th, 2010, 12:22 pm
vs
Joined: October 18th, 2006, 12:45 pm
I am truly sorry to disappoint you, but this is not a valid argument. Sure, scsi tries his best to piss everyone off, but the fact that he joined the forum later than someone else does not mean he is worse than that person (yet there are other things that make him look just plain stupid).
scsi
Posts: 14
Joined: Fri Nov 26, 2010 3:22 am

Re: 16 bit c code to flat binary.

Post by scsi »

to berkus:
are you cumbuster's lawyer.i think cumbuster wasnt able to discuss with me and hired you.joining forum earlier doesnt make you two genius.instead of telling me to read the "smart questions" you should stop talking dumb.

to Fanael:
i agree with your first sentence but if some one is stupid no discussion it is you i think.
Post Reply