FPGA Pokey replacement - discuss!

Nes4life

Active member
vacBacker
Feedback
11 (100%)
Credits
1,117CR
Maybe someone is already working on this somewhere behind closed doors but I’d like to put forward ‘FPGA replacement for the Atari Pokey’ as a candidate for the next community-driven hardware project. I’m guessing it’s going to be ridiculously complex, or perhaps it’s just not possible for some technical reason I’m unaware of, but either way I welcome some open discussion on the topic. The arcade community is going to need this in the not so distant future (perhaps even now) as availability of spares has dwindled and prices are climbing. I know it’s easy for me to request this as I’m not going to be bringing much to the table (I can’t program in VHDL or Verilog for example), but together we might have the skills, dedication and time to do it collectively, or we might know of someone or a group who’s already done it (or the bulk of the work). I’m willing to donate a Pokey to someone like @ArcadeHacker if we need to life the lid on the real implementation.

I’m contacting fpgaarcade to see if it’s already been done. I’m guessing those guys have implemented parts of the Pokey for use on larger FPGA designs but maybe haven’t yet put that isolated implementation on a small ‘drop-in’ FPGA. From my understanding, NOS Pokey cost between £20 to £30+ (big thanks to @jonhughes for organising the Pokey chips order), and QuadPokey are the price of a small car, so looking at a FPGA replacement is definitely feasible from a cost perspective.

I’ve seen a few links to projects that replicate Pokey in TTL(!), and I definitely salute those guys, but obviously not feasible for the mass market.

Discuss, paste-links, offer services, dob-in tinkerers, and cuss in this thread!Nes4life2018-10-04 08:07:34
 

DanP

Administrator
Staff member
vacBacker
Feedback
5 (100%)
Credits
2,175CR
As mentioned on Slack, here's a link to a Quad Pokey (4 pokeys in one) already done in FPGA;

https://hotrodarcade.com/collections/new-arcade-parts/products/new-atari-quad-pokey-eliminator-replacement-board

It does look to have some compatibility issues, this one only works on Major Havoc and not the other quad pokey games.

I think the technical challenges to getting a working FPGA pokey aren't insurmountable. The issue is (or was) in keeping the price point for such a device down low enough to be attractive, and by that I mean near to or lower than a real pokey IC. With the rise in prices that point has obviously moved but as the quad pokey shows, there's still work to do to get a 100% compatible with all games FPGA pokey done. The testing alone will be a massive task, that's where a community effort will definitely help!

I think there are 3 distinct things a pokey does (there may be more?);

1) Input for Pots and Keys (from its home computer origins)

2) Audio/Sound effects generation

