Discussion:
Is it possible to cross-compile C++ 11 (or later) code for DOS using Windows 10 x64?
(too old to reply)
Alex D
2019-09-02 18:58:29 UTC
Permalink
Hi, newbie here looking to get into the world of DOS programming.
I've been looking at DJGPP, which seemed to be exactly what I needed - a DOS port of a modern GCC and G++ compiler, so I assume it does support the new language features. However, it turned out out be a true DOS port - it's an MS-DOS executable, which cannot be run in a 64-bit Windows 10 OS.

Is there some other toolchain that can do this?
Alternatively, is it possible to build DJGPP as a native 32-bit Windows PE executable so that it's compatible with 64-bit systems?
Alexei A. Frounze
2019-09-02 19:10:51 UTC
Permalink
Post by Alex D
Hi, newbie here looking to get into the world of DOS programming.
I've been looking at DJGPP, which seemed to be exactly what I needed - a DOS port of a modern GCC and G++ compiler, so I assume it does support the new language features. However, it turned out out be a true DOS port - it's an MS-DOS executable, which cannot be run in a 64-bit Windows 10 OS.
It used to work on 32-bit Windows.
Post by Alex D
Is there some other toolchain that can do this?
There's Open Watcom C/C++. But it's too old and
it doesn't support C++11, not even C99.
There's also Open Watcom v2. No idea if it's any better
in terms of newer language versions.
Post by Alex D
Alternatively, is it possible to build DJGPP as a native 32-bit Windows PE executable so that it's compatible with 64-bit systems?
Dunno. I remember I could run DJGPP under DOSBox
some years ago. It might still work that way, albeit
somewhat slowly. There may be issues with long file
names though (I vaguely remember having some).

Alex
Giraffe
2019-09-02 20:41:37 UTC
Permalink
Post by Alexei A. Frounze
It used to work on 32-bit Windows.
I think DOS mode emulation was removed in 64-bit versions of Windows as the 32-bit mode is emulated itself, which would make DOS 2 layers of emulation deep - I guess MS devs just didn't want to go there. I could run it in a virtual machine, but I can't find any VM software that would work without requesting me to turn off Hyper-V which I need to run other emulators - a silly corner I'm stuck in for now.

Thanks a lot for the answer, OpenWatcom v2 looks promising, giving it a try right now. But it seems that it doesn't support C++11 and maybe not even all of C++03...
r***@gmail.com
2019-09-05 03:44:26 UTC
Permalink
Hi,
Post by Giraffe
I could run it in a virtual machine, but I can't find any VM software
that would work without requesting me to turn off Hyper-V which I need
to run other emulators
VMware? VPC? VirtualBox? QEMU? I don't use Hyper-V, but I've used both
VBox and QEMU under Windows (esp. VBox with VT-X) successfully.

What you probably want is a cross-compiler from here (e.g. GCC 7.2.0):

* https://github.com/andrewwutw/build-djgpp/releases

But DJGPP won't support all of C++11, especially Unicode (or any
wchar stuff) or threading. But "normal" stuff should be okay
(as even GCC itself is compiled as C++ nowadays).
Post by Giraffe
Thanks a lot for the answer, OpenWatcom v2 looks promising,
giving it a try right now. But it seems that it doesn't support
C++11 and maybe not even all of C++03...
There's also OrangeC (although I haven't tested it lately, plus
I don't grok C++). It should mostly work, hopefully!

* http://ladsoft.tripod.com/orange_c_compiler.html

Honestly, I'd rather suggest you use Free Pascal ("{$mode tp}")
instead, but I know that's probably not what you want to hear.
Giraffe
2019-09-05 11:37:21 UTC
Permalink
On Thursday, September 5, 2019 at 6:44:27 AM UTC+3, ***@gmail.com wrote:

