Last week I worked on the high-resolution EGA graphics modes, first the 640x200 (which only needs horizontal scaling) and 640x480 (which needs 2-to-1 scaling in both directions). On Friday I then implemented also the 640x350 EGA mode, after I figured out that the easiest way to fit this vertically into 320x240 would probably be to alternatively copy one scanline directly and then average the next two scanlines, so that every 3 input scanlines generate 2 output scanlines. This just leaves a few black lines on the bottom.
The next step was to add audio support, which I then started working on Saturday morning. I began with the AdLib emulation, as that is easy and I could copy the code pretty much directly from an old version of DS2x86 (before I switched to my own transfer code and began using the ARM7 processor for audio). First I needed to look into how audio is supported on GCW0, and it looked like using SDL would be quite easy. I found a very simple tutorial and used that as an example, and it didn't take very long to have the audio framework in place. Next I just added a call to my AdLibEmulation routine from the audio callback code, and already at 9am I had AdLib audio working in Doom (which I used as my test bench). So, I decided to continue immediately with Sound Blaster support.
The AdLib support can manage with reasonably long latencies (longer latency just sounds like some inaccurate note timing, not as any distortion or other more distracting artifacts), but SoundBlaster digital audio support is rather timing-critical. For example Doom needs an IRQ after every 128 samples have been played (at 11.1kHz sample rate), and it will immediately cause audio problems if it does not get an IRQ when it expects one. I play audio at 22kHz, so that 128 samples translates pretty closely to 256 samples. I decreased the SDL sample buffer size from 512 to 256, and luckily this seemed to work fine without buffer underruns, and so Doom began to play also digital audio. I still need to do some adjustments to the audio routines, and all ADPCM audio playing code is still commented out, but I was pretty happy to get the audio code already mostly working, after basically just one day of work.

Next I will continue enhancing the emulation and adding the still missing features, hopefully I can release the first version publicly within a couple of weeks. The most important still missing features (in no specific order) are the following:
  • Proper keyboard mapping supoort, with game-specific configuration possibility.
  • Virtual keyboard support.
  • Mouse support.
  • EMS memory support.
  • SuperVGA support.
  • Non-scaled support for high-resolution screen modes.
  • Text mode 4x8 font, to show the full 80x25 chars.
  • FPU support.
  • Virtual memory support.
  • A lot of minor fixes to other features.


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