3) Random number generation (if this doesn't work the mushrooms in Centipede are all in a line, the Asteroids in Asteroids Deluxe are all stuck in the middle of the screen)

Dan

P.S I've got a weird bootleg Missile Command with a Pokey in TTL adapter board that I can dig out if it will help with this project. From memory it worked OK in a real Missile Command as well but the sound was (to my ears) slightly off.

P.P.S Mark Haysman did a pokey on a breadboard, his input will be invaluable if you can get it.
 

iamjimmi

Active member
vacBacker
Feedback
8 (100%)
Credits
481CR
Check out what the guys from hotrodarcade.com have been up to.

Also their thread on KLOV.

They do have a QPokey FPGA board but currently only works for Major Havoc. And the cost is on par with costs of buying the nos pokeys i.e. cost of small car.

Not for a minute saying it's not a project worth exploring but those guys might have already done some of the leg work.
 

lix

Active member
vacBacker
Feedback
1 (100%)
Credits
545CR
I've been thinking about designing a set of generic PCBs for custom chip replacements, where a small but powerful FPGA is mounted on 24, 28, 32 and 40 pin DIL header boards. Think of it as a universal custom chip replacement. All of the pins by default are connected to the FPGA IO pins, but solder pads are available next to the pins in order to connect a pin to supply or ground for the chip (well the onboard regulator as the FPGA will most likely need special voltages). The board will also need signal level conversion ICs or the FPGA to have 5v tolerant inputs via dropping resistors, that's all something that I'm researching right now.

Theoretically you could even use one to replace a CPU like a Z80 or 6502 if you dropped the logic core into one and reconfigured the supply pins. Even better, in this usage scenario you could add replacement ram or host alternate ROM images within the FPGA logic if it has enough spare gates to be configured as such!

I've bought a couple of FPGA dev boards and I'm learning Verilog right now. I do have a lot of projects on the go at the moment though so I don't know what kind of commitment I can make, but I am looking into it all. My current project is figuring out if I can bring CPS1 customs into FPGA form, for all of mine and everybody elses glitchy boards.

Certainly wouldn't mind some spare Pokeys myself, I have a shed load of Atari boards but many years ago I harvested a bunch of them from Atari 7800 carts, which I guess now is a bit frowned upon with homebrewers wanting the carts too.
 

Mitchell Gant

Active member
vacBacker
Feedback
2 (100%)
Credits
884CR
I've been looking at POKEY replacement for a while, those videos I linked above I did in 2012!

DanP said:
The issue is (or was) in keeping the price point for such a device down low enough to be attractive, and by that I mean near to or lower than a real pokey IC.

That's the main reason for not going much further with it as Dan says. The last lot I bought were about £12 each, and you can't build much for that sort of cost.

Now it looks more possible though, and it's only going to get worse.

DanP said:
I think there are 3 distinct things a pokey does (there may be more?);

1) Input for Pots and Keys (from its home computer origins)

2) Audio/Sound effects generation

