#Win16
Some important TWIN porting updates.

TWIN is a LGPL Win16/Win32 implementation started in 1993 and abandoned in 2001 that I am porting to modern-ish Linux.

We have progman... kind of...

#retrocomputing
November 18, 2026 at 10:13 PM
@Screwtapello oh god, now you just make me decide to implement it such that you could do that...

I guess that the runtime could thunk entirely at the edges, and the win16 drawing APIs could be entirely mundane Rust that you could run outside of the win16 abi emulator...

Super cursed... But […]
Original post on mastodon.tmm.cx
mastodon.tmm.cx
November 19, 2026 at 8:40 AM
@Screwtapello win16? That wasn't even a good GUI framework for PC!

Microsoft has spent the past 30 years trying to murder it, unsuccessfully.

Maybe it IS good... Like a cockroach
November 19, 2026 at 8:33 AM
@hp Exactly!

People say that Win32 on Wine is the stable ABI for Linux, making Win16 a graphics API for Rust isn't that much more cursed. :P
November 19, 2026 at 8:34 AM
Oh god, I so want to take what I've learned hacking on twin and build a win16 implementation like it in rust.

That's an insane thing to do right? And I shouldn't do it, right? There's got to be better things to do with my real finite human days.

And yet, I can't get it out of my mind...

No […]
Original post on mastodon.tmm.cx
mastodon.tmm.cx
November 19, 2026 at 8:18 AM
Important TWIN update! We now have working win16 cursors.

TWIN now stores a pointer to a GDI object in the 16 bit LDT selector for certain types of objects (Cursors and Icons for now) so a 16bit app can directly change the pixel data of a cursor by treating […]

[Original post on mastodon.tmm.cx]
November 13, 2026 at 2:01 AM
More crucial TWIN updates:

Turns out that pbrush.exe wants to directly write to the memory where Windows is storing the current cursor. On Wine, TWIN, and NT, this doesn't work because of the emulation of the cursor setting from Win16 applications.

That's also why it still works on the DOS […]
Original post on mastodon.tmm.cx
mastodon.tmm.cx
November 12, 2026 at 2:54 PM
Some important TWIN porting updates.

TWIN is a LGPL Win16/Win32 implementation started in 1993 and abandoned in 2001 that I am porting to modern-ish Linux.

So, pbrush.exe shows the wrong cursors when selecting tools. It always uses the DUMMY cursor resource instead of the correct one. I […]
Original post on mastodon.tmm.cx
mastodon.tmm.cx
November 11, 2026 at 12:22 PM
Some important TWIN porting updates.

TWIN is a LGPL Win16/Win32 implementation started in 1993 and abandoned in 2001 that I am porting to modern-ish Linux.

TWIN_SCALE so now you can enjoy all of your favorite Win16 applications on your 4K display*

* As […]

[Original post on mastodon.tmm.cx]
November 8, 2026 at 10:14 PM
The Win16 NE binary is the annoying part. otvdm runs the original on a modern box, so it works as a reference oracle. Did you diff the Rust build against the original frame by frame, or was Cua only checking that it boots and plays?
November 7, 2026 at 9:03 PM
Porting Willows TWIN (A Win16/Win32 emulator that started in 1993) to modern-ish Linux. Making some progress, but I saw an error from #skifree that probably very few people have seen!

Yet outta memory, duuuude!

#retrocomputing
November 6, 2026 at 10:53 PM
And now the waiting begins...

#fosdem #fosdem2027 #retrocomputing
November 3, 2026 at 2:13 PM
64비트 Windows에서 16비트 Windows(Windows 1.x, 2.x, 3.0, 3.1 등) 실행하기

winevdm 은 16비트 Windows 에뮬레이터를 수정해 64비트 Windows로 이식한 프로젝트로, Win16 실행 파일을 구동함 CPU 에뮬레이터 와 Wine 기반 Win16→Win32 변환 코드 를 결합하고, 16비트와 네이티브 HANDLE 사이의 변환을 처리함 설치 ...
64비트 Windows에서 16비트 Windows(Windows 1.x, 2.x, 3.0, 3.1 등) 실행하기
winevdm 은 16비트 Windows 에뮬레이터를 수정해 64비트 Windows로 이식한 프로젝트로, Win16 실행 파일을 구동함 CPU 에뮬레이터 와 Wine 기반 Win16→Win32 변환 코드 를 결합하고, 16비트와 네이티브 HANDLE 사이의 변환을 처리함 설치 ...
news.hada.io
October 28, 2026 at 10:00 PM
winevdm - 64비트 Windows에서 16비트 Windows 프로그램 실행하기

Windows 1.x부터 3.1까지의 프로그램을 실행하는 에뮬레이터입니다. CPU 에뮬레이션과 Wine 기반 코드로 16비트 Windows 호출을 Win32 호출로 변환합니다.

