Building Lua for 16-bit PCs with Open Watcom

208 views
Skip to first unread message

Jason Lethbridge

unread,
Feb 9, 2025, 5:12:37 AM2/9/25
to lu...@googlegroups.com
Hi all.

Last year I wrote a set of patches to build Lua for 16-bit DOS systems
(PC-DOS 2 or later) using Open Watcom 1.9.

The build of Lua 5.4.6 was successful and you can now run Lua scripts
on a 1981 IBM 5150 (assuming the script can fit in memory).

The patches however where only concerned about getting a build working
without any compiler warnings for this type of machine. I'd like to
rewrite the patches in a way that they can be up-streamed.

I assume the proper patch will involve a lot of `#if(n)def __I86__` but
I appreciate any input on how this could be done better.

The DOS binary, floppy disk images, Watcom makefile and source code
patches can all be found at https://github.com/Lethja/lua-watcom for
those curious.

Jorge Visca

unread,
Feb 12, 2025, 8:32:09 AM2/12/25
to lu...@googlegroups.com
We have just found the new Roberto's development machine.

Jason Lethbridge

unread,
Feb 28, 2025, 4:19:11 PM2/28/25
to lu...@googlegroups.com
No progress on the patches yet but the repository has been updated to
Lua 5.4.7 with additional makefiles to cross compile OS/2 and Windows
95+ binaries.

Jason Lethbridge

unread,
Mar 21, 2025, 1:36:33 PM3/21/25
to lu...@googlegroups.com
Mission Accomplished!

As of tag 2025-03-21 the patch to remove Open Watcom warnings doesn't
interfere with mainline builds. The Windows executable now has an icon
and metadata and everything seems to work well in my testing. Some
basic Lua scripts have been added to the floppy disk, most notable of
which are a CPU benchmark and MD5/SHA256 file checksum utilities. It
all still fits on a single 1.44 MB floppy disk image for your retro
machine and emulator needs.

Every version of this port, even PC-DOS 2.0, is the full Lua 5.4.7
environment with 64-bit int/decimal support like mainline. To the best
of my knowledge, that now makes Lua the most portable and backward
compatible scripting language in the entire PC ecosystem.

I'm pleased with the state of this port and now consider it complete
but it's possible I have overlooked something. If you find a bug unique
to the Watcom builds, feel free to open an issue on GitHub.

It's also great to see Rafael make a Lua port for ELKS.
Reply all
Reply to author
Forward
0 new messages