Homebrew Seeking Help... Nintellivision - an Emulator for the DS/DSi

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
upload_2021-8-30_9-10-56.png


So I've been playing a lot of Intellivision Lives DS which is a commercial (released in 2010) emulator for the DS. As you might be aware - it's got problems. The emulator is laggy in spots (though helped by running in overclocked TWL mode on the DSi). It's also got an amazing number of bugs - so many that it's hard to imagine anyone played any of the games prior to release. Off the top of my head, here are some problems:

AD&D Treasure of Tarmin (aka Minotaur) the bottom row of sprites does not render. You can't tell what's in your hand, the lower 2 items on your pack, monster strength, weapon strength, etc. It doesn't do count arrows nor count food.

AD&D Cloudy Mountain (aka Adventure) the count arrows doesn't work (button is completely missing from overlay) and there are many glitches where the little guy runs through walls.

Buzz Bombers - if a bee lands on the right side of the screen and creates a flower - your spray can will get stuck on it. The left side, for some strange reason, works okay.

Space Spartans - computer won't announce any numbers - so Energy Level and # of Aliens is completely broken.

Basically every game has issues - some are so debilitating that it makes it hard to enjoy. And, of course, all the great 3rd party games plus the TRON games are missing.

So I looked for an Intellivision emulator for the DS. No luck. I stumbled upon some source code for a couple of emulators and it turns out that BLISS (C++ sources discontinued a decade ago but ran INTV games and Intellivoice games really well) source was pretty easy to understand and with some code tweaks I was able to get all the major pieces (CPU, Audio chips, Video chips, Input chips) compiled under GCC. Basically I have a bunch of modular blocks but feel a little overwhelmed to assemble them into a functional NDS build.

I'm not great at hooking these into the NDS. BLISS renders a 160x192 pixel buffer that needs to be put up on the NDS display. That's almost ideal vertically... and the 160 can be easily stretched to 256 horizontally via DS hardware (just like the Atari 2600 StellaDS does). The audio is a bit more perplexing to me... BLISS outputs into a 16-bit audio buffer and maybe it's just as simple as telling the ARM7 processor where the buffer is and what size it is and what sample rate to use and it will just work... but I'm far from an expert on the NDS audio/video handling. I'd love to find someone that was really good at that to help cobble the emulator onto the NDS - once it's basically running (probably slowly), I can then optimize it and generate custom overlays, better key mappings, options and such.

In short, I need someone good with libnds and video/audio processing on the NDS to help kickstart this into a DS project and then I can do all the heavy lifting after that.

Any takers? Long shot I know... but the Intellivision has such great classic games not found elsewhere and it's as shame how badly the commercial release turned out.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
Until someone smarter than me (hint: this is everyone!) comes along, I'm slowly building the structure to load the emulator. Right now it all builds and links under Linux using GCC. I made a little main program to drive the loading of the emulator, reading of a single binary cartridge (using Astrosmash as my test), loading the BIOS files and generally staging everything to get the emulator running. So far, so good.