실행 파일을 otvdm.exe에 끌어 놓으면 구동할 수 있고, 설치 후에는 Win16 실행 파일을 직접 실행할 수 있습니다.
winevdm - 64비트 Windows에서 16비트 Windows 프로그램 실행하기
winevdm - 64비트 Windows에서 16비트 Windows 프로그램 실행하기 Windows 1.x부터 3.1까지의 프로그램을 실행하는 에뮬레이터입니다. CPU 에뮬레이션과 Wine 기반 코드로 16비트 Windows 호출을 Win32 호출로 변환합니다. 실행 파일을 otvdm.exe에 끌어 놓으면 구동할 수 있고, 설치 후에는 Win16 실행 파일을 직접 실행할 수 있습니다.
news.hada.io
October 29, 2026 at 2:42 AM
Win16時代、まだwchar_tが存在しない頃にsprintfのWindows版、という意味を込めてwsprintfと名付いていたが

あとからwchar_tがC95で登場したときにprintfのwide版、という意味を込めて名付けられたwprintf関数が登場してしまった、ということなのかな?

> … The w apparently stands for Windows.
stackoverflow.com/a/18196375

> This is a Windows version of sprintf.
learn.microsoft.com/en-us/window...
Should I use wsprintf() to print a double as a wide string?
I am unable to print double value using wsprintf(). I tried sprintf() and it worked fine. Syntax used for wsprintf() and sprintf() is as follows: wsprintf(str,TEXT("Square is %lf "),iSquare); // ...
stackoverflow.com
October 15, 2026 at 2:05 PM
Last year at #fosdem I did a talk on writing a Microsoft Bob application. See here if you're interested! https://archive.fosdem.org/2026/schedule/event/XHSRAF-microsoft-bob-adversarial-interoperability/