3) Random number generation (if this doesn't work the mushrooms in Centipede are all in a line, the Asteroids in Asteroids Deluxe are all stuck in the middle of the screen)

A POKEY does quite a bit more, but I'm not aware yet of any Atari games that use more than the three functions Dan listed.

Star Wars did have the PCB laid out to use serial data in/out, for possible linking cabinets together, but was never implemented.

Keyboard scanning is obviously used on an Atari 400/600/800/etc computer, but don't think the arcade games use that. They DO use POT inputs, but in a very crude manner. It's simple 8 bit parallel port read for DIP switches/button inputs. Easy to emulate I think.

Us arcade collectors should really be leaving the real POKEYs for the home computer collectors for this reason.

There's a timer interrupt (as well as keyboard and serial interrupts) that I doubt will be used on arcade games, so that's another chunk of logic to leave out.

Even after removing that there's quite a bit of logic to generate, certainly beyond the small CPLD devices that Colin D used for the SLAPSTIC and SLAGS repros. I think the other programmable DIL devices that are used for various Namco custom replacements are also too small. Please prove me wrong someone!

There's an FPGA Asteroids Deluxe that outputs to a raster monitor, written by Mike J of FPGA Arcade fame, with VHDL code available. I looked at the POKEY he'd done, stripped out the unused parts and tried to compile but it was still many hundreds of logic elements. This was as recent as a few weeks ago I did this.

If you then turn to larger devices like FPGAs or newer larger CPLDs, they're 3.3V only, so you'd then have to build a PCB with the FPGA, a regulator and voltage translation devices. That's pretty large so unlikely to fit in place of a 40 pin DIP POKEY. That doesn't necessarily rule out the Quad POKEY though.

How about software emulation on a micro-controller? That's what I did with the dsPIC in the Youtube videos. Again it's 3.3V, though the dsPIC and some other devices do have 5V tolerant input pins. The problem then is that I didn't have a bus interface to connect my PCB to a real arcade PCB. You have to support the POKEY 16 address I/O register scheme with chip selection and output enables with in the timing of the arcade board. Not easy to do, but perhaps possible?

The emulation has a maximum 23KHz sound sample rate, so not a real POKEY output waveform. Sounded OK to me, but then I already have a constant 10KHz tone in my hearing... thanks Lemmy!

Or you add some external logic for the bus interface, but then it's back to a large PCB that won't fit a 40 pin DIP footprint...

There's also the audio output. My dsPIC PCB used a DAC I hacked on to the board, but a real POKEY has a strange 4/5 bit analogue output I believe. You can't just output from an FPGA or CPLD either without more external circuitry.

They're just two methods of emulation, one based on something that's 90% there. But the 10% remaining is the killer.
 

FPGAArcade

Newbie
Credits
20CR
Hi.

There is a reasonable Pokey FPGA version in my public repos. I'll take a look at the schematics and see if it can be improved. I would need to model the analog stuff better to make a replacement part though.

So, currently I have 100s of the 28 pin CPLD based modules for the namco stuff, and a 48pin FPGA board. I'm doing a 40 pin CPLD module at the moment, and I reckon I can get the pokey logic into one of the Atmel CPLD devices. Will keep you informed.

/MikeJ (fpgaarcade)
 

Mitchell Gant

Active member
vacBacker
Feedback
2 (100%)
Credits
884CR
Hi Mike,

See my post above, if it helps fit it in a smaller device, you can leave out all the pot handling functions and just use a straight 8 bit read.

The Atari game code I've looked at (Ast Dlx, Space Duel, Gravitar/Black Widow, Tempest, etc) just do a parallel read from register 0x8 ALLPOT immediately after a write to 0xB POTGO

It would be great if you could fit onto one of your existing boards!
 

John Bennett

Senior Member
vacBacker
Feedback
10 (100%)
Credits
5,002CR
As a novice at FPGAs and someone who's had 10 minutes research into what a Pokey is, forgive the any dumb questions:

1. What are the low-level timing requirements for operation? Does it have to do anything cycle-accurate at >1MHz, to function with arcade games, or do you just dump data in the registers and forget about it?
I'm guessing it might be different for different functions.

2. Are the non-arcade functions big, or are they dwarfed by the audio part?

3. How far is what people are willing to share from what can be compiled and implemented in an arcade game?

At least it's pretty easy to change devices in Quartus to see if something will fit (and if it'll go into a 5V part, then great).
John Bennett2018-10-04 12:20:24
 

Nes4life

Active member
vacBacker
Feedback
11 (100%)
Credits
1,117CR
Great discussion so far! Looking forward to MikeJ @FPGAArcade coming back with his public implementation and its current state / suitability. Perhaps a few people getting involved with porting his effort to an affordable module (FPGA or CPLD) is probably the way forward. Reducing the size by stripping unused functionality sounds like a great idea. The community could help here by listing all the arcade games that use the Pokey in a single list and hunting down the required functionality for each game.

@Mitchell Gant Neil your effort looks really quite epic (well done!) and I believe you've got a lot of knowledge / experience in which games use what functionality already; would you mind starting a table of games with functionality that we can populate? I've no idea if this is the best collaboration platform for this; but it's definitely a start! If you want to start a KB somewhere or a shared document that people can openly alter then please do so if that's easier. Alternatively, I can start a Google doc or something if that's helpful.

Please, if anyone else wants to chime in with some ideas / knowledge or wants to get involved then say so here. I don't want to call the shots but I do want to help an open and community-led effort come to fruition. The last UKVac hardware project was pretty inspiring!
 

VectorGlow

Active member
vacBacker
Feedback
34 (100%)
Credits
900CR
The Wikipedia page may be useful to some:

https://en.wikipedia.org/wiki/POKEY

It's pretty detailed.

and this:

https://user.xmission.com/~trevin/atari/pokey_regs.html

