A ZX Next core for the MEGA65: a port of the open source ZX Spectrum Next FPGA core, based on the MiSTer core ZXNext_MiSTer and built on the MiSTer2MEGA65 framework.
MegaZXNext is not a ZX Spectrum Next and is not made or endorsed by SpecNext Ltd. The licence of the System/Next distribution does not allow systems built from the ZX Next's VHDL to be called "ZX Spectrum Next"; "Sinclair" and "ZX Spectrum" are trademarks of their owners.
The ZX Next is an enhanced ZX Spectrum: a Z80N CPU at 3.5, 7, 14 or 28 MHz, Layer 2 bitmap graphics, tilemap, sprites, copper, DMA, three AY sound chips, DivMMC and Multiface, and 2 MB of RAM. It runs NextZXOS and the classic Spectrum 48K, 128K and +3 software. On the MEGA65 it uses the MEGA65 keyboard, joysticks in both ports and an Amiga mouse as the ZX Next's Kempston mouse.
Download: the latest build is on the releases page.
V1.3 updates the ZX Next core to version 3.02.04, so System/Next 26.11 (firmware 1.46) now boots without the firmware swap. Tested on the R6 with 26.11 and with 24.11. The options menu has ZX Spectrum colours.
V1.2 runs on a MEGA65 R6: NextZXOS boots, its menus, 48K BASIC and the Browser work, music plays, Next games (Warhawk Next, Nextoid) run with keyboard control, tape (.TAP) games load, and a joystick reads correctly as Kempston. The grey screen that V0.2 alpha sometimes showed after a reset is fixed (it was an SDRAM read timing problem). New in V1.2: an Amiga mouse works as the ZX Next's Kempston mouse (see "Mouse"; tested on the R6). V1.1 added remembered options menu settings (see "Options menu"). Please report bugs (see below).
- R4 and R5: the core builds for them, but nobody has tested it on these boards yet. If you have one, a test report is very welcome.
- R3 / R3A: 1 MB. The R3 and R3A have no SDRAM, so on them the ZX Next gets
1 MB of RAM inside the FPGA, like an unexpanded ZX Next (NextZXOS shows 768K of RAM).
A tester ran it on an R3 and reports that it works like the R6 version: HDMI modes, VGA,
scanlines, booting from an image or from a real ZX Next SD card, Reset ZX Next, joysticks and
many games. Software that needs 2 MB does not run (for example RogueCraft DX: you end up
back in the NextZXOS menu). Since V1.1 the R3 build is part of the normal release
(
megazxnext_r3.cor). The same tester has since run V1.2 on an R3A: it works there too, including the Amiga mouse and F13 (CPU speed).
- A MEGA65 R6, R3 or R3A (R4/R5 untested; R3/R3A: 1 MB, see above).
- Either an image of a ZX Next SD card on the MEGA65's SD card (FAT32), or a real ZX Next SD card (FAT32) in one of the MEGA65's SD card slots. No ROMs or system files are included in this core: the ZX Next loads its firmware, ROMs and NextZXOS from that card, just like the real machine does.
- Optional: joysticks, and an Amiga mouse (in either joystick port) as the Kempston mouse.
There are two ways to give the ZX Next its SD card:
- An image file (recommended): a byte-for-byte copy of a complete ZX Next SD card, stored on the MEGA65's normal SD card next to everything else. The ZX Next only ever touches that file.
- A real ZX Next SD card (new in V1.0): a FAT32 card prepared for the ZX Next, for
example the card from a real ZX Spectrum Next or one you made with the ZX Next's own tools,
put into the MEGA65's back slot (external micro SD) or the bottom tray. The
core uses it when the card has no image on it but has
/TBBLUE.FWin its root. The ZX Next then reads and writes the card directly, as on a real Next. FAT16 cards are not supported (the MEGA65 needs to read the card at startup): copy the files of a FAT16 card onto a FAT32 card.
Warning
Format the ZX Next card with the official SD Card Formatter
of the SD Association, as the ZX Next website recommends, and not with Windows or other tools.
This is only about the separate ZX Next card. Do not reformat the MEGA65's own SD card: the
MEGA65 prepares it itself, with a hidden system partition that a reformat would erase. If the
MEGA65 card shows the problem below, only repair the partition type.
The MEGA65 needs an MBR partition table with partition 1 of type 0x0B or 0x0C (FAT32).
"FAT32" alone is not enough: a card that was exFAT before can keep the type 0x07, Windows
reads it without complaint, but the MEGA65 says "Cannot mount the SD card". Use a card of
32 GB or less: the SD Card Formatter formats larger cards (SDXC) as exFAT, which the MEGA65
cannot read.
To check or repair a card without reformatting (Windows PowerShell as administrator, N = the
card's disk number from Get-Disk):
Get-Partition -DiskNumber N | Select-Object PartitionNumber, MbrType # must be 11 or 12
Set-Partition -DiskNumber N -PartitionNumber 1 -MbrType 12 # if it is 7(or diskpart: select disk N, select partition 1, set id=0C override). The data on the
card stays as it is.
The core uses one SD card, chosen once when it starts:
- The card in the back slot, if one is inserted.
- Otherwise the card in the bottom tray.
On that card it looks first for /zxnext/boot.vhd, then /zxnext/boot.img. If neither is
there but /TBBLUE.FW is, it uses the card itself as a real ZX Next card. The other slot is not
used at all.
| Back slot | Bottom tray | What the ZX Next uses |
|---|---|---|
| empty | MEGA65 card with /zxnext/boot.img |
the image on the bottom tray card |
MEGA65 card with /zxnext/boot.img |
anything | the image on the back slot card |
| real ZX Next card | MEGA65 card | the real ZX Next card (the tray card is not used) |
| empty | real ZX Next card | the real ZX Next card |
So you can keep your normal MEGA65 card in the bottom tray (with /zxnext/boot.vhd on it if you
like) and put a real ZX Next card into the back slot when you want to use it: with the back slot
empty, the core boots the image from the tray card.
Don't swap or remove cards while the core is running: switch the MEGA65 off first.
The MEGA65 SD card (FAT32) needs one file:
| Path on the MEGA65 SD card | What it is |
|---|---|
/zxnext/boot.vhd or /zxnext/boot.img |
an image (a byte-for-byte copy) of a complete ZX Next SD card |
Inside the image (or on the real ZX Next card), the ZX Next expects the System/Next distribution, exactly as on a real ZX Spectrum Next. The files it needs at a minimum:
| Path inside the image | What it is |
|---|---|
/TBBLUE.FW |
the ZX Next firmware (boot menu, loads the ROMs) |
/machines/next/ |
the ROMs (enNextZX.rom NextZXOS ROM, enNxtmmc.rom DivMMC ROM, 48.rom, 128.rom, plus3.rom, ...), keymaps and config.ini (machine settings) |
/nextzxos/, /sys/, /dot/ |
NextZXOS and its system files and dot commands |
Everything else in the distribution (/games, /apps, /demos, /docs, ...) is optional
but recommended. TBBLUE.TBU (FPGA core updates for a real Next) is not used.
These files are not provided here. The ROMs, the firmware and NextZXOS are copyrighted by
their owners (among others: the Sinclair ZX Spectrum ROMs © Amstrad / Sky plc, NextZXOS and
NextBASIC © Garry Lancaster, TBBlue © Victor Trucco and Fabio Belavenuto, System/Next ©
SpecNext Ltd; see the distribution's README.md and LICENSE.md). This repository and its
releases contain only the FPGA core. Get the files from their official sources:
- the System/Next distribution, free from SpecNext Ltd (https://www.specnext.com), or
- the
boot.vhdof the MiSTer core (in thereleasesfolder of ZXNext_MiSTer): a ready-made image with an older distribution.
To make an image with the current distribution, prepare a ZX Next SD card the official way (a
FAT32 card with the distribution unzipped onto it), then copy the whole card into an image file
(e.g. dd on Linux/macOS, Win32 Disk Imager on Windows). Tested on the R6: System/Next 26.11
(512 MB image) and 24.11 (2 GB image).
System/Next 26.11 with V1.2 or older: its firmware (TBBLUE.FW 1.46) needs the newer ZX Next
core of V1.3: on V1.2 the machine resets back to the firmware screen after you choose a
personality. Update to V1.3, or use the firmware of 24.11: copy TBBLUE.FW and TBBLUE.TBU from
sn-complete-24.11.zip over the ones of 26.11 in the root of the image.
The ZX Next firmware picks its boot screen by the machine ID, and this core reports the MiSTer
one, so the firmware shows "MiSTer Next". tools/bootscreen makes a copy
of your TBBLUE.FW that shows the MegaZXNext logo instead (Python 3, nothing else):
python3 tools/bootscreen/zxn_bootscreen.py patch TBBLUE.FW TBBLUE-megazxnext.FW
Put the new file into the image (or onto the real ZX Next card) as /TBBLUE.FW and keep the
original. A new distribution or firmware update brings back the MiSTer screen; run the tool
again on the new TBBLUE.FW. Tested on the R6 with System/Next 24.11.
-
The ZX Next SD card image (see above). Use one of:
- the
boot.vhdof the MiSTer core (in thereleasesfolder of ZXNext_MiSTer), or - an image file of a ZX Next SD card with the System/Next distribution (tested: 26.11 and 24.11).
Copy it to the MEGA65's SD card as
/zxnext/boot.vhdor/zxnext/boot.img. The file does not need to be contiguous (up to 512 fragments are fine). Remember: a card in the back slot is used before the card in the bottom tray (see "Which SD card is used" above).Or use a real ZX Next SD card (FAT32,
/TBBLUE.FWin its root) instead: put it into the back slot or, with the back slot empty, into the bottom tray (see "Which SD card is used" above).[!CAUTION] Again: format a real ZX Next card only with the official SD Card Formatter, as the ZX Next website says. Cards formatted with Windows or other tools are the usual cause of "Cannot mount the SD card" (wrong partition type, see the warning above). Never reformat the MEGA65's own card.
- the
-
The core. Download the zip from the latest release (
megazxnext_v1.1.zip), unzip it and take the.corfile for your board (megazxnext_r6.corfor an R6,megazxnext_r3.corfor an R3/R3A;_r5/_r4are untested). Also copyzxnext/zxncfgfrom the zip to the MEGA65's SD card as/zxnext/zxncfgif you want the options menu settings remembered. Flash it into a core slot with the MEGA65's flash menu (switch the MEGA65 on while holding No Scroll), as described in the MEGA65 user guide. -
Start the core. The welcome screen shows the most important keys; press Space and the ZX Next boots.
| MEGA65 key | ZX Next |
|---|---|
| Shift | Caps Shift |
| Ctrl, MEGA | Symbol Shift |
| Alt | Extend Mode |
| Caps Lock | Caps Lock |
| No Scroll | Graph |
| Tab / Clr Home | True Video / Inv Video |
| Esc, Run/Stop | Break |
| ← (left of 1) | Edit |
| Inst/Del | Delete |
| Cursor keys | Cursor keys |
: + - * / = @ £ ^ |
the matching Symbol Shift combinations |
| F3 | 50 Hz / 60 Hz |
| F9 | Multiface NMI |
| F11 | DivMMC NMI (drive button) |
| F13 | Next CPU speed (3.5 → 7 → 14 → 28 MHz) |
| Help | Options menu |
The reset button: a short press is a soft reset (back to the NextZXOS menu), a long press a hard reset (reloads the firmware). Reset ZX Next in the options menu is a soft reset, too.
MEGA65 port 1 is the ZX Next's left joystick, port 2 its right joystick (Flip joystick ports in the options menu swaps them). What a joystick does is a setting of the ZX Next, not of the core, and it depends on your image: a joystick may act as Cursor keys (it moves through the NextZXOS menus) or as Sinclair keys (the number keys). Most games want Kempston. To change it: press Space while the firmware boots, select the machine, edit its settings (press E, the joysticks are on the second page) and set Right Joy (port 2) or Left Joy (port 1) to Kempston 1, then save. The ZX Next stores it in the image. One fire button is supported.
An Amiga mouse in either joystick port is the ZX Next's Kempston mouse. Nothing to set
up: the core notices the mouse the first time you move it. Left button = left, right button =
right. Its speed is the ZX Next's own mouse setting (DPI, nextreg 0x0A). To try it, run
/apps/tools/mouse/NXMOUSE.BAS from the Browser. Software for the Kempston mouse reads it
through the usual Kempston mouse ports.
Once the core has seen the mouse, that port is a mouse only, not a joystick: if you then plug a joystick into it, hold the MEGA65's reset button for a moment (ZX Next hard reset) or restart the core. Use the other port for a joystick. Commodore 1351 mice are not supported.
Tested with an Amiga mouse in port 1: on an R6 (movement, left and right button) and on an R3A (MouSTer adapter in Amiga mouse mode: movement and all three buttons). Port 2 is not tested yet.
Press Help for the options menu: HDMI mode (720p, 576p, 640x480, 720x480, 800x600), VGA mode (standard or 15 kHz retro), flip joystick ports, HDMI CRT emulation, audio improvements, Reset ZX Next and the help pages.
Remembering the settings: copy the file zxnext/zxncfg from the release zip (also in this
repository: release/zxnext/zxncfg, 31 bytes) to the MEGA65's SD card as
/zxnext/zxncfg, next to your boot.vhd/boot.img. The core then loads the settings at
startup and saves them whenever you change one: the ZX Next pauses for a moment while the file is
written. The core cannot create the file itself: without it (or if its size is not exactly 31
bytes) the defaults are used and nothing is saved. With a real ZX Next SD card the settings are
loaded from /zxnext/zxncfg on that card if it is there, but not saved: the core cannot pause the
ZX Next in the middle of its own SD card commands.
- Tested on R6, R3 and R3A. R4/R5 are untested. The mouse is tested in port 1 only (port 2 untested). The R3/R3A build has 1 MB of RAM: software that needs 2 MB does not run.
- "Cannot mount the SD card" with a real ZX Next card that Windows reads fine: the partition type
is probably
0x07(exFAT/NTFS) instead of0x0B/0x0C(FAT32), see the warning in "What goes on the SD card". Reported on the R3 and the R6; after the repair the card booted in the back slot and in the bottom tray. The earlier report "does not boot in the bottom tray" was with that card, so it probably had the same cause. - The options menu settings are only remembered with an image and a
/zxnext/zxncfgfile (see "Options menu"), not with a real ZX Next SD card. Tested on the R6. - F13 changes the CPU speed (nextreg 0x07 goes 3.5 → 7 → 14 → 28 MHz, tested on an R3A), but nothing on screen shows it: as on a real ZX Next (F8), the NextZXOS menu shows its own speed setting, not the current speed. F9 opens the NMI menu. F11 (DivMMC NMI) does nothing unless the drive button NMI is enabled (nextreg 0x06 bit 4); not tested with it enabled yet.
- Real ZX Next SD cards must be FAT32 (MBR partition type
0x0B/0x0C); FAT16 and exFAT cards are not supported. - The boot screen of the ZX Next firmware says "MiSTer Next" (the firmware chooses it by the
machine ID the core reports).
tools/bootscreenchanges it to the MegaZXNext logo (see "What goes on the SD card"). - +3 disk images (.DSK) have not been tested yet.
Please open an issue at https://github.com/freemchr/MegaZXNext/issues with your MEGA65 board revision (R3/R3A/R4/R5/R6), the image you use, and what you did.
See AGENTS.md for the layout of the repository, how to build the bitstream with Vivado and how to run the simulations.
ZX Spectrum Next core by Alvin Albrecht, Victor Trucco and Fabio Belavenuto; MiSTer port by Sorgelig and the MiSTer team; MiSTer2MEGA65 by sy2002 and MJoergen. MEGA65 port by Chris Freeman. See AUTHORS for everything this core uses.
The core is licensed under the GNU GPL v3 (see LICENSE). Parts of it are licensed under other free software licenses, as stated in the source files.