Emulator [Intellivision] Constructed
ROM Added [ECS ROM #1]
ROM Added [ECS ROM #2]
ROM Added [ECS ROM #3]
ROM Added [Intellivoice ROM]
ROM Added [Executive ROM]
ROM Added [GROM]
Peripheral [0] Added
Peripheral [1] Added
**NINTELLIVISION INITALIZED**
Trying to load .BIN [astrosmash.int]
RIP Peripheral Name [Astrosmash]
ROM Added [Cartridge ROM]
Configuration [knowncarts.cfg] loaded successfully
File [astrosmash.int] read into memory successfully
The file size is [8192] bytes
Parsing file into RIP format
Loading ROM segment [Cartridge ROM 2 4096]
Done parsing...
RIP loaded!
RIP uses target system ID [4AC771F8] with CRC [FAB2992C]
END OF LINE.

The next step is to start the emulator running... this should produce frames out output into a frame buffer and audio into an audio buffer and look for input on the input buffer. Now none of those things is implemented for the DS yet so it won't be exciting but if the game is running (however invisibly), that's a huge step. Once I know that the emulator is running, I can work on mapping the pixel buffer created by the emulator onto the DS screen. That should allow video output - though no sound nor input would work. That would be a huge step - if I can get that far, it will increase the chance of this actually getting released someday.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
And more progress... it's now loading all of the right things into memory at the right locations. Even complex games like the Intellivoice games are hooking in where they need to be. Here is some debug output for fun


Successful Load of [./exec.bin]
Successful Load of [./grom.bin]
Successful Load of [./ivoice.bin]
Peripheral Inserted: [Intellivision]
Processors [4]
[CP1610]
[AY-3-8900]
[AY-3-8914]
[Audio Mixer]
RAM [6]
@ [0100] Size [00F0]
@ [0200] Size [0160]
@ [3800] Size [0200]
@ [0200] Size [00F0]
@ [0000] Size [0040]
@ [01F0] Size [0010]
ROM [2]
[Executive ROM] @ [1000] Size [1000]
[GROM] @ [3000] Size [0800]
VIDEO PRODUCERS [1]
AUDIO PRODUCERS [1]
INPUT CONSUMERS [2]
[Hand Controller #1]
[Hand Controller #2]
Peripherals Done
Peripheral Inserted: [Intellivoice]
Processors [1]
[SP0256]
RAM [1]
@ [0080] Size [0002]
ROM [1]
[Intellivoice ROM] @ [1000] Size [0800]
VIDEO PRODUCERS [0]
AUDIO PRODUCERS [1]
INPUT CONSUMERS [0]
Peripherals Done
Peripheral Inserted: [Tron Solar Sailer]
Processors [0]
RAM [0]
ROM [2]
[Cartridge ROM] @ [5000] Size [2000]
[Cartridge ROM] @ [D000] Size [1000]
VIDEO PRODUCERS [0]
AUDIO PRODUCERS [0]
INPUT CONSUMERS [0]
Peripherals Done
END OF LINE.
 

FluBBa

Well-Known Member
Member
Joined
Jan 16, 2004
Messages
130
Trophies
0
Age
46
Website
www.ndsretro.com
XP
980
Country
Have you looked at my GitHub? https://github.com/FluBBaOfWard?tab=repositories
In main.c of one of the emulators you can see how I set up the sound, just register a callback that renders the sound according to the settings(8/16bit, stere/mono) plus length.
I even have an AY38900 there which should work without too much trouble.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
Thanks @FluBBa - I'll take a look! I'm getting 735 16-bit samples into a buffer whenever a frame is rendered. Not 100% sure what to do with that - but maybe it's just as simple as registering the callback as a 16-bit PCM and telling it where the buffer is.

As far as the emulator itself - it's kinda running!! I know this output won't be impressive - but it represents a huge step forward for me. The Intellivision only has 16 colors - so I render them out as "text" to my console for debugging as the letters A-L. Here is Astrosmash loaded up and actually clocking CPU ticks and frames outputting... the 'L' is that lovely intellivision green background retro-gamers know so well!

Unfortunately the emulator renders everything in 32-bit (well, 24-bit) RGB which doesn't appear to be ideal for the NDS. For now I'm going to add a translation layer that will copy it to the NDS video memory as 8-bit and then find a way to streamline the whole thing later if I can get it to render right. My guess is that it will be slow - but I can fix slow :)
 

CrashMidnick

Well-Known Member
Member
Joined
Jul 22, 2015
Messages
299
Trophies
0
Age
38
XP
1,222
Country
France
It. Is. Alive! Slow... about 50% speed right now on the DSi but sound works, inputs work and screen output works. Not bad for 20 hours of effort :)

It's going to be a mountain of work to speed it up and get all the overlays in ... but the hard part is over!

That was fast !! Keep up the good work ;)

frankenstein-its-alive.gif
 
Last edited by CrashMidnick,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
Thanks for the links, Cloud. I investigated jzintv as it is rumored to have very high compatibility but, like BLISS, is highly layered to the point where it really bottle-necks these old, slow CPUs. But I'll see what I can gleen from the CPU core over there. Right now, everything is running on my Nintellivision but just 50% speed which I'm working on improving.

In the meantime, here is the first DS screenshot of Treasure of Tarmin (aka Minotaur) with ALL the graphics shown (on DS Lives, the entire bottom row of icons is missing).

upload_2021-9-1_7-37-30.png
 

CrashMidnick

Well-Known Member
Member
Joined
Jul 22, 2015
Messages
299
Trophies
0
Age
38
XP
1,222
Country
France
And we're up to 60FPS and beyond on some games (DSi only... DS is still pretty slow). I had to add in a throttle for the first time which is a good sign :)

View attachment 274583

What is the average frame rate on regular DS ?
Did you have time to try those games : burger time, shark shark and tower of doom ?
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
What is the average frame rate on regular DS ?
Did you have time to try those games : burger time, shark shark and tower of doom ?

I only tried one game on the original DS: Astrosmash... and it ran at 15 FPS when the DSi was running at 30. I haven't gone back to the DS now that I've got Astrosmash running at 60... but we can probably interpolate that we are half-speed which is not acceptable to play.

I did try Shark Shark and Tower of Doom - both of those run at full 60FPS on the DSi.

Beauty and the Beast is down around 55FPS but playable...

The Intellevoice games are struggling down closer to 50FPS but I believe those will be possible on a DSi sooner or later with this project.
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
Yeah, for sure. Shark! Shark! is phenomenal and is one of the few games on the Intelly Lives DS that works pretty well. So my emulator won't add much to that... but Beuty and the Beast is equally great and will now be playable on the DS (well, at least DSi for the short-term future).

I do plan on having a fully mappable set of keys for L/R X,Y,A,B such that any of the overlay keypad keys can be mapped on a per-game basis. This will allow much more flexibility than the DS Lives compilation. For example you will be able to map arrow fire UP,DN,LEFT,RIGHT to the XYAB keys and you will be easily able to run and shoot in one of the cardinal directions (but will need the touch screen for the other off-directions). This alone will make playing AD&D Cloudy Mountain much more enjoyable.
 
Last edited by wavemotion,

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
Added the standard controller and the ability to load games from a menu. On the DSi, non-Intellivoice games are running at 60FPS with slight dips into the upper 50s (still fine for gameplay). On the older DS hardware things are closer to 40FPS but that's still gives hope that further optimizations will get this into the playable range sooner or later.

I played a full game of AD&D Treasure of Tarmin last night... so very satisfying!

upload_2021-9-2_7-10-44.png
 

wavemotion

Benign Geek
OP
Member
Joined
Nov 23, 2020
Messages
430
Trophies
1
XP
2,908
Country
United States
As usual, I'm not one to sit on things too long... First beta release is here.

https://github.com/wavemotion-dave/NINTV-DS

Place NINTV-DS.NDS on your flash cart
All ROMs must use .int extension
In the same folder as the ROMs, you must have the following 3 files (1 of which is included in the release package):
grom.bin
exec.bin
knowncarts.cfg (part of the release package)

If you want to play Intellivoice games, you will also need ivoice.bin

Don't ask where you can get the grom, exec and ivoice binaries... if you have any of the Intellivision Lives products over the decades you likely have them or you can seek them out elsewhere.

Enjoy - it's probably buggy and won't run anywhere near full speed on the older DS... but on a DSi there's a ton of fun to be had!

upload_2021-9-2_18-0-56.png
 
General chit-chat
Help Users
    gudenau @ gudenau: This source file is now valid C, C++, Java and Scala.