Compiling 16 bit C++

Programming, for all ages and all languages.
Post Reply
matematik
Posts: 4
Joined: Sun Aug 24, 2008 5:49 am
Contact:

Compiling 16 bit C++

Post by matematik »

How can I compile 16 bit c++ code on linux? I tried g++, but i seems, it only support 32 and 64 bit 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: Compiling 16 bit C++

Post by Combuster »

GCC assumes a flat memory model (i.e. access to all 4 GB) and no segmentation (DS=ES=SS). If you want to have real mode code, then those assumptions are not valid and you're stuck.

Otherwise, you can tell the assembly part of GCC to use 16-bits as the default size via the .code16gcc directive, which essentially means that it will tell the processor for each instruction to treat it as 32 bits.

If you really want a native real mode C++ compiler, you should try a DOS-era compiler. Turbo C springs to mind
"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 ]
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Re: Compiling 16 bit C++

Post by Brynet-Inc »

Open Watcom might be an option.. try their site.
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Re: Compiling 16 bit C++

Post by DeletedAccount »

I think , you can use Dosbox to run Turbo C++ in Linux :)
Post Reply