Homebrew A7800DS - Improved

  • Thread starter Thread starter wavemotion
  • Start date Start date
  • Views Views 24,978
  • Replies Replies 128
  • Likes Likes 25
V4.9 : 17-Feb-2025 by wavemotion-dave
  • High Score (HSC) auto-save improvements - no longer write the backing .hsc file if the write didn't actually change HSC data.
  • Improved Sally emulation accuracy and optimization pass to render the games 3-4% faster.
  • Improved Pokey emulation - missing sounds on games like Ballblazer are now much better.
  • Improved memory emulation for more accurate mirror handling - 7800 Utility cart now shows this as a PASS.
  • Improved memory caching to help with the really big games (those 512K or larger).
  • All but two games on the DSi are now rendered without any form of frameskip (the two holdouts are 1942 and Realsports Baseball). Older DS-Lite/Phat reduces frameskip due to new optimizations.
Fast turnaround on a new release - we had a storm come through over the past 36 hours and I had nothing to do but write code
:)


This is my favorite kind of release - nothing highly visible to the end-user, but a lot of improvements under the hood. The emulation accuracy has gone up here - and the best part is that the game rendering is also 3-4% faster across the board. That's unusual - as accuracy often comes with a slowdown. But I was able to get a 6-7% speed up and with that I gave back some of those gains to improve the overall emulation accuracy.

I've learned quite a bit over the last few years of programming emulators for the DS. One big gain for this round of cleanup was in predictive coding. For example, the branch handling for the 6502 is now optimized to assume the branch is taken (from experiments across a wide variety of 7800 games, the branch is taken more than 95% of the time). So now my cycle table builds in the assumption that the branch is taken - and if the branch is not taken, I simply subtract out those extra cycles which would have been consumed had the branch been taken. Given that we hit this logic about 100K per second - that little change makes an impact.

I had some other optimizations that were not completely 'safe' that I've now removed. Assumptions about how a programmer might access the Pokey registers has been made right. RAM Mirrors are in place though I don't really know if anyone really uses them in any meaningful way - but at least the 7800 Utility Cart now shows a PASS on the internal memory check.
 
Last edited by wavemotion,
https://github.com/wavemotion-dave/A7800DS

V5.0 : 21-Feb-2025 by wavemotion-dave
  • Kangaroo mode fixed and fully implemented. Cleans up some small graphical glitches on a number of games.
  • Composite Artifacting implemented for Tower Toppler and Jinks.
  • Sound handler fixed so that drop-outs of sounds are eliminated (or at least greatly minimized).
  • The X button on the NDS is now configurable to a range of joystick/console buttons.
Some big improvements in accuracy. There isn't all that much software that takes advantage of the 'Kangaroo' mode of the graphics chip... but there are a number of great hombrews that do use it (if sparingly). This should render graphics cleanly now ... small and subtle improvements (e.g. the rolling Atari Age logo on Beef Drop is no longer a blur - it's nice, crisp and correctly rendered).

The composite artifacting is really only enabled for Tower Toppler and Jinks. It's done as best I could given the limited CPU power available - but it makes Tower Toppler quite playable (and enjoyable!). This is only of benefit on the DSi/XL/LL or above... there is just not enough CPU cycles on the older DS-Lite/Phat hardware to render the artifacting.

I found a bug in the sound handler after playing about 1 billion hours of the first level in Tower Toppler... music would sometimes glitch. I found the nasty bug - it was possible for the sound buffer to overflow/wrap and it would cause a 1/16th of a second drop out in sound. Not noticeable in most games but any game that had music playing (e.g. Tower Toppler, Keystone Koppers, etc.) should see things smoothed out nicely now.

And lastly, there are a few games where having a third button is just desired... thrust in Asteroids/Deluxe, the hyperspace in Meteors, etc. So the X button is now fully configurable in settings for that purpose. I may expand this in the future for more full button mapping on the NDS.

It's taken a long time to overcome some of the problems in the ProSystem emulator code base ... but we're almost there!
 
Last edited by wavemotion,
Version 5.1 is released! https://github.com/wavemotion-dave/A7800DS
  • 7800 BIOS is now supported. Place bios exactly named '7800.rom' in /roms/bios, /data/bios or same directory as the emulator itself.
  • New internal database with many cleanups and corrections. Now compliant with Trebor Pro-Pack v8_16 from early 2025.
  • New configuration option to allow mapping both both X and Y buttons.
  • Maria and CPU cycle counting are much closer to real hardware - all of the DMA Cycle adjustments/hacks have been removed.
  • This fixes a number of small problems such as Pole Position II joystick selection of track when game loads.

Big change here is the inclusion of BIOS support. It's totally optional - but if you feel nostalgic about the wonderful color-cycling splash screen for the 7800, you'll want to use it. Only the two known 4K NTSC BIOS files will be accepted - name it 7800.rom or 7800.bin and place that file into the /roms/bios folder (or /data/bios or just in the same directory as the emulator... it will search out all those locations). If you want to skip the BIOS, you can press the START button (instead of the 'A' button) when launching a game. There are a few old hacks that don't have proper encrypted signatures that you might need to bypass the BIOS checking.

To get the BIOS working, I had to improve some of the cycle handling which has always been problematic for the ProSystem emulator. I've made strides over the past year and with this latest 5.1 update, I think I'm 98.3% there...


image.png.c923cc7e046b1ee7336e4e3704e1a219.png

I've spent a lot of time with the 7800 Test Cart getting this as close as possible... not every mode is perfect, but it's much closer across the board.
image.png.fb4ba3f395822f7840eff9e1e534242c.png
 
Well... file this under keeping me humble.

For more than a year now I've had a RAM decode issue in A7800DS that affected SUPERCART RAM games with RAM mapped into $4000. Basically I only allowed access to the first 4K of that. The bug crept in on v4.9 with my over-zealous optimization of the memory handler.

Sigh... anyway! Here is the fix along with a few new improvements. Of note is the new NTSC True Sync handling. The DS/DSi/XL/LL handhelds refresh the LCD at 60Hz. In all my early emulators, I basically used a DS software timer to produce the 60Hz refresh but it didn't care where the DS hardware was in refreshing the frame. This could produce some slight visual tearing artifacts - minor but still annoying. With v5.2, I'm now letting the DS tell me when it is in a vertical blank and I refresh the screen at that time - reducing visual artifacts. Now this isn't as great as it sounds since the 7800 native resolution is more than the DS LCD resolution so I have to do a bit of compression - meaning that compression artifacts still remain. But it's a step in the right direction.

A couple of cosmetic improvements as well... I still need to go through the latest ProPack and make sure everything is still looking and playing great so there might be another version coming in the next month or so.

V5.2 : 28-Feb-2026 by wavemotion-dave
  • Fix for Supercart RAM at $4000 games - glitches on 1942EX now gone.
  • Added NTSC True Sync at 60Hz to reduce screen tearing (7800 emulated frame now refreshes in sync with DS LCD refresh)
  • Improved options / file selection graphic
  • Improved Zoom Icon handling
 
Hi. I've been using a7800ds for a while. Now I've got New3DS and can't get it to run. There is downloadable file in Universal updater and I also tried to install my NDS file with NDS forwarder, but a7800DS wasn't added to my home menu. Can anyone point me how to get this working Without TWL++ ?
 

Site & Scene News

Popular threads in this forum