PCEM in FREEBASIC!!!!

Support and general discussion.
Post Reply
jepalza
Posts: 4
Joined: Fri 15 Feb, 2019 6:37 pm

PCEM in FREEBASIC!!!!

Post by jepalza »

(Sorry for the English, I use Google to translate).

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 800x600 to 16 colors, but it moves better in 640x480 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.

For now, I can not leave the source code, because I do not know if it can be distributed, because it is based on PCEM

You can see my progress in "https://www.freebasic.net/forum/viewtop ... 96#p258396"

Image
Image
Image
User avatar
SarahWalker
Site Admin
Posts: 1885
Joined: Thu 24 Apr, 2014 4:18 pm

Re: PCEM in FREEBASIC!!!!

Post by SarahWalker »

jepalza wrote:
Fri 15 Feb, 2019 10:21 pm
For now, I can not leave the source code, because I do not know if it can be distributed, because it is based on PCEM
PCem is licensed under the GPL, so you are required to provide the source code for any derivative works.
jepalza
Posts: 4
Joined: Fri 15 Feb, 2019 6:37 pm

Re: PCEM in FREEBASIC!!!!

Post by jepalza »

Ok, then, goes to publish it, in freebasic forum.
User avatar
omarsis81
Posts: 857
Joined: Thu 17 Dec, 2015 6:20 pm

Re: PCEM in FREEBASIC!!!!

Post by omarsis81 »

Congratulation for your work jepalza! It seems you have a good knowledge of programming. It would be great if you can contribute with some patches in current PCem.
Nice work again, congrats!
jepalza
Posts: 4
Joined: Fri 15 Feb, 2019 6:37 pm

Re: PCEM in FREEBASIC!!!!

Post by jepalza »

Maybe I could, but PCEM is already very advanced, and I could not contribute at this stage of the project.
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: PCEM in FREEBASIC!!!!

Post by neozeed »

I did a quick post about this project and I was left with 2 things....

A rather harsh critique...

Code: Select all

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…
It's not from me, and I mean no disrespect.... :|


I think this may be overall about pcem...

Code: Select all

PCEM 286 可能有BUG,286 gate descriptors type 是 4-7,但是PCEM 支持大于8的descriptors type

PCEM 286 may have a BUG, 286 gate descriptors type is 4-7, but PCEM supports a descriptors type greater than 8.
jepalza
Posts: 4
Joined: Fri 15 Feb, 2019 6:37 pm

Re: PCEM in FREEBASIC!!!!

Post by jepalza »

Do not worry about the criticism. I've tried those optimization options, but I do not see any difference, it's hardly noticeable in speed, only a few thousand seconds between them.
This project I have only done for fun, and for demonstrating that it is possible to do it in BASIC, not for winning a programming contest or for making money. Only pure fun. I do not care what others think of it.

What really matters is the final result, which is spectacular :-)

(using google translate, sorry)
neozeed
Posts: 176
Joined: Tue 08 Jul, 2014 4:41 am
Location: Hong Kong SAR
Contact:

Re: PCEM in FREEBASIC!!!!

Post by neozeed »

jepalza wrote:
Tue 19 Feb, 2019 4:25 pm
What really matters is the final result, which is spectacular :-)

(using google translate, sorry)
No need to be sorry, and really It's amazing to watch even just going into the BIOS setup.

I know that after the initial rush of javascript written emulation that something like this is possible, but seeing it, however is simply amazing

great job!
Post Reply