via http://zerox86.patrickaalto.com/zblog.html

During the past couple of weeks I have made quite a few enhancements to zerox86, but it still is not quite ready for release. There are some essential features still missing, and there is a very annoying bug or race condition that occasionally crashes the whole program. I have had a similar problem in DS2x86, and I am pretty certain that the problem is caused by lack of proper thread synchronization in the IRQ emulation. I have divided my time between trying to hunt down this bug, and adding some new features.

Jazz Jackrabbit support
For some reason I had thought that Jazz Jackrabbit uses virtual memory and thus will not run in zerox86, but a beta tester reported that he got it running by disabling all audio. There were some bad graphics glitches, though. So, I decided to test it myself and fix at least the graphics glitches. One graphics problem was quite obvious, I had not yet implemented the file data reading directly to VGA VRAM, which Jazz Jackrabbit does. It is the only game I have encountered that does that while in Mode-X graphics mode. After that the sprites began to work correctly, but still the bottom part of the screen flickerd, and I found a bug in my Mode-X VGA Line Compare Register handling. Fixing that made the game run the demo game with no graphics glitches that I could see.


After those fixes I tried to get the audio support also working, but even after spending several hours with that I still could not find out the reason for the immediate crash. It does not actually crash zerox86, instead it causes a General Protection Fault when loading an invalid value to a segment register. I was able to determine that in DS2x86 it does not load this invalid value to the register, but I could not yet find out why it runs differently in zerox86 and what is the original cause for this difference. So, Jazz Jackrabbit does not yet run with audio enabled.

EMS memory and SuperVGA support
After I got frustrated with lack of progress on Jazz Jackrabbit support, I decided to work on some easier features, first by adding EMS support. This was pretty simple, as my EMS support is coded in C so I could port it from rpix86 with very few changes. Since 4DOS.COM by default swaps to EMS if it is available, it was easy to see that EMS memory support began to work. I also tested Wing Commander 2 digitized audio, which also needs EMS memory to work. I found a small bug in my SB digitized audio support, it played one more samples than what it should have, which sometimes caused a click to the sound, so I fixed that problem as well.

After EMS memory I coded support for SuperVGA 640x400 and 640x480 screen modes. I decided to support these modes scaled to 320x200 and 320x240 resolution, which meant averaging every four input pixels to one output pixel. As this needs to be done with CPU (at least for now), it will slow down the emulation somewhat. I tested my LineWars II and Little Big Adventure, both of which use 640x480 SVGA mode. Below is a screen copy from Little Big Adventure running in zerox86.


80x25 scaled text mode
Next I changed the 80x25 text mode to use 4x8 pixel font, so that I could fit all 80 characters to the 320 pixel wide GCW0 screen. The font is not nearly as readable as my default 6x8 font, but using that gets rid of the need to scroll the screen. I plan to have an option to switch between scaled and scrollable screens, same as I did in DSx86, but for now I will use scaled mode in all text/graphics modes.

I also found and fixed a problem I had in the text mode cursor routines where extra cursor images were sometimes left around the screen, for example in Norton Sysinfo. This was caused by the software setting the cursor start scanline to a large value, like 63, with the ending scanline being the default 7. This should skip the cursor drawing completely, but my routine always drew at least one scanline of the cursor, which was wrong.


PC Speaker support
I also added support for PC Speaker sounds. The game I use to test these is the old CGA game Paratrooper. It plays some musical tones using the PC Speaker, so it is good test bench for that, as well as CGA graphics. It was one of the first games I got working in DSx86, so I like to test that in all my emulators during their early development phase.


Virtual keyboard
The next step is to add a virtual keyboard to zerox86. I am thinking of having the virtual keyboard be visible always when in 80x25 (or 40x25) text mode, as these will only need 320x200 pixels, while the zerox86 screen is 320x240 pixels. So I have an area of 320x40 pixels to use for virtual keyboard. Since the standard PC keyboard has 6 rows of keys, I have 6 scanlines to use for each row, and still have 4 scanlines left over. I decided to use the 4x6 pixel font for the key labels, which allows me to fit the full 101-key PC keyboard image to the 320x40 area.

You can see the keyboard image in several of the screen copies above. I haven't yet decided how I handle the keys selection, it might perhaps be made to work using the analog controller for key selection and then either A or Start to actually press that key. Or simply using the D-Pad to move the focus from one key to the next, but since especially on DOS prompt the cursor keys are used while joystick is not, the analog joystick control would be a better choice. I will continue working on this feature, as well as trying to hunt down the annoying crashing bug during the upcoming weeks.