Homebrew Emulation Introducing Nintellivision - an Emulator for the DS/DSi

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Version 1.8 released: https://github.com/wavemotion-dave/NINTV-DS

V1.8 : 26-Sep-2021 by wavemotion-dave
* Reworked configuration options - new game specific and global options available.
Unfortunately your old config will be wiped out in favor of the new format. Sorry!
* Improved sound quality for the DSi.

Major update to the way configuration is implemented and stored. Your old configuration will be wiped out in favor of this new format - which is more flexible and will make for easier future expansion. I've also improved the sound quality for the DSi by one "step" and added a new even-higher-quality you can select (for the older DS hardware, this new quality won't be much use as the CPU is just too slow to render it properly). You can set a default sound quality in the new Global Options and you can override it on a per-game basis.

I apologize for making folks re-do their configuration but this new method allows me to add all kinds of cool things in the future - custom locations for BIOS files, favorites lists, game statistics (time played, etc). It's for the greater good so we all must take one for the team :)

@MarioKartFan - no changes for overlays (other than you can now store them in their own directory) so they should all work "out of the box" with v1.8 :)
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
@RocketRobz just checked in a version with command-line ARGV/ARGC support. I briefly tested it but let me know if I screwed up :)

I also just checked in the first version that doesn't rely on knowncarts.cfg to exist. The game database is internal now - and you can have a specific <gamerom>.cfg files for new games that aren't in the database - this is standard in the Intellivision homebrew community in recent years. In short: users don't need to add this extra configuration file anymore and it won't be distributed starting with the next version 1.9 (released later today).

I experimented with the GPL replacement miniexec and minigrom BIOS files but only a few homebrews will run with those. The vast majority of games require the real grom.bin and exec.bin files - and those will never be distributed with the emulator. So that's kinda a bummer that there is some reliance on the end-user to supply those.

Be aware that the game uses 2 kinds of rom files... the .int (or .bin but I realize you can't really use that extension as it's too vague) are standard binary files.

.int files are standard binary files and are the usual format for most of the original 125 Intellivision games and some early homebrew games.

.rom files are "newer" (still more than two decades old) and contain the loader information built-in. Most of the newer homebrew games come in this format.

NINTV-DS supports both - though I realize you may not want to associate .rom files with my emulator... that would mean that only the original games would load up via the command line via TWL++ (though the player could then just hit the LOAD button to pick from the full spectrum of game types supported).

PS: would love to see a beautiful woodgrained classic Intellivision on the loader screen :)
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Version 1.9 released: https://github.com/wavemotion-dave/NINTV-DS

V1.9 : 27-Sep-2021 by wavemotion-dave
  • Removed reliance on knowncarts.cfg. Internal database handles most games and you can use a "romname".cfg for new .bin games.
  • Added command line support so it can be called via TWL++.

This may not look like a big update but internally it's huge - and something I've been wanting to clean up since the first beta release. Gone is the reliance on knowncarts.cfg - this file is no longer used nor is it included in the 1.9 release distribution. If you have it hanging around from a previous install - you can delete it.

Instead there is an internal database containing the entire 125 original game library plus two dozen of the most popular homebrews. Games will simply load and run at the right memory locations.

For newer homebrews, most will come in .ROM format which has the memory map built-in. For the few that still come in .BIN/.CFG format, we support the "industry standard" (ha!) .cfg format which will supply the mapping. The .cfg file is the same base filename as the rom being loaded and will look similar to this (every .cfg is a little different):

[mapping]
$0000 - $1FFF = $5000
$2000 - $3FFF = $9000
$4000 - $47FF = $C000
$4800 - $57FF = $D000

[memattr]
$D000 - $D3FF = RAM 8

As a bonus - I've also included a small .rom database because there are some .rom files that don't properly specify the peripherals needed (e.g. Missile Domination requires the JLP expanded RAM module be installed). So now you can load the following freely available homebrews and they will have the right settings applied:

Missile Domination (.ROM)
Grail of the Gods (.ROM)
Super Pixel Bros. (.ROM)
FW Diagnostics (.ROM)

Enjoy!
 
Last edited by wavemotion,

RocketRobz

