Homebrew XEGS-DS - Yeah, it's a thing...

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.2 is released: https://github.com/wavemotion-dave/XEGS-DS

V1.2 : 06-Feb-2021 by wavemotion-dave
* Added built-in BASIC cart support which now renders several hundred games playable (if a game crashes it's most likely due to needing BASIC cart support).
* PAL sound and rendering fixes.
* More optimizations and improvements across the board.
* Tap the lower right corner of the touch screen to toggle A=UP (B is always Fire). This makes games
that utilize a lot of jumping via the UP (or UP+Left, UP+Right) much more playable on a DS D-Pad.
Yes, Alley Cat, I'm looking at you.

About 97% of the massive 5000+ Atari 8-bit game library will now play in XEGS.
 
Last edited by wavemotion,

Indy13

Well-Known Member
Member
Joined
Jan 26, 2017
Messages
602
Trophies
0
Age
45
XP
1,277
Country
France
Great improvements! I just tested the multi-disk system with Gauntlet, it works perfectly. On the other hand, I don't remember if it was the same on the previous version or not, was there an icon image for .nds file or not? Because there is just a black square on HBmenu.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Okay... fixed the icon issue. And been working on a new Options screen. Too many buttons to configure too many things so I'm going to consolidate them all into a simple Gear Icon on the main screen.

upload_2021-2-6_17-54-58.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.3 is released: https://github.com/wavemotion-dave/XEGS-DS

V1.3 : 08-Feb-2021 by wavemotion-dave
* Major overhaul to bring the SIO and Disk Loading up to Atari800 4.2 standards.
This fixes disk loading so games like The Eidolon will load properly.
* New options menu with a variety of options accessed via the GEAR icon.
* Fixed ICON
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.4 is released: https://github.com/wavemotion-dave/XEGS-DS

Fortunately numbers are cheap :)

Version 1.4 fixes an unfortunate crash on DS-LITE and DS-PHAT systems. Sorry!
Much improved and faster file selection (reading files/dirs is now 100x faster).
Added option for X key to simulate SPACE key or RETURN key.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Not ready for a new build yet, but just checked in the source (and .NDS) with frameskip enabled on the DS-LITE/PHAT. I had to rework the main loop timing code to get this to run properly - but it looks like a huge win! Games run 10-20% faster depending on the amount of screen rendering being done... and it's enough extra power to make the first 10 games I tried on the DS-LITE to run at full speed with proper sound!

Woot! The build I checked in allows you to toggle FrameSkip ON/OFF in options (Gear Icon) but it defaults to ON for DS-LITE/PHAT and OFF for DSi where the CPU is enough to play virtually any game.

The 8-bit classics are now available to the masses :)

I should be able to port this to the A5200DS though I don't think this scheme will work well for StellaDS given the way it was implemented.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.5 is released: https://github.com/wavemotion-dave/XEGS-DS

Frame Skip is implemented. It's ON by default for older DS hardware and OFF by default for DSi and above.

It's both amazing and disappointing.

Amazing in the sense that it renders thousands of games fully playable on the older DS hardware.

Disappointing in the sense that it introduces glitches to a handful of games (Buried Bucks is unplayable and Caverns of Mars has graphical glitches but is playable... and those are the only 2 I found on a pass through of 100 popular games).

With this old hardware, everything is tied so closely together - rendering of screen, sounds and CPU clock cycles are all in perfect harmony as the game plays. A few games are very sensitive to frames being skipped - I'll do my best to work out the glitches but I'm basically using the same scheme as the most current Atari800 windows emulator (an ancient version of that code base is what's under the hood for XEGS-DS).

So it's not perfect ... but it's still a major win to allow the vast majority of games to be playable with full speed/sound on the older DS hardware!
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
You are saying that according to your tests, 98% of the most popular games are working just fine ? To me, it is amzaing and certainly not disappointing ;)
Thanks !:)
You're quite welcome! Yeah, of the 100 games I played, only 2 had obvious issues.

With coffee this morning I played some of the real heavy games - the ones that pushed the 8-bit hardware to the limits. Berks4 and Dropzone both worked fine - at full speed with the amazing Dropzone occasionally dropping down to 58FPS when the action got heavy (it was not noticeable other than with the Frame Counters turned on). Heck, even Bounty Bob Strikes Back is running full speed on the ancient hardware!

