Posted By: wraggster
Pate has posted some WIP News of his Dos Emulator for the DS:
Okay, during last week I got my PC issues solved, so that by Thursday I was back in business with coding DSx86. I had managed to get Commander Keen 4 to start, but the display was completely garbled as soon as it went into EGA mode. This weekend I concentrated my coding efforts to improving the EGA support enough to make CK4 running properly.
The first big issue was the initial two-way horizontally scrolling huge "COMMANDER KEEN" text at the very beginning of the game intro. I debugged the EGA register access the game uses, and noticed that it changes the EGA Offset register (which determines the number of bytes per screen row, with a normal value of 0x14) to 0x7C, which corresponds to 1984 pixels wide display! No wonder my fixed 320x200 display blitting code could not handle that. After I fixed the blitting code to properly handle that register, I got the scrolling text to display, but there were quite a bit of additional problems remaining. The vertically scrolling "An ID Software Production" text jumped around and left extra pixels around the screen. When starting the game, every second frame was completely garbled. The whole system hang when the StarWars-style scrolling text should have appeared, etc.
It took me pretty much the whole weekend to get most of these problems fixed. CK4 used a lot of various EGA tricks that I hadn't coded at all yet, for example:
Letting the EGA memory address wrap around to the start of the EGA 64K VRAM block when indexing beyond the end,
Using the EGA "Horizontal Pixel Panning" register to smooth-scroll the display horizontally by one pixel increments,
Using EGA "Write Mode #2" to to fill up to 8 neighbouring pixels with the same color using a single XCHG opcode,
Using EGA "Function Select" register to XOR the data onto the screen, again with the XCHG opcode.
All these are standard EGA/VGA features which I would have needed to add at some point in any case, so CK4 was a pretty good testbench for these somewhat advanced EGA features.
However, when I tested the version of DSx86 that runs CK4 fine, I noticed that none of the EGA games that ran on 0.04 version run any more! This is why I can not release this version yet, I'll need to check which of my changes broke some earlier working code.
It'll probably take me all of next week to make sure the new EGA code works properly, and I also need to fix more of the issues in the log files I have received (thanks again for those!). I hope to have version 0.05 available during the next weekend, unless something unexpected happens (again).
http://dsx86.patrickaalto.com/DSblog.html