PCem ported to FreeBASIC

Yes, it’s that PCem. And yes BASIC.

From the post on the freebasic.net/forum.

Some time ago I raised a challenge: make a PC emulator 80486 in Basic !!!

To achieve this, I used a very old version of PCEM, with the help of “FreeBasic”, starting from PCEM-V4.1, about six months ago, I managed to make it work, in 80286 mode only. Then I went little by little adding functionalities of the following versions, until arriving at the V8 (not completely, but if great part). Due to the complexity and lack of speed in BASIC, I have only converted the modules that have interested me the most, eliminating many unnecessary ones, so I have managed to reach an 80486-DX2-66mhz with FPU, 16mb of RAM and VGA TSENG of 2mb.
I have removed many non-necessary modules, such as the sound (it does not have any sound), the LPT port, the PS2 port, the FDC unit and more.
It has many faults, but in general they work VERY well, and it is capable of running “WINDOWS 3.11”, “Deluxe Paint”, “Wolfstein 3D” and many other programs. 
It can reach a resolution of 800×600 to 16 colors, but it moves better in 640×480 16 colors.
The keyboard fails, all the keys do not work, and neither EMM386.EXE nor EXPANDED memory can be used, because it fails and becomes very slow.
It works in both protected mode and real mode, but when entering protected mode, the PC becomes slow.

It’s slow, but yes, it runs!

It only has one config hard coded, as jepalza ported enough of it for this one config. Oddly enough it’s my least favorite the ‘winbios’ 486.

I have to say this is pretty cool!

As always, here is my mirror (usual 404 page reading required) here: PCEM_FB486.rar

9 thoughts on “PCem ported to FreeBASIC

  1. nice, but your freebasic code is terrible….
    not used -gen gcc to optimize it (not doing that would be almost equivalent of compiling with -O0 in C)
    using “dim shared” instead of the faster “static shared” for global fixed size arrays… using “select case as const” with just 3 options (thats slow even with -gen gcc) using one line functions instead of macros, using loops instead of memset to set byte arrays, settings byte arrays byte by byte instead of int by int, for a project of this magnitude using “screen” instead of “screenres” make it feel you are coding for qbasic, not using “=any” on local variables that dont need to be initialized to 0 (all of them since this was converted from c), not using freebasic pointers, etc…

  2. That’s pretty awesome. I wrote a FreeBASIC 80186 PC emulator in 2011 that worked really well. It ran most old games, Windows 3.0 and MINIX, etc. A few years later, I ported it to VB6 for fun.

    It took 8 years, but I’ve been officially beaten now with a 486 emulator. Good work! 🙂

    I’ll have to get back to work and see if I can reclaim the crown somehow. Competition breeds progress!

Leave a Reply to neozeed Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.