More SID Work

Well, I’ve been hard at work tweaking my SID implementation. So far, I have moved all control functions over to a second 6502, added a bunch of hardware (bankswitching, display control, etc) and finally loaded some REAL SID tunes into it. I quickly ran into a ton of bugs with the envelope unit, which have been fixed now. I also worked on the combined waveform thinger too, and figured out pretty much how that works. There’s still a few issues left that I have to solve, like some aliasing between the SID output and the sample rate of my DAC. This is no surprise, however, since the NES has a similar problem with the periodic noise. I already have a 256th order FIR filter for the NES stuff, so I may just drop that in. On these following two demos you will probably hear the aliasing issues if you know what to listen for.

Also note that I know the pitch is slightly off on my demos- I am using 1.02MHz (NTSC rate) while most of these tunes are designed for PAL rate (0.98MHz). you can slow them down 4% or so if you wish to hear them at the correct pitch, tho it will be 4% slower. I was thinking of speeding the timer up and then slowing it down to compensate but I’m kinda lazy.

I’ve run 20 SID tunes through it so far and found a few minor bugs but I think they are supposed to be there. I’ve been listening to a real SID to determine which is the case. The jury’s still out- if nothing else, it’s just more noticable here for some reason and I will have to fix that.

Soo, give it a listen:

Rambo, set of tunes (10 mins)

Tetroid, a “scene tune” that abuses the SID.

More SID tunes!

Well I converted my other SID player code I wrote ages ago so that it can write to my SID that is sitting at a rather unorthodox 06000h. I tweaked a few things and got all the distortion and crap out. I found out that my noise on channels 1 and 2 was dead though. Noise on channel 0 worked fine, however. This is because when in reset, the state machine is reset too, which can only init the first LFSR. whoops. I manually poked the test bits which loaded the goodies into the remaining 2 channels and they worked fine after that.

Anyways, if you want about 9 minutes of SID bliss, from the editor “Studio 64”, this is your lucky day. Tune #4 is an amusing rendition of “Sweet Dreams”. giggle.

Listen to it!

SID in an FPGA with hardware filter, oh my

Well I decided to try to make a SID in the FPGA. So far, I have it playing a SID tune somewhat. This is about 1 day of work so far.

listen to it!

So far, the SID enveloper, waveform generator (with “invalid” bit combinations), and some other goodies are done. For starters, I am outputting the straight and filtered audio separately, so that it can run to my filter circuit.

Unlike all the other FPGA SID implementations out there, mine’s gonna use a real live filter! I have designed and made the filter, and it seems to mostly work. It’s made similar to the filter on the real chip, using MOS transistors and such, so it should accurately model it. I hope. I passed some waveforms through it while I dinked around with the cutoff freq and all that jazz and it sounded pretty decent. We’ll know when I hook it up to the FPGA if I got it or not.

All in all not a bad deal for about 1 day of work. Hopefully tonight I will have a proper “SID core” set up and running. We’ll see.

SP0256-xxx Emulator on a PIC!

Well, I’ve been coding on it the last 5 days on and off, and it mostly works. I made an SP0256 emulator on the PIC18F! I also dumped my set of SP0256’s including the SP0256-017 SP0256-018, the -004, -012, -019, -053, -060 and -AL2. I dumped a bunch of SPR128’s and SPR016’s also.

The emulator mostly works now, and only two of the allophones in the AL2 chip don’t seem quite right. I had alot of “fun” cramming 480K multiplies/sec into the code, and everything is incredibly optimized. The LPC “core” itself takes around 56% of the CPU while it is running. The chip spits out 10KHz 10 bit samples to an external DAC, but it could just as easily use the PIC’s PWM output. The SP0256 uses a 7 bit PWM output which you then lowpass filter to produce it’s audio output.

Wonder if anyone would be interested in a “true” SP0256-AL2 replacement that doesn’t cost $20-$30? I could also make SP0256-??? replacements of any other SPxxxx chips, like the SP0256-017 talking clock chipset. The PIC has enough room for up to 40K or so of speech data, and I stuck the two speech ROMs from the -019 (Odyssey^2 “The Voice”) onto it and was playing around. Though htere appears to be a problem or two with one of the SP0256 opcodes in the microsequencer still.

Hopefully later I will have some audio samples up and a pic of the board… tho the board isn’t much to look at, just a piece of perf with 2 chips on it.

PES Hacking for fun and (non)profit!

Well, Lord Nightmare wondered what could be done about this PES box. For those that don’t know what it is, it’s a white box with a TSP5220CNL TI speech chip inside it. There’s an 8031, RS-232 port, and a few other doo-dads. It was apparently some kind of educational aid. The box’s PCB inside is marked: “Pacific Educational Systems VPU Ver 2.1” The EPROM had a hand-written sticker on it marked “2.5” which is apparently the version number. There’s an empty spot on the board for a RAM chip, but it’s not populated. The box will run OK off of 12V DC, or a 9V wall wart (since these output around 12V DC when lightly loaded). Don’t feed it much more than this, the cap on the input is only rated for 16V and might go kablooey otherwise.

The problem with it is that the handshake handling is very crummy on it- it is almost impossible to make it work without overrunning its (nonexistant) buffer. I tried shutting off the serial port FIFO, but even that wasn’t enough. Sooo, out came the EPROM and the disassembler!

The EPROM contents were disassembled 2 years ago when we originally got the boxes to see how they worked. Come to find out, the code is only around 120 bytes, so most of the 8K EPROM is just wasted space.

I pretty much rewrote most of its code and added a 64 byte FIFO as well as proper handshaking control and XON/XOFF. This lets you feed it from a serial port and not worry about buffer overruns (within reason). The end result is it works perfectly when I send it a sample file dumped from Paperboy (arcade).

The frequency is a tad high though for Paperboy, so I removed the 82K resistor and dropped a 100K resistor in the box, then tweaked the pot until I got 160KHz on the ROM clock (as it came, it was set for 200KHz). I probably didn’t have to swap the resistor out but that’s how it ended up.

For fun, I swapped in a TMS5200, which is an earlier (buggy) version of the TMS5220. The results of both can be heard. The first is the TMS5200, the second is the TMS5220. The MP3 is here:

MP3

If you want to modify your box, you can get the asm file and binary files here:

PES.ASM
PES.BIN