Monday, February 2, 2015

Happy New Year!

Belated New Years greetings to you, special reader! Special because I doubt that too many people read the blog regularly especially now that I'm only updating every couple of months. So there you go, you're probably more or less unique. Rejoice in your individuality you little retrotechnohipster you.


So 2015 found me taking a brief hiatus from working on ZX Prism as I was in the UK for a month visiting family. On my return, I used the space the month had given me to take a step back and plot out the next few months' worth of work on ZX Prism.


More on that later, firstly let me fill you in on the work done on ZX Prism since the last update:


ZX Prism's "ROMs" are now stored in flash memory, and ZX Prism has been configured to use flash instead of on-FPGA emulated ROM. The flash chip provides 256 x 16K "ROMs". At power-on, ZX Prism boots from "ROM" 0.   ROM switching is done by OUT 60987,x where X is the ROM number you wish to page in, with "X" being an 8 bit byte of course. Additionally, the Spectrum 128 and +2A/+3 ROM switching mechanism is implemented. Port 7FFD bit 4 alters bit 0 of the ROM  number and Port 1FFD bit 2 alters bit 1 of the ROM number.


Added "SAFE" ROM mode. This is entered by holding reset (F12) and tapping F9. It maps a predefined ROM image stored in on-FPGA emulated ROM into memory location 0x0000. Therefore, ZX Prism will be bootable even if the flash chip is blank or corrupted. Currently on the development ZX Prism, this ROM image is the standard 48K spectrum ROM but will be replaced with a specific ZX Prism boot/utility ROM in future (containing, amongst other things, firmware for "flashing" ROM images into the flash memory)


Added "Programming" ROM mode. This moves the selected flash "ROM" page to 0x8000 in memory, enables the WR (write) signal to the flash chip, and presents the SAFE mode "ROM" at 0x0000. This mode is only used when programming or erasing the flash memory.


Wrote a rudimentary flash memory programmer/eraser in BASIC. Programmed the development ZX Prism's flash memory with the following ROMs for testing purposes:
  • Sinclair Spectrum 16K/48K ROM
  • Sinclair Spectrum 128K ROM 0
  • Sinclair Spectrum 128K ROM 1
  • SE BASIC IV ROM 0
  • SE BASIC IV ROM 1
  • +3eMMC ROM 0 (hacked to use DivMMC's SPI ports)
  • +3eMMC ROM 1 (hacked to use DivMMC's SPI ports)
  • +3eMMC ROM 2 (hacked to use DivMMC's SPI ports)
  • +3eMMC ROM 3 (hacked to use DivMMC's SPI ports)
  • Some interface 2 ROM cartridge images
All worked as expected after a little bit of refactoring of the CPU data bus MUX :)


Added support for DivMMC. Much time was spent trying to debug this. To date, it's a partial success. Whilst the DivMMC memory control and automapper are not working (and have been temporarily disabled), the card control and SPI ports are working fine. These were tested by using the +3e ROMS for ZXMMC which were hacked to use the DivMMC port addresses. I've successfully loaded, saved and renamed files on a +3eDOS partition on an SD Card.   For many this would be an acceptable solution, but I'd like to get the memory control and automapper working so that I can use esxDOS in the future.


Fixed an intermittent crash when booting to +3eMMC ROMs. Debugging this, along with trying to debug the DivMMC automapper, took up much of November. When I finally found the cause of the crash I could have slapped myself. The +3eMMC ROMs check for a disk in the floppy drive. As ZX Prism doesn't have a floppy controller but does emulate the floating bus, this meant that a read of the floppy controller port would sometimes return 255 (as a +2A/+2B does, indicating no floppy controller is present so fall back to +2A mode) but would sometimes return the last byte read by the video circuit - and it was this scenario that was causing the crash. The fix was therefore simple - return 255 for any read of the floppy controller's IO ports. The emulated floating bus is still returned for any other unused IO port.


So that's where I am today - ZX Prism can load and save to SD Cards which have been formatted to work on a +3e. For compatibility, I can switch to use the original Spectrum ROM. I can run the image of an Interface 2 cartridge. I can write new ROMs to the flash memory and boot from them. Plus all the other groovy stuff that's been discussed elsewhere on this blog.


A pretty good place to start out from in 2015 :)


So what's on the cards for this year? A small list of what I'll be working on next:
  • Refactor the MMU and data bus MUX so that they're easier to add to/modify.
  • Update the MMU so that it can switch in either 8K or 16K pages easily.
  • Add support for the Chloe 280SE "sideways" memory paging model.
  • Add support for the Timex/Chloe screen modes
  • Hardware: interface an audio codec to the FPGA
  • Hardware: simple kempston joystick interface
  • Hardware: improve the VGA DAC
  • Add AY audio chip support; investigate modelling other audio chips (SAA, turbosound etc)


There are other things on the list of course, but that's enough for starters I think!