ZX-Badaloc  Nano

The Badaloc project can now run on the tiny Avnet 3A evaluation board, which is a cheap device with a powerful 3A-400 FPGA.


click on images to enlarge


Latest Updates:

Bootrom Firmware 0.12: Added delays to the RS-232 TX routine to allow the PsOC to deliver data through USB without overrun errors. This solved the checksum errors when receiving packets larger than 1000 bytes. For the same reason, 16K snapshots can now be saved and the Parallel Flash can be read through the Flash --> Get Rom Bank menu.
Tiny Bootloader 1.21: same patch as in bootrom firmware: this allows the xilinx .bit configuration file to be successfully compared (FPGA menu). Since the bootloader is embedded into the .bit xilinx file, this has been updated but keeps same version number.

FPGA 1.01: Write enable control bit restored for Parallel Flash programming. This bit was implemented on the original CPLD clone, to activate the write access to onboard flash chip, but was then removed in the badaloc_fpga project because all roms are stored in SPI flash then downloaded to DDR memory. In badaloc_nano the parallel flash is a must, because there is no so much ram. Hence, this control bit (D4 on $34DF register) has been restored on both the 3E project and badaloc_nano.
This bit was used for joystick programming: as on the 3E clone, the joustick programming is now accomplished by writing 'Bx' to $1F register (kempston). This will map 32 bytes of joystick layout (inputs to keystrokes mapping) in MEMORY (see 3E clone registers for more details).

Bootrom Firmware 0.11: Joystick programming routine updated to match new fpga registers.

FPGA 1.00: First version from Badaloc-Reloaded FPGA V1.11
Bootrom firmware 0.10: First version from Badaloc-Reloaded Bootrom V0.98c


This tiny evaluation board lacks a few peripherals, needed by the project:

1) There is no VGA nor PS/2 Keyboard connector.

2) There is no DDR nor Static ram.

3) The RS-232 port for ZX-Com communication is replaced by the USB port from the on-board PSoc

4) The main project's Tape Interface / SD-CARD / Joystick board can be used AS IT IS, thanks to the two Digilent-compatible 6 pin headers.

Due to lack of external RAM, the current implementation only works as a 16K ZX-Spectrum, so the only ROM that works is the 16/48K. The bootrom is however almost fully functional with SD-Card snapshot management and ZX-Com interfacing.


How to run the project:

Build this VGA and PS/2 Keyboard adapter which connects to the 40 pin header of the Avnet Board.

Optionally, you may also build the Tape/SD-Card/Joystick board described in the 3E project, which needs no changes and connects to the two Digilent-compatible 6-pin headers. This will let you load programs from tape, save snapshots to sd-card and have a powerful 16-input programmable joystick that can be mapped to any key and also works as Kempston.

Once you have the hardware ready, connect a VGA monitor and a PS/2 keyboard then upload the badaloc_reloaded_nano.bit file to your board, using AvProg and the USB cable. The VGA monitor will display the same cycling border color seen for the main project (on the 3E board). Note that if you're afraid you're sinking too much power from your USB port, just plug a *STABILIZED* 5V power supply to the power jack and move JP2 to "jack" position.

Every 8 color cycles, the firmware running on the T80 will try to boot a rom image from onboard SPI Flash at address $F0000.

This may be a Sinclair ROM, but should better be the provided Bootrom Firmware. You have two options for programming this ROM into the SPI Flash chip: using AvProg (take care to tell him to store the file at $F0000 offset) or using the ZX-Com Program. In this case, exit AvProg in order to free the virtual COM port, then start zx-com and select proper port and hardware from the "Option" menu. Then, from the "Fpga" menu select the "SPI Flash $F0000 Bootrom Programming".

Note: on my machine, I'm having trouble programming the SPI chip with AvProg. If your setup does not work after programming the ROM using AvProg, please read back the spi flash content and compare it to original file. In my case, the content is scrambled. Since I always get the same bitmap, I suppose the problem is in SENDING with AvProg, while RECEIVING seems to work. In case, use zx-com to program the SPI flash.

No matter how you program it, as soon as the ROM is in place it will be executed and the main bootrom menu will appear on the screen.

As stated above, the machine can only run as a 16K spectrum because no external ram has been added (yet). For this reason, of the many ROMs displayed on the screen, only the 16/48K can be used.

All roms should be programmed into the on-board Parallel Flash chip and their layout is the same used for the 3E version. The location for the 16/48K Spectrum rom is on bank 2, which means offset $8000 in the Flash Chip (each bank is 16KBytes in size). By now, the only available option for programming the Parallel Flash chip is AvProg. Please note that AvProg will SWAP high/low bytes of your binary file, scrambling the ROM content. For this reason, you need to run this tiny program which swaps the hi/lo bytes of a given file.

In the archive you will also find a ready-to-program "swapped" rom file called "48_reverted.rom". Just program this file in the parallel flash at offset $8000 with AvProg.

Note that ZX-Com can actually READ the parallel flash through the Flash --> Get Rom Bank menu.

Restart the system, then at the main menu press the letter 'C' (16/48K rom): the rom at address $8000 will be paged-in in memory area 0-$3FFF (as required by zx-spectrum memory layout) and your brand new 16K Spectrum is ready.

Pressing the NMI button (PUSH_B) then the 'Q' key will take a 16K snapshot to the sd-card. 48K ('W') and 128K ('E') snapshots cannot be saved just because such memory does not exists.


EF1    (PUSH_A)    Z80 Reset
EF2    (PUSH_B)    Z80 NMI (useful for sd-card snapshots)
EF3    (PUSH_C)    Inibiths the SPI Flash bootrom download, allowing ZX-Com to upload a new version
EF4    (RESET)     FPGA Main Reset

You will then probably store the project (fpga .bit file) in the SPI flash. As stated above, I'm having trouble programming the SPI flash chip with AvProg. You can use the zx-com 'Xilinx .bit file SPI Flash Program' option from the 'FPGA' menu. For this menu to work, the fpga should be in 'bootloader' mode. If you already programmed a ROM, you should prevent it's download from SPI memory by keeping pressed the EF3 button (see above).

Known issues:

While Z80 erases the SPI Flash, for example while updating the bootrom firmware, the PSoc may sometimes reset the FPGA. This error is recovered by the firmware, which will resume it's operation.


Back to Project Index