18

We all know that various ports of Pac-Man exist but my question is just for one specific computer. Could the Spectrum, with time and proper knowledge, run the Arcade version of Pac-Man despite it's Z80 processor running a 3.5 MHZ?

Let's assume that everything has been optimized perfectly and there are zero mistakes in the code.

How well, in a side by side comparison, will the Z80 compare to the arcade release? I won't even attempt to program it until some time (I.E I will be OLD when i do) has passed.

Vpirate21
  • 197
  • 1
  • 4
  • 3
    Hm... I used both extensively, and I'm not aware of any advantages of 6502 over Z80 from the software (i.e. assembly) point of view. There are some unique curiosities about 6502, but I wouldn't voluntarily use it after Z80. Your question conflates CPU (in the body) and a computer (in the title), but on the CPU side nothing prevents a Z80 implementation of anything that is possible on 6502. Computers are a different matter though as there are many more architectural considerations. – Zeus Jul 27 '20 at 07:51
  • The 6502 is much better than the Z80 for applications requiring data tables with less than 256 entries. Something like ldx index ; lda table,x really has no equal on the Z80. It's also really good for dealing with objects of 256 bytes or less, using (ind),y addressing mode. The z80 may have an edge for situations that require sequential through uniform data structures with more than 256 bytes. – supercat Jul 27 '20 at 15:04
  • I would expect it would be easier to port 6502 code onto a Z80 than the opposite but I only touched 6502 a couple of times back in the day so could be wrong. Porting retro arcade machine code onto retrocomputers with different architectures is the perfect use case and a much tougher job than the one we see here. – hippietrail Jul 28 '20 at 01:14
  • 2
    What is even the 6502 reference doing here? What I've seen, the original Pac-Man had a Z80 processor on board. – UncleBod Jul 28 '20 at 09:55
  • 2
    @UncleBod: Yep the OP was wrong. – hippietrail Jul 28 '20 at 12:10
  • I thought it was 6502 originally until i looked at the source code. i will amend the mistake – Vpirate21 Jul 28 '20 at 23:22
  • There was a port to Yamaha MSX (based on Z80 CPI as well) done by Namco back in the 1980s. And then there was even a port from MSX to an i8080-based Soviet home computer: http://sensi.org/scalar/media/s/pacman2.png – DmytroL Sep 02 '20 at 11:40

1 Answers1

67

Both the Sinclair ZX Spectrum and the Pac-Man arcade machine used the Zilog Z 80 CPU.

Pac-Man's display was slightly larger and vertical at 224×288 while the Speccy's was horizontal at 256×192.

The Speccy did not have hardware sprites or pixel-addressable colours.

The original 48K Speccy only had "1 bit" beeper sound though later models had an AY sound chip. The arcade machine had a Namco PSG sound chip.

But if you're willing to scale down the graphics just a tiny bit and put up with a bit of colour clash when different coloured things are too close to each other, you should actually be able to port the Pac-Man arcade ROM code to work on the Spectrum hardware.

No need though since Simon Owen already did exactly that nearly a decade ago:

Simon Owen's ZX Spectrum Pac-Man

It's not a port. You need to provide the Pac-Man arcade board's ROMs. It runs the ROM code and just emulates the hardware differences. As a nice coincidence he just released the first update in four years this March.


By the way:

I just discovered that somebody has actually done the opposite of this too. The early Spectrum classic game Manic Miner was converted to run on original Pac-Man arcade hardware! Also almost a decade ago.

hippietrail
  • 6,646
  • 2
  • 21
  • 60
  • interesting. Is there a TZX image? – Vpirate21 Jul 27 '20 at 04:09
  • 3
    @Vpirate21: No because he doesn't have the right to redistribute the Pac-Man arcade ROMs. It has a makefile that builds a tape image once you have the right ROMs. I haven't actually tried to build it myself. – hippietrail Jul 27 '20 at 04:48
  • 3
    It's very easy to build, and delightful to see a timing-perfect Pac-Man running on a 128K Speccy, complete with colour clash. You just need to find the correct pacman.zip archive for the Midway ROM images for MAME, then the makefile just concatenates a header, the roms and a trailer to make a TAP image. And it works! – scruss Jul 27 '20 at 12:39
  • @scruss: If I had a real Speccy I think I would've tried it straight away, maybe even if I had a Next. In fact even if there was a version with an anti-colour-clash technique like Bifrost or Nirvana Engine. I'm pretty sure the author didn't know about these techniques at least at the time he first did this. I don't know their overheads to know whether it would be possible but some recent Speccy games that use them don't look any more CPU hungry than Pac-Man to me. – hippietrail Jul 27 '20 at 13:20
  • For a preview, you can see it in action at https://youtu.be/lCbaOsqEFMg?t=77 or the SAM Coupé version at https://www.youtube.com/watch?v=XpOI6ym-MA8 – Tommy Jul 27 '20 at 15:20
  • @Tommy: There's a preview if you click the screengrab in the answer too, without the Spanish commentary. I forget now if I'd seen the Sam version back when I first stumbled across this, but I've never seen an actual Sam in real life either so the nostalgia isn't the same, even if it is the retrocomputer I most want (-: – hippietrail Jul 27 '20 at 16:13
  • 2
    @hippietrail - I don't think anti-colour-clash techniques could apply to this, as the author has to work within the design constraints of the original Pac-Man ROM graphics. I think colour-clash adds to the ambience of the game. The SAM Coupé was quite neat: I was at the show where it was launched, and even had a brief chat with Mel Croucher. So I've seen one, but never used one. – scruss Jul 28 '20 at 00:21
  • @scruss: Actually the graphics are not the originals as each piece had to be replicated one pixel smaller to fit the Speccy's smaller screen size, if I remember correctly when I was reading all the blog entries and such about a month ago. But I first saw his original monochrome version and agree the colour clash is part of the nostalgia, but pushing the limits of the little machine is also part of the nostalgia. – hippietrail Jul 28 '20 at 01:05
  • didn't believe my eyes until i saw the scan. Amazing work Owen! – Vpirate21 Jul 28 '20 at 23:28
  • The highest-resolution assault on colour clash gives the spectrum 8x1 attributes rather than 8x8 by continuously rewriting the attribute array for the entire duration of the visible portion of the display, but there's also nothing much else to time against so I guess that the default loss is ~82% of processor time. That is, without doing some real raster-matched programming ala e.g. the stable-output ZX80 Kong. EDIT: also, I owned a SAM Coupé. – Tommy Jul 29 '20 at 00:33
  • It doesn't have to do it for the entire visible portion of the display, just for the attributes. That's only 768 bytes as opposed to 6kb. But I haven't done any Speccy machine code programming for over 30 years and never tried to use any of the anti-colour-clash techniques. Most of the available games that use them have character-based movement, but two or three have pixel based movement and are more colourful than Pac-Man. Perhaps a new site question on the topic would be nice? – hippietrail Jul 29 '20 at 04:58
  • 1
    @Hippietrail - multicolour on the Spectrum such as Nirvana works by updating the colour attributes as the raster moves over the screen, and then updating them again for the next pixel row, so 768 x 8. It requires a lot of unrolled code instead of loops and continuously updating attrs as the raster moves down the screen in tight synchronisation. That way you can have independent 2 colours in up to every pixel row of a character square, but cost 75% of of CPU time. Even then the horizontal colour limit is still the same, a ghost approaching Pacman from the side will still cause colour clash. – Thomas Quillin Oct 04 '21 at 19:37