Boot system

The Next/TBBlue runs some steps during boot to kickstart the machine. On power-on, the VHDL configures yourself as a ZX Spectrum 48K, sets the IPL and bootrom internal flags and runs IPL code in the original ROM space. Flag Bootrom indicates whether the IPL will be mapped in original ROM space.

The Next/TBBlue then performs a few steps to start the machine. When the Next/TBBlue is powered on, the VHDL is configured as a ZX Spectrum 48K, but instead of the original ROM it loads the contents of the Initial Program Loader (IPL) explained below, with and 48K of RAM, with the SPI interface from DivMMC active.

The IPL contains 8KB of code, mirrored in the 16K ROM space, and is loaded from the flash into the internal RAM together with FPGA loading process. This code initializes the video RAM of the ULA and initializes the SD card. If the SD card is successfully initialized, the IPL looks for the file ‘TBBLUE.FW’ in the root of the SD, where it contains the rest of the code, and tests if any key was pressed. In the file ‘TBBLUE.FW’ there are three modules, the boot, the editor and the updater.

If the ‘SPACE’ key is pressed during boot the IPL sets to load the editor module, but the IPL checks for the existence of the ‘TBBLUE.TBU’ file in the root of the SD card, if it exists and the ‘U’ key is pressed the IPL sets to load the updater module. If none of the above conditions are true, IPL sets to load the boot module.

The modules are loaded into the RAM region starting at 0x6000 and the IPL jumps to that address at the end of the load, reseting the bootrom flag. At this point the IPL is removed from the ROM region and the RAM is mapped in this region for the future loading of the ROMs.

If any error occurs in the process the ULA border is set to red colour and an error message is displayed on the screen, leaving the machine in an infinite loop.