PDA

View Full Version : DS86 News - Dos Emulator for Nintendo DS - Mouse work



wraggster
April 7th, 2010, 15:15
Pate posted this news concerning his Dos Emulator for DS:


The last couple of days I have been working on the mouse support. I decided to try emulating the mouse cursor using a sprite, and as I had not done anything with sprites on a Nintendo DS before this, it took me a while to learn the stuff needed to work with the sprite engine. I got the mouse cursor sprite to work, but I am not quite sure yet whether using a sprite is the best method to do this, as I am using a scaled background and I would need to scale the mouse sprite as well. Also, it looks like most games use their own software mouse cursor, so my spending a lot of time on the sprite cursor might go somewhat to waste. But, at least I learned how to do stuff with the Nintendo DS sprites. :-)

Most of the mouse operations are currently supported, both in graphics modes (using the sprite) and in text modes (where I draw the mouse cursor similarly to how a real mouse driver does it, by changing the character cell background color). Both of these still need a little bit of work, especially for the scaled screen modes, but in principle the mouse handling works, so it will be included in version 0.08.

After I got the mouse to work somewhat, I moved on to the other big issue I want to work on during my Easter vacation, which is adding support for higher-resolution graphics modes. I started with the CGA 640x200 monochrome mode, as it is the easiest and I can use it to develop the new screen zoom and scale methods that I need. My current plan is to continue using the current 512x256 pixel background even in the high resolution modes, as all of these modes use screen blitting from the virtual screen memory to the physical VRAM. In the zoomed mode I can simply copy a 256x192 pixel window from the virtual screen memory, and when the screen is scaled I think I'll interpolate from the input 640 pixels in a row to 320 output pixels in the DS VRAM, and then scale this to the 256-pixel wide LCD screen. I could perhaps also setup a 1024x512 pixel background and then copy the whole 640x480 pixels (in the highest-resolution VGA mode) and then use the hardware scaling to scale this to 256x192, but I don't think that will result in a very clear display and might also be slower.

Anyways, I'm on vacation for the whole next week, so I can experiment with different methods to make the high-res modes supported. I am also testing Windows 2.03 (as it uses the 640x200 CGA mode in the logo page), but I doubt I'll get Windows actually running in the next version yet. It uses very low-level DOS and EMS-memory calls, so I need to improve those quite a bit before Windows will run.

Oh, when I debugged Windows I noticed I had a pretty severe bug in the mov reg16,[BP+SI] and mov reg16,[BP+DI] opcodes, they used BX register instead of BP for the memory access! Strange that my tester program had not detected this, but this may have caused all sorts of weird behaviour in various games. This will be fixed in 0.08 version.

http://dsx86.patrickaalto.com/DSblog.html