The real acid-test is Bosconian - the 2017 homebrew that pushes the system hard. It's almost playable on the older DS hardware. It's down around 52FPS with some stuttering in the sound. In PAL TV mode, it's down around 44FPS. But I can live with some games not able to keep up on the DS-LITE/PHAT provided the majority are running right.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Not ready for a new build, but just checked in the first build with the 320K RAMBO ram expander. There weren't many games to take advantage of > 128K memory (and the vast majority stuck with 64K so as to be compatible with a large number of Atari 8-bit machines out in the wild). But a few games and utilities did take advantage of more RAM and, as it turns out, there was exactly 320K of available VRAM that I could use for the buffers. So games like PANG and AIRBALL will run fairly close to full speed if you set the new Skip Frames option to "AGGRESSIVE"... BOMB JACK is still a bit too slow to play but it's close if I can figure out a faster bank switching method.

upload_2021-2-11_12-8-14.png
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.6 is released: https://github.com/wavemotion-dave/XEGS-DS

V1.6 : 13-Feb-2021 by wavemotion-dave
* Added 320KB RAMBO memory expansion emulation for the really big games!
* Added Artifacting modes that are used by some high-res games.
* Improved option selection - added brief help description to each.
* Improved video rendering to display high-res graphics cleaner.
* Fixed directory/file selection so it can handle directories > 29 length.

PS: Artifacting is a really interesting technical subject... I don't understand all of it but the jist of it is that older color TV sets would produce small artifacts when rendering a pixel on screen (unlike modern LCD/LED screens which produce very few artifacts and have amazing pixel resolution). But varying the timing of the clock signal, a programmer could use these artifacts to their advantage. The high-res 320 pixel mode of the Atari 8-bit computers could only render in 1 color (on black TV background) but using these older TV set artifacts the programmers could trick your eye into seeing 4 different colors. Prior to implementing this in the emulator, those high-res games would look monochrome (and rather poorly drawn at that) but with the artifacting you can see it's much nicer.

Witness Loderunner (which uses the high-res mode and artifacting) - the image on the left is without artifacting and the image on the right is with artifact emulation ON.

upload_2021-2-13_8-45-4.png


Now you might be thinking, "Dave! The image on the left clearly has more than one color... looks like 2 colors!" and that's true. The SCORE at the bottom is in a different color - and that's because another interesting thing about the Atari 8-bit is something called display lists where a programmer can break up vertical chunks of screen into different graphics modes. So the score at the bottom is not the high-res single color graphics mode. As I've said before... these guys were "racing the beam" to display graphics as the video rendered on the TV.

Yeah, I realize this stuff is only interesting to me :)
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Not ready for a new release yet, but just checked in a build that has config save support on a per-game basis. So now you can save off whether the game is PAL or NTSC, screen offsets/scaling, button config, memory settings, etc. Pretty much everything that is in the Options Menu is saved on a per-game basis. To save the config for a game you can press both L/R shoulder buttons at the same time while playing or there is a new button mapped (with description) in the Options sub-menu.

The new config file is created in a directory off the root in: /data/XEGS-DS.DAT

If the directory or file doesn't exist, it's automatically created. The file is 128K in size and will accommodate 1250 possible game configurations. At any time you can safely erase the file and wipe all game configurations clean.

I've also added 3 levels of "autofire" (Slow, Medium and Fast) to accommodate more tastes.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.7 is released: https://github.com/wavemotion-dave/XEGS-DS

V1.7 : 18-Feb-2021 by wavemotion-dave
* Added saving of configuration for 1800+ games. Press L+R to snap out config
for any game (or use the START key handling in the Options Menu).
* Autofire now has 4 options (OFF, Slow, Medium and Fast).
* Improved pallet handling.
* Other cleanups as time permitted.


And it's finally ready! I had to make sure the config stuff was right so as not to have to needlessly change it in the future and blow away any config settings the (admittedly tiny!) userbase might have. The system can save off configurations for 1820 (yeah, strange number... don't ask) games. Yeah, it's a limitation but it's not a practical one... most people will have less than 50 games they care about (even my config library is unlikely to see more than a few hundred). I included a dozen spare configuration bytes for future expansion and I added a configuration revision byte and checksum into the header so as to future-proof it a bit (if needed, I can detect what version of the config file you have should it change and automagically upgrade it). The checksum provides some resistance to potentially corrupt files - if the file does not have integrity, it will be wiped back to defaults.

