83 Commits
Author SHA1 Message Date
opencode.energia.arti.ee 68f873784b tms34010: run TI TMS34010 OS/2 tools (gspa/gsplnk/gsprom) under 2ine
Build / Linux (push) Waiting to run
Fixes needed to run the 1990 TI 'TMS340 Family Code Generation Tools r5.01'
(16-bit OS/2 1.x NE, DOSCALLS-only) on 2ine:

* CMake: fall back to the system SDL2 headers when /usr/local/include/SDL2
  is absent; the hard-coded path broke the build on stock distros.

* doscalls16: implement the entry points these tools import
  - Dos16GetDateTime (33) with the OS/2 1.x *hours-first* 10-byte layout
    (the year-first 8-byte layout crashes gspa in asctime/localtime)
  - Dos16NewSize (68)
  - Dos16GetHugeShift (135) / Dos16HugeIncr (136)
  - Dos16CreateCSAlias (43), Dos16DevConfig (52), Dos16Move (67)

* lx_loader: walk NE fixup chains to the segment's 64K virtual size instead
  of its file size, so fixups pointing into the BSS tail are applied. gspa
  segfaulted in a lcall to its CRT exit handler because of this.

* doscalls: do not assert that the host PID fits in 16 bits (pid_max is
  4194304 on current kernels); the 16-bit API truncates anyway.

Verified: gspa assembles a 2,412-line TMS34010 source with 'No Errors,
No Warnings', gsplnk links it with rts.lib, gsprom converts to Tek-hex.
The C compiler child (gspac via gspcl) still hits the lxConvert1616to32
selector assertion; see TMS34010.md.
2026-10-31 20:50:11 +00:00
Ryan C. Gordon 1ca194f39b viocalls: Actually, VioGetMode() needs to initialize ncurses.
It needs the screen size, etc.

Now that 23e344a212 fixes unloading the
VIOCALLS module, we can tolerate this better.
2022-01-31 11:39:58 -05:00
Ryan C. Gordon fa7901d918 vio: Don't init ncurses in VioGetMode().
Info-Zip unzip.exe uses this but doesn't actually _need_ anything but
stdout, so don't mess up the terminal if we don't have to.

