Homebrew Stella-DS Improved

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
I've taken a break from adding instruction manuals to address the scaling and offset rendering of various games. As I cleanup some of the odd games (especially those that were PAL and converted to NTSC), I've discovered that more than a few games utilize the Vertical Blank (top area of the screen that, in theory, would be cut off by older tube-TVs) and many more games utilize the Overscan area (bottom area of the screen that, in theory ,would be cut off by older tube-TVs). And, just to make life interesting, a few games steal some scanlines in the VBLANK area and also in the OVERSCAN area. Such is life in the wild-west of vintage video gaming!

This is most easily explained by a picture:

upload_2021-7-7_9-8-18.png


You can see that an "ideal" game would only utilize 192 lines of visible frame information. This works out perfectly for the DS/DSi which has 192 vertical pixel lines. That's as good as it gets!! However, as mentioned before - many games steal extra scanlines above and below the theoretical visible frame. 99.9% of TVs handle this fine - the 192 was a "safe" value given by Atari to make sure even the worst rounded tube-TV of the 1970s would still show the game fine... however even Atari in their Pack-In game (Combat) violated the ideal "standard".

So Stella-DS goes to great lengths to have a database of almost 1000 games to properly position them on screen... where a several lines are "borrowed" from the top (vertical blank) or bottom (overscan) area, we can compensate by adjusting the position and/or scaling the image slightly to ensure it looks basically okay.

When you scale, however, some lines must be lost. The DSi can't show more than 192 vertical pixel lines - and if you are squeezing a 200 line game image onto the screen... 8 lines have to go somewhere. Sometimes this is just "sky" or "ground" and has nothing to do with the game - so I'll usually just cut them off and let them not display. However, if a score or other important playfield graphic is used in those area... I have to compress the screen down to 192 and do so as delicately as possible. Usually the result is acceptable for gameplay.

