freebasic on win32s

DOS specific questions.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: freebasic on win32s

Post by Mysoft »

srvaldez wrote:@Mysoft
looks really nice, what screen resolution are you using on DOSBox?
1024x768... i also made a "mouse program" to have a seamless mouse on win3.11, and the win3.11 on dosbox have winsock using Trumpet TCP, because the drivers for native MS Network or MS Lanman does not work on dosbox, and so Trumpet TCP can use the regular packet driver to implement TCP on windows, so its great (despite probabily less efficient)
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: freebasic on win32s

Post by jj2007 »

Hi MySoft, that's a great project! I am still running a big 16-bit application that uses lots of 32-bit stuff through thunking, it runs fine in XP but I doubt it would run in a Win 3.1 plus Win32s environment. May I ask what is your motivation to do this? Even finding the hardware must be non-trivial...
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: freebasic on win32s

Post by Mysoft »

jj2007 wrote:Hi MySoft, that's a great project! I am still running a big 16-bit application that uses lots of 32-bit stuff through thunking, it runs fine in XP but I doubt it would run in a Win 3.1 plus Win32s environment. May I ask what is your motivation to do this? Even finding the hardware must be non-trivial...
heh most likely it was design for win95/98 but using 16bit stuff because it was what was there already... but since its 16bit... it could work fine on win3.11 beause even on win95 the preemptive of 16bit is the same.. so it will all depend on the 32bit thunk :), but really win32s is more complete than one can think because win32s is not based on win95/98 but on NT!, so even some of the W api is there!
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: freebasic on win32s

Post by Mysoft »

and talking about win32s compatibility... its somewhat "harder" to write for it with modern tools, because theres no debuggers that can debug properly... so the only way to debug would be use MSVC 4? that support win32s and then it can be REMOTELY debugged to a NT 3.52 machine... and it would be huge setback have to use that instead of waaay faster mingw...

so for that reason i made a crash handler using SEH, that reads STABS (later i may make it understand DWARF as well), accompanied from the disasm that i made (I could had used other libs... but they were bigger so i decided that was better to make my own), and now not only i solved pretty much the debugging problem as well i got a nice crash handler that works fine even on modern coding (the first screenshot is the current state of it... altough there will be some improvements)

but theres one slight problem with win32s is that theres many of functions there, that are not implement... but they EXIST as dummy... for example theres no threads but theres CreateThread (that always return NULL) but most programs dont actually do thread checks... so they end just not running a thread... and sometimes not even crash... other programs are buggy on win32 but the bugs are hidden either with exception handlers or by coincidence but so... on win32s a 32bit program is running on the same level as the 16bit supervisor... so it can acess EVERYTHING and likewise it can corrupt everything that is not CODE :P

and third win16/32 when a bad parameter/flag is called on a function it exposes that automatically to trough OutputDebugMessage(), so i found "bugs" on my win32 program because of that... (on the style of double free of winapi resources, or using window that was already destroyed), those would just silently fail on win32 unless you check the return (which i dont for those 'obvious' stuff), so such debugging worked very nice!

but unfortunately when a function is not implemented they forgot to put the messages on OutputDebugMessage() i have to manually check the code (when for example compiling a win32 library to work on win32s)

but overall it have been a very pleasant surprise how much win32s is helping me as a programmer :)
marcov
Posts: 3454
Joined: Jun 16, 2005 9:45
Location: Netherlands
Contact:

Re: freebasic on win32s

Post by marcov »

Mysoft wrote:
marcov wrote:The point is that you can't do things like you normally do, and what internet recommends. This complicates things for people mostly working on newer windows. Just like any Windows code after 2000-2005 will probably call -W functions a lot.
Things like that are basically behind the advise to not add to the win32 target, but rather split it in (multiple?) old and new.
good... because you shouldnt simple do what internet recommends without reasoning first... the last thing you want is to code like a genius for no good reason...
Exactly my sentiment. Why do a lot of navigating to keep win32s .. win10 in one target? Just separate them into separate targets, and retro and more forward developers are not constantly at loggerheads and /or calling each other names like "capitalist slave" (or "caveman" :-)

And no, doing manual hacks simply are not an option. Retro options should NOT dictate mainstream Windows devels how to code.

This is also absolutely not anti-retro, it is simply about managing retro within a not-retro-only project, giving it a proper place. FPC nowadays supports 16-bit dos, 32-bit dos, win16, win32(i386, MIPS and Sparc), win64(x86_64 and ARM), nativent and wince (IOW every MS target but win32s :-)

And even retro non-dos targets like various Amiga targets as well as embedded 8-bitters like Arduino.
Last edited by marcov on Nov 26, 2022 21:47, edited 2 times in total.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: freebasic on win32s

Post by Mysoft »

ok then :) well my point was that win32s programs works fine even on win10, theres no attempt to unite anything... and i was point out some factors that make win32s superior in terms of teaching good practices even to win32 programmers, and that most of the commercial programs are easily doable even with win32s without little to no effort (as long the person is not from a lazy background :P)

and after all i implemented win32s a suffix, so yeah its a different target specially because libraries need to be recompiled, because msvcrt.dll does not exist and even static crt would fail to initialize there... so i have to use -ffreestanding because the mingw with crtdll (they exist) but they are very old... so i wanted to avoid that as i wanted to avoid having to use an old compiler
exagonx
Posts: 314
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: freebasic on win32s

Post by exagonx »

Mysoft wrote: Oct 10, 2019 14:10
so if anyone have interest on that, or want more details, or get it for testing, usage, i can provide, (i just didnt released because its a WIP, just because i was doing tests on it... for some other project :)
Im interessed because I want use Windows 3.11 API for make interfaces, Actually I Use Visual C++ But Many of my Code are in FreeBASIC and If I have to rewrite all in C++ Become very complicated,

So can you explain how can I make a compiler for Windows 3.11 ?

Im working on ATX machine with 486DX CPU and 16MB RAM and With SVGA compatible card (S3 Vesa Card 1024 x 768 with 32k of colors)

Thank you for any help
And your work are very beautyfull.
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Re: freebasic on win32s

Post by Mysoft »

exagonx wrote: Nov 24, 2022 4:12
Mysoft wrote: Oct 10, 2019 14:10
so if anyone have interest on that, or want more details, or get it for testing, usage, i can provide, (i just didnt released because its a WIP, just because i was doing tests on it... for some other project :)
Im interessed because I want use Windows 3.11 API for make interfaces, Actually I Use Visual C++ But Many of my Code are in FreeBASIC and If I have to rewrite all in C++ Become very complicated,

So can you explain how can I make a compiler for Windows 3.11 ?

Im working on ATX machine with 486DX CPU and 16MB RAM and With SVGA compatible card (S3 Vesa Card 1024 x 768 with 32k of colors)

Thank you for any help
And your work are very beautyfull.
oh sure, i will make a post about it, sorry for the late response, been away from the world :P

but this right now is not a compiler running on win32s, its to cross compile to win32s, it would require a special version of the compiler AND (GNU TOOLS!) to have it native, and similar stuff as i had to do to get it compiling in DOS with 16mb as well... but win3.11 does not have a console so it will require a GUI one... altough maybe using the DOS version cross compiling to win32s could be a simpler solution there assuming ther DOS version (since its protected mode) can even work inside win3.11 DOS VM
Post Reply