Coolest of TWL
Developer
Joined
Oct 1, 2010
Messages
14,750
Trophies
2
Age
22
XP
16,678
Country
United States
Did you change bios path in the general settings ? (Press select at main screen). AFAIR default folder was in the rom path.
It's already set to "Same as ROMs". When I move them out of "bios" folder, then it works, but only if I start the emulator itself, instead of launching the game in the TWLMenu++ GUI.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
@RocketRobz - I have my global configuration set to store my BIOS files in /roms/bios which is where grom.bin and exec.bin are.

When I tested this, I renamed NINTV-DS.NDS to StellaDS.NDS and replaced the stock one in TWL++ and then renamed one of my Intellivision games to .a26 and that way I fooled the current TWL++ into launching what it thought was an .a26 Atari 2600 game but it really launched an Intellivision game. That worked just fine. So if you set your global config to the /roms/bios or /roms/intv/bios directory and put your bios file there - it should work.

However: I suspect that "Same as ROMs" won't work right because NINTY-DS won't change into the directory where the game is being launched (assuming you are passing me the full path?). That is: it's trying to load the bios files from either the root folder or the folder where the emulator lives. Maybe.

I can try changing NINTY-DS to parse the command line argument and navigate the path and then launch the file from there... give me 30 mins and let me see if I can do that...
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
@RocketRobz ... okay 1.9a checked in. Try the new NINTY-DS.NDS

You definitely send me a fully qualified path along with the file and the CWD is definitely still the _nds.../emulators directory to start. Now I'll check the passed argument for a path and traverse the path so we end up loading the file in the current working directory - that should allow the system to find BIOS files, overlays, etc. if those are set to "same as ROMs" (which is the default).

Let me know how it goes... in the meantime, I'm going to watch Big-Bang Theory and play some Treasure of Tarmin :D
 

RocketRobz

Coolest of TWL
Developer
Joined
Oct 1, 2010
Messages
14,750
Trophies
2
Age
22
XP
16,678
Country
United States
@RocketRobz ... okay 1.9a checked in. Try the new NINTY-DS.NDS

You definitely send me a fully qualified path along with the file and the CWD is definitely still the _nds.../emulators directory to start. Now I'll check the passed argument for a path and traverse the path so we end up loading the file in the current working directory - that should allow the system to find BIOS files, overlays, etc. if those are set to "same as ROMs" (which is the default).

Let me know how it goes... in the meantime, I'm going to watch Big-Bang Theory and play some Treasure of Tarmin :D
It works! The ROM boots after being passed by TWLMenu++!
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Version 2.0 released: https://github.com/wavemotion-dave/NINTV-DS

V2.0 : 02-Oct-2021 by wavemotion-dave
* Improved loading from command line so custom overlays work again.
* Improved first-load of a game so it's faster/smoother.
* New meta key for "SWAP" to swap left/right controllers which is useful for games like Swords & Serpents.
* Patch for Q-Bert so lives are not lost (ever... it's not a great patch but makes the game playable)
* Another frame or two of speedup.
* Other cleanups under the hood.

The Swap functionality is only useful for a few games... but you can now assign one of the DS buttons to instantly swap the left/right intellivision controllers. This allows you to play Swords and Serpents as "solo" 2P co-op (wizard + prince). Cool!

I'm going after some of the bugs in the emulator but not having much success. I did cleanup loading of new games which sometimes would freeze or glitch - this should be much better now. I patched the bug in Q*Bert that loses a life on every board clear - this bug exists in the BLISS core and in the current MAME intv core... I don't know what causes it but the patch will simply keep the lives counter refreshed to '3 lives' and that renders the game playable... though it's only marginally better than the original bug.

I can't figure out the Nova Blast freeze. It's the only bug that doesn't seem to manifest on the windows version of BLISS. It's probably fetching some crap memory location - though all the debug I've put in hasn't found it yet.

The minor graphical glitches in D1K and D2K (ape climbing the girders) are also escaping me... it happens on the BLISS core in windows as well but I've gone over the MOB (movable object) rendering and can't see any obvious problems.

I'll keep at it... though at some point these are fairly minor issues in the grand scheme of things.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Version 2.0b released: https://github.com/wavemotion-dave/NINTV-DS

I had broken Ms Pac-Man ROM with the 2.0 release (it does some funky memory usage) and then tried to patch it with 2.0a and that broke older games... but 2.0b is now ready and everything should be working again.

I think :)