In previous versions of Stella-DS I had a fixed number of overscan and underscan lines I could use. I could utilize up to 6 Vertical Blank lines and 14 overscan lines... that worked for 98% of all games. But I want 100% :) So I've reworked the code so that every game can specify it's own underscan/overscan usage. This lets very difficult to render games (I'm looking at you... Carnival) as well as possible on the DS hardware.

This also means that for the first time, I can actually render a PAL image on screen semi-properly. That means starting with Stella 3.6 (next release), I should be able to support true 50Hz PAL Atari 2600 games. There is still a problem, however... PAL utilizes fewer frames but has more scanlines. So the ideal 192 bumps up to an ideal of 228... and of course the PAL games also sometimes steal overscan and underscan lines as well... so that could easily get to 250 lines. Now we still only have 192 pixel lines to work with on the DS/DSi and so squishing potentially 250 down to 192 is a 23% loss... meaning every 4th pixel line must be removed. It's easy to do in software - but I'm worried that the resulting game will not look great - at least for some games (many games you won't be able to tell anyway). Still... I'm going to include this in the next release - proper PAL support hasn't been working properly since... well... ever :)

upload_2021-7-7_9-4-54.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 3.6: https://github.com/wavemotion-dave/StellaDS

V3.6 :10-July-2021 by Dave Bernazzani (wavemotion)
* PAL Support! PAL games will render in proper 50Hz / 312 Scanlines.
* Database of known games expanded from 850 to 1900.
* Long rom filenames now scroll when selecting a game.
* Total instruction manuals: 80!

This was a lot more effort than I expected... maybe not even worth the amount of time - but at long last, real PAL support is implemented! I've used the RomHunter / Atarimania / Atariage rom checksums and so now there isn't likely a game on the planet you can't throw at StellaDS and it will figure out what region it was originally played in and adjust accordingly.

I've also changed to adding an internal ID for all games so that any version of a game will bring up the right manual. So it doesn't matter if you're playing the official Missile Command, a PAL version or a hacked version... if it's basically Missile Command it will bring up the Missile Command instruction manual.

Be aware that PAL support comes with some caveats. In the late 1970s and early 1980s almost all game developers were American and 99% of all games were developed as NTSC games. Some companies did a great job porting to PAL systems for our European and South American friends... Imagic did a great job. Atari was hit-or-miss... some titles well supported in PAL and others less so. Activision is among the worst - they did straight ports without compensating for the frame rate difference of the TV sets and as such the games run a full 17% slower. Kaboom at 17% slower is cheating folks :) Anyway, Imagic did the best job - often utilizing the extra scanlines to make for a tweaked game experience on TVs that supported more scalines... but remember that the DS only has 192 pixel lines to work with so even the small wins that PAL gains for a few games is lost due to the conversion back to 192 pixel lines. All of this to say: if you want a genuine Atari 2600 experience, you're better off sticking to NTSC roms which play the way the developers expected. StellaDS will render PAL games as faithful as possible... but you have been warned.

More game manuals added... I'm hoping to sit on the couch today and play a ton of Laser Gates :)
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
By the way... starting with V3.7 I've left the ability to enable debug monitor which I use to help tweak various games.

If you want to see it (it serves you no purpose other than being a sort of "oh... weird"), it's enabled if you hold down the secret X button while you press A/Y to select a game in the roms menu.

upload_2021-7-13_8-13-43.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Productive morning! I finally got a chance to implement the very unique WD Bankswitching scheme. This bankswitching scheme is used for only 1 prototype game - Pursuit of the Pink Panther. The game was made in 1983 but never commercially released since the custom RAM chip used inside the cart was unreliable to manufacture and with the video game crash in progress, the game got cancelled even though it was finished.

In 2019 (yes, 36 years later!!) the game was finally dumped to ROM and it could be played. I put in the handling for the unusual bank switching scheme and after a bit of debug, it works - full speed on the DSi (the older DS is a bit too slow for this one).

You can play this if you want using the nightly build (I'm not ready for a full 3.8 release yet): : https://github.com/wavemotion-dave/StellaDS

upload_2021-7-17_8-22-40.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 3.8: https://github.com/wavemotion-dave/StellaDS

Big update!

V3.8 :18-July-2021 by Dave Bernazzani (wavemotion)
* Massive update to database to support 50+ of the best Atari Hacks and another 20+ homebrews.
* Support for WD bankswitching - Pursuit of the Pink Panther is now playable.
* Genesis Controller support for all the awesome games that take advantage of it (including all the 2 button hacks)
* 120 Game Manuals!!
* Other cleanups/improvements as time allowed.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 3.9: https://github.com/wavemotion-dave/StellaDS

V3.9 :22-July-2021 by Dave Bernazzani (wavemotion)
* Finally fixed graphical glitches in Rabbit Transit and Dragonstomper.
* Many cleanups and improvements to the TIA handling.
* Better cart detection schemes for UA and FE bankswitching.
* Another 100 games added to the compatibility database.


I learned a lot about the TIA handling of graphics... as mentioned before, the Atari 2600 programmer has to render the line on-the-fly as the TV is rendering the image. This is colloquially known as "racing the beam" and leads to all sorts of awesome little tricks that can be performed by the 2600. In addition to this, the TIA chip has helpful "player-missile-graphics" commands to start/stop/move players and missiles on a given scanline. Without this help, the programmer wouldn't stand a chance of rendering images in the scant time allotted to the game engine. By the letter of the specs, a programmer should wait at least 24 clock cycles after rendering an HMOVE (horizontal move) command before issuing another command for that same object... but guess what? Programmers are weird. So some would issue a new TIA command part-way through an existing move - and it causes some interesting graphical effects. One such well documented effect is the starfield in Cosmic Ark - the programmer issues new commands to the TIA mid-move and it causes the awesome looking background starfield in that game. Unfortunately sometimes a programmer doesn't do it on purpose - and that can cause little graphical glitches and artifacts for the games. While Stella-DS doesn't have the new and improved TIA core from later Stella versions (which is awesome but much slower to render - and we can't afford that kind of speed loss) - I've taken some key components from it to help fix up some games that were not looking right. Most specifically the snakes in Rabbit Transit which appeared to "jump" a bit as they entered the left side of the screen and the scrolling left "screen jump" in Dragonstomper (both Arcadia/Starpath Supercharger games...). In the older 2.x versions of Stella (of which Stella-DS is based), these were called "hacks" because they replicated the look and feel of the graphics output but stopped short of actually emulating the "illegal HMOVE" handling that later versions of Stella would get right.

We still aren't perfect in our emulation of the Atari screen - but this version gets us closer.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 4.0: https://github.com/wavemotion-dave/StellaDS

V4.0 :24-July-2021 by Wavemotion-Dave
* Found another 3-5% speed up in TIA rendering! Official Frogger now at 60FPS.
* Press and hold L+R+A to swap LCD screens.
* Other minor cleanups and polish.

Everytime I think there can't be any more juice to squeeze from the stone, I find something... in this case I found that *most* of the time there are not collisions happening on screen nor are there screen color changes (most Atari games use a small number of colors and often a repeated background color throughout)... and as such if I optimize to assume there are no changes on a scanline and then correct it when collision bits change, I could get a 3-5% speedup depending on the game. Elevators Amiss which was really hard to get up to 60FPS (and it often fell back to 58FPS at times) is now at a solid 63FPS. The Official Frogger is, for the first time, at 60+ FPS. Almost all of the games that were borderline full-speed are now rendering at full frame rate. Midnight Magic is one of the few holdouts running at 57FPS but still very playable. Escape from the Mindmaster is upwards of 58FPS during the minigames and often faster in the maze section. Pitfall II is finally playable at or near full frame rate - though the background music is still not properly emulated. Everything else is pretty much rock-solid on a DSi or above. Enjoy! I'm off to sit on the couch and play some Official Frogger!

upload_2021-7-24_17-42-45.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 4.1: https://github.com/wavemotion-dave/StellaDS

V4.1 :28-July-2021 by Dave Bernazzani (wavemotion)
* Found another 1-2% speed up in TIA rendering!
* Bumper Bash now plays correctly (you can use the shoulder buttons too).
* Kool-Aid-Man now plays correctly
* Meltdown graphics improvements (not completely fixed... but playable).
* Alpha Beam, Big Bird and Cookie Monster games all work with joystick controls now.

This build brings support for some games that have not played right for ages... these were generally problem games in early versions of Stella as well (in fact, Meltdown wasn't properly emulated for like a decade!).

I've also brought in some fixes from later Stella releases to make this version as good as it can be!
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
But, Will Pitfall II be fixed or can it be fixed?
So, Pitfall II is an interesting case. I've got the DPC emulation working enough that the game is fully playable... but the music fetchers in the DPC (think of this like a co-processor built into every Pitfall II cartridge) don't work. This isn't because the music fetchers can't be emulated but because of the way the audio is rendered. Even if I implement the fetchers (and I have an internal version with those fetchers working), because of the way the main audio driver works it just sounds like high pitch whining - enough to make a dog start barking. Since it would require quite a re-write of the audio handlers for the entire system, I'm not likely to get that done anytime soon.

So Pitfall II has the wrong background music (it actually has the base-thump because that's done with normal TIA audio). It has the right jumping and other sounds... and it plays fine. So it's not all bad.

And, of course, I've got 3 other Atari 8-bit emulators... and you can load up Pitfall II on the 5200 or XEGS and enjoy it with full frame rate and full sound.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
At this point I'm just running through the ~ 1000+ games and tweaking visuals and making sure I've got the controller settings correct. I've found a couple of mistakes - on games you are never likely to want to play :)

For example, Bachelorette party uses the "paddles" but I had configured it for Joystick use... so you can't move the player. But the game sucks so nobody has reported it yet. Still... there's no reason not to correct these things to provide a higher level of game compatibility. I'll be checking in new nightly builds on the trunk for a while but won't bother to put out the next release (v4.2) until I've got them all cleaned up.
 

Deleted member 668561

GBAtemp Official Psychonaut
Banned
Joined
Jan 29, 2008
Messages
1,875
Trophies
0
Location
somewhere within 4 dimensional space-time
XP
2,654
Country
United States
thought about designing a slot-2 card for the nds, with 32-64MB of ram and a dsp or fast stm32, use it to offload tasks such as rendering, sound, 3d

it would extremely useful for emulation, people already know stm32 or similar which have plenty of docs

also would allow for way more complex homebrew

DSPcart
 
Last edited by Deleted member 668561,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,345
Country
United States
Version 4.2: https://github.com/wavemotion-dave/StellaDS


V4.2 : 02-Aug-2021 by wavemotion-dave
  • New overlay graphic for Star Raiders (plus manual)
  • Y button is now set to auto-fire
  • A half dozen odd games got their controllers straightened out
  • About 100 graphical tweaks for various games to make them look as good as possible
upload_2021-8-2_8-57-44.png
 

Site & Scene News

Popular threads in this forum

Recent Content

General chit-chat
Help Users
    Faust03 @ Faust03: hey the spam bots are acting up again