We might actually _need_ to query terminal characteristics at some point
in a complete implementation of VioGetMode, but for now this is fine.
2022-01-31 10:28:49 -05:00
Ryan C. Gordon 86446d8d9c msg: Stub implementation for 32-bit DosTrueGetMessage(). 2022-01-31 10:13:52 -05:00
Ryan C. Gordon fc4154b166 doscalls: fixes to DosQueryPathInfo(x, FIL_QUERYFULLNAME, ...).
This gets unzip.exe (and self-extracting zip files) to mostly work.
2022-01-31 10:12:42 -05:00
Ryan C. Gordon d1c19eadba doscalls: Added a missing TRACE_NATIVE macro. 2022-01-29 16:34:14 -05:00
Ryan C. Gordon 908587878a doscalls: Fixed a memory leak. 2022-01-29 16:33:54 -05:00
Ryan C. Gordon e993edf411 doscalls: Implemented DosCreateDir and Dos16MkDir
Not sure what Dos16MkDir2 is--probably a large extended attributes struct?--
but the real OS/2 toolkit defines DosMkDir and DosMkDir2 to be DosCreateDir,
so hopefully this is fine in general.
2022-01-29 16:31:06 -05:00
Ryan C. Gordon b8f67643dc Make DosBeep volume configurable. 2018-07-10 02:00:31 -04:00
Ryan C. Gordon 1fd6bab8eb Report OS version as OS/2 Warp 4.5, not 4.0.
It's the last official release (and even what modern spins, like ArcaOS 5,
report).
2018-07-10 01:45:05 -04:00
Ryan C. Gordon 490702cc45 Implemented DosBeep in doscalls and a simple audio mixer in lib2ine. 2018-07-10 01:33:11 -04:00
Ryan C. Gordon 8c5d43f997 pmwin: Added a few WinIs* APIs. 2018-07-10 01:27:30 -04:00
Ryan C. Gordon e31492cc16 pmwin: Changed a bunch of printf things from "unsigned int" to "uint". 2018-07-10 01:26:40 -04:00
Ryan C. Gordon 536bf684cb Implemented more robust current dir/disk APIs. 2018-07-10 01:30:01 -04:00
Ryan C. Gordon 9860532454 Cleanup *INFOSEG creation. 2018-06-19 13:59:21 -04:00
cracyc 35d2162ba4 fix last few export names 2018-06-19 12:05:24 -04:00
cracyc c7f212d035 build fixes 2018-06-19 11:59:46 -04:00
cracyc 8457fc0e22 Implemented a whole bunch of 16-bit APIs. OS/2 1.0's cmd.exe sort of works!
(Most of this work was cracyc's effort, but I started tweaking it before
I thought to perform a commit.  --ryan.)
2018-06-18 15:52:58 -04:00
Ryan C. Gordon 3e83a67d48 Let OS2APIINFO optionally take key/value pairs, use it for export names.
This lets me remove my tcpip32 hack, and will let me export old symbols
as all caps for OS/2's use and something more sane for regular use
(like VioGetCurPos() in modern times is VIOGETCURPOS in viocalls.dll, etc).
2018-06-17 22:21:52 -04:00
Ryan C. Gordon a80afaa0c1 Be aggressive about saving registers in the 16-bit bridge.
Fixes a lot of stuff.  :)
2018-06-14 12:25:38 -04:00
Ryan C. Gordon cdaf533140 Fixed typo in Dos16Write's TRACE_NATIVE line. 2018-06-14 12:24:57 -04:00
Ryan C. Gordon 37c3cc5a0a Bunch more work on 16-bit entry points.
Can run testargv16.exe now. This means Watcom C startup code, and Watcom's
printf(), both work.
2018-06-07 23:48:39 -04:00
Ryan C. Gordon 085b1c7ec7 Implement some 16-bit APIs that our hello16.exe needs. 2018-06-06 17:27:37 -04:00
Ryan C. Gordon 312b87ca53 Let the libraries build as native binaries without 32-bit x86 dependencies.
Obviously, this disables lx_loader, but you can compile a C program that
uses OS/2 APIs as a native 64-bit Linux app and run them.

So now we can do 2ine and 2inelib.  :)
2018-02-27 23:42:17 -05:00
Ryan C. Gordon aa8f842232 Work to make OS/2 API available to native apps, not just OS/2 binaries.
GLoaderState is moved to a new lib2ine library, which everything links
to and sets up what it can in a DLL constructor, so your app can just
link to doscalls or whatever and it'll have what it needs without
something like lx_loader doing a lot of heavy lifting before your
main() runs.
2018-02-27 23:18:51 -05:00
Ryan C. Gordon a1af09c108 Hacked up tcpip32.h to allow including from native apps outside of 2ine. 2018-02-27 15:16:17 -05:00
Ryan C. Gordon 6821de5ed7 Automate handling of support code for OS/2 binaries.
Now a perl script parses our headers and generates glue code, export tables,
etc. This automates all the macro nonsense and bridge code, and separates
out all the stuff you need for binary compat with OS/2, so you can remove it
all from the build if you want to just build native libraries that supply
the OS/2 API to native apps (like Winelib vs Wine).