Sorry about that guys - this stuff is part science and part voodoo!!
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Not ready for a new build but after 4 hours of mind-numbing debug... Nova Blast is fixed.

I lost a couple of frames of speed with the fix but it's checked in. I hope someone, somewhere will play this game because after 4 hours of playing the first 10 seconds of the game, I don't think I ever want to see it again :)
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Version 2.1 released: https://github.com/wavemotion-dave/NINTV-DS

V2.1 : 03-Oct-2021 by wavemotion-dave

* Nova Blast fixed.
* JLP random fixed and improved JLP compatibility.
* Reduced dynamic memory allocation.
* Added headers and cleanup under the hood.

After the "adventure" that was 2.0(a)(b)(c)(d) yesterday, here's a fairly stable release 2.1 :)
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
Not ready for a new build but just checked in a major update to the way the background is drawn - this fixes the long-standing (at least a decade old) flicker problem in Stampede which is now running fine. Turns out a smaller flickering problem in Masters of the Universe (fireballs) is also fixed by the same change.

For those curious, the Intellivision renders its background as a series of small (8x8) squares... there are 20 across and 12 down for a total of 240 squares on the screen. Think of these like little graphical postage stamps that you assemble to form the background. The game is free to use stock images (from grom.bin) or make their own (GRAM ) or any combination. They can also change, at any time, which postage stamps (formally called "cards") show in which spots. Most games just render a static background - or if they change it, it's only between levels and such. But a few games (the aforementioned Stampede and the fireballs in MotU) will use some clever tricks to produce smooth animations using these background cards.

When a real Intellivision renders a frame on screen, it will pull from a table (called the backtab) of these cards and display them on screen. As the frame draws, it locks in one row of these cards and renders them to the screen... then it moves on to the next row of cards (until all 12 rows are drawn... then the next frame will repeat this all over again). A clever programmer writing a game can know that the hardware has already rendered a row of cards and can then change those cards to get ready for the next frame. Clever! But the way the old BLISS core handled cards was that at the end of a frame it would just display all 240 (12x20) cards... but the Clever Programmer doesn't want that - he was counting on changing cards after the display rendered the old ones.

So I've changed Nintellivision to match... we now latch and display cards much close to the way a real Intellivision does it (not perfect, but close enough). This fixes all the flicker problems for games that use this clever programming technique. But it comes at a cost... I lost 3-4 % of speed to make this right. Fortunately the DSi had plenty of frames to spare... the DS just barely had enough to spare... so I think in the end it will all be fine and the improved accuracy reduces the number of problems in the emulator to just a very few... I can always get the speed back with other improvements :)
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
446
Trophies
1
XP
2,989
Country
United States
DK transparency issues next?!?
Honestly, DK transparency issues were first on my list :) Out of Nova Blast (now fixed), Q-Bert (now patched) and Stampede (now fixed)... DK is better than all 3 of those games combined!

But the bug has eluded me. I have an inkling of a thought that it's related to the Stampede fix where the background tiles (cards) need to be applied with specific frame timing (i.e. they need to be drawn with correct timing as the screen is rendered from top-to-bottom). The DK issue isn't background tiles, however, - it's MOBs (Movable Objects - aka Sprites). I assume sprites should also draw top-to-bottom as the screen renders - but the current BLISS core renders those all at the end of a frame to keep the logic simple/fast. If that's the problem, the "fix" won't be nearly as simple as the one for Stampede since background tabs are in fixed locations and sprites can be rendered anywhere and at any offset and that makes rendering them much harder (and slower) if it has to be done on-the-fly.

The reason I suspect this is because the animation of the climbing is probably really difficult to do on this system with only 8 sprites of limited size - so the program had to use most of them to make the effect work. And I could imagine that (just like the clever programmer using background tiles for animation) he might have to start reworking the sprite almost immediately after it is rendered and because the BLISS core we use will render all sprites at the end of a frame, we are not getting the correct sprite animations. In addition to the transparency, I can also see some areas around (left/right) the ape that are not right.

I'll keep poking around and hopefully find a fix. It's only a matter of time. Fortunately, D1K and D2K only suffer these issues on ape-climbing cutscenes and not in actual gameplay.
 
Last edited by wavemotion,
General chit-chat
Help Users
    ChrisOwl @ ChrisOwl: Thank you linuxares! Funny, my sxos/emunand/ folder have nothing there lol, I will try to follow...