(this may reproduce info on the Wikipedia page above, I haven't checked)

Is the MAME source for the Pokey of any use?

https://github.com/mamedev/mame/blob/master/src/devices/sound/pokey.cpp

I don't recall all of the games that use the Pokey, but here's some:

Missile Command

Gauntlet

Centipede

Asteroids Deluxe

Tempest

Millipede (uses two Pokeys)

Crystal Castles

Marble Madness

Star Wars

feel free to add to the list.

VectorGlow2018-10-04 16:41:38
 

ColinD

Active member
Feedback
6 (86%)
Credits
1,367CR
I have my own 40 pin CPLD Module design, it's very basic but works well and uses a 100 pin device at 5V. Can be Altera(Intel) or Atmel (Microchip) and probably some other devices.

It can take CPLD's of up to 160 macro cells (128 cells is a good happy medium - but fairly basic and nowhere near an fpga in density) but is enough to do a few basic different devices. It also allows you to 'carefully' cut it down in size if you really needed to (say to do a 28 or 32 pin device), has a few but limited basic options for power pins, and will also take a 3.3v regulator if required as some of the 5v devices are now obsolete. I've not explored 5v tolerant inputs and whether 'some' devices need additional parts and such. There are still some 5V devices available and in production.

To fully emulate a pokey, I guess you need to take into account analogue inputs and also possibly analogue outputs too (or use PWM). If the rest is digital then fair enough.

As shown above in one of the links, using a reasonably fast micro controller or dsp (as long as relatively low cost) also seems fairly viable too. In this case we don't need to emulate a full sound board and just need enough power and speed to be able to render the audio and poll the control pins for the registers.

I'm happy to help in some respects but its a fair bit of work to repro the full thing in detail. If some features are not used such as the pots inputs then it becomes a little easier.

So.. clearly there are a few ways to crack this...

ColinD2018-10-04 19:43:47
 

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
*cough* if Pokey's really fetch anything up to £30 these days then I could be persuaded to part with some. I was selling NOS ones at one point having brought a load of them in from the US. I actually can't remember what I was charging (I'm sure someone will know) but it sure as hell wasn't £30 each. I'd be surprised if it was £20 for a tube!

Times change though I know.

As for the discussion at hand I think you've already found that being cost effective about it is going to be difficult. A lot of the FPGAs that we take for granted are not so readily available any more. The world is marching on, and by definition, we are not.
 

Bensonrad

STILL looking for an Outrun & Paperboy!
vacBacker
Feedback
68 (100%)
Credits
939CR
guddler said:
*cough* if Pokey's really fetch anything up to £30 these days then I could be persuaded to part with some. I was selling NOS ones at one point having brought a load of them in from the US. I actually can't remember what I was charging (I'm sure someone will know) but it sure as hell wasn't £30 each. I'd be surprised if it was £20 for a tube!

Times change though I know.

As for the discussion at hand I think you've already found that being cost effective about it is going to be difficult. A lot of the FPGAs that we take for granted are not so readily available any more. The world is marching on, and by definition, we are not.

I had a 2 for £10 each from you I think when my Millipede PCB turned up from the states missing them, was 2 to 3 years back though I think.
 

guddler

Busting vectors like it's 1982!
vacBacker
Feedback
10 (100%)
Credits
4,055CR
Ah yes, I forgot I sold a few a few years ago. I was already firmly in the "not really sure I wan't to run out of these" mindset by then. Technically while I don't have any Atari cabs left any more I've probably got way more PCBs that are potentially dead than I have pokey's left. I forgot about all of those. Having said that, I've personally never come across that many that need replacing. Clearly a few do or this thread wouldn't be here.
 

FPGAArcade

Newbie
Credits
20CR
I've got a few requirements for a flexible 40 pin replacement module.

In orders of increasing complexity and cost:

1 - 5V CPLD such as ATF1508AS

2 - PSOC4 from Cypress

3 - Spartan7 FPGA + logic translators

This is the most interesting for me for development and testing, but probably looking at 40$+ per module still

Might do them all!

FPGAArcade2018-10-10 10:50:42
 
Top