Thanks for the encouragement; sadly I am the dev in question and it was in my little research app. After losing a few days of distraction to it, I can say I was intimately aware of the bug. But I can also now happily say that particular bug is squashed. 😀
No code progress, just some planning and research. I'm going to try to polish off the basic resource loading in this final sprint; checklist looks like 1) Resources, 2) Refactor an item that's bugging me, 3) Layout and display graphically in some fashion the relocs including emulator stub, and then package and release the code. It's a VS2012 C# .NET 4 project, but it's pretty simple and I assume other C# & Mono compilers will have little or no problems with it. I'd be happy to hear real details whatever they are - hey, I'm happy if anyone actually takes a look at the app or code under any conditions. 😁
Now I'm just debating license for a silly tool like this - just PD it, CC, or something heavier? 😜 I doubt it matters other than to keep everyone provably legit if they ever want to use code from it, but I'm open to opinions. Of course everything that changed in a dosbox patch/private build would stay under the dosbox license, and I'm assuming I can mix Wine code in without license conflict, but I'm totally ignorant on the realities of the conflict between FOSS licenses other than to observe the occasional train wreck.
After that, I'll start to tackle some of the other DosBox and Wine related setup questions and try to get in place to start actual hacking around and building. Meanwhile I'm planning and designing pieces in my head.
One question for right now: Does anyone know a FOSS font I can use as the basic 'windows 3.1' replacement font under the dosbox license? I can research (or draw, they are raster, not vector IIRC) something to start, but if someone has some knowledge that'd help. I definitely need at least one to start, but I assume I'll need at least 3 to be serious: serif, sans serif, and symbol. Maybe more as I complete more research, I've totally forgotten what the win31 font landscape looked like.
The other question I'm working on but haven't researched yet is how to hook into DosBox's back channel communication - the invalid opcode mentioned above. Thanks again for the pointers, crazyc, I've found and started where you say. I can see using a single or small range of 16 bit words; I can see hooking a port to stuff data into before triggering the callback opcode; and worst case I assume I can push something on the stack, but that alteration of current emu state makes me uncomfortable. Of course I assume I can hook ports and access and alter stack pointers and memory locations, otherwise I'm in big trouble and have totally wrong designs "dancing like sugar plums in my head". 😀 But that's what emulators do, I think. If I do use a port to pass data, that'll make "Windows support" a hardware attachment as far as dosbox is concerned... a mental picture that amuses me for some reason. I envision it as an oversized thumb-drive sized dongle somehow hanging off the back of a PC XT 5160 with a microsoft & windows 3 era logo on it.
Does anyone have any helpful pointers for me to claim a port or port range in DOSBox, like maybe a "PORT_Allocate"? 😀
At the moment I think the reloc data will be pointed at a stub (one stub per windows module + function), and each stub will have the basic psudocode (assuming port method for params):
OUT ModuleID WORD - less than 65k modules allowed, seems reasonable
OUT FunctionID WORD - less than 65k funcs per module allowed, seems reasonable
CALLBACK OPCODE (FE 07)
RET(F)
That's in the ballpark of 10-16 bytes per stub, which should work fine. My simple Win31 program examples have 50 - 100 WinAPI calls, so 1K for stubs seems very reasonable and room to grow.
The Emulation side will know the module and function ordinal number and name for all (supported) windows api calls, and will use that to distinguish stubs from actual client dlls that have to be loaded. Wine hopefully comes in with functions to execute or at least provide a starting point to execute the windows funcs in the emulator; everything that doesn't have to be invented will help.
There will be a loader .com dos app that starts the load and calls into the emu code, something like "lwin3 APP_NAME", the new win emulator code will load the win3 app into memory, setup the stubs, load any client dll hierarchy, and init itself. If it doesn't run out of dos memory in dosbox between loading and runtime memory alloc, I think I can get away with just doing that.
There will be a config section in the dosbox.conf file (or a separate config file?) to setup any windows environment stuff - does anyone have advice or opinion on whether that belongs in the standard conf file or it's own file? I envision several sections, the emulator setup section like 'win3xemu', and [windows] and [system] sections to stand in for the windows ini files as necessary.
If everything works perfectly, I can imagine having similar emulation for this Win3.x 16 bit, Win3x w/ Win32s, Win9x, and WinXP someday - big dreams, but mostly want to avoid naming conflicts now through good planning. Suggestions welcome.
The initial version will stay in real mode, as I think it doesn't matter for a single app. If I have to run in 16 bit protected mode, I'll cross that bridge later. It's probably no problem, I just don't have any experience with protected mode. Opinions welcome there, too. Win3.0 ran in real mode, and I think apps didn't care, especially the games we'd be targeting. Not like it's Excel or Lotus123!
That's the plan after this research app is completed, and I'm trying to fly from one project stage to the other on the wings of enthusiasm to see how far I can get. Any glaring oversights anyone sees?