I'm thinking of submitting a talk this year: "Win16: Write once, run anywhere." A history on […]
Original post on mastodon.tmm.cx
mastodon.tmm.cx
October 11, 2026 at 10:40 PM
A custom virtual machine for the Stars! 4X game
Stars! is a 1995 4X game (explore, expand, exploit, exterminate) for 16-bit Windows 3.1 that I first played ~28 years ago. While Windows is famously backwards compatible, it’s notoriously difficult to play Stars! today. Windows x64 cannot run 16-bit applications, and playing requires either retro hardware or emulation (otvdm, DOSBox), sometimes paired with Wine. My new, exciting solution, **Stars!VM** , or _Stars! Virtual Machine_ , embeds a custom 80286 emulator and a Win16 to Win32 bridge. As native Win32, the game looks and feels exactly as it did originally, except sporting a modern file chooser and 4k scaling. It’s indistinguishable from a genuine 32-bit or 64-bit port of the game, especially with the original 16-bit game embedded inside the VM executable. The signed releases on GitHub embed a compressed copy of the original 16-bit game, so that single EXE is ready to play out-of-the-box with no further setup or downloads. I’m distributing 32-bit builds (but requires SSE2) because there’s no advantage to 64-bit here, and these builds work (almost) everywhere _except_ 16-bit Windows. 32-bit Windows could run the original 16-bit game, but the VM-encapsulated version is better behaved. It doesn’t dump a `Stars.ini` under `C:\WINDOWS`, it interacts properly with the task bar, and copy protection is neutralized via the OS bridge. If you ever been curious about Stars!, now’s the time to try it. The game has a thorough, built-in tutorial, but also check out the wiki, the official strategy guide, and AutoHost (play-by-email service). The game predates the modern search engine concept, otherwise they might have chosen a better name. I suggest using “stars 4x” in your searches. If you want to build from source and hack on the VM yourself, the best tool for the job is w64devkit, of course, because it comes with everything you’ll need. Plus the game itself: `stars.exe` from stars27jrc3.zip. ### Implementation details The emulator itself requires x86 or x86-64 because it does not implement x87 (80-bit floating point) in software, but instead runs these operation directly on the host’s x87 hardware. This is simple, fast, and precise. The project validates the emulation as a whole with a differential fuzzer against the host. The fuzzer randomly generates a 16-bit instruction, emulates it, then runs it with JIT on the host and compares the results. Handles on Windows are pointer-sized, and so the Win16-to-Win32 bridge maps 16-bit handles to host handles. It marshals between different struct layouts when translating these calls, services the DOS interrupts the game requires, an copies data in and out of guest memory. It’s rather like running a Wasm instance, which of course makes sense in retrospect. The Win32 bridge is also monitorable and manipulatable using the Model Context Protocol (MCP). AI agents can “see” the UI “DOM” as it’s built, and can drive it by injecting synthetic events into the event pump, all without going through the usual desktop control. The MCP can also read and write guest memory. Opus 5 played a complete game through MCP — which is quite fun to watch — requesting my assistance at just two points when it got stuck in the UI. A foundation for a new Stars!Bench? Targeting old 16-bit computers, the authors couldn’t afford to build a sloppy, wasteful UI, and so by modern standards the game UI is remarkably fast and responsive. They don’t make ‘em like they used to. Computing the next turn, or “turn generation,” is the computational bottleneck, and so that’s where I focused my optimization efforts. The emulator can trace executed instructions, so I gathered traces of turn generation, then had Fable 5.1 identify and reverse engineer the hottest common routines (e.g. the game’s L’Ecuyer MCG PRNG) and basic blocks. Each was re-written in C and mapped into the instruction decoder as new 80286 instructions. On load the emulator identifies these routines and patches them with the new instruction. This resulted in a nearly ~2x speedup of turn generation. By exploiting local conditions, emulating a particular known program, I get JIT performance without JIT complexity. The original game doesn’t use buffered I/O, and instead issues many small reads and writes. Passing these small reads/writes straight to Win32 made I/O take ~5% turn generation time, probably worse today than it was back then. Plus it’s just rude. The emulator buffers the game’s I/O calls, further speeding up turn generation. The game has some sound effects in the “battle VCR” and the final version of the game shipped with Microsoft’s `WaveMix.dll`. Rather than load and link this DLL, the emulator implements the DLL’s interfaces natively, and these routines are dynamically linked into the 16-bit process. You will not need this DLL with the emulator, nor is it embedded in releases. The game also has art assets embedded uncompressed in the original EXE, forming the bulk of its ~3MB. Stars!VM uses a custom LZ-based compression algorithm tailored to compressing the original game. It’s compressed when embedded in releases. So the 32-bit version of the game is half the size of the original, at ~1.5MB. The original game requires a serial code, serving as its copy protection. A code is 8 alpha-numeric characters that must pass two checks. Failing the first is loud, but failing the second will sabotage your game with penalties. You’ll know because it will announce that your people suspect you are a usurper. Most codes you’ll find online are such “usurper” codes. Play-by-email (PBEM) saves embed a hardware signature derived from C and D drive configuration. People playing on different machines using the same serial code recieve the usurper penalty. I bought a serial code back in the day, but it hasn’t been possible to purchase one a for at least decade now. So the emulator injects a fixed serial code on first run (disable with `--prompt-serial`), and you won’t need to worry about it. The VM also produces a fixed hardware signature (same as any other emulator), so it looks like everyone running Stars!VM is sharing the a machine, meaning no penalty for key reuse. I cracked the serial code checks anyway, allowing me discover interesting ones. My favorites: CLONEMUM, CROSSNUT, EGGSWAIN, GHOSTKIN, GONKSHOW, GRIPMIME, SEEKCAPS, SIFTBOLD, SIRBUOYS, SLIMFAZE, SLOTMOPS, SPAWNELK, SUNBLOND, WANTNEAR, and WRONGPOX. These look like some of my passwords. ### Endless possibilities I’m quite pleased and excited with the results, especially for a weekend project. It’s breathed life back into the game for me, not only having a better experience running it, but also that I can trivially bend the game to my will in the ways I dreamed about. A few hooks in the right places should open the game to easy modding, but I’m more engineer than modder.
nullprogram.com
September 17, 2026 at 10:42 PM
📯look at this happy fella
September 9, 2026 at 10:12 PM
Such a definition is valid even on MS-DOS, Win16 and OS/2 far pointers; 8086 segmentation is “flat enough” in all but the “huge” memory model.
September 4, 2026 at 6:12 PM
The indignity of having a 386DX or 486 and having to think in terms of 16-bit registers and 16-bit segment / 16-bit offset and all the permutations of memory models because you're writing Windows 3.1 code or DOS asm for my class, but I was reading Win16 books at the time and being mad about it too.
September 3, 2026 at 1:08 AM
The close family relationship was visible in the early days.

NT 3.x had an OS/2 personality alongside DOS/Win16, Win32 and POSIX. It could run text-mode OS/2 apps. It could format and use OS/2 HPFS hard disks.
Presentation Manager for Windows NT | Virtually Fun
virtuallyfun.com
August 30, 2026 at 6:31 PM
Now that I think about it I remember writing Win16 code in 1996 but that memory must have been automatically censored by some sort of cognitohazard protection mechanism.
August 28, 2026 at 10:21 PM
I actually have a win16 environment I have with both SimCity & SimTower, a few others like chip's challenge. The UIs are really tiny, not intended for modern resolutions. The toolbar icons are probably 16x16 at the most.
July 15, 2026 at 6:48 AM