Skip to content

Commit 75ffe3c

Browse files
authored
Merge pull request #3 from Lethja/os2
OS/2
2 parents 1f82360 + 748a1a5 commit 75ffe3c

File tree

4 files changed

+220
-15
lines changed

4 files changed

+220
-15
lines changed

.github/workflows/LuaWatcom.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,35 @@ jobs:
2121
export INCLUDE=$WATCOM/h
2222
wmake -f wm_dos16.mak
2323
24-
- name: Build Lua for DOS4GW
24+
- name: Build Lua for DOS4GW 32-bit Extender
2525
run: |
2626
export INCLUDE=$WATCOM/h
2727
wmake -f wm_dos4g.mak
2828
29-
- name: Build Lua for WinNT
29+
- name: Build Lua for Windows 95
3030
run: |
3131
export INCLUDE=$WATCOM/h/nt:$WATCOM/h
3232
wmake -f wm_winnt.mak
3333
34+
- name: Build Lua for OS/2 16-bit
35+
run: |
36+
export INCLUDE=$WATCOM/h/os2:$WATCOM/h
37+
wmake -f wm_os216.mak
38+
39+
- name: Build Lua for OS/2 32-bit
40+
run: |
41+
export INCLUDE=$WATCOM/h/os2:$WATCOM/h
42+
wmake -f wm_os232.mak
43+
3444
- name: UPX Binary Compression
3545
uses: crazy-max/ghaction-upx@v3
3646
with:
3747
version: latest
3848
args: -9 --8086
3949
files: |
40-
dist/bin/*.exe
50+
dist/bin/lua16.exe
51+
dist/bin/lua4g.exe
52+
dist/bin/luant.exe
4153
4254
- name: Copy DOS4GW Binary
4355
run: |

README.md

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,59 @@
11
# Lua for Open Watcom
22

3-
This repository contains wmake style makefiles and patches to build [Lua](https://lua.org) on Open Watcom 1.9 or later.
4-
The primary goal is to allow Lua scripts to be run on DOS systems in real mode.
3+
This repository contains `wmake` style makefiles and patches to build [Lua](https://lua.org) on Open Watcom 1.9 or later.
4+
The primary goal was to allow Lua scripts to be run on DOS systems in real mode but has expanded
5+
to include all Open Watcom targets that don't require external dependencies to build.
56

67
## Runtime Requirements
7-
To run Lua built by Open Watcom you will need the following:
88

9-
| Requirement | Sources/Comment |
10-
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
11-
| [8088 CPU](https://en.wikipedia.org/wiki/Intel_8088)*<br/> <pre>*or compatibiles<br/>like the 8086, V20,<br/>286, 386 etc<br/><br/>Machine emulators<br/>provided as an alternative<br/>for other ISAs</pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/)) |
12-
| PC-DOS 2.1 or higher | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
13-
| At least 320 kilobytes<br/>of total system memory | <pre>Any memory above<br/>640 kilobytes is<br/>inaccessible to all<br/>real mode DOS programs |
14-
| At least 600 kilobytes<br/>of hard disk space or x2<br/>360 kilobyte diskettes | <pre>Can be ran directly<br/>from a diskette on<br/>machines without a<br/>hard drive |
9+
Lua for Watcom binaries can run on a number of legacy systems as well as some modern ones.
1510

16-
> If in doubt, install [DOSBox-X](https://dosbox-x.com/)
11+
### Absolute Minimum Requirements
12+
13+
These are the absolute lowest system requirements needed for a PC to run `LUA16.EXE`.
14+
15+
| Type | Requirement | Remarks |
16+
|----------------------|-------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
17+
| CPU | [8086 compatible](https://en.wikipedia.org/wiki/Intel_8086) | <pre>Compatibles like<br/>the Intel 8088, NEC V20,<br/>286, 386 etc<br/><br/>Machine emulators<br/>provided as an alternative<br/>for other ISAs</pre>[86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/)) |
18+
| Operating System | PC-DOS 2.0 | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
19+
| Random Access Memory | At least 512 kilobytes<br/>of base system memory | <pre>Any memory above<br/>640 kilobytes is<br/>inaccessible to all<br/>real mode DOS programs |
20+
| Storage | At least 150 kilobytes<br/>of free disk space | <pre>Can be ran directly<br/>from a diskette on<br/>machines without a<br/>hard drive |
21+
22+
### Binary Native Targets
23+
24+
Since Open Watcom can produce binaries for several operating systems,
25+
each binary has been given a unique name to distinguish the native **Operating System** (OS)
26+
and **Instruction Set Architecture** (ISA) it is intended for.
27+
28+
| Binary Name | Native OS | Native ISA |
29+
|---------------|-----------------|------------|
30+
| **LUA16.EXE** | Real mode DOS | 8086 |
31+
| **LUA21.EXE** | OS/2 1.2 | 80286 |
32+
| **LUA22.EXE** | OS/2 2.0 | 80386 |
33+
| **LUA4G.EXE** | DOS4GW extender | 80386 |
34+
| **LUANT.EXE** | Windows 95 | 80386 |
35+
36+
### Binary Compatibility Matrix
37+
38+
Some OSes can run binaries intended for another out of the box.
39+
Do keep in mind, however, that in most of these cases
40+
the OS is newer and has higher minimum requirements.
41+
42+
| Operating System | Minimum OS ISA(s) | LUA16.EXE | LUA21.EXE | LUA22.EXE | LUA4G.EXE | LUANT.EXE |
43+
|-------------------------------------|-----------------------------|-----------|-----------|-----------|-----------|-----------|
44+
| DOS 2.x - 4.x<br/>Windows 1.x - 3.x | 8086 | Yes | No | No | No | No |
45+
| DOS 5.x - 7.x | 8086<br>80386SX | Yes | No | No | No<br>Yes | No |
46+
| OS2 1.0 - 1.1 | 80286 | Yes | No | No | No | No |
47+
| OS2 1.2 - 1.3 | 80286 | Yes | Yes | No | No | No |
48+
| OS2 2.x | 80386SX | Yes | Yes | Yes | No | No |
49+
| OS2 3.x | 80386SX | Yes | Yes | Yes | Yes | No |
50+
| OS2 4.x | 80486SX | Yes | Yes | Yes | Yes | No |
51+
| Windows 95 | 80386SX | Yes | No | No | Yes | Yes |
52+
| Windows 98 | 80486DX<br/>80486SX+80487SX | Yes | No | No | Yes | Yes |
53+
| Windows 2000 - ME | 80586 | No | No | No | No | Yes |
54+
| Windows XP | 80586<br/>x86_64 | No | No | No | No | Yes |
55+
| Windows Vista - 10 | 80686<br/>x86_64 | No | No | No | No | Yes |
56+
| Windows 11 | x86_64 | No | No | No | No | Yes |
1757

1858
## Build Requirements
1959
To build Lua with Open Watcom you will need the following:
@@ -22,11 +62,11 @@ To build Lua with Open Watcom you will need the following:
2262
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
2363
| Lua 5.4 source code (or build machine with `git submodules`) | [lua.org](https://lua.org/ftp/) ([GitHub](https://github.com/lua/lua/tree/v5.4.6)) |
2464
| Open Watcom 1.9 (or later) | [openwatcom.org](https://www.openwatcom.org/) ([GitHub](https://github.com/open-watcom))<br/>[FreeDOS Bonus CD](https://www.freedos.org/download/) (`FDIMPLES`)<br/>[SvarDOS](http://svardos.org/?p=repo) (`PKGNET` repository) |
25-
| DOS operating system<br/>(MS-DOS 5.0 compatible) | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
65+
| Operating System supported by Open Watcom<br/>(at least MS-DOS 5.0) | [FreeDOS](https://www.freedos.org/download/)<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[SvarDOS](http://svardos.org/) |
2666
| [80386 compatible processor](https://en.wikipedia.org/wiki/I386)* <br/> <pre>*Any AMD or Intel CPU <br/>made in the last 3 decades<br/>is compatible.<br/><br/>Machine emulators provided <br/>as an alternative for other ISAs </pre> | [86Box](https://86box.net/) ([GitHub](https://github.com/86Box/86Box))<br/>[DOSBox-X](https://dosbox-x.com/) ([GitHub](https://github.com/joncampbell123/dosbox-x))<br/>[PCem](https://www.pcem-emulator.co.uk/) ([GitHub](https://github.com/sarah-walker-pcem/pcem/))<br/>[Qemu](https://www.qemu.org/) ([GitLab](https://gitlab.com/qemu-project/qemu)) |
2767
| A patching utility | [GNU Patch](https://savannah.gnu.org/projects/patch/)<br>[DifPat](https://github.com/deverac/difpat) |
2868

29-
> If in doubt, install [DOSBox-X](https://dosbox-x.com/)
69+
> If in doubt, [DOSBox-X](https://dosbox-x.com/) can be used on a modern machine
3070
3171
## How to build
3272
1) Extract Luas source code to the `Lua` folder. This can be achieved in two ways:
@@ -48,6 +88,9 @@ To build Lua with Open Watcom you will need the following:
4888
|-------------------------|----------------------|-------------|--------------------|
4989
| `wmake -f wm_dos16.mak` | `dist/bin/lua16.exe` | PC-DOS 2.0+ | 8086/8088 or later |
5090
| `wmake -f wm_dos4g.mak` | `dist/bin/lua4g.exe` | MS-DOS 5.0+ | 80386 or later |
91+
| `wmake -f wm_os216.mak` | `dist/bin/lua21.exe` | OS/2 1.2 | 80286 or later |
92+
| `wmake -f wm_os232.mak` | `dist/bin/lua22.exe` | OS/2 2.0 | 80386 or later |
93+
| `wmake -f wm_winnt.mak` | `dist/bin/luant.exe` | Windows 95+ | 80386 or later |
5194

5295

5396
Other targets may work but are untested

wm_os216.mak

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Watcom Makefile for building Lua 5.4.6
2+
# This is the DOS 4G flat model version
3+
# There are no configurable parts to this file
4+
# Run with `wmake -f wm_os216.mak`
5+
6+
objs = $(OBJDIR)lapi.obj $(OBJDIR)lctype.obj &
7+
$(OBJDIR)lfunc.obj $(OBJDIR)lmathlib.obj &
8+
$(OBJDIR)loslib.obj $(OBJDIR)ltable.obj &
9+
$(OBJDIR)lundump.obj $(OBJDIR)lauxlib.obj &
10+
$(OBJDIR)ldblib.obj $(OBJDIR)lgc.obj &
11+
$(OBJDIR)lmem.obj $(OBJDIR)lparser.obj &
12+
$(OBJDIR)ltablib.obj $(OBJDIR)lutf8lib.obj &
13+
$(OBJDIR)lbaselib.obj $(OBJDIR)ldebug.obj &
14+
$(OBJDIR)linit.obj $(OBJDIR)loadlib.obj &
15+
$(OBJDIR)lstate.obj $(OBJDIR)ltm.obj &
16+
$(OBJDIR)lvm.obj $(OBJDIR)lcode.obj &
17+
$(OBJDIR)ldo.obj $(OBJDIR)liolib.obj &
18+
$(OBJDIR)lobject.obj $(OBJDIR)lstring.obj &
19+
$(OBJDIR)lzio.obj $(OBJDIR)lcorolib.obj &
20+
$(OBJDIR)ldump.obj $(OBJDIR)llex.obj &
21+
$(OBJDIR)lopcodes.obj $(OBJDIR)lstrlib.obj
22+
23+
lua_obj = $(OBJDIR)lua.obj
24+
luac_obj = $(OBJDIR)luac.obj
25+
26+
CC = *wcc
27+
28+
CFLAGS = -q -bt=os2 -bc -2 -ml -d0 -osr -zc
29+
LFLAGS = SYS os2 OPT st=8192
30+
31+
!ifdef __UNIX__
32+
BINDIR = dist/bin/
33+
OBJDIR = obj/21/
34+
SRCDIR = lua/
35+
!else
36+
BINDIR = dist\bin\ #
37+
OBJDIR = obj\21\ #
38+
SRCDIR = lua\ #
39+
!endif
40+
41+
$(BINDIR)lua21.exe: $(OBJDIR) $(BINDIR) $(objs) $(lua_obj)
42+
*wlink NAME $@ $(LFLAGS) FILE {$(objs) $(lua_obj)}
43+
44+
$(BINDIR)luac21.exe: $(BINDIR) $(OBJDIR) $(objs) $(luac_obj)
45+
*wlink NAME $@ $(LFLAGS) FILE {$(objs) $(luac_obj)}
46+
47+
{$(SRCDIR)}.c{$(OBJDIR)}.obj:
48+
$(CC) $(CFLAGS) -fo=$@ $<
49+
50+
clean: .SYMBOLIC
51+
!ifdef __UNIX__
52+
@!if [ -e $(OBJDIR) ]; then rm -R $(OBJDIR); fi
53+
@!if [ -e $(BINDIR)luant.exe ]; then rm $(BINDIR)luant.exe; fi
54+
@!if [ -e $(BINDIR)luacnt.exe ]; then rm $(BINDIR)luacnt.exe; fi
55+
!else
56+
!ifdef __NT__
57+
@!if exist $(OBJDIR) rd /S /Q $(OBJDIR)
58+
!else
59+
@!if exist $(OBJDIR) deltree /Y $(OBJDIR)
60+
!endif
61+
@!if exist $(BINDIR)luant.exe del $(BINDIR)luant.exe
62+
@!if exist $(BINDIR)luacnt.exe del $(BINDIR)luacnt.exe
63+
!endif
64+
65+
dist:
66+
mkdir dist
67+
68+
obj:
69+
mkdir obj
70+
71+
$(BINDIR): dist
72+
mkdir $(BINDIR)
73+
74+
$(OBJDIR): obj
75+
mkdir $(OBJDIR)

wm_os232.mak

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Watcom Makefile for building Lua 5.4.6
2+
# This is the DOS 4G flat model version
3+
# There are no configurable parts to this file
4+
# Run with `wmake -f wm_os232.mak`
5+
6+
objs = $(OBJDIR)lapi.obj $(OBJDIR)lctype.obj &
7+
$(OBJDIR)lfunc.obj $(OBJDIR)lmathlib.obj &
8+
$(OBJDIR)loslib.obj $(OBJDIR)ltable.obj &
9+
$(OBJDIR)lundump.obj $(OBJDIR)lauxlib.obj &
10+
$(OBJDIR)ldblib.obj $(OBJDIR)lgc.obj &
11+
$(OBJDIR)lmem.obj $(OBJDIR)lparser.obj &
12+
$(OBJDIR)ltablib.obj $(OBJDIR)lutf8lib.obj &
13+
$(OBJDIR)lbaselib.obj $(OBJDIR)ldebug.obj &
14+
$(OBJDIR)linit.obj $(OBJDIR)loadlib.obj &
15+
$(OBJDIR)lstate.obj $(OBJDIR)ltm.obj &
16+
$(OBJDIR)lvm.obj $(OBJDIR)lcode.obj &
17+
$(OBJDIR)ldo.obj $(OBJDIR)liolib.obj &
18+
$(OBJDIR)lobject.obj $(OBJDIR)lstring.obj &
19+
$(OBJDIR)lzio.obj $(OBJDIR)lcorolib.obj &
20+
$(OBJDIR)ldump.obj $(OBJDIR)llex.obj &
21+
$(OBJDIR)lopcodes.obj $(OBJDIR)lstrlib.obj
22+
23+
lua_obj = $(OBJDIR)lua.obj
24+
luac_obj = $(OBJDIR)luac.obj
25+
26+
CC = *wcc386
27+
28+
CFLAGS = -q -bt=os2 -bc -3 -d0 -osr -zc
29+
LFLAGS = SYS os2v2 OPT st=8192
30+
31+
!ifdef __UNIX__
32+
BINDIR = dist/bin/
33+
OBJDIR = obj/22/
34+
SRCDIR = lua/
35+
!else
36+
BINDIR = dist\bin\ #
37+
OBJDIR = obj\22\ #
38+
SRCDIR = lua\ #
39+
!endif
40+
41+
$(BINDIR)lua22.exe: $(OBJDIR) $(BINDIR) $(objs) $(lua_obj)
42+
*wlink NAME $@ $(LFLAGS) FILE {$(objs) $(lua_obj)}
43+
44+
$(BINDIR)luac22.exe: $(BINDIR) $(OBJDIR) $(objs) $(luac_obj)
45+
*wlink NAME $@ $(LFLAGS) FILE {$(objs) $(luac_obj)}
46+
47+
{$(SRCDIR)}.c{$(OBJDIR)}.obj:
48+
$(CC) $(CFLAGS) -fo=$@ $<
49+
50+
clean: .SYMBOLIC
51+
!ifdef __UNIX__
52+
@!if [ -e $(OBJDIR) ]; then rm -R $(OBJDIR); fi
53+
@!if [ -e $(BINDIR)luant.exe ]; then rm $(BINDIR)luant.exe; fi
54+
@!if [ -e $(BINDIR)luacnt.exe ]; then rm $(BINDIR)luacnt.exe; fi
55+
!else
56+
!ifdef __NT__
57+
@!if exist $(OBJDIR) rd /S /Q $(OBJDIR)
58+
!else
59+
@!if exist $(OBJDIR) deltree /Y $(OBJDIR)
60+
!endif
61+
@!if exist $(BINDIR)luant.exe del $(BINDIR)luant.exe
62+
@!if exist $(BINDIR)luacnt.exe del $(BINDIR)luacnt.exe
63+
!endif
64+
65+
dist:
66+
mkdir dist
67+
68+
obj:
69+
mkdir obj
70+
71+
$(BINDIR): dist
72+
mkdir $(BINDIR)
73+
74+
$(OBJDIR): obj
75+
mkdir $(OBJDIR)

0 commit comments

Comments
 (0)