Friday, August 29, 2014

Progress report for August

Apologies for being quiet for a while - lots of tuning and small changes have been taking place. It's probably easiest to report just what's been going on by sharing this excerpt from the changelog:

ZX Prism version 0.12
Archived: 25/8/2014 (non-released, but flashed to board)

  • After noting that shadow warriors screen corruption stopped in 7MHz mode (though it still crashed), added check for CLK_EN='0' for SRAM_WE. This stopped the screen corruption in all CPU speeds though the game still crashes.
  • added clock enable check for port 7FFD
  • Altered CPU speed selection to give choice of spectrum clock derived CPU speeds or Video clock derived speeds: 3.18MHz, 3.5MHz, 6.375MHz, 7MHz, 12.75MHz, 14MHz, 25.5MHz, 28MHz and 51MHz
  • Altered interupt generator so it generates a CPU or Video clock derived interrupt.
  • Fixed interrupt frequencies (CPU speed derived interrupt was being generated at 100Hz  not 50Hz!
  • Fixed odd crashes at higher speeds... Now works up to 51MHz. 
  • Disabled 56MHz clock speed as I couldn't get it to run without random crashing
  • Reinstated partial address decoding for port 7FFD (fixes crashes/odd behavior in some 128K games which don't fully address the port). Am currently using the partial decoding as used on the Spectrum +3, +2A and +2B
  • Fixed another problem with interrupts - the video clock derived interrupts were running at half speed.
  • "tuned" interrupt signal duration so that they are different for each clock speed, using R-Type as a test. Settled now for values for each clock speed which i) don't cause R-Type to crash, ii) Allow R-Type to detect keypresses, iii) Allow R-Types screen updating to happen properly. These will not likely be the final durations ;)
  • Made video domain interrupt calculator equal frame length equal to 1 VGA frame (oops)
  • Successfully loads Speedlocked game (Sabre Wulf from They Sold a Million) at double speed (with CPU at 7MHz) and quad speed (with CPU at 14MHz) from audio CD

  • Flashed this version to FPGA board via Active Serial (so that it runs as soon as the board is turned on instead of having to be configured by the PC each time)
Loading a ULAplus enhanced game

And another ULAplus enhanced game. Hurrah for The Mojon Twins!

ZX Prism version 0.11
Archived: 18/8/2014 (non-released)

  • Added support to read palette entries from ULAplus (IN 65339)
  • Altered Mike Stirling's keyboard driver to handle cases where multiple keyboard rows are scanned by software (fixes "press any key" problem in Pssst etc etc etc)
  • Fixed bus timing issues introduced/uncovered by changing keyboard driver (!)
  • CPU speed stable to 28MHz
  • Fully implemented rest of port 7FFD including latch locking for ports 7FFD and 1FFD
  • Small update to VIDEO driver to allow screen selection
  • Implemented scanning of function keys. F12 sends a reset signal to CPU etc. F1-F11 send signals to the "buswatch" glue logic block to act as NMI keys, turbo buttons etc.
  • Implemented F12 = reset
  • Implemented F9 = Unlock ports 7FFD/1FFD if locked
  • Implemented F5 - F8 as CPU speed selectors (allows me to test games at different CPU speeds without having to hack their loaders which was getting tedious..)
  • Made keyboard scanning synchronous with CPU at whatever speed (stops Starstrike II crashing)
  • implemented F1-F4 as NMI keys (all 4 just send NMI to CPU at this stage)
  • fixed VRAM timing error which resulted in noise on screen on some games (eg Gyroscope)

ZX Prism version 0.1
Archived: 12/8/2014 (non-released)


  • Spectrum ROM implemented as on-chip memory, hard-coded into 0x0000
  • Implemented extra sceen resolutions (512x192, 256x384, 512x384)
  • Implemented screen decode methods: Standard, 16+16, 32 colour, 256 colour 1, 4 plane planar
  • Implemented SRAM for 512K memory pagable into 0xC000; page 2 hard-coded into 0x8000
  • VRAM page 0 hard-coded into 0x4000, no shadow screen selection yet
  • Port 7FFD partially implemented (memory select on bits 0-2, 6 and 7)
  • CPU speed selectable. Tested at 3.5Mhz and 7MHz
  • Default palette defined (except last 8 entries!)
  • ULA2 palette implemented but colour definition currently broken
  • Basic ULAplus implementation (can turn on and off and redefine RGB palette)
  • PS/2 keycode -> spectrum keyboard scanning implemented (based on Mike Stirling's FPGA Spectrum keyboard code)


  • Simple kempston joystick using on-devboard keys
  • Reset key implemented
  • PS/2 re-implemented off-devboard due to hardware issue and 2 dead FPGA pins
  • VGA re-implemented off-devboard to achieve 16 levels of red, green and blue (on-board VGA is 8 colour total)
  • Current RAM and ROM page displayed on 7-seg LED array
  • Tape IN and Tape OUT implemented via MX3232 RS232 UART.
  • Tape interface thoroughly tested and tweaked
  • Tape OUT tested with headphones only, haven't tried to SAVE
  • Beeper output directed to TAPE OUT for now (beeper port of ULA is XORed with the tape out port - some music routines, eg Manic Miner, don't work properly)

Software tested against v0.1 (and subsequently used to test fixes in later revisions):

  • Aquaplane (as expected the border effect doesn't work due to VGA timings and lack of contended memory)
  • Manic Miner (music didn't work due to how beeper is mixed with tape-out; ie digitally rather than in analog circuit)
  • Myth (seemed to work fine)
  • PSSST! (from ROM) (worked fine except 'press any key' only accepted keypress from a single row)
  • Fred (worked fine)
  • Kokotoni Wilf (graphical corruption; this may have been a dodgy load, must verify)
  • Gilligan's Gold (worked fine)
  • The Pyramid (worked fine)
  • Starbike (worked fine)
  • Match Point (worked fine)
  • Freddy Hardest (worked fine)
  • Buck Rogers (worked fine)
  • Midnight Resistance (loaded fine, redefine keys option didn't work)
  • Skool Daze (worked fine)
  • Slap Fight (worked fine though Slap Fight logo appeared to have some minor corruption -load error?)
  • Saboteur (worked fine)
  • Horace Goes Skiing (worked fine, seemed a little fast though - lack of contention?)
  • Bionic Commando 128 (crashes after loading first block on tape)
  • Super Sprint (worked fine except border effect didn't work, as expected)
  • Where Time Stood Still (worked fine)
  • Sabre Wulf (alkatraz loader from Ultimate Collected Works) (worked fine)
  • Uridium Plus (seemed to be working but couldn't move ship up and down - fire and reverse direction worked)
  • - Shadow Warriors (graphical corruption then crash)

ZX Prism loading Ghouls N Ghosts from (audio) CD


  1. I would love to have a go at porting this to the DE2-115 board from Terasic. I already ported Mikes code:

    Are you planning to release the source?

  2. I'd love to see a DE2-115 port! Yes, the source, circuit diagrams etc will be available in the future (just don't laugh at my VHDL, I'm a complete novice - this project is, in part at least, a learning exercise!)