This makes upkeep details less nasty, and easier to build native binaries
when implementing and improving APIs, so you can debug directly without
a lot of drama.
2018-02-27 03:25:21 -05:00
Ryan C. Gordon dcf40e843b Added header comments to everything. 2018-02-26 12:54:16 -05:00
Ryan C. Gordon 6604f3c169 Added DosWaitThread() to LX export table. 2018-02-26 09:57:31 -05:00
Ryan C. Gordon b6795ed5f6 Add in some stub libraries.
These don't do anything but exist and export no symbols for now, but if you
have something that links against, say, SOM.DLL, you can at least start it
up and have it fail when it calls into that library instead of failing to
start at all.
2018-02-24 16:50:05 -05:00
Ryan C. Gordon cec77df5d6 Implemented DosSetFileSize().
Info-ZIP's unzip for OS/2 can now unpack .zip files!  :)
2018-01-20 02:03:35 -05:00
Ryan C. Gordon efbc04419f Commented out some debug printf()s. 2018-01-20 02:02:31 -05:00
Ryan C. Gordon 84e1191db9 Don't close Unix's stdio handles when unloading doscalls library. 2018-01-19 19:12:40 -05:00
Ryan C. Gordon 644d0558bd Minor tweaks. 2018-01-19 19:12:16 -05:00
Ryan C. Gordon 612773c635 Fixed DosExit() to work with thread termination. 2018-01-19 01:36:43 -05:00
Ryan C. Gordon c523c36f5e Moved doscalls export tables to bottom of sources, like everyone else. 2018-01-19 00:56:40 -05:00
Ryan C. Gordon 33870fc221 DosCreateThread should reserve some stack for 2ine's use.
Fixes crash in FTP.EXE's background thread.
2018-01-18 21:58:52 -05:00
Ryan C. Gordon b6c47ee91d Implemented enough of the Presentation Manager API to draw a blank window. 2018-01-15 02:33:27 -05:00
Ryan C. Gordon 40b9b9e141 Filled in enough of tcpip32 and doscalls to run OS/2's TCPIP/bin/FTP.EXE.
It crashes right after a completed download, but otherwise seems to
fully work!
2018-01-04 02:50:26 -05:00
Ryan C. Gordon c2e43984c2 Fixed calling of KbdCharIn.
It was just seven kinds of wrong before. Now it's gone from a stub to
barely-usable.  :)
2018-01-04 00:27:59 -05:00
Ryan C. Gordon 185a983b3c DosFlatToSel() needs to save off registers.
It's not syscall calling convention, and CSet/2 generates thunks that call
this function but expect %ecx to not be altered by it. Save off a bunch,
just in case.
2018-01-04 00:26:52 -05:00
Ryan C. Gordon b302f0ff38 Fixes for LDT manipulation.
- Let allocateSelector() specify number of pages to allocate.
- Let findSelector() specify if this is a code or data segment.
- Let findSelector() choose if this is a code or data segment
  if the caller doesn't know (DosFlatToSel(), etc).
2018-01-04 00:20:16 -05:00
Ryan C. Gordon 44565f529b Move the 16-bit bridge heavy-lifting to the 32-bit code segment.
Now we save off the stack pointer and immediately jmp back to 32-bit. This is
slightly easier to debug (gdb doesn't get confused by addresses, registers or
disassembly), and puts all the 32-bit registers in a 32-bit code segment, to
keep things sane.

Also: doesn't write duplicate instructions to update %ds and %es if they are
the same values in Linux land.
2018-01-04 00:15:31 -05:00
Ryan C. Gordon b72ccd6e5a Implemented just enough of tcpip32.dll and dependencies to run FINGER.EXE.
Finger (etc) also rely on MPTN\DLL\tnls32.dll, which I pulled out a copy of
OS/2 Warp 4.52, which loads and limps along enough to not be a problem.
Reimplementing that library is going to be a pain, so that's a job for another
day. Inexplicably, tnls32 references pmgpi.dll's GpiQueryTextBox(), so I put a
stub for that in, too, but we're nowhere near really implementing GPI yet.

This is enough to run "finger.exe icculus@icculus.org" and see my .plan file,
which I consider a victory. A few more TCP/IP command line tools aren't far
behind.
2017-12-21 17:53:05 -05:00
Ryan C. Gordon fabd3be3e6 Some minor build fixes. 2017-12-21 17:44:50 -05:00
Ryan C. Gordon 3864bc9d61 DosAllocMem() promises that allocated memory will be zeroed out, apparently.
Fixes lots of stuff.  :)
2017-12-21 17:44:12 -05:00
Ryan C. Gordon 20d2bfa3ff Split out OS2EXPORT from OS2API.
Otherwise, "SomeObj * OS2API FunctionName()" won't work.
2017-12-20 18:31:48 -05:00
Ryan C. Gordon 93448975c2 Whoops, DosCloseMutexSem() needs to free memory we previously allocated. 2017-09-15 10:49:26 -04:00
Ryan C. Gordon ceb7900db7 Implemented DosCloseMutexSem().
This gets PhysicsFS's test_physfs.exe to run (although it's still broken in
other ways).
2017-09-14 23:51:04 -04:00
Ryan C. Gordon 4e6452445e More work on getting Java to run. Still not there. 2016-11-01 21:38:48 -04:00