Hi, and thanks a lot for the reply with some great info!
Post by r***@gmail.com
VMware? VPC? VirtualBox? QEMU? I don't use Hyper-V, but I've used both
VBox and QEMU under Windows (esp. VBox with VT-X) successfully.
VMware Workstation was my go-to virtual machine software and it's no-go until 2020 when VMware promised to release a tech preview (not even the final product) of Hyper-V coexistence. Oracle VBox doesn't work out of the box either, but is close as I've found a magic command somewhere on the VBox forums that makes my Linux machine start up and run, but eventually the guest Linux system itself crashes (the VM remains alive). It did not occur to me to try QEMU as I never used it before, I suspect it should work as I believe that's what Google uses for its Android emulators, and having to run this emulator is why I needed to explicitly turn Hyper-V on in the first place. Good pointers there for further research.
Post by r***@gmail.com
* https://github.com/andrewwutw/build-djgpp/releases
Yes, YES! Bingo! 7.2.0 runs perfectly on my machine, and I just wrote a sample "Hello DOS" program using C++17 (!!) features for which this G++ build produced an .EXE runnable on a physical FreeDOS installation as well as DosBOX. Admittedly, I have no retro PC hardware at home just yet so I ran FreeDOS natively on my 2013 Sandy Bridge laptop (in legacy BIOS mode), but I have high hopes it will remain functional on a real retro IBM PC compatible computer.
Now I can program in my favorite language for which I have tried and tested code base for template meta-programming and other universally useful stuff. Thank you so much for finding this project and pointing me to it! And, of course, huge thanks to the people who made it possible in the first place by porting GCC tools to DOS and providing working pre-built cross-compilers.
Post by r***@gmail.com
Honestly, I'd rather suggest you use Free Pascal ("{$mode tp}")
instead, but I know that's probably not what you want to hear.
I have nothing against Pascal, it was the first high-level language I learned (it was Borland Pascal, not Free Pascal, but I don't think they're too different), but I would prefer C++, all else being equal. Why do you suggest FP over C++? I can feel you know the topic pretty well so I'm sure you have reasons for this recommendation, I'd be thankful if you shared them.
r***@gmail.com
2019-09-08 18:54:20 UTC
Permalink
Hi again, (sorry for delay in responding)
Post by Giraffe
Hi, and thanks a lot for the reply with some great info!
news://comp.os.msdos.djgpp is still active (barely).
Post by Giraffe
It did not occur to me to try QEMU as I never used it before,
I suspect it should work as I believe that's what Google uses
for its Android emulators, and having to run this emulator
is why I needed to explicitly turn Hyper-V on in the first place.
Good pointers there for further research.
I haven't used ultra-latest QEMU in a few months, but I have used QEMU
atop Windows in recent years successfully. So it does work quite well
(at least with FreeDOS).

The builds I use are also pointed to by the official qemu.org site:

* https://qemu.weilnetz.de/w64/

DJGPP should still mostly work fine in raw DOS (even without a LFN
driver, but obviously many things are complicated beyond even that).
Post by Giraffe
Post by r***@gmail.com
* https://github.com/andrewwutw/build-djgpp/releases
a sample "Hello DOS" program using C++17 (!!) features for which this
G++ build produced an .EXE runnable on a physical FreeDOS installation
as well as DosBOX.
I forget which GCC started supporting C++1z (6.x?). Last I heard they
defaulted to C++14 nowadays (and C17, aka fixed C11). Not sure.
I honestly don't really know any C++, but everyone else loves it.

DOSBox is good but only for games and quite limited (64 MB RAM max,
default 486 DX2, not meant for running compilers like DJGPP).
I guess you could also try VDosPlus or whatever, but I haven't.
Post by Giraffe
Admittedly, I have no retro PC hardware at home
just yet so I ran FreeDOS natively on my 2013 Sandy Bridge laptop
(in legacy BIOS mode), but I have high hopes it will remain functional
on a real retro IBM PC compatible computer.
From what, bootable USB? That what I sometimes use (on my old laptop),
made by RUFUS (custom FreeDOS install):

* http://rufus.ie/
Post by Giraffe
Now I can program in my favorite language for which I have tried
and tested code base for template meta-programming and other
universally useful stuff. Thank you so much for finding this
project and pointing me to it! And, of course, huge thanks to the
people who made it possible in the first place by porting GCC
tools to DOS and providing working pre-built cross-compilers.
Cross-compilers have been overlooked, believe it or not. Usually
you're told to run under NTVDM (or raw DOS, which is less easy).
But yes, I love DJGPP, it's been around for decades and still
kicking. (But most people don't target DJGPP anymore, so it's
fairly hard to find or make something work with it, at least
with crappy "POSIX only" code that makes too many bad assumptions.)

I think a guy named Brian Overland wrote a C++ book (2004?)
and included DJGPP. I never bought it, but I saw it in a store
once. (I have an older C book he wrote.) But that's fairly
old (probably included RHIDE, I forget exactly, which is
long ago abandoned).

There is a good C++ book on multi-threading (revised recently,
2nd ed.) that sounded impressive, but that was way out of my league.
(Also, most DOSes don't support that, nor does DJGPP, so that
won't work for you here, at least not for target.)
Post by Giraffe
Post by r***@gmail.com
Honestly, I'd rather suggest you use Free Pascal ("{$mode tp}")
instead, but I know that's probably not what you want to hear.
I have nothing against Pascal, it was the first high-level language
I learned (it was Borland Pascal, not Free Pascal, but I don't think
they're too different), but I would prefer C++, all else being equal.
Why do you suggest FP over C++? I can feel you know the topic pretty
well so I'm sure you have reasons for this recommendation, I'd be
thankful if you shared them.
Well, yes, I mainly meant FPC (Free Pascal). Believe it or not, both
FPC and FBC (FreeBASIC) are based upon DJGPP (although FPC less so
since it doesn't need libc). They're all great, use them all (and
I think you can mix and match objects, if you're savvy enough,
but I've never tried)!

Like I said, I don't grok C++. It's a popular, powerful, and
expressive language. But I spent more time in recent years
learning Pascal (classic, Turbo, Extended), Modula-2 and Oberon,
and some other miscellaneous things. FPC is mostly focused on
Delphi these days (since 2.0.0 in 2005), but they still support
TP, which is great (since even that had lots of good features).
GPC died due to maintainer difficulties (2011), and GCC migrated
to C++ itself (2013). Not to mention newer C++ standards.
Yeah, tech changes too fast. (Clang's f18 Fortran compiler is
written in C++17.)

Hey, did you hear that GM2 is fairly close to being mainlined
into GCC? Unfortunately not yet, but D (GDC?) did finally
get integrated, which was no small feat. Oh, also C++20 will
have coroutines and modules (which Modula-2 had 40 years ago!).
Heh, I know, snarky and cheap, but it's true. So that's good.

No, there's no huge reason to abandon C++ in favor of Delphi.
Heck, GNAT (Ada) is still supported in GCC (although less so
for DJGPP, but it halfway worked last I tried). Delphi has
exceptions, generics, OOP (classes), properties, interfaces,
huge (now Unicode) strings, and tons of other features.

FPC's just a great compiler (and builds itself). Go32v2 is based
upon DJGPP (32-bit), but they also have had a cross-compiler
(Win or Linux) since 2015 for i8086-msdos (16-bit). The
default "fpc" dialect is like "tp" but allows function
overloading and structured return values. The textmode IDE
(compiler + debugger) isn't totally flawless but works okay
(and can use CHM help). Units, smartlinking, and built-in
assembler + linker make it quite fast.

So it's not like you have to choose or prefer one over
the other. They're both good. But do take a closer look
at FPC, especially if you're already familiar with TP.
Giraffe
2019-10-20 08:15:46 UTC
Permalink
Hi! I apologize, it only just occurred to me I never replied to your very detailed post. Thanks a lot for sharing your thoughts!

I've made some progress with my retro rig in the meantime. I asked my mom if she still has that AMD 386DX-40 system at work I remember from childhood, and turns out she did, and it's already been written off the inventory so I just came and grabbed it. This PC has a sentimental value to me since it's the very first computer I used as a kid.

I've learned a bit about DOS graphics modes and written a simple test, and I continued having great success with DJGPP throughout my first experiences. Everything just works!

As for C++ vs. other programming languages. For me personally, C++ is the language I love the most and know the best so it only makes sense that I would choose it whenever possible. But modern C++ has some interesting features that other languages simply can't offer. Features that let you write high-level, abstract, easy to understand and maintain source code that compiles to very minimal binary code with no overhead.

Jason Turner is my favorite C++ person right now, and he did an incredible talk 3 years ago that really highlights what makes C++ great for computed of limited power. I can't recommend this talk highly enough and I urge anyone with at least basic knowledge of C++ to watch it. It's a very relaxed talk that I'm sure will be entertaining even for non-C++ programmers.

Jason Turner: "Rich Code for Tiny Computers: A Simple Commodore 64 Game in C++17"


As for my personal journey into programming for DOS, I have a couple ideas for a few simple programs that will be fun to implement for learning purposes, but I no longer find it enjoyable writing code in a generic text editor and invoking the compiler manually. I want to, and to some extent need to set up a more or less proper IDE to use DJGPP, but so far it proves more problematic than I expected it to be (and really, than it should be).
Visual Studio Code with the C++ should be able to do this easily, but I've found that the documentation is lacking, and pretty much nothing works as soon as you try to tie it to your own non-standard compiler.
Then I looked at Qt Creator, it has bare metal support and should also be able to work with any C++ compiler, but the setup procedure also has a few not-so-obvious quirks, and it looks like there's no choice but to use CMake build system. There is only one thing I can say about CMake: "Ugh."

It really saddens me that I got all the difficult things working quickly, but lost A LOT of time on the IDE - and still didn't get to work yet. It's not strictly required, but it would really make all the further programming that much simpler and more convenient...
T. Ment
2019-10-20 13:12:31 UTC
Permalink
Post by Giraffe
It really saddens me that I got all the difficult things working quickly,
but lost A LOT of time on the IDE - and still didn't get to work yet.
DJGPP == frustration.

Symantec C++ 6.1 has a good IDE for Windows 3.1.

https://winworldpc.com/product/symantec-cpp/6x

Borland C++ 3.1 has a text mode IDE if you don't want Windows. You can
get that at winworldpc too.
Giraffe
2019-10-20 13:33:58 UTC
Permalink
Post by T. Ment
DJGPP == frustration.
Symantec C++ 6.1 has a good IDE for Windows 3.1.
Thanks for the tip, but that unfortunately misses both of my main points: I need C++17 (the more recent the compiler - the better, and C++20 is coming right up), and I want to cross-compile in the comfort of my main Windows 10 8-core home machine rather than suffer old IDEs on old CPUs for no benefit (to me, at least).
Giraffe
2019-10-20 13:35:03 UTC
Permalink
P. S. Why did you find DJGPP frustrating? Maybe there's something wrong with it when running on older hardware as I didn't try that, but on Windows 10 it's been flawless so far.
T. Ment
2019-10-20 13:42:49 UTC
Permalink
Post by Giraffe
Why did you find DJGPP frustrating?
Frustrating for you, not me. I don't touch it. Windows 10 either.
r***@gmail.com
2019-10-22 06:42:04 UTC
Permalink
Hi,
Post by Giraffe
Hi! I apologize, it only just occurred to me I never replied
to your very detailed post. Thanks a lot for sharing your thoughts!
It's okay. I'm no engineer, just an amateur. Still, I try.
Post by Giraffe
I've made some progress with my retro rig in the meantime.
I asked my mom if she still has that AMD 386DX-40 system
at work I remember from childhood, and turns out she did,
and it's already been written off the inventory so I just
came and grabbed it. This PC has a sentimental value to
me since it's the very first computer I used as a kid.
I know nothing about cpu architecture nor design. But how
much RAM does it have? I presume it has no cpu cache at
all (neither external nor internal). Technically, slow
graphics card could also be a bottleneck, but you're
probably worrying more about RAM and slow disk. (Use
a RAM disk ... if you can afford the waste.)

I don't really recommend self-hosted builds, but I
did use DJGPP (C only) back in 1997 on a 486.
Actually, you can rebuild old 2.7.2.3 in pure DOS.
I think it took ten minutes on my Pentium 166.

I also had a one-floppy DJGPP install I made in 2012,
but it was "newer" GCC 2.95.3 + BinUtils 2.16.1 (and
old DJGPP 2.03p2), compressed with .7z. So it fits
on a 3.5" 1.44 MB floppy, but ... I already know
it's much slower than 2.7.2.x on old machines.
I know you don't care, but older versions really
are preferred. (C++ support was much worse, though.)

Then again, you might honestly be better off using
Forth, QBASIC, Turbo Pascal, assembly, AWK, REXX,
or who knows what else. Cross-compiling is fine,
but I'm just thinking out loud here!
Post by Giraffe
I've learned a bit about DOS graphics modes and written
a simple test, and I continued having great success with
DJGPP throughout my first experiences. Everything just works!
Allegro is what I would recommend (although I never utilized
that much either). Granted, it doesn't do literally everything,
but it's still good. Of course, there are other things.
mGRX was just updated (also for DJGPP) and allegedly has an
optional GUI nowadays.

* http://na.mirror.garr.it/mirrors/djgpp/current/v2tk/allegro/
* https://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/devel/libs/allegro/

It's been a few years since I played any Doom ports, even with FreeBoom,
but you can try "updated" MBF. (Almost all Doom ports for DOS used
DJGPP and Allegro.)

* https://www.vogons.org/viewtopic.php?f=24&t=40857

Just in case that helps inspire you, graphically, for DOS. (It's
not C++, but obviously we never got a port of Doom 3! One guy did
back-port Hexen 2, though [Quake 1-based], but that's also only C.)
Post by Giraffe
As for C++ vs. other programming languages. For me personally,
C++ is the language I love the most and know the best so it only
makes sense that I would choose it whenever possible.
Use what you know. Use what works best. Use whatever's reasonable.
Post by Giraffe
But modern C++ has some interesting features that other languages
simply can't offer.
To co-opt an old saying: "The programming language graveyard is
full of features that nobody could live without!"

No offense, seriously, but saying "C++ is my favorite" and then
*only* preferring C++17 means that C++ isn't really your favorite.
It means your favorite is some kind of non-existent, future
version. Again, don't take this the wrong way, but if you can't
appreciate C++98, you probably are barking up the wrong tree.

(I don't expect much sympathy for pre-standard versions. Even
I bought a pre-standard [1995, DOS-era] book in 1998 but only
half read it and never truly learned it. I still have my copy
of Turbo C++ 1.01, but it's AT&T 2.0, pre-exceptions,
pre-standard, quite old. Still, I'm sure it's good for what
it supports.)
Post by Giraffe
Features that let you write high-level, abstract,
easy to understand and maintain source code that compiles
to very minimal binary code with no overhead.
Nothing's smaller than assembly. Of course, Turbo Pascal 5.5
has a smartlinker, unlike TCPP101. Even DJGPP only partially??
(barely, experimentally) has support for -fdata-sections
-ffunction-sections -Wl,--gc-sections or whatever. It seemed to
work (barely), but I wouldn't rely on it! FPC is better in that
regard.

DJGPP was never meant for small size, so most people never cared.
CWSDPMI does swap to hard disk, if extra RAM needed, but obviously
that's quite slow and should be mostly avoided.

I also still sympathize with interpreters. Hey, I'm no genius,
but AWK still seems pretty useful. So does Sed, even! You
don't necessarily need raw, compiled, binary code for everything.
(We have an older Python 2.4.2 port for DJGPP, too. And Ruby 1.8.4,
but anything after 1.8.7 won't build easily.)
Post by Giraffe
Jason Turner is my favorite C++ person right now, and he did
an incredible talk 3 years ago that really highlights what
makes C++ great for computed of limited power. I can't recommend
this talk highly enough and I urge anyone with at least basic
knowledge of C++ to watch it. It's a very relaxed talk that I'm
sure will be entertaining even for non-C++ programmers.
I believe you, and I definitely believe that C++ has many virtues.
People love it, and clearly it's expressive. Still, I've not
really tried (yet). I enjoy videos like this sometimes, so
maybe I'll watch it. But I still have little interest in C++17.

(Given enough spare energy, I'm willing to learn anything and
everything, but so far, nope. I'm mostly content with Pascal,
Oberon, etc.)
Post by Giraffe
A Simple Commodore 64 Game in C++17"
http://youtu.be/zBkNBP00wJE
The Paku Paku dude did his C64 version in C although he prefers
Pascal. The DOS version was TP7 with tons of inline asm (mostly
to keep RAM down since he wanted to work on literally all IBM
PCs, even the original.)
Post by Giraffe
As for my personal journey into programming for DOS,
I have a couple ideas for a few simple programs that will
be fun to implement for learning purposes, but I no longer
find it enjoyable writing code in a generic text editor and
invoking the compiler manually. I want to, and to some extent
need to set up a more or less proper IDE to use DJGPP, but so
far it proves more problematic than I expected it to be
(and really, than it should be).
GNU Emacs seems like an obvious choice (although I haven't
used it in years). "M-x compile" should work.
Post by Giraffe
Visual Studio Code with the C++ should be able to do this
easily, but I've found that the documentation is lacking,
and pretty much nothing works as soon as you try to tie it
to your own non-standard compiler.
Code::Blocks, maybe?? I dunno, never used many IDEs. Something
like JED would probably also work. Oh, OpenWatcom has a simple
(Windows) IDE, too. But ....
Post by Giraffe
Then I looked at Qt Creator, it has bare metal support and
should also be able to work with any C++ compiler, but the
setup procedure also has a few not-so-obvious quirks, and
it looks like there's no choice but to use CMake build system.
There is only one thing I can say about CMake: "Ugh."
Modules will helps C++ a lot. Honestly, I hope it works out
because Makefiles are too brittle. (However, even some Modula-2
and Oberon compilers often made you do it manually, which is
unnecessarily frustrating.) Then again, if you just "keep it
simple", you won't have that many problems. Easier said than
done! Don't let yourself overly complicate everything!
Post by Giraffe
It really saddens me that I got all the difficult things
working quickly, but lost A LOT of time on the IDE - and
still didn't get to work yet. It's not strictly required,
but it would really make all the further programming that
much simpler and more convenient...
Ask on news://comp.os.msdos.djgpp for advice. But I halfway
imagine they'll suggest GNU Emacs or VIM.

BTW, I sympathize with you wisely using an 8-core machine
for builds. Saving time is good. However, for small projects,
it's really not *that* bad to build in raw DOS. (Use a RAM
disk, software cache, enable Ultra DMA ... works for me!)

Feel free to get on any of the FreeDOS mailing lists (or
similar forums, e.g. BTTR). Granted, most people there
don't prefer C++, but they are quite savvy. I feel like
you could have fun benchmarking some stuff on that 386.
But who knows what your ultimate future plans are.

Oh, before I forget, I have no idea what is optimal for 386.
I read once that 386 prefers smallest code, but 486 shuns
that (e.g. string instructions) in favor of more RISC-y
code (plus is *very* sensitive to alignment). Being AMD
might also affect things. A 486 is twice as fast as a
386 at the same clock speed. Maybe OpenWatcom -3 helps,
but I don't know. (Higher than that is only "tuning".)
Yeah, I'm not sure if most compilers really optimize
well for a literal 386.

Anyways, good luck!
Kerr-Mudd,John
2019-10-23 11:07:17 UTC
Permalink
Post by r***@gmail.com
Hi,
[]
Post by r***@gmail.com
Post by Giraffe
A Simple Commodore 64 Game in C++17"
http://youtu.be/zBkNBP00wJE
Nice; especially as the asm without (sprite code) was 83 instructions;
231 total.
Post by r***@gmail.com
The Paku Paku dude did his C64 version in C although he prefers
Pascal. The DOS version was TP7 with tons of inline asm (mostly
to keep RAM down since he wanted to work on literally all IBM
PCs, even the original.)
--
Bah, and indeed, Humbug.
r***@gmail.com
2019-10-23 16:36:44 UTC
Permalink
Hi again,
Post by r***@gmail.com
Post by Giraffe
I've learned a bit about DOS graphics modes and written
a simple test, and I continued having great success with
DJGPP throughout my first experiences. Everything just works!
It's been a few years since I played any Doom ports, even with FreeBoom,
but you can try "updated" MBF. (Almost all Doom ports for DOS used
DJGPP and Allegro.)
One guy did port Wolf3D (four years ago?) from 286 C to 386 C++
for DOS 32-bit using OpenWatcom. (AFAIK, it doesn't use Allegro.)

* https://github.com/TobiasKarnat/Wolf4GW
Post by r***@gmail.com
Post by Giraffe
As for C++ vs. other programming languages. For me personally,
C++ is the language I love the most and know the best so it only
makes sense that I would choose it whenever possible.
But modern C++ has some interesting features that other languages
simply can't offer.
To co-opt an old saying: "The programming language graveyard is
full of features that nobody could live without!"
The game Retro City Rampage DX was ported to 486 by its author (2015).
Not "open source" (OSI), but he used OpenWatcom (and C++, I believe).
I saw a video he made talking about it, years ago. I own it, it's cool
(using PC speaker to great effect). It's basically a parody of
the old, 2D, GTA 1 game.

Oh, my point here is that OpenWatcom heavily improved its C++
support in release 1.8. But latest official release is
1.9 from 2010! All the v2.0-prereleases haven't really been
finalized yet.

* https://github.com/open-watcom/open-watcom-v2

My point is that it's probably mostly C++98, so nothing newer.
That's still somewhat "good", right?? I know things change and
improve, but I refuse to believe that there's nothing salvageable
there. (I also read somewhere that Wii U development only supported
C++98. Of course, that console dates from 2012 and is now discontinued.)
Post by r***@gmail.com
Post by Giraffe
Features that let you write high-level, abstract,
easy to understand and maintain source code that compiles
to very minimal binary code with no overhead.
Nothing's smaller than assembly.
Apparently, Jason used Clang to target 386, then used a "reassembler"
to convert that to 6502 code. Thus, 1005 bytes, even for Pong, ain't
too shabby!

I'm (almost) surprised FPC doesn't target 6502 since it has so
many others. Apparently other options exist for that, though.
Post by r***@gmail.com
Post by Giraffe
Jason Turner is my favorite C++ person right now, and he did
an incredible talk 3 years ago that really highlights what
makes C++ great for computed of limited power. I can't recommend
this talk highly enough and I urge anyone with at least basic
knowledge of C++ to watch it. It's a very relaxed talk that I'm
sure will be entertaining even for non-C++ programmers.
It was an interesting video, and he's clearly a smart guy.
I remember watching a video about C++ modules (Gabriel Dos Reis)
a few years ago. Apparently he has a newer one!
Post by r***@gmail.com
The Paku Paku dude did his C64 version in C although he prefers
Pascal. The DOS version was TP7 with tons of inline asm (mostly
to keep RAM down since he wanted to work on literally all IBM
PCs, even the original.)
Even he halfway started rewriting completely in assembly, allegedly.
Post by r***@gmail.com
you could have fun benchmarking some stuff on that 386.
Here's two, if you're curious:

* https://dosbenchmark.wordpress.com/
* https://github.com/graemeg/freepascal/blob/master/tests/bench/drystone.pas
Mateusz Viste
2019-09-02 19:19:31 UTC
Permalink
Post by Alex D
Hi, newbie here looking to get into the world of DOS programming.
(...)
it's an MS-DOS executable, which cannot be run in a 64-bit Windows 10
OS.
So... you do NOT want to get into the world of DOS programming - what you
seem to be looking for is a way to build console-mode applications for
Windows. Probably any Windows compiler can do that, it's just a matter of
finding the right switch to tell it "build a console application". MinGW
does that by default, unless called with "-mwindows".

https://mingw-w64.org/doku.php

Mateusz
Loading...