I also figured out the proper number of Y lines to offset for most games... 24 lines. I had been using 20 because it "looked right" for many NTSC games... but 24 is the proper number if a game adheres to the Atari specifications (many don't). The idea was that the older TV sets could/would lose some of those early scanlines or late scanlines lines "off the screen" (or, if they did show, they would be at the maximum curvature of the glass on the TV screen... something we no longer worry about with flat screens). So to be "safe" a programmer was given guidelines to utilize the middle 192 scanlines for their graphics/game. This works out perfectly for the NDS which has 192 vertical pixels. Perfect, that is... until the programmer decides to utilize some of the underscan or overscan area (the 24 blank lines above and below the recommended area). This happened with great regularity - even by Atari programmers. The vast majority of TVs (especially as the TVs got better and better) handled those extra lines easily... and so the programmers would creep up and down from the recommended 192 to cram a bit more graphics on their screen. Fortunately, XEGS-DS has scaling that can compensate - but it does come at a loss of graphical information should the programmer utilize TOO many of those extra blank lines. And, of course, with release 1.7 we can now save off our scaling and X/Y offset values on a per-game basis!

upload_2021-2-18_7-56-33.png
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Version 1.8 is released: https://github.com/wavemotion-dave/XEGS-DS

Nothing Earth-shattering here... mostly cleanup. I'm through trying almost 2000 games and have found a few that didn't work and added some features that gets them running - the compatibility on this version is very high especially if you have the Atari XL/XE BIOS and the Rev C Basic ROM. Even the built-in Altirra replacement roms are working at > 95% of all games.

V1.8 : 25-Feb-2021 by wavemotion-dave
* Added option for slower I/O (disk reads) as a few games will detect that
the game is not running at the right speed and not play (copy protection
of a sort ... 1980s style). So you can now slow down the I/O to get those
games running.
* Reverted to "Old NTSC Artifacting" after discovering at least one game
does not play nicely with the new artificating. Still investigating but
this cures the problem for now (the game was Stellar Shuttle).
* Added the R-TIME8 module for time/date on some versions of DOS.
* Other minor cleanups as time permitted.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
I need to add a "troubleshooting" guide to the readme (or, better yet, included in the emulator itself as nobody reads anymore!). Because there are so many possible configurations needed to get games running. After working through almost 2000 games now, I've come across most of the configuration issues. It would read something like this:

Most games run as-is. Pick game, load game, play game, enjoy game.

If a game crashes (crash message shows at bottom of screen or game does not otherwise run properly), check these in the order they are shown:
  1. Try turning BASIC ON - some games (even a handful of well-known commercial games) require the BASIC cartridge be enabled. If the game runs but is too fast with BASIC on, use the Atari Rev C Basic (slower but should run at proper speed).
  2. If BASIC ON didn't do the trick, turn it back off and switch from the ALTIRRA OS to the real ATARI XL OS (you will need atarixl.rom in the same directory as the emulator). Some games don't play nice unless you have the original Atari BIOS.
  3. Next try switching from NTSC to PAL or vice-versa and restart the game.\
  4. Lastly, try switching the DISKS SPEEDUP option to OFF to slow down I/O. Some games check this as a form of basic copy-protection to ensure you're running from a legit disk.
With those 4 tips, you should be able to get 99% of all games running. There are still a few odd "never heard of" games of little or no consequence (i.e. not major titles) that will not run with the emulator - such is life!
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Version 1.8 is released: https://github.com/wavemotion-dave/XEGS-DS

Nothing Earth-shattering here... mostly cleanup. I'm through trying almost 2000 games and have found a few that didn't work and added some features that gets them running - the compatibility on this version is very high especially if you have the Atari XL/XE BIOS and the Rev C Basic ROM. Even the built-in Altirra replacement roms are working at > 95% of all games.

V1.8 : 25-Feb-2021 by wavemotion-dave
* Added option for slower I/O (disk reads) as a few games will detect that
the game is not running at the right speed and not play (copy protection
of a sort ... 1980s style). So you can now slow down the I/O to get those
games running.
* Reverted to "Old NTSC Artifacting" after discovering at least one game
does not play nicely with the new artificating. Still investigating but
this cures the problem for now (the game was Stellar Shuttle).
* Added the R-TIME8 module for time/date on some versions of DOS.
* Other minor cleanups as time permitted.

Good work!

Ehh.. by artifacting do you mean, screen pixel artifacts? If that's true, then it's 99% fault of EWRAM cache. This is what works for me when working with cached memory (read and write):
Coto88 / gbarunner2 / gbarunner2 / common / dldigba.cpp — Bitbucket

Mostly "coherent" cache opcodes are fast. This means these could be inlined in, say a full image DMA operation copy
as opposed to a read/write IO port method. (Here it'd be better to move the IO ports to DTCM, and remove DTCM MPU protection altogether).
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
916
Trophies
1
XP
7,335
Country
United States
Good work!

Ehh.. by artifacting do you mean, screen pixel artifacts? If that's true, then it's 99% fault of EWRAM cache. This is what works for me when working with cached memory (read and write):
Coto88 / gbarunner2 / gbarunner2 / common / dldigba.cpp — Bitbucket

Mostly "coherent" cache opcodes are fast. This means these could be inlined in, say a full image DMA operation copy
as opposed to a read/write IO port method. (Here it'd be better to move the IO ports to DTCM, and remove DTCM MPU protection altogether).
Cool! But yeah, that's not my issue.

Artifacting was something the older 8-bit computers did to try and trick your eye into seeing more colors than were possible. So the high-resolution modes of the Atari and Apple early computers were monochrome... just 2 colors (generally black and white). But... old TV screens were weird... they had curved glass and colored scanbeams and you could pull tricks whereby you could alter the NTSC color clock slightly as the image was being drawn which would shift a white pixel into looking more blue or more red (depending on which way you shifted it). In this way, you could fool the user into seeing 4 colors instead of 2. Apple used this on tons of games... Atari didn't use it nearly as heavily. In any event, the NDS does not use scanbeams nor curved glass and so artifacts don't happen unless they are programmed into the emulation (i.e. done before we render the scanline to the Nintendo LCD display). The emulator I used has 2 modes... "old artifcating" and "new artifacting" with the catch that the "new" is slower but more accurate. I settled on the "new" because it really wasn't much slower and it did look better... but it turns out it screws with some other aspect of the emulation (namely collision detection... so games like Stellar Shuttle would just let you float through the nicely rendered asteroids without exploding).

So for now, I've gone back to the "old" artifacting... it was the default and I've verified that the "new" artifacting does, indeed, cause problems with the latest Atari800 emulators on the PC (so it's not a function of a problem on the NDS... it's a bug in the mainline emulation core that nobody bothered to fix).
 

Coto

-
Member
Joined
Jun 4, 2010
Messages
2,979
Trophies
2
XP
2,565
Country
Chile
Cool! But yeah, that's not my issue.

Artifacting was something the older 8-bit computers did to try and trick your eye into seeing more colors than were possible. So the high-resolution modes of the Atari and Apple early computers were monochrome... just 2 colors (generally black and white). But... old TV screens were weird... they had curved glass and colored scanbeams and you could pull tricks whereby you could alter the NTSC color clock slightly as the image was being drawn which would shift a white pixel into looking more blue or more red (depending on which way you shifted it). In this way, you could fool the user into seeing 4 colors instead of 2. Apple used this on tons of games... Atari didn't use it nearly as heavily. In any event, the NDS does not use scanbeams nor curved glass and so artifacts don't happen unless they are programmed into the emulation (i.e. done before we render the scanline to the Nintendo LCD display). The emulator I used has 2 modes... "old artifcating" and "new artifacting" with the catch that the "new" is slower but more accurate. I settled on the "new" because it really wasn't much slower and it did look better... but it turns out it screws with some other aspect of the emulation (namely collision detection... so games like Stellar Shuttle would just let you float through the nicely rendered asteroids without exploding).

So for now, I've gone back to the "old" artifacting... it was the default and I've verified that the "new" artifacting does, indeed, cause problems with the latest Atari800 emulators on the PC (so it's not a function of a problem on the NDS... it's a bug in the mainline emulation core that nobody bothered to fix).

I see, great explanation. Thanks!
 
  • Like
Reactions: Tarmfot and banjo2

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: