Wednesday, 17 August 2016

Redesigning the ZX Spectrum 128k - My childhood dream :)

The ZX Spectrum was my favourite thing in the whole world when i was 8. It's what led me into a world of software and hardware design. Every since i first got a rubber keyed 48k, i always thought one day i'll make my own, never really thinking that it would be possible. However with my lifetime of 8-bit pinball hardware repair knowledge always expanding and with me developing my own range of replacement cpu and sound board hardware for various pinball systems over the last few years the thought reappeared in my mind and now didn't feel to far away :)

The thought of being able to redesign and make my own computer that could load and play games, connect up to modern TVs and be still affordable to buy or self build for the hobbits was my goal. Having spent many years with a 48k model and having pictures of the original Sinclair designed 128k machine on my bedroom wall, the 128k model had to be the one to remake and hopefully improve.  Later on in my spectrum days is did manage to get myself a +2A and +3, and even though i couldn't love them like the 'proper' Sinclair made versions i did love the 128k music and games. The AY-8912 chip is a thing of beauty and is featured in many arcade and pinball pieces of hardware from the same era.

Thinking about my redesign and remake, I wanted to approach this in the same way as my pinball hardware redesigns, so this would be:
  1. Simplify the design taking advantage of modern electronics
  2. Reduce the chip count especially within the ram chips
  3. Add additional functionality to avoid as many plug on modules being needed
    1. Kempston Joystick Interface
    2. IDE interface
  4. Maintain a fully plate through design
  5. Add power leds and test points
  6. Enable better connection to modern TVs
  7. Reduce power consumption where possible
I set to work on creating a design that would encompass the above and thought about how i would like to case this new board. I wanted to be able to offer a pcb that would fit within the original spectrum + cases or the spectrum 128k case. Of course some small modifications to the lower case edges would be needed for the different connections but would be nice to still fit within an original case.

The first design was completed and it filled me with excitement to get the board made and try it out.

PCBs arrived a few weeks later and i assembled the first prototype. I had to make a few modifications to the design, but this is all part of the design process and is how i build up my board designs. You have to start with a pcb design and modify as required, as its too complex to breadboard with full thing to begin with.

A picture of sorts was displayed and initially i was quite pleased to get something visible. My TV also correctly identified the incoming signal as RGB so that was good to. I realised that the sync line to the tv need more investigation and had another look at the SCART pinout diagrams i had.

After swapping round the input and output composite sync pins i got a nice stable and crisp picture :) though it was clear more work was needed.

Some more research was needed and cross referencing various old schematics form the original spectrum 48k revisions. The address multiplexing for the ram ics is individual 74 logic in the same way before the custom ZX8401 ic was introduced and was based on the design by here - A mistake with my conversion on A15 was identified and fixed and also an error with the VA-14 and VA-15 outputs being reserved from the custom PAL memory banks ic were resolved.

Also after some advice from fellow hardware and software designer Tynmouth Software i located some ram test and hardware test programs to try out including the excellent full machine test from Retroleum. Burned some new ics and tried them out.

The first real image appeared, which was a major milestone. This proved that large parts of the design were working and i could now concentrate of specific areas resolve the remaining issues. There appeared to be a problem displaying half the screen graphics, which seems to be every odd column and by deciphering the missing screen graphics there was a bank or ram issue.

I rechecked the original 128k schematics and the +2 schematics using a couple of versions and noticed some errors on there to do with the type of clock inverter ic used. So I experimented with various types of 7404 ic to reduce proportion delay 74AS04 (from 74LS04). I also hooked up my oscilloscope to check the clock pulses being generated into the ULA, out of the ULA and into the CPU.

I checked the video RAS and CAS signals. I realised from more research (and re-reading sections of the excellent The ZX Spectrum ULA: How to design a microcomputer book by Chris Smith) that the screen is built up from video fetches that take 2 complete sets of character blocks at a time (a set is made up of a RAS address read and 2 CAS address reads to load the pixel data and attribute data for 1 character block. The screen is made from 32 x 24 character blocks)

This made me wonder if my graphics issue was related to timing issues with the ram and the delay to the start of the second character set.

The pulses looked good though there was a question over the start of the second RAS pulse in relation to the end of 2nd CAS and before the start of the 3rd CAS. Trying the ram tester rom again now gave a successful result but the screen was still messed up.

Back to the drawing board with the video ram fetch. Lots of late nights and weeks passed whilst i retraced all my designs and checked over all schematics, as well as experimenting with some capacitor values on the ras and cas lines to modify the timing signals slightly. I also tried various different ram chip speeds. My design uses 41464 dynamic ram ics as only 4 ics are needed for the full 8 pages of 16k (128k total)

Then....  late..... very late one evening the magic capacitor value was found !! A single additional capacitor  was required ion the video ram RAS select line n conjunction with some logic gate buffering delay to the multiplexing video address select line. (taken from the 48k schematic rev 4b)

To see the familiar operating menu appear is all its crisp glory was such a rush! I think i must have just sat down and starred at it for around 1 hour! I created a quick test

Next up was to load a game and see whether i could actually play something and also test the ay sound & music generator :) I populated these sections ...

There's more to talk about in terms of the sound input side and how i loaded wav files into the system using just a usb stick but i'll leave that for another post, as well as going into more technical detail on a few other areas.

The project works, has been a major learning curve with some tricky moments, but has been so rewarding. I'll be making my first batch of assembled boards and kits soon so you to can have a new 128k Spectrum in and old case :) The boards will be available like all my other pcbs and products on my web store here.

The new boards will feature:

  • Reduced chip count and power consumption
  • Reduced custom chip usage
  • Fully spectrum 128k compatible
  • 8 pages of 16k ram 128k total 
  • High quality picture - RGB scart socket with proper tv identification capability. 
  • Standard female 21 pin socket for use with stock fully wired scart cables
  • Built in kempston joystick port
  • Built in IDE 40 pin connection
  • Uses the 128k ULA IC - Ferranti 7K010E/Amstrad 40056
  • Full set of test pads
  • Power leds
  • Low power 5v regulator
  • Single 12v supply power in
  • Modern reset chip and on board reset button
  • AY-8912 sound generator on board for retro 80s music
  • AY-8912 expansion connector for 3rd party dev
  • Sound line in for Tape loading or loading wav files
  • Sound line out for connection to amps and playing music
  • Fully compatible card extension port
  • Full plate through design, no SMD
  • Designed and assembled in UK

Now for some videos with music and more screen shots :)

Thanks to:

Tynemouth Software
The ZX Spectrum ULA - How to design a microcomputer book by Chris Smith

Sunday, 14 August 2016

Fixing a Midway Rampage Arcade PCB (MCR Monoboard 1986)


I thought i'd start a new thread on another hardware project i have started recently. I'm really enjoying learning about old arcade pcb designs and how they work etc after getting my Nintendo Donkey Kong 4 stack up and running earlier on this year/last year as its something different to pinball pcbs which i work on all the time!. I have another nintendo pcb coming soon which i'll be diving into aswell on another thread - Donkey Kong Jr pcb, but this thread is about my latest purchase of a Midway Monoboard :)

So i was going through some of the old 8-bit games having a look at some of my old favourites and who made them etc. This was started by the discs of tron speech board project i did recently for someone. I found myself looking up all the old Midway (Bally) arcade games that came out at a similar time to Tron and the few years after etc. Tapper was one that i really loved and still do and another was Rampage.

I started researching about the MCR boards sets and the monoboard version for Rampage. This lead me to search for some on eBay which i ended up finding an 'as is' untested and presumed non working 'Sarge' pcb.

I decided to see if i could get this board up and running somehow and convert it to a Rampage game. As what to do with the cabinet side of things once i get the pcb to work is something else to think about and i may build a new cabinet solely for running original pcbs in etc Ideas welcome here :)

So whilst waiting for the PCB to arrive from the USA i burnt a new set of roms in anticipation.

The board arrived this week just gone and i had a check over it. There were a couple of missing chips, some broken caps and a rusty cpu chip, but other than being pretty dusty it all looked pretty good.

Changed the CPU chip and replaced the 3 large power caps. Changed over the full ROM set and reseated all socketed chips. Made some test cables, 1 power cable and 1 video cable.

Plugged it all together. Now, currently i don't have a spare CGA monitors so i'm using a gonbes arcade vga to cga convertor card and an LCD for testing. This may or may not be a good idea but i wanted to see what i good get on screen if anything :)

At first power on i didn't get anything other than a pure green screen, then after a little bit of messing with power cabling to the gonbes board, checking a few signals to the cpu with my trusty basic logic probe and pressing the reset button on the MCR board a few times, I got a few glimpses of the following:

Pretty damn happy to see this even though there is more work to do with the sync etc. These images flash up on screen then go back to 'no signal' so i'm wondering if the gonbes card is no use really here and i need to get something else setup for the picture. Anyway that's where i'm at with it so far. Let me know what you think :)