Basic Go binaries for MSDOS?

1,236 views
Skip to first unread message

Steve Mynott

unread,
Apr 11, 2016, 1:20:59 PM4/11/16
to golan...@googlegroups.com
OK I know this is somewhat pointless but just for the sake of
completeness I was wondering if it was possible to generate basic
hello world type binaries which would execute on MSDOS generation OSes
(Sure it's not 64 bit and goroutines would be quite impossible).

I imagine this might be more likely with go using gccgo and the right
crosscompilation options than the mainstream gc compiler. It might
even be of some use for embedded systems using FreeDOS.

Enquiring minds want to know!

--
4096R/EA75174B Steve Mynott <steve....@gmail.com>

David Symonds

unread,
Apr 11, 2016, 7:15:13 PM4/11/16
to Steve Mynott, golang-nuts
The Go spec defines `int` as either a 32-bit or 64-bit type, which
practically (if not strictly technically) restricts to Go being
implemented on 32-bit or 64-bit platforms. As far as I know, there
aren't DOS-like OSes that support 32-bit modes, though it's been many
years since I looked closely.

I don't actually think goroutines would be impossible, or even
particularly hard. It's actually relatively straightforward to have Go
stick to a single thread.

Andrew Gerrand

unread,
Apr 11, 2016, 7:27:47 PM4/11/16
to David Symonds, Steve Mynott, golang-nuts
DOS programs could run in 32-bit protected mode. Examples of 32-bit DOS programs are Windows 3.1 and Doom (which used the popular "DOS extender" DOS/4GW).

I have no idea what would be involved in porting Go to DOS, but it doesn't seem worth the trouble to me. :-)

Andrew



--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Symonds

unread,
Apr 11, 2016, 7:29:32 PM4/11/16
to Andrew Gerrand, Steve Mynott, golang-nuts
Hah, I completely forgot about 32-bit protected mode and related things.

I think it's infeasible to port Go to a C64, though perhaps it's
feasible to do a DOS port (386+).

Aram Hăvărneanu

unread,
Apr 12, 2016, 4:47:50 AM4/12/16
to David Symonds, Andrew Gerrand, Steve Mynott, golang-nuts
Porting Go to DOS wouldn't be any more difficult than porting it to
bare metal, which is not very difficult. In the early days Go used to
ship with a bare metal (GOOS=tiny) toy port.

--
Aram Hăvărneanu

john warmer

unread,
Mar 17, 2026, 3:55:55 AM (yesterday) Mar 17
to golang-nuts

Creating basic “Hello World” binaries for MSDOS using Go is indeed possible but comes with limitations, especially since the mainstream Go compiler (gc) targets modern OSes and 64-bit architectures, making features like goroutines impractical. Using gccgo with the right cross-compilation flags increases your chances of generating small, executable binaries suitable for FreeDOS or other MSDOS environments. Think of it like ordering a KFC special: just as KFC customizes a special meal with select ingredients for a unique taste, you can tailor Go’s compilation options and libraries to produce a minimal, functional MSDOS binary, focusing only on the essentials needed to run, without the overhead of modern OS features.

Brian Candler

unread,
Mar 17, 2026, 8:18:10 AM (20 hours ago) Mar 17
to golang-nuts
tinygo supports Linux on both 386 and amd64, and Windows (unclear whether it's 32-bit, 64-bit, or both).  That might be another starting point.
Reply all
Reply to author
Forward
0 new messages