<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Orcmeal</id>
	<title>SpecNext Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Orcmeal"/>
	<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/Special:Contributions/Orcmeal"/>
	<updated>2026-05-23T04:56:49Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41928</id>
		<title>MAME:Installing</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41928"/>
		<updated>2026-05-12T16:24:05Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added info about required SDL3 library when installing on macOS.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mamedev.org/ MAME] (formerly an acronym of Multiple Arcade Machine Emulator) is a free and open-source emulator designed to emulate the hardware of arcade games, later expanded to include video game consoles, old computers and other systems in software on modern personal computers and other platforms.&lt;br /&gt;
&lt;br /&gt;
MAME has supported the ZX Spectrum Next since version 0.267. The existing implementation is based on the v3.02.01 core and implements most of the features.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
You will need to install MAME, provide it with the Next firmware (&#039;ROM&#039;), and get the NextZXOS image:&lt;br /&gt;
&lt;br /&gt;
=== 1. Get MAME ===&lt;br /&gt;
Start with these official MAME releases. If you encounter crashes or other bugs, try replacing the MAME executable with holub&#039;s latest Continuous Integration (CI) builds as described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
MAME for macOS now requires the SDL3 library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Windows:&#039;&#039;&#039; Download [https://www.mamedev.org/release.html MAME for Windows].&lt;br /&gt;
* &#039;&#039;&#039;macOS:&#039;&#039;&#039; Download the [https://github.com/libsdl-org/SDL/releases/latest SDL3 library], and copy its &#039;&#039;&#039;SDL3.xcframework&#039;&#039;&#039; and &#039;&#039;&#039;share&#039;&#039;&#039; folders to ~/Library/Frameworks, as instructed in the included INSTALL.md file. Then download [https://sdlmame.lngn.net/ MAME for macOS].&lt;br /&gt;
* &#039;&#039;&#039;Linux:&#039;&#039;&#039; Install MAME from the flatpak repositories by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo flatpak install org.mamedev.MAME&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that Windows and macOS will likely prevent you from launching MAME (and the SDL3 framework) directly for security reasons. See below on how to solve this.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the MAME platform as a whole, you can also check your package manager, or [https://docs.mamedev.org/initialsetup/compilingmame.html build from sources].&lt;br /&gt;
&lt;br /&gt;
Git of official MAME: [https://github.com/mamedev/mame/ https://github.com/mamedev/mame/] [https://github.com/mamedev/mame/blob/master/src/mame/sinclair/next/specnext.cpp specnext.cpp]&lt;br /&gt;
&lt;br /&gt;
Git of holub&#039;s fork: [https://github.com/holub/mame https://github.com/holub/mame] [https://github.com/holub/mame/blob/master/src/mame/sinclair/next/specnext.cpp specnext.cpp] (may contain extra fixes and features before they are merged to official repository)&lt;br /&gt;
&lt;br /&gt;
=== 2. Get TBBLUE (the Next &#039;boot ROM&#039;) ===&lt;br /&gt;
Put the file  [https://github.com/Threetwosevensixseven/NexCreator/raw/master/bootroms/tbblue.zip tbblue.zip] into MAME&#039;s &amp;lt;code&amp;gt;roms&amp;lt;/code&amp;gt; folder. Don&#039;t extract it; MAME will look for the zip file when the &amp;quot;tbblue&amp;quot; machine is selected.&lt;br /&gt;
&lt;br /&gt;
Note: The ROMs in this zip are what is embedded inside the FPGA core on real Next hardware. They&#039;re different from any ZX Spectrum machine ROMs you may be used to using, that are on the distro, SD card or SD image file.&lt;br /&gt;
&lt;br /&gt;
=== 3. Get the NextZXOS Image ===&lt;br /&gt;
Get an SD card image file of [https://www.specnext.com/latestdistro/ NextZXOS]. Note that &#039;&#039;&#039;some disk images published  on the official SpecNext.com site do not work with some emulators currently&#039;&#039;&#039; (the &amp;lt;code&amp;gt;latestdistro&amp;lt;/code&amp;gt; link points to the official location where the latest distribution can be found), but &#039;&#039;&#039;all images from &amp;lt;code&amp;gt;https://zxnext.uk/hosted/&amp;lt;/code&amp;gt; work with both MAME and CSpect&#039;&#039;&#039;, like [https://zxnext.uk/hosted/index_files/hdfimages/cspect-next-2gb.zip this SD card image in the zip archive]. Extract the image &amp;lt;code&amp;gt;cspect-next-2gb.img&amp;lt;/code&amp;gt; from the archive to use it, then point MAME to this SD card image with the &amp;lt;code&amp;gt;-hard1&amp;lt;/code&amp;gt; option (or select that file from the menu inside MAME).&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
MAME looks for its configuration and helper files in specific (configurable) folders. By default, these are relative to the current working directory (cwd), i.e., from where you launched the executable. The &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file and folders like &amp;lt;code&amp;gt;roms, bgfx, plugins, language, ...&amp;lt;/code&amp;gt; are expected there, unless the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file specifies other paths. When launching through a desktop icon or menu, depending on the OS, the working directory is often defined by the properties of that launch shortcut. When launching MAME from the command line, the current directory is &amp;quot;cwd&amp;quot; (doh). On Linux, MAME will look for &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; first in the &amp;lt;code&amp;gt;~/.mame&amp;lt;/code&amp;gt; folder. You can use the option &amp;lt;code&amp;gt;-inipath&amp;lt;/code&amp;gt; to point MAME to a different path for the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
However, the fastest way to run a machine with a desired configuration is from the command prompt, without requiring a &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file. Most of the features are also available through MAME&#039;s UI, although that takes more time to configure.&lt;br /&gt;
&lt;br /&gt;
As an example, this invocation enables the UI, uses &amp;quot;crisp pixels&amp;quot;, starts in a window, doesn&#039;t display the starting gameinfo window (it can still be displayed interactively from the UI), disables the mouse, confirms before exiting MAME, and specifies the disk image (remember to adjust the path to it):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mame -ui_active -nounevenstretch -aspect 2:1 -video bgfx  -bgfx_screen_chains unfiltered -window -skip_gameinfo -mouse_device none -confirm_quit tbblue -hard1 /path/to/cspect-next-2gb.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s cover some useful options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Run inside a window and with no mouse support, until you get familiar with the UI keys:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; mame tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch the Linux flatpak version using the same options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; flatpak run org.mamedev.MAME tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Activate UI keys on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -ui_active&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Don&#039;t show the info popup on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -skip_gameinfo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run with debugger. If you don&#039;t request this on startup, you won&#039;t have access to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -debug&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;quot;crisp&amp;quot; pixels:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -nounevenstretch -aspect 2:1 -video bgfx -bgfx_screen_chains unfiltered&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;No joystick connected to PC (having this may slightly speed up MAME&#039;s startup, but &#039;&#039;remember to remove this part from the command line and the corresponding setting in the ini file if you do want to use a joystick&#039;&#039;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -joystickprovider none&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ask for confirmation when exiting MAME (otherwise it&#039;s easy to exit MAME accidentally by hitting ESC, especially when playing games or navigating menus):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -confirm_quit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.mamedev.org/commandline/commandline-all.html#mame-commandline-universal official MAME documentation] for more advanced usage.&lt;br /&gt;
&lt;br /&gt;
= Security: Allowing MAME to Run on Windows and macOS =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Windows,&#039;&#039;&#039; you will need to confirm that you want to launch MAME by clicking &amp;quot;Run Anyway&amp;quot; on first launch. &#039;&#039;(More details needed here.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On macOS,&#039;&#039;&#039; MAME will not open at first. Instead, a dialog will appear saying:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;“mame” Not Opened. Apple could not verify “mame” is free of malware that may harm your Mac or compromise your privacy.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click “Done”. Then open &#039;&#039;&#039;System Settings -&amp;gt; Privacy &amp;amp; Security&#039;&#039;&#039;, and scroll down to the message &#039;&#039;mame was blocked to protect your Mac.&#039;&#039; Click “Allow Anyway”.&lt;br /&gt;
&lt;br /&gt;
Now launch MAME again. A dialog will ask once more if you want to open “mame”. Click “Open Anyway”, and enter your password or use Touch ID when prompted by macOS.&lt;br /&gt;
&lt;br /&gt;
You will then need to &#039;&#039;&#039;repeat this process for the SDL3 framework.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
From now on, you can launch this version of MAME without warnings. However, you &#039;&#039;&#039;will&#039;&#039;&#039; need to repeat this each time you update MAME or the SDL3 framework.&lt;br /&gt;
&lt;br /&gt;
= Keys =&lt;br /&gt;
&lt;br /&gt;
Keys are emulated in two modes: either to control the MAME emulator or completely dedicated to the emulated system (the Next). You can toggle between these two keyboard modes with ScrLk (on Win and Linux) or fn+delete (on Mac).&lt;br /&gt;
&lt;br /&gt;
Some UI keys:&lt;br /&gt;
* F3 - soft reset&lt;br /&gt;
* Shift+F3 - hard reset&lt;br /&gt;
* F4 - sprites/tiles/font viewer (Enter, ], [)&lt;br /&gt;
* F5 - pause emulation&lt;br /&gt;
* F6 - save state&lt;br /&gt;
* F7 - load state&lt;br /&gt;
* Tab - emulator settings&lt;br /&gt;
* ~ - menu&lt;br /&gt;
* ` (backtick) - debugger (when enabled by starting MAME with &amp;lt;code&amp;gt;-debug&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; on the command line)&lt;br /&gt;
* PgDwn (Linux/Mac), fn-Downarrow (MacBooks) or Insert (Win) - hold down to fast-forward emulation at maximum speed, e.g., to speed up booting the Next&lt;br /&gt;
* Esc - exit (exits menus but also the entire emulator - see &amp;lt;code&amp;gt;-confirm_quit&amp;lt;/code&amp;gt; option above)&lt;br /&gt;
* F11 - DivMMC NMI&lt;br /&gt;
* F12 - Multiface NMI&lt;br /&gt;
&lt;br /&gt;
Check [https://docs.mamedev.org/usingmame/defaultkeys.html default keys documentation] for more.&lt;br /&gt;
&lt;br /&gt;
= Changing the UI toggle key =&lt;br /&gt;
&lt;br /&gt;
Some laptops don&#039;t have a Scroll Lock key, so you may not be able to exit MAME if you run it in full-screen mode. In these cases, you can change the UI toggle key as follows:&lt;br /&gt;
&lt;br /&gt;
* Run MAME without any command line arguments (except maybe -window) to open its GUI.&lt;br /&gt;
* Push TAB and enter the General Settings menu.&lt;br /&gt;
* Go to Input Assignments -&amp;gt; User Interface -&amp;gt; Toggle UI controls and select a new key. I use Right Alt / Alt GR.&lt;br /&gt;
* Return to the previous menu twice, then choose Save Settings&lt;br /&gt;
&lt;br /&gt;
= Creating and manipulating NextZXOS SD card image =&lt;br /&gt;
&lt;br /&gt;
Most users wanting to emulate the Next using MAME will be fine using a pre-built SD card image downloaded from the site hosting best pre-made images (currently, [https://zxnext.uk/hosted zxnext.uk/hosted] ) website. The following guide is provided for anyone wanting to create a NextZXOS SD card image from scratch.&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.specnext.com/latestdistro/ latest NextZXOS distribution zip file] (named something like sn-complete-WX.YZ.zip) and extract it into a new, empty directory.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using hdfmonkey jjjs build ==&lt;br /&gt;
&lt;br /&gt;
The [https://www.specnext.com/forum/viewtopic.php?t=2604 hdfmonkey &amp;quot;jjjs build&amp;quot;] is a variant of hdfmonkey tool which includes some unique features and its main archive (at the previously given link) also contains pre-built binaries for Windows x64, MacOS x64, MacOS Apple Silicon and Linux x64. (Alternatively, the process to build a local Linux version of the executable is described [[Development_Tools:Linux_setup#hdfmonkey_tool | here]] )&lt;br /&gt;
&lt;br /&gt;
If you extracted sn-complete-WX.YZ.zip into a subdirectory named &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt;, and you want to create a 1GB image called &amp;lt;code&amp;gt;NextZXOS.img&amp;lt;/code&amp;gt; and you have a jjjs build&amp;quot; of hdfmonkey, then it&#039;s enough to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hdfmonkey create NextZXOS.img 1G&lt;br /&gt;
hdfmonkey putdir NextZXOS.img snWXYZ /&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line creates an empty 1GB image and formats it with the best FAT parameters suited to the size of the image.&lt;br /&gt;
&lt;br /&gt;
The second line recursively copies all the content of the directory &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt; to the image, preserving the directory structure inside, starting from the &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; in the image.&lt;br /&gt;
&lt;br /&gt;
One of the advantages of this method is that even if the image has a capacity of 1GB, it will use much less space on your hard drive until you fill up the image. On Linux or MacOS, a command &amp;lt;code&amp;gt;du -h NextZXOS.img&amp;lt;/code&amp;gt; shows the actual amount of disk space used by the image. On Windows the same information can be seen in the File Properties dialog.&lt;br /&gt;
&lt;br /&gt;
The fastest way to transfer a file or a directory (including its content, recursively) into an image is by using a single &amp;lt;code&amp;gt;put&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;putdir&amp;lt;/code&amp;gt;, if it&#039;s to transfer the directory file content to an existing directory) command of hdfmonkey.&lt;br /&gt;
&lt;br /&gt;
The most convenient tool to copy of all the content from the image to a folder outside of the image is 7-zip. On Windows, just use the 7-zip GUI. On MacOS and Linux, see: [[Development_Tools:Linux_setup#Extracting_all_files_from_the_sd-card_image]].&lt;br /&gt;
&lt;br /&gt;
=MAME Plugins and Scripts=&lt;br /&gt;
&lt;br /&gt;
Some MAME plugins and scripts that may be useful for Next developers and end users are listed [[MAME:Plugins_and_Scripts|here]]. They let you speed up the Next boot time, profile your NextBASIC or assembler code, and more.&lt;br /&gt;
&lt;br /&gt;
=Continuous Integration MAME Builds=&lt;br /&gt;
&lt;br /&gt;
MAME is updated on a release schedule, but due to the ongoing nature of development, including for the MAME Next machine, it can sometimes be useful to install a more recent build if it contains a new feature or bugfix you are interested in. Sometimes, this ongoing work is discussed on social media, such as the [https://discordapp.com/channels/556228195767156758/752197165891321886 Next Developer Discord].&lt;br /&gt;
&lt;br /&gt;
Continuous Integration (CI) builds are available from both the [https://github.com/mamedev/mame/actions primary MAME repo] and [https://github.com/holub/mame/actions holub&#039;s GitHub repo]. Both are considered bleeding-edge, with the primary MAME repo slightly less so. MAME CI builds are available for Windows, Linux, and macOS and are updated automatically whenever code is committed by a maintainer or pushed to the primary repo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You need to be logged in to github&#039;&#039;&#039; to download CI artifacts, so [https://github.com/login sign in] or [https://github.com/signup sign up].&lt;br /&gt;
&lt;br /&gt;
To try out a CI build (more precisely, the resulting binary executable, which is a produced &amp;quot;artifact&amp;quot; of the build process) , first do a full MAME install from the [https://www.mamedev.org/release.html latest release] if you have not already done so. Then back up your main binary from its installation location - these are called something like &amp;lt;code&amp;gt;mame.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mame&amp;lt;/code&amp;gt;. You&#039;re backing it up to be able to restore it if the CI build doesn&#039;t work, or if you don&#039;t like how the CI build behaves.&lt;br /&gt;
&lt;br /&gt;
Then visit one of the links above and find a workflow run item for your platform. Workflow items are the things in the list. The tags are flagged as &amp;lt;code&amp;gt;CI (Windows)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CI (Linux)&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;CI (macOS)&amp;lt;/code&amp;gt; in the second row of each workflow item in the list (not the filter in the left hand nav menu). Click on a completed workfow item (only items with green checkmarks will have created downloadable binaries yet), find the Artifacts section at the bottom (note again: you need to be signed up to see that section and/or download the artifact), then click the Download button. Unzip the downloaded file and find the main binary (with the same name as above). Copy the main binary to the install location, overwriting the original one, and run MAME the same way you were running it before. On Windows and macOS, you need to repeat the security steps above to trust the new MAME executable.&lt;br /&gt;
&lt;br /&gt;
= More MAME related links =&lt;br /&gt;
&lt;br /&gt;
MAME [https://docs.mamedev.org/ documentation].&lt;br /&gt;
&lt;br /&gt;
Report any issues with MAME on the [https://mametesters.org/ bugtracker].&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;Linux&#039;&#039;&#039; users there are more tips (how to compile MAME from source, how to configure it to not use CWD as starting path for resource directories, how to mount or create image file) at [[Development_Tools:Linux_setup]] page.&lt;br /&gt;
&lt;br /&gt;
[https://docs.mamedev.org/advanced/devicemap.html MAMEDEV.ORG MAME Stable Controller IDs].&lt;br /&gt;
By default, MAME does not assign stable numbers to input devices. For instance, a game pad controller may be assigned to “Joy 1” initially, but after restarting, the same game pad may be reassigned to “Joy 3”.&lt;br /&gt;
Here a some hints how to fixate MAME´s Joystick-Detection to specific Controllers: [https://www.youtube.com/watch?v=YmjfwLuZ_X0 Youtube - Mapping your controllers for stable IDs]&lt;br /&gt;
and: [https://forums.launchbox-app.com/topic/89296-stable-controller-ids-for-mame/ Stable Controller IDs for MAME]&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41927</id>
		<title>MAME:Installing</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41927"/>
		<updated>2026-05-12T16:17:19Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mamedev.org/ MAME] (formerly an acronym of Multiple Arcade Machine Emulator) is a free and open-source emulator designed to emulate the hardware of arcade games, later expanded to include video game consoles, old computers and other systems in software on modern personal computers and other platforms.&lt;br /&gt;
&lt;br /&gt;
MAME has supported the ZX Spectrum Next since version 0.267. The existing implementation is based on the v3.02.01 core and implements most of the features.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
You will need to install MAME, provide it with the Next firmware (&#039;ROM&#039;), and get the NextZXOS image:&lt;br /&gt;
&lt;br /&gt;
=== 1. Get MAME ===&lt;br /&gt;
Start with these official MAME releases. If you encounter crashes or other bugs, try replacing the MAME executable with holub&#039;s latest Continuous Integration (CI) builds as described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
MAME for macOS now requires the SDL3 library.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Windows:&#039;&#039;&#039; Download [https://www.mamedev.org/release.html MAME for Windows].&lt;br /&gt;
* &#039;&#039;&#039;macOS:&#039;&#039;&#039; Download [https://sdlmame.lngn.net/ MAME for macOS].&lt;br /&gt;
* &#039;&#039;&#039;Linux:&#039;&#039;&#039; Install MAME from the flatpak repositories by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo flatpak install org.mamedev.MAME&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that Windows and macOS will likely prevent you from launching MAME directly for security reasons. See below on how to solve this.&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the MAME platform as a whole, you can also check your package manager, or [https://docs.mamedev.org/initialsetup/compilingmame.html build from sources].&lt;br /&gt;
&lt;br /&gt;
Git of official MAME: [https://github.com/mamedev/mame/ https://github.com/mamedev/mame/] [https://github.com/mamedev/mame/blob/master/src/mame/sinclair/next/specnext.cpp specnext.cpp]&lt;br /&gt;
&lt;br /&gt;
Git of holub&#039;s fork: [https://github.com/holub/mame https://github.com/holub/mame] [https://github.com/holub/mame/blob/master/src/mame/sinclair/next/specnext.cpp specnext.cpp] (may contain extra fixes and features before they are merged to official repository)&lt;br /&gt;
&lt;br /&gt;
=== 2. Get TBBLUE (the Next &#039;boot ROM&#039;) ===&lt;br /&gt;
Put the file  [https://github.com/Threetwosevensixseven/NexCreator/raw/master/bootroms/tbblue.zip tbblue.zip] into MAME&#039;s &amp;lt;code&amp;gt;roms&amp;lt;/code&amp;gt; folder. Don&#039;t extract it; MAME will look for the zip file when the &amp;quot;tbblue&amp;quot; machine is selected.&lt;br /&gt;
&lt;br /&gt;
Note: The ROMs in this zip are what is embedded inside the FPGA core on real Next hardware. They&#039;re different from any ZX Spectrum machine ROMs you may be used to using, that are on the distro, SD card or SD image file.&lt;br /&gt;
&lt;br /&gt;
=== 3. Get the NextZXOS Image ===&lt;br /&gt;
Get an SD card image file of [https://www.specnext.com/latestdistro/ NextZXOS]. Note that &#039;&#039;&#039;some disk images published  on the official SpecNext.com site do not work with some emulators currently&#039;&#039;&#039; (the &amp;lt;code&amp;gt;latestdistro&amp;lt;/code&amp;gt; link points to the official location where the latest distribution can be found), but &#039;&#039;&#039;all images from &amp;lt;code&amp;gt;https://zxnext.uk/hosted/&amp;lt;/code&amp;gt; work with both MAME and CSpect&#039;&#039;&#039;, like [https://zxnext.uk/hosted/index_files/hdfimages/cspect-next-2gb.zip this SD card image in the zip archive]. Extract the image &amp;lt;code&amp;gt;cspect-next-2gb.img&amp;lt;/code&amp;gt; from the archive to use it, then point MAME to this SD card image with the &amp;lt;code&amp;gt;-hard1&amp;lt;/code&amp;gt; option (or select that file from the menu inside MAME).&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
MAME looks for its configuration and helper files in specific (configurable) folders. By default, these are relative to the current working directory (cwd), i.e., from where you launched the executable. The &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file and folders like &amp;lt;code&amp;gt;roms, bgfx, plugins, language, ...&amp;lt;/code&amp;gt; are expected there, unless the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file specifies other paths. When launching through a desktop icon or menu, depending on the OS, the working directory is often defined by the properties of that launch shortcut. When launching MAME from the command line, the current directory is &amp;quot;cwd&amp;quot; (doh). On Linux, MAME will look for &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; first in the &amp;lt;code&amp;gt;~/.mame&amp;lt;/code&amp;gt; folder. You can use the option &amp;lt;code&amp;gt;-inipath&amp;lt;/code&amp;gt; to point MAME to a different path for the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
However, the fastest way to run a machine with a desired configuration is from the command prompt, without requiring a &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file. Most of the features are also available through MAME&#039;s UI, although that takes more time to configure.&lt;br /&gt;
&lt;br /&gt;
As an example, this invocation enables the UI, uses &amp;quot;crisp pixels&amp;quot;, starts in a window, doesn&#039;t display the starting gameinfo window (it can still be displayed interactively from the UI), disables the mouse, confirms before exiting MAME, and specifies the disk image (remember to adjust the path to it):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mame -ui_active -nounevenstretch -aspect 2:1 -video bgfx  -bgfx_screen_chains unfiltered -window -skip_gameinfo -mouse_device none -confirm_quit tbblue -hard1 /path/to/cspect-next-2gb.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s cover some useful options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Run inside a window and with no mouse support, until you get familiar with the UI keys:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; mame tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch the Linux flatpak version using the same options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; flatpak run org.mamedev.MAME tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Activate UI keys on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -ui_active&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Don&#039;t show the info popup on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -skip_gameinfo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run with debugger. If you don&#039;t request this on startup, you won&#039;t have access to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -debug&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;quot;crisp&amp;quot; pixels:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -nounevenstretch -aspect 2:1 -video bgfx -bgfx_screen_chains unfiltered&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;No joystick connected to PC (having this may slightly speed up MAME&#039;s startup, but &#039;&#039;remember to remove this part from the command line and the corresponding setting in the ini file if you do want to use a joystick&#039;&#039;):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -joystickprovider none&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ask for confirmation when exiting MAME (otherwise it&#039;s easy to exit MAME accidentally by hitting ESC, especially when playing games or navigating menus):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -confirm_quit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.mamedev.org/commandline/commandline-all.html#mame-commandline-universal official MAME documentation] for more advanced usage.&lt;br /&gt;
&lt;br /&gt;
= Security: Allowing MAME to Run on Windows and macOS =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Windows,&#039;&#039;&#039; you will need to confirm that you want to launch MAME by clicking &amp;quot;Run Anyway&amp;quot; on first launch. &#039;&#039;(More details needed here.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On macOS,&#039;&#039;&#039; MAME will not open at first. Instead, a dialog will appear saying:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;“mame” Not Opened. Apple could not verify “mame” is free of malware that may harm your Mac or compromise your privacy.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click “Done”. Then open &#039;&#039;&#039;System Settings -&amp;gt; Privacy &amp;amp; Security&#039;&#039;&#039;, and scroll down to the message &#039;&#039;mame was blocked to protect your Mac.&#039;&#039; Click “Allow Anyway”.&lt;br /&gt;
&lt;br /&gt;
Now launch MAME again. A dialog will ask once more if you want to open “mame”. Click “Open Anyway”, and enter your password or use Touch ID when prompted by macOS.&lt;br /&gt;
&lt;br /&gt;
From now on, you can launch this version of MAME without warnings. However, you &#039;&#039;&#039;will&#039;&#039;&#039; need to repeat this each time you update MAME.&lt;br /&gt;
&lt;br /&gt;
= Keys =&lt;br /&gt;
&lt;br /&gt;
Keys are emulated in two modes: either to control the MAME emulator or completely dedicated to the emulated system (the Next). You can toggle between these two keyboard modes with ScrLk (on Win and Linux) or fn+delete (on Mac).&lt;br /&gt;
&lt;br /&gt;
Some UI keys:&lt;br /&gt;
* F3 - soft reset&lt;br /&gt;
* Shift+F3 - hard reset&lt;br /&gt;
* F4 - sprites/tiles/font viewer (Enter, ], [)&lt;br /&gt;
* F5 - pause emulation&lt;br /&gt;
* F6 - save state&lt;br /&gt;
* F7 - load state&lt;br /&gt;
* Tab - emulator settings&lt;br /&gt;
* ~ - menu&lt;br /&gt;
* ` (backtick) - debugger (when enabled by starting MAME with &amp;lt;code&amp;gt;-debug&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; on the command line)&lt;br /&gt;
* PgDwn (Linux/Mac), fn-Downarrow (MacBooks) or Insert (Win) - hold down to fast-forward emulation at maximum speed, e.g., to speed up booting the Next&lt;br /&gt;
* Esc - exit (exits menus but also the entire emulator - see &amp;lt;code&amp;gt;-confirm_quit&amp;lt;/code&amp;gt; option above)&lt;br /&gt;
* F11 - DivMMC NMI&lt;br /&gt;
* F12 - Multiface NMI&lt;br /&gt;
&lt;br /&gt;
Check [https://docs.mamedev.org/usingmame/defaultkeys.html default keys documentation] for more.&lt;br /&gt;
&lt;br /&gt;
= Changing the UI toggle key =&lt;br /&gt;
&lt;br /&gt;
Some laptops don&#039;t have a Scroll Lock key, so you may not be able to exit MAME if you run it in full-screen mode. In these cases, you can change the UI toggle key as follows:&lt;br /&gt;
&lt;br /&gt;
* Run MAME without any command line arguments (except maybe -window) to open its GUI.&lt;br /&gt;
* Push TAB and enter the General Settings menu.&lt;br /&gt;
* Go to Input Assignments -&amp;gt; User Interface -&amp;gt; Toggle UI controls and select a new key. I use Right Alt / Alt GR.&lt;br /&gt;
* Return to the previous menu twice, then choose Save Settings&lt;br /&gt;
&lt;br /&gt;
= Creating and manipulating NextZXOS SD card image =&lt;br /&gt;
&lt;br /&gt;
Most users wanting to emulate the Next using MAME will be fine using a pre-built SD card image downloaded from the site hosting best pre-made images (currently, [https://zxnext.uk/hosted zxnext.uk/hosted] ) website. The following guide is provided for anyone wanting to create a NextZXOS SD card image from scratch.&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.specnext.com/latestdistro/ latest NextZXOS distribution zip file] (named something like sn-complete-WX.YZ.zip) and extract it into a new, empty directory.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using hdfmonkey jjjs build ==&lt;br /&gt;
&lt;br /&gt;
The [https://www.specnext.com/forum/viewtopic.php?t=2604 hdfmonkey &amp;quot;jjjs build&amp;quot;] is a variant of hdfmonkey tool which includes some unique features and its main archive (at the previously given link) also contains pre-built binaries for Windows x64, MacOS x64, MacOS Apple Silicon and Linux x64. (Alternatively, the process to build a local Linux version of the executable is described [[Development_Tools:Linux_setup#hdfmonkey_tool | here]] )&lt;br /&gt;
&lt;br /&gt;
If you extracted sn-complete-WX.YZ.zip into a subdirectory named &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt;, and you want to create a 1GB image called &amp;lt;code&amp;gt;NextZXOS.img&amp;lt;/code&amp;gt; and you have a jjjs build&amp;quot; of hdfmonkey, then it&#039;s enough to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hdfmonkey create NextZXOS.img 1G&lt;br /&gt;
hdfmonkey putdir NextZXOS.img snWXYZ /&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line creates an empty 1GB image and formats it with the best FAT parameters suited to the size of the image.&lt;br /&gt;
&lt;br /&gt;
The second line recursively copies all the content of the directory &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt; to the image, preserving the directory structure inside, starting from the &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; in the image.&lt;br /&gt;
&lt;br /&gt;
One of the advantages of this method is that even if the image has a capacity of 1GB, it will use much less space on your hard drive until you fill up the image. On Linux or MacOS, a command &amp;lt;code&amp;gt;du -h NextZXOS.img&amp;lt;/code&amp;gt; shows the actual amount of disk space used by the image. On Windows the same information can be seen in the File Properties dialog.&lt;br /&gt;
&lt;br /&gt;
The fastest way to transfer a file or a directory (including its content, recursively) into an image is by using a single &amp;lt;code&amp;gt;put&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;putdir&amp;lt;/code&amp;gt;, if it&#039;s to transfer the directory file content to an existing directory) command of hdfmonkey.&lt;br /&gt;
&lt;br /&gt;
The most convenient tool to copy of all the content from the image to a folder outside of the image is 7-zip. On Windows, just use the 7-zip GUI. On MacOS and Linux, see: [[Development_Tools:Linux_setup#Extracting_all_files_from_the_sd-card_image]].&lt;br /&gt;
&lt;br /&gt;
=MAME Plugins and Scripts=&lt;br /&gt;
&lt;br /&gt;
Some MAME plugins and scripts that may be useful for Next developers and end users are listed [[MAME:Plugins_and_Scripts|here]]. They let you speed up the Next boot time, profile your NextBASIC or assembler code, and more.&lt;br /&gt;
&lt;br /&gt;
=Continuous Integration MAME Builds=&lt;br /&gt;
&lt;br /&gt;
MAME is updated on a release schedule, but due to the ongoing nature of development, including for the MAME Next machine, it can sometimes be useful to install a more recent build if it contains a new feature or bugfix you are interested in. Sometimes, this ongoing work is discussed on social media, such as the [https://discordapp.com/channels/556228195767156758/752197165891321886 Next Developer Discord].&lt;br /&gt;
&lt;br /&gt;
Continuous Integration (CI) builds are available from both the [https://github.com/mamedev/mame/actions primary MAME repo] and [https://github.com/holub/mame/actions holub&#039;s GitHub repo]. Both are considered bleeding-edge, with the primary MAME repo slightly less so. MAME CI builds are available for Windows, Linux, and macOS and are updated automatically whenever code is committed by a maintainer or pushed to the primary repo.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;You need to be logged in to github&#039;&#039;&#039; to download CI artifacts, so [https://github.com/login sign in] or [https://github.com/signup sign up].&lt;br /&gt;
&lt;br /&gt;
To try out a CI build (more precisely, the resulting binary executable, which is a produced &amp;quot;artifact&amp;quot; of the build process) , first do a full MAME install from the [https://www.mamedev.org/release.html latest release] if you have not already done so. Then back up your main binary from its installation location - these are called something like &amp;lt;code&amp;gt;mame.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mame&amp;lt;/code&amp;gt;. You&#039;re backing it up to be able to restore it if the CI build doesn&#039;t work, or if you don&#039;t like how the CI build behaves.&lt;br /&gt;
&lt;br /&gt;
Then visit one of the links above and find a workflow run item for your platform. Workflow items are the things in the list. The tags are flagged as &amp;lt;code&amp;gt;CI (Windows)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CI (Linux)&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;CI (macOS)&amp;lt;/code&amp;gt; in the second row of each workflow item in the list (not the filter in the left hand nav menu). Click on a completed workfow item (only items with green checkmarks will have created downloadable binaries yet), find the Artifacts section at the bottom (note again: you need to be signed up to see that section and/or download the artifact), then click the Download button. Unzip the downloaded file and find the main binary (with the same name as above). Copy the main binary to the install location, overwriting the original one, and run MAME the same way you were running it before. On Windows and macOS, you need to repeat the security steps above to trust the new MAME executable.&lt;br /&gt;
&lt;br /&gt;
= More MAME related links =&lt;br /&gt;
&lt;br /&gt;
MAME [https://docs.mamedev.org/ documentation].&lt;br /&gt;
&lt;br /&gt;
Report any issues with MAME on the [https://mametesters.org/ bugtracker].&lt;br /&gt;
&lt;br /&gt;
For &#039;&#039;&#039;Linux&#039;&#039;&#039; users there are more tips (how to compile MAME from source, how to configure it to not use CWD as starting path for resource directories, how to mount or create image file) at [[Development_Tools:Linux_setup]] page.&lt;br /&gt;
&lt;br /&gt;
[https://docs.mamedev.org/advanced/devicemap.html MAMEDEV.ORG MAME Stable Controller IDs].&lt;br /&gt;
By default, MAME does not assign stable numbers to input devices. For instance, a game pad controller may be assigned to “Joy 1” initially, but after restarting, the same game pad may be reassigned to “Joy 3”.&lt;br /&gt;
Here a some hints how to fixate MAME´s Joystick-Detection to specific Controllers: [https://www.youtube.com/watch?v=YmjfwLuZ_X0 Youtube - Mapping your controllers for stable IDs]&lt;br /&gt;
and: [https://forums.launchbox-app.com/topic/89296-stable-controller-ids-for-mame/ Stable Controller IDs for MAME]&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41465</id>
		<title>MAME:Installing</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41465"/>
		<updated>2025-12-06T13:03:13Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added suggestion in the beginnign to start with official MAME, and try the CI builds if problems occur.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mamedev.org/ MAME] (formerly an acronym of Multiple Arcade Machine Emulator) is a free and open-source emulator designed to emulate the hardware of arcade games, later expanded to include video game consoles, old computers and other systems in software on modern personal computers and other platforms.&lt;br /&gt;
&lt;br /&gt;
MAME has supported the ZX Spectrum Next since version 0.267. The existing implementation is based on the v3.02.01 core and implements most of the features.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
You will need to install MAME, provide it with the Next firmware (&#039;ROM&#039;), and get the NextZXOS image:&lt;br /&gt;
&lt;br /&gt;
=== 1. Get MAME ===&lt;br /&gt;
Start with these official MAME releases. If you encounter crashes or other bugs, try replacing the MAME executable with holub&#039;s latest Continuous Integration (CI) builds as described at the end of this article.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Windows:&#039;&#039;&#039; Download [https://www.mamedev.org/release.html MAME for Windows].&lt;br /&gt;
* &#039;&#039;&#039;macOS:&#039;&#039;&#039; Download [https://sdlmame.lngn.net/ MAME for macOS].&lt;br /&gt;
* &#039;&#039;&#039;Linux:&#039;&#039;&#039; Install MAME from the flatpak repositories by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo flatpak install org.mamedev.MAME&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the MAME platform as a whole, you can also check your package manager, or [https://docs.mamedev.org/initialsetup/compilingmame.html build from sources].&lt;br /&gt;
&lt;br /&gt;
Note that Windows and macOS will likely prevent you from launching MAME directly for security reasons. See below on how to solve this.&lt;br /&gt;
&lt;br /&gt;
=== 2. Get TBBLUE (the Next &#039;ROM&#039;) ===&lt;br /&gt;
Put the file  [https://github.com/Threetwosevensixseven/NexCreator/raw/master/bootroms/tbblue.zip tbblue.zip] into MAME&#039;s &amp;lt;code&amp;gt;roms&amp;lt;/code&amp;gt; folder. Don&#039;t extract it; MAME will look for the zip file when the &amp;quot;tbblue&amp;quot; machine is selected.&lt;br /&gt;
&lt;br /&gt;
=== 3. Get the NextZXOS Image ===&lt;br /&gt;
Get an SD card image file of [https://www.specnext.com/system-next22-10/ NextZXOS]. Some published images do not work with some emulators, but all images from https://zxnext.uk/hosted/#sd are now confirmed to work with both MAME and CSpect, like [https://zxnext.uk/hosted/index_files/hdfimages/cspect-next-2gb.zip this one] (the SD card image is the &amp;lt;code&amp;gt;cspect-next-2gb.img&amp;lt;/code&amp;gt; file inside the zip archive). You will point MAME to this SD card image with the &amp;lt;code&amp;gt;-hard1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-hard2&amp;lt;/code&amp;gt; options (or select the files from the menu inside MAME).&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
MAME looks for its configuration and helper files in specific (configurable) folders. By default, these are relative to the current working directory (cwd), i.e., from where you launched the executable. The &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file and folders like &amp;lt;code&amp;gt;roms, bgfx, plugins, language, ...&amp;lt;/code&amp;gt; are expected there, unless the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file specifies other paths. When launching through a desktop icon or menu, depending on the OS, the working directory is often defined by the properties of that launch shortcut. When launching MAME from the command line, the current directory is &amp;quot;cwd&amp;quot; (doh). On Linux, MAME will look for &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; first in the &amp;lt;code&amp;gt;~/.mame&amp;lt;/code&amp;gt; folder. You can use the option &amp;lt;code&amp;gt;-inipath&amp;lt;/code&amp;gt; to point MAME to a different path for the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
However, the fastest way to run a machine with a desired configuration is from the command prompt, without requiring a &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file. Most of the features are also available through MAME&#039;s UI, although that takes more time to configure.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s cover some useful options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Run inside a window and with no mouse support, until you get familiar with the UI keys:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; mame tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch the Linux flatpak version using the same options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; flatpak run org.mamedev.MAME tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Activate UI keys on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -ui_active&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Don&#039;t show the info popup on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -skip_gameinfo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run with debugger. If you don&#039;t request this on startup, you won&#039;t have access to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -debug&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;quot;crisp&amp;quot; pixels:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -nounevenstretch -aspect 2:1 -video bgfx -bgfx_screen_chains unfiltered&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;No joystick connected to PC (may slightly speed up MAME&#039;s startup):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -joystickprovider none&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ask for confirmation when exiting MAME (otherwise it&#039;s easy to exit MAME accidentally by hitting ESC, especially when playing games or navigating menus):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -confirm_quit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.mamedev.org/commandline/commandline-all.html#mame-commandline-universal official MAME documentation] for more advanced usage.&lt;br /&gt;
&lt;br /&gt;
As an example, this invocation enables the UI, uses &amp;quot;crisp pixels&amp;quot;, starts in a window, doesn&#039;t display the starting gameinfo window (it can still be displayed interactively from the UI), disables the mouse, confirms before exiting MAME, and specifies the disk image (remember to adjust the path to it):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mame -ui_active -nounevenstretch -aspect 2:1 -video bgfx  -bgfx_screen_chains unfiltered -window -skip_gameinfo -mouse_device none -confirm_quit tbblue -hard1 /path/to/cspect-next-2gb.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Security: Allowing MAME to Run on Windows and macOS =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Windows,&#039;&#039;&#039; you will need to confirm that you want to launch MAME by clicking &amp;quot;Run Anyway&amp;quot; on first launch. &#039;&#039;(More details needed here.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On macOS,&#039;&#039;&#039; MAME will not open at first. Instead, a dialog will appear saying:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;“mame” Not Opened. Apple could not verify “mame” is free of malware that may harm your Mac or compromise your privacy.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click “Done”. Then open &#039;&#039;&#039;System Settings -&amp;gt; Privacy &amp;amp; Security&#039;&#039;&#039;, and scroll down to the message &#039;&#039;mame was blocked to protect your Mac.&#039;&#039; Click “Allow Anyway”.&lt;br /&gt;
&lt;br /&gt;
Now launch MAME again. A dialog will ask once more if you want to open “mame”. Click “Open Anyway”, and enter your password or use Touch ID when prompted by macOS.&lt;br /&gt;
&lt;br /&gt;
From now on, you can launch this version of MAME without warnings. However, you &#039;&#039;&#039;will&#039;&#039;&#039; need to repeat this each time you update MAME.&lt;br /&gt;
&lt;br /&gt;
= Keys =&lt;br /&gt;
&lt;br /&gt;
Keys are emulated in two modes: either to control the MAME emulator or completely dedicated to the emulated system (the Next). You can toggle between these two keyboard modes with ScrLk (on Win and Linux) or fn+delete (on Mac).&lt;br /&gt;
&lt;br /&gt;
Some UI keys:&lt;br /&gt;
* F3 - soft reset&lt;br /&gt;
* Shift+F3 - hard reset&lt;br /&gt;
* F4 - sprites/tiles/font viewer (Enter, ], [)&lt;br /&gt;
* F5 - pause emulation&lt;br /&gt;
* F6 - save state&lt;br /&gt;
* F7 - load state&lt;br /&gt;
* Tab - emulator settings&lt;br /&gt;
* ~ - menu&lt;br /&gt;
* ` (backtick) - debugger (when enabled by starting MAME with &amp;lt;code&amp;gt;-debug&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; on the command line)&lt;br /&gt;
* PgDwn (Linux/Mac), fn-Downarrow (MacBooks) or Insert (Win) - hold down to fast-forward emulation at maximum speed, e.g., to speed up booting the Next&lt;br /&gt;
* Esc - exit (exits menus but also the entire emulator - see &amp;lt;code&amp;gt;-confirm_quit&amp;lt;/code&amp;gt; option above)&lt;br /&gt;
* F11 - DivMMC NMI&lt;br /&gt;
* F12 - Multiface NMI&lt;br /&gt;
&lt;br /&gt;
= Changing the UI toggle key =&lt;br /&gt;
&lt;br /&gt;
Some laptops don&#039;t have a Scroll Lock key, so you may not be able to exit MAME if you run it in full-screen mode. In these cases, you can change the UI toggle key as follows:&lt;br /&gt;
&lt;br /&gt;
* Run MAME without any command line arguments (except maybe -window) to open its GUI.&lt;br /&gt;
* Push TAB and enter the General Settings menu.&lt;br /&gt;
* Go to Input Assignments -&amp;gt; User Interface -&amp;gt; Toggle UI controls and select a new key. I use Right Alt / Alt GR.&lt;br /&gt;
* Return to the previous menu twice, then choose Save Settings&lt;br /&gt;
&lt;br /&gt;
= Creating a NextZXOS SD card image under Linux =&lt;br /&gt;
&lt;br /&gt;
Most users wanting to emulate the Next using MAME will be fine using a pre-built SD card image downloaded from the specnext website. The following guide is provided for anyone wanting to create a NextZXOS SD card image from scratch.&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.specnext.com/latestdistro/ latest NextZXOS distribution zip file] (named something like sn-complete-WX.YZ.zip) and extract it into a new, empty directory.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using hdfmonkey ==&lt;br /&gt;
&lt;br /&gt;
If you extracted sn-complete-WX.YZ.zip into a subdirectory named &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt;, and you want to create a 1GB image called &amp;lt;code&amp;gt;NextZXOS.img&amp;lt;/code&amp;gt; and you have a [[Development_Tools:Linux_setup#hdfmonkey_tool | &amp;quot;jjjs build&amp;quot; of hdfmonkey]], then it&#039;s enough to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hdfmonkey create NextZXOS.img 1G&lt;br /&gt;
hdfmonkey putdir NextZXOS.img snWXYZ /&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line creates an empty 1GB image and formats it with the best FAT parameters suited to the size of the image.&lt;br /&gt;
&lt;br /&gt;
The second line recursively copies all the content of the directory &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt; to the image, preserving the directory structure inside, starting from the &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; in the image.&lt;br /&gt;
&lt;br /&gt;
One of the advantages of this method is that even if the image has a capacity of 1GB, it will use much less space on your hard drive until you fill up the image. A command &amp;lt;code&amp;gt;du -h NextZXOS.img&amp;lt;/code&amp;gt; shows the actual amount of disk space used by the image.&lt;br /&gt;
&lt;br /&gt;
The fastest way to transfer a file or a directory (including its content, recursively) into an image is by using a single &amp;lt;code&amp;gt;put&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;putdir&amp;lt;/code&amp;gt;, if it&#039;s to transfer the directory file content to an existing directory) command of hdfmonkey.&lt;br /&gt;
&lt;br /&gt;
The most convenient tool to [[Development_Tools:Linux_setup#Extracting_all_files_from_the_SD_image | copy of all the content from the image to a folder outside of the image]] is 7-zip.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using other tools ==&lt;br /&gt;
&lt;br /&gt;
Create a disk image of at least 256 MB. The current complete NextZXOS distro requires at least 130 MB of disk space. This command will create a 256 MB SD card image; change the &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; value to make the image file as big as you want in megabytes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dd if=/dev/zero of=NextZXOS.img bs=1M count=256&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the commands in this guide must be run as the root user or using sudo.&lt;br /&gt;
&lt;br /&gt;
You will need to install the dosfstools and parted packages if they are not already installed. Debian and Ubuntu Linux users can install these using this apt command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install dosfstools parted&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the SD card image loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find NextZXOS.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a FAT32 partition:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;parted /dev/loop0 mklabel msdos&lt;br /&gt;
parted /dev/loop0 mkpart primary fat32 1MB 100%&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Format and mount the partition under /mnt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mkfs.vfat -F 32 /dev/loop0p1&lt;br /&gt;
mount /dev/loop0p1 /mnt&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now copy all of the files you extracted from sn-complete-WX.YZ.zip into /mnt.&lt;br /&gt;
&lt;br /&gt;
After copying the files, unmount and detach the loopback device (the SD card image):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Warning: the resulting image of this method, if the parameters of different steps aren&#039;t carefully chosen and matched, could be out of the official FAT specifications and/or the expectations of some of the existing programs or systems.&lt;br /&gt;
&lt;br /&gt;
= Mounting SD card images under Linux =&lt;br /&gt;
&lt;br /&gt;
Under Linux, you can use &amp;lt;code&amp;gt;losetup&amp;lt;/code&amp;gt; to mount SD card images as loop devices. This lets you copy files to and from the image and perform other file management tasks as you would using any other filesystem.&lt;br /&gt;
&lt;br /&gt;
Run the following commands as the root user to mount an image called sn-emulator-22.10a.img under the /mnt directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find cspect-next-2gb.img&lt;br /&gt;
mount /dev/loop0p1 /mnt/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you are finished modifying the SD card image, cd out of /mnt, then unmount and detach the loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=MAME Plugins and Scripts=&lt;br /&gt;
&lt;br /&gt;
Some MAME plugins and scripts that may be useful for Next developers and end users are listed [[MAME:Plugins_and_Scripts|here]]. They let you speed up the Next boot time, profile your NextBASIC or assembler code, and more.&lt;br /&gt;
&lt;br /&gt;
=Continuous Integration MAME Builds=&lt;br /&gt;
&lt;br /&gt;
MAME is updated on a release schedule, but due to the ongoing nature of development, including for the MAME Next machine, it can sometimes be useful to install a more recent build if it contains a new feature or bugfix you are interested in. Sometimes, this ongoing work is discussed on social media, such as the [https://discordapp.com/channels/556228195767156758/752197165891321886 Next Developer Discord].&lt;br /&gt;
&lt;br /&gt;
Continuous Integration (CI) builds are available from both the [https://github.com/mamedev/mame/actions primary MAME repo] and [https://github.com/holub/mame/actions holub&#039;s GitHub repo]. Both are considered bleeding-edge, with the primary MAME repo slightly less so. MAME CI builds are available for Windows, Linux, and macOS and are updated automatically whenever code is committed by a maintainer or pushed to the primary repo.&lt;br /&gt;
&lt;br /&gt;
To try out a CI build (more precisely, the resulting binary executable, which is a produced &amp;quot;artifact&amp;quot; of the build process) , first do a full MAME install from the [https://www.mamedev.org/release.html latest release] if you have not already done so. Then back up your main binary from its installation location - these are called something like &amp;lt;code&amp;gt;mame.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mame&amp;lt;/code&amp;gt;. You can always restore these if the CI build doesn&#039;t work, or if you don&#039;t like how it behaves.&lt;br /&gt;
&lt;br /&gt;
You need to be logged in to github to download CI artifacts, so [https://github.com/login sign in] or [https://github.com/signup sign up].&lt;br /&gt;
&lt;br /&gt;
Then visit one of the links above and find a workflow run item for your platform. Workflow items are the things in the list. The tags are flagged as &amp;lt;code&amp;gt;CI (Windows)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CI (Linux)&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;CI (macOS)&amp;lt;/code&amp;gt; in the second row of each workflow item in the list (not the filter in the left hand nav menu). Click on a completed workfow item (only items with green checkmarks will have created downloadable binaries yet), find the Artifacts section at the bottom, then click the Download button. Unzip the downloaded file and find the main binary (with the same name as above). Copy the main binary to the install location, overwriting the original one, and run MAME the same way you were running it before. On Windows and macOS, you need to repeat the security steps above to trust the new MAME executable.&lt;br /&gt;
&lt;br /&gt;
= More MAME links =&lt;br /&gt;
&lt;br /&gt;
The official MAME source code repository is available [https://github.com/mamedev/mame/blob/master/src/mame/sinclair/specnext.cpp here].&lt;br /&gt;
&lt;br /&gt;
holub, the author of the Next emulation, maintains a fork [https://github.com/holub/mame here] that may contain new fixes and features before they are merged into the official repository.&lt;br /&gt;
&lt;br /&gt;
MAME [https://docs.mamedev.org/ documentation].&lt;br /&gt;
&lt;br /&gt;
Report any issues with MAME on the [https://mametesters.org/ bugtracker].&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41464</id>
		<title>MAME:Installing</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41464"/>
		<updated>2025-12-05T22:46:59Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added security instructions for macOS. Reformatted instructions for clarity.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mamedev.org/ MAME] (formerly an acronym of Multiple Arcade Machine Emulator) is a free and open-source emulator designed to emulate the hardware of arcade games, later expanded to include video game consoles, old computers and other systems in software on modern personal computers and other platforms.&lt;br /&gt;
&lt;br /&gt;
MAME has supported the ZX Spectrum Next since version 0.267. The existing implementation is based on the v3.02.01 core and implements most of the features.&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
You will need to install MAME, provide it with the Next firmware (&#039;ROM&#039;), and get the NextZXOS image:&lt;br /&gt;
&lt;br /&gt;
=== 1. Get MAME ===&lt;br /&gt;
* &#039;&#039;&#039;Windows:&#039;&#039;&#039; Download [https://www.mamedev.org/release.html MAME for Windows].&lt;br /&gt;
* &#039;&#039;&#039;macOS:&#039;&#039;&#039; Download [https://sdlmame.lngn.net/ MAME for macOS].&lt;br /&gt;
* &#039;&#039;&#039;Linux:&#039;&#039;&#039; Install MAME from the flatpak repositories by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo flatpak install org.mamedev.MAME&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alternatively, for the MAME platform as a whole, you can also check your package manager, or [https://docs.mamedev.org/initialsetup/compilingmame.html build from sources].&lt;br /&gt;
&lt;br /&gt;
Note that Windows and macOS will likely prevent you from launching MAME directly for security reasons. See below on how to solve this.&lt;br /&gt;
&lt;br /&gt;
=== 2. Get TBBLUE (the Next &#039;ROM&#039;) ===&lt;br /&gt;
Put the file  [https://github.com/Threetwosevensixseven/NexCreator/raw/master/bootroms/tbblue.zip tbblue.zip] into MAME&#039;s &amp;lt;code&amp;gt;roms&amp;lt;/code&amp;gt; folder. Don&#039;t extract it; MAME will look for the zip file when the &amp;quot;tbblue&amp;quot; machine is selected.&lt;br /&gt;
&lt;br /&gt;
=== 3. Get the NextZXOS Image ===&lt;br /&gt;
Get an SD card image file of [https://www.specnext.com/system-next22-10/ NextZXOS]. Some published images do not work with some emulators, but all images from https://zxnext.uk/hosted/#sd are now confirmed to work with both MAME and CSpect, like [https://zxnext.uk/hosted/index_files/hdfimages/cspect-next-2gb.zip this one] (the SD card image is the &amp;lt;code&amp;gt;cspect-next-2gb.img&amp;lt;/code&amp;gt; file inside the zip archive). You will point MAME to this SD card image with the &amp;lt;code&amp;gt;-hard1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-hard2&amp;lt;/code&amp;gt; options (or select the files from the menu inside MAME).&lt;br /&gt;
&lt;br /&gt;
= Usage =&lt;br /&gt;
MAME looks for its configuration and helper files in specific (configurable) folders. By default, these are relative to the current working directory (cwd), i.e., from where you launched the executable. The &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file and folders like &amp;lt;code&amp;gt;roms, bgfx, plugins, language, ...&amp;lt;/code&amp;gt; are expected there, unless the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file specifies other paths. When launching through a desktop icon or menu, depending on the OS, the working directory is often defined by the properties of that launch shortcut. When launching MAME from the command line, the current directory is &amp;quot;cwd&amp;quot; (doh). On Linux, MAME will look for &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; first in the &amp;lt;code&amp;gt;~/.mame&amp;lt;/code&amp;gt; folder. You can use the option &amp;lt;code&amp;gt;-inipath&amp;lt;/code&amp;gt; to point MAME to a different path for the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
However, the fastest way to run a machine with a desired configuration is from the command prompt, without requiring a &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file. Most of the features are also available through MAME&#039;s UI, although that takes more time to configure.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s cover some useful options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Run inside a window and with no mouse support, until you get familiar with the UI keys:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; mame tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch the Linux flatpak version using the same options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; flatpak run org.mamedev.MAME tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Activate UI keys on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -ui_active&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Don&#039;t show the info popup on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -skip_gameinfo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run with debugger. If you don&#039;t request this on startup, you won&#039;t have access to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -debug&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;quot;crisp&amp;quot; pixels:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -nounevenstretch -aspect 2:1 -video bgfx -bgfx_screen_chains unfiltered&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;No joystick connected to PC (may slightly speed up MAME&#039;s startup):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -joystickprovider none&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ask for confirmation when exiting MAME (otherwise it&#039;s easy to exit MAME accidentally by hitting ESC, especially when playing games or navigating menus):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -confirm_quit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.mamedev.org/commandline/commandline-all.html#mame-commandline-universal official MAME documentation] for more advanced usage.&lt;br /&gt;
&lt;br /&gt;
As an example, this invocation enables the UI, uses &amp;quot;crisp pixels&amp;quot;, starts in a window, doesn&#039;t display the starting gameinfo window (it can still be displayed interactively from the UI), disables the mouse, confirms before exiting MAME, and specifies the disk image (remember to adjust the path to it):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mame -ui_active -nounevenstretch -aspect 2:1 -video bgfx  -bgfx_screen_chains unfiltered -window -skip_gameinfo -mouse_device none -confirm_quit tbblue -hard1 /path/to/cspect-next-2gb.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Security: Allowing MAME to Run on Windows and macOS =&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On Windows,&#039;&#039;&#039; you will need to confirm that you want to launch MAME by clicking &amp;quot;Run Anyway&amp;quot; on first launch. &#039;&#039;(More details needed here.)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;On macOS,&#039;&#039;&#039; MAME will not open at first. Instead, a dialog will appear saying:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;“mame” Not Opened. Apple could not verify “mame” is free of malware that may harm your Mac or compromise your privacy.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Click “Done”. Then open &#039;&#039;&#039;System Settings -&amp;gt; Privacy &amp;amp; Security&#039;&#039;&#039;, and scroll down to the message &#039;&#039;mame was blocked to protect your Mac.&#039;&#039; Click “Allow Anyway”.&lt;br /&gt;
&lt;br /&gt;
Now launch MAME again. A dialog will ask once more if you want to open “mame”. Click “Open Anyway”, and enter your password or use Touch ID when prompted by macOS.&lt;br /&gt;
&lt;br /&gt;
From now on, you can launch this version of MAME without warnings. However, you &#039;&#039;&#039;will&#039;&#039;&#039; need to repeat this each time you update MAME.&lt;br /&gt;
&lt;br /&gt;
= Keys =&lt;br /&gt;
&lt;br /&gt;
Keys are emulated in two modes: either to control the MAME emulator or completely dedicated to the emulated system (the Next). You can toggle between these two keyboard modes with ScrLk (on Win and Linux) or fn+delete (on Mac).&lt;br /&gt;
&lt;br /&gt;
Some UI keys:&lt;br /&gt;
* F3 - soft reset&lt;br /&gt;
* Shift+F3 - hard reset&lt;br /&gt;
* F4 - sprites/tiles/font viewer (Enter, ], [)&lt;br /&gt;
* F5 - pause emulation&lt;br /&gt;
* F6 - save state&lt;br /&gt;
* F7 - load state&lt;br /&gt;
* Tab - emulator settings&lt;br /&gt;
* ~ - menu&lt;br /&gt;
* ` (backtick) - debugger (when enabled by starting MAME with &amp;lt;code&amp;gt;-debug&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; on the command line)&lt;br /&gt;
* PgDwn (Linux/Mac), fn-Downarrow (MacBooks) or Insert (Win) - hold down to fast-forward emulation at maximum speed, e.g., to speed up booting the Next&lt;br /&gt;
* Esc - exit (exits menus but also the entire emulator - see &amp;lt;code&amp;gt;-confirm_quit&amp;lt;/code&amp;gt; option above)&lt;br /&gt;
* F11 - DivMMC NMI&lt;br /&gt;
* F12 - Multiface NMI&lt;br /&gt;
&lt;br /&gt;
= Changing the UI toggle key =&lt;br /&gt;
&lt;br /&gt;
Some laptops don&#039;t have a Scroll Lock key, so you may not be able to exit MAME if you run it in full-screen mode. In these cases, you can change the UI toggle key as follows:&lt;br /&gt;
&lt;br /&gt;
* Run MAME without any command line arguments (except maybe -window) to open its GUI.&lt;br /&gt;
* Push TAB and enter the General Settings menu.&lt;br /&gt;
* Go to Input Assignments -&amp;gt; User Interface -&amp;gt; Toggle UI controls and select a new key. I use Right Alt / Alt GR.&lt;br /&gt;
* Return to the previous menu twice, then choose Save Settings&lt;br /&gt;
&lt;br /&gt;
= Creating a NextZXOS SD card image under Linux =&lt;br /&gt;
&lt;br /&gt;
Most users wanting to emulate the Next using MAME will be fine using a pre-built SD card image downloaded from the specnext website. The following guide is provided for anyone wanting to create a NextZXOS SD card image from scratch.&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.specnext.com/latestdistro/ latest NextZXOS distribution zip file] (named something like sn-complete-WX.YZ.zip) and extract it into a new, empty directory.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using hdfmonkey ==&lt;br /&gt;
&lt;br /&gt;
If you extracted sn-complete-WX.YZ.zip into a subdirectory named &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt;, and you want to create a 1GB image called &amp;lt;code&amp;gt;NextZXOS.img&amp;lt;/code&amp;gt; and you have a [[Development_Tools:Linux_setup#hdfmonkey_tool | &amp;quot;jjjs build&amp;quot; of hdfmonkey]], then it&#039;s enough to do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
hdfmonkey create NextZXOS.img 1G&lt;br /&gt;
hdfmonkey putdir NextZXOS.img snWXYZ /&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first line creates an empty 1GB image and formats it with the best FAT parameters suited to the size of the image.&lt;br /&gt;
&lt;br /&gt;
The second line recursively copies all the content of the directory &amp;lt;code&amp;gt;snWXYZ&amp;lt;/code&amp;gt; to the image, preserving the directory structure inside, starting from the &amp;lt;code&amp;gt;/&amp;lt;/code&amp;gt; in the image.&lt;br /&gt;
&lt;br /&gt;
One of the advantages of this method is that even if the image has a capacity of 1GB, it will use much less space on your hard drive until you fill up the image. A command &amp;lt;code&amp;gt;du -h NextZXOS.img&amp;lt;/code&amp;gt; shows the actual amount of disk space used by the image.&lt;br /&gt;
&lt;br /&gt;
The fastest way to transfer a file or a directory (including its content, recursively) into an image is by using a single &amp;lt;code&amp;gt;put&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;putdir&amp;lt;/code&amp;gt;, if it&#039;s to transfer the directory file content to an existing directory) command of hdfmonkey.&lt;br /&gt;
&lt;br /&gt;
The most convenient tool to [[Development_Tools:Linux_setup#Extracting_all_files_from_the_SD_image | copy of all the content from the image to a folder outside of the image]] is 7-zip.&lt;br /&gt;
&lt;br /&gt;
== Creating and populating a SD card image using other tools ==&lt;br /&gt;
&lt;br /&gt;
Create a disk image of at least 256 MB. The current complete NextZXOS distro requires at least 130 MB of disk space. This command will create a 256 MB SD card image; change the &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; value to make the image file as big as you want in megabytes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dd if=/dev/zero of=NextZXOS.img bs=1M count=256&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the commands in this guide must be run as the root user or using sudo.&lt;br /&gt;
&lt;br /&gt;
You will need to install the dosfstools and parted packages if they are not already installed. Debian and Ubuntu Linux users can install these using this apt command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install dosfstools parted&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the SD card image loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find NextZXOS.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a FAT32 partition:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;parted /dev/loop0 mklabel msdos&lt;br /&gt;
parted /dev/loop0 mkpart primary fat32 1MB 100%&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Format and mount the partition under /mnt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mkfs.vfat -F 32 /dev/loop0p1&lt;br /&gt;
mount /dev/loop0p1 /mnt&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now copy all of the files you extracted from sn-complete-WX.YZ.zip into /mnt.&lt;br /&gt;
&lt;br /&gt;
After copying the files, unmount and detach the loopback device (the SD card image):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Warning: the resulting image of this method, if the parameters of different steps aren&#039;t carefully chosen and matched, could be out of the official FAT specifications and/or the expectations of some of the existing programs or systems.&lt;br /&gt;
&lt;br /&gt;
= Mounting SD card images under Linux =&lt;br /&gt;
&lt;br /&gt;
Under Linux, you can use &amp;lt;code&amp;gt;losetup&amp;lt;/code&amp;gt; to mount SD card images as loop devices. This lets you copy files to and from the image and perform other file management tasks as you would using any other filesystem.&lt;br /&gt;
&lt;br /&gt;
Run the following commands as the root user to mount an image called sn-emulator-22.10a.img under the /mnt directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find cspect-next-2gb.img&lt;br /&gt;
mount /dev/loop0p1 /mnt/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you are finished modifying the SD card image, cd out of /mnt, then unmount and detach the loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=MAME Plugins and Scripts=&lt;br /&gt;
&lt;br /&gt;
Some MAME plugins and scripts that may be useful for Next developers and end users are listed [[MAME:Plugins_and_Scripts|here]]. They let you speed up the Next boot time, profile your NextBASIC or assembler code, and more.&lt;br /&gt;
&lt;br /&gt;
=Continuous Integration MAME Builds=&lt;br /&gt;
&lt;br /&gt;
MAME is updated on a release schedule, but due to the ongoing nature of development, including for the MAME Next machine, it can sometimes be useful to install a more recent build if it contains a new feature or bugfix you are interested in. Sometimes, this ongoing work is discussed on social media, such as the [https://discordapp.com/channels/556228195767156758/752197165891321886 Next Developer Discord].&lt;br /&gt;
&lt;br /&gt;
Continuous Integration (CI) builds are available from both the [https://github.com/mamedev/mame/actions primary MAME repo] and [https://github.com/holub/mame/actions holub&#039;s GitHub repo]. Both are considered bleeding-edge, with the primary MAME repo slightly less so. MAME CI builds are available for Windows, Linux, and macOS and are updated automatically whenever code is committed by a maintainer or pushed to the primary repo.&lt;br /&gt;
&lt;br /&gt;
To try out a CI build (more precisely, the resulting binary executable, which is a produced &amp;quot;artifact&amp;quot; of the build process) , first do a full MAME install from the [https://www.mamedev.org/release.html latest release] if you have not already done so. Then back up your main binary from its installation location - these are called something like &amp;lt;code&amp;gt;mame.exe&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mame&amp;lt;/code&amp;gt;. You can always restore these if the CI build doesn&#039;t work, or if you don&#039;t like how it behaves.&lt;br /&gt;
&lt;br /&gt;
You need to be logged in to github to download CI artifacts, so [https://github.com/login sign in] or [https://github.com/signup sign up].&lt;br /&gt;
&lt;br /&gt;
Then visit one of the links above and find a workflow run item for your platform. Workflow items are the things in the list. The tags are flagged as &amp;lt;code&amp;gt;CI (Windows)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CI (Linux)&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;CI (macOS)&amp;lt;/code&amp;gt; in the second row of each workflow item in the list (not the filter in the left hand nav menu). Click on a completed workfow item (only items with green checkmarks will have created downloadable binaries yet), find the Artifacts section at the bottom, then click the Download button. Unzip the downloaded file and find the main binary (with the same name as above). Copy the main binary to the install location, overwriting the original one, and run MAME the same way you were running it before. On Windows and macOS, you need to repeat the security steps above to trust the new MAME executable.&lt;br /&gt;
&lt;br /&gt;
= More MAME links =&lt;br /&gt;
&lt;br /&gt;
The official MAME source code repository is available [https://github.com/mamedev/mame/blob/master/src/mame/sinclair/specnext.cpp here].&lt;br /&gt;
&lt;br /&gt;
holub, the author of the Next emulation, maintains a fork [https://github.com/holub/mame here] that may contain new fixes and features before they are merged into the official repository.&lt;br /&gt;
&lt;br /&gt;
MAME [https://docs.mamedev.org/ documentation].&lt;br /&gt;
&lt;br /&gt;
Report any issues with MAME on the [https://mametesters.org/ bugtracker].&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41436</id>
		<title>MAME:Installing</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=MAME:Installing&amp;diff=41436"/>
		<updated>2025-12-02T19:01:08Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added -confirm_quit startup option. Corrected minor typos throughout.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://www.mamedev.org/ MAME] (formerly an acronym of Multiple Arcade Machine Emulator) is a free and open-source emulator designed to emulate the hardware of arcade games, later expanded to include video game consoles, old computers and other systems in software on modern personal computers and other platforms.&lt;br /&gt;
&lt;br /&gt;
MAME supports the ZX Spectrum Next since version 0.267. The existing implementation is based on the v3.02.01 core and implements most of the features.&lt;br /&gt;
&lt;br /&gt;
= Get =&lt;br /&gt;
The latest MAME version for Windows is available [https://www.mamedev.org/release.html here], and macOS builds can be downloaded from [https://sdlmame.lngn.net/ here.] For the MAME platform as a whole, check your package manager, or [https://docs.mamedev.org/initialsetup/compilingmame.html build from sources].&lt;br /&gt;
&lt;br /&gt;
Linux users can also install the latest stable version of MAME from the flatpak repositories by running:&lt;br /&gt;
&amp;lt;pre&amp;gt;sudo flatpak install org.mamedev.MAME&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Put the ROM dump zip of the ZX Next [https://github.com/Threetwosevensixseven/NexCreator/raw/master/bootroms/tbblue.zip tbblue.zip] into MAME&#039;s &amp;lt;code&amp;gt;roms&amp;lt;/code&amp;gt; folder (don&#039;t extract it; MAME will look for the zip file when the &amp;quot;tbblue&amp;quot; machine is selected).&lt;br /&gt;
&lt;br /&gt;
Prepare an SD card image file of [https://www.specnext.com/system-next22-10/ NextZXOS]. Some published images do not work with some emulators, but all images from https://zxnext.uk/hosted/#sd are now confirmed to work with both MAME and CSpect, including the official ones like [https://zxnext.uk/hosted/index_files/hdfimages/cspect-next-2gb.zip this one] (the SD card image is the &amp;lt;code&amp;gt;cspect-next-2gb.img&amp;lt;/code&amp;gt; file inside the zip archive). You will point MAME to the desired SD card image with the &amp;lt;code&amp;gt;-hard1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-hard2&amp;lt;/code&amp;gt; options (or select the files from the menu inside the emulator).&lt;br /&gt;
&lt;br /&gt;
= Use =&lt;br /&gt;
MAME looks for its configuration and helper files in specific (configurable) folders. By default, these are relative to the current working directory (cwd), ie., from where you launched the executable. The &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file and folders like &amp;lt;code&amp;gt;roms, bgfx, plugins, language, ...&amp;lt;/code&amp;gt; are expected there, unless the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file specifies other paths. When launching through a desktop icon or menu, depending on the OS, the working directory is often defined by the properties of that launch shortcut. When launching MAME from the command line, the current directory is &amp;quot;cwd&amp;quot; (doh). On Linux, MAME will look for &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; first in the &amp;lt;code&amp;gt;~/.mame&amp;lt;/code&amp;gt; folder. You can use the option &amp;lt;code&amp;gt;-inipath&amp;lt;/code&amp;gt; to point MAME to a different path for the &amp;lt;code&amp;gt;mame.ini&amp;lt;/code&amp;gt; file.&lt;br /&gt;
&lt;br /&gt;
The fastest way to run a machine with a desired configuration is from the command prompt. Most of the features are also available through MAME&#039;s UI, but that takes more time to configure.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s cover some useful options:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol start=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Run inside a window and with no mouse support, until you get familiar with the UI keys:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; mame tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
To launch the Linux flatpak version using the same options:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; flatpak run org.mamedev.MAME tbblue -window -mouse_device none -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Activate UI keys on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -ui_active&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
Don&#039;t show the info popup on startup:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -skip_gameinfo&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Run with debugger. If you don&#039;t request this on startup, you won&#039;t have access to it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -debug&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Use &amp;quot;crisp&amp;quot; pixels:&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -nounevenstretch -aspect 2:1 -video bgfx -bgfx_screen_chains unfiltered&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;No joystick connected to PC (may slightly speed up MAME&#039;s startup):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -joystickprovider none&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;Ask for confirmation when exiting MAME (otherwise it&#039;s easy to exit MAME accidentally by hitting ESC, especially when playing games or navigating menus):&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;gt; ... -confirm_quit&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.mamedev.org/commandline/commandline-all.html#mame-commandline-universal official MAME documentation] for more advanced usage.&lt;br /&gt;
&lt;br /&gt;
As an example, this invocation enables the UI, uses &amp;quot;crisp pixels&amp;quot;, starts in a window, doesn&#039;t display the starting gameinfo window (it can still be displayed interactively from the UI), disables the mouse, confirms before exiting MAME, and specifies the disk image:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mame -ui_active -nounevenstretch -aspect 2:1 -video bgfx  -bgfx_screen_chains unfiltered -window -skip_gameinfo -mouse_device none -confirm_quit tbblue -hard1 /path/to/next-distribution.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Keys =&lt;br /&gt;
&lt;br /&gt;
Keys are emulated in two modes: either to control the MAME emulator or completely dedicated to the emulated system (the Next). You can toggle between these two keyboard modes with ScrLk (on Win and Linux) or fn+delete (on Mac).&lt;br /&gt;
&lt;br /&gt;
Some UI keys:&lt;br /&gt;
* F3 - soft reset&lt;br /&gt;
* Shift+F3 - hard reset&lt;br /&gt;
* F4 - sprites/tiles/font viewer (Enter, ], [)&lt;br /&gt;
* F5 - pause emulation&lt;br /&gt;
* F6 - save state&lt;br /&gt;
* F7 - load state&lt;br /&gt;
* Tab - emulator settings&lt;br /&gt;
* ~ - menu&lt;br /&gt;
* PgDwn (Linux/Mac), fn-Downarrow (MacBooks) or Insert (Win) - hold down to fast-forward emulation at maximum speed, e.g., to speed up booting the Next&lt;br /&gt;
* Esc - exit (exits menus but also the entire emulator - see &amp;lt;code&amp;gt;-confirm_quit&amp;lt;/code&amp;gt; option above)&lt;br /&gt;
* F11 - DivMMC NMI&lt;br /&gt;
* F12 - Multiface NMI&lt;br /&gt;
&lt;br /&gt;
= Changing the UI toggle key =&lt;br /&gt;
&lt;br /&gt;
Some laptops don&#039;t have a Scroll Lock key, so you may not be able to exit MAME if you run it in full-screen mode. In these cases, you can change the UI toggle key as follows:&lt;br /&gt;
&lt;br /&gt;
* Run MAME without any command line arguments (except maybe -window) to open its GUI.&lt;br /&gt;
* Push TAB and enter the General Settings menu.&lt;br /&gt;
* Go to Input Assignments -&amp;gt; User Interface -&amp;gt; Toggle UI controls and select a new key. I use Right Alt / Alt GR.&lt;br /&gt;
* Return to the previous menu twice, then choose Save Settings&lt;br /&gt;
&lt;br /&gt;
= Mounting SD card images under Linux =&lt;br /&gt;
&lt;br /&gt;
Under Linux, you can use &amp;lt;code&amp;gt;losetup&amp;lt;/code&amp;gt; to mount SD card images as loop devices. This lets you copy files to and from the image and perform other file management tasks as you would using any other filesystem.&lt;br /&gt;
&lt;br /&gt;
Run the following commands as the root user to mount an image called sn-emulator-22.10a.img under the /mnt directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find cspect-next-2gb.img&lt;br /&gt;
mount /dev/loop0p1 /mnt/&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you are finished modifying the SD card image, cd out of /mnt, then unmount and detach the loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Creating a NextZXOS SD card image under Linux =&lt;br /&gt;
&lt;br /&gt;
Most users wanting to emulate the Next using MAME will be fine using a pre-built SD card image downloaded from the specnext website. The following guide is provided for anyone wanting to create a NextZXOS SD card image from scratch.&lt;br /&gt;
&lt;br /&gt;
Download the [https://www.specnext.com/latestdistro/ latest NextZXOS distribution zip file] (named something like sn-complete-WX.YZ.zip) and extract it into a new, empty directory.&lt;br /&gt;
&lt;br /&gt;
Create a disk image of at least 256 MB. The current complete NextZXOS distro requires at least 130 MB of disk space. This command will create a 256 MB SD card image; change the &amp;lt;code&amp;gt;count&amp;lt;/code&amp;gt; value to make the image file as big as you want in megabytes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;dd if=/dev/zero of=NextZXOS.img bs=1M count=256&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The rest of the commands in this guide must be run as the root user or using sudo.&lt;br /&gt;
&lt;br /&gt;
You will need to install the dosfstools and parted packages if they are not already installed. Debian and Ubuntu Linux users can install these using this apt command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;apt install dosfstools parted&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the SD card image loopback device:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;losetup --partscan --show --find NextZXOS.img&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Create a FAT32 partition:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;parted /dev/loop0 mklabel msdos&lt;br /&gt;
parted /dev/loop0 mkpart primary fat32 1MB 100%&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Format and mount the partition under /mnt:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;mkfs.vfat -F 32 /dev/loop0p1&lt;br /&gt;
mount /dev/loop0p1 /mnt&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can now copy all of the files you extracted from sn-complete-WX.YZ.zip into /mnt.&lt;br /&gt;
&lt;br /&gt;
After copying the files, unmount and detach the loopback device (the SD card image):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;umount /mnt/&lt;br /&gt;
losetup -D&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=MAME Plugins and Scripts=&lt;br /&gt;
&lt;br /&gt;
Some MAME plugins and scripts that may be useful for Next developers and end users are listed [[MAME:Plugins_and_Scripts|here: MAME:Plugins_and_Scripts]]. They let you speed up the Next boot time, profile your NextBASIC or assembler code, and more.&lt;br /&gt;
&lt;br /&gt;
=Continuous Integration MAME Builds=&lt;br /&gt;
&lt;br /&gt;
MAME is updated on a release schedule, but due to the ongoing nature of development, including for the MAME Next machine, it can sometimes be useful to install a more recent build if it contains a new feature or bugfix you are interested in. Sometimes, this ongoing work is discussed on social media, such as the [https://discordapp.com/channels/556228195767156758/752197165891321886 Next Developer Discord].&lt;br /&gt;
&lt;br /&gt;
Continuous Integration (CI) builds are available from both the [https://github.com/mamedev/mame/actions primary MAME repo] and [https://github.com/holub/mame/actions holub&#039;s GitHub repo]. Both are considered bleeding-edge, with the primary MAME repo slightly less so. MAME CI builds are available for Windows, Linux, and macOS and are updated automatically whenever code is committed by a maintainer or pushed to the primary repo.&lt;br /&gt;
&lt;br /&gt;
To try out a CI build, first do a full MAME install from the [https://www.mamedev.org/release.html latest release] if you have not already done so. Then back up your main binary from its installation location - these are called something like &amp;lt;code&amp;gt;mame.exe&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;mame&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;mametiny&amp;lt;/code&amp;gt;. You can always restore these if the CI build doesn&#039;t work, or if you don&#039;t like how it behaves.&lt;br /&gt;
&lt;br /&gt;
Then visit one of the links above and find a workflow run item for your platform - these are flagged as &amp;lt;code&amp;gt;CI (Windows)&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;CI (Linux)&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;CI (macOS)&amp;lt;/code&amp;gt;. Click on it and find the Artifacts section at the bottom, then click the Download button. Unzip the downloaded file and find the main binary (with the same name as above). Copy the main binary to the install location, overwriting the original one, and run MAME the same way you were running it before. On Windows and macOS, you may need to take an additional step to trust the binary (&amp;quot;Run Anyway&amp;quot; on Windows; &amp;quot;System Preferences -&amp;gt; Privacy &amp;amp; Security -&amp;gt; Allow mame to Run&amp;quot; on macOS).&lt;br /&gt;
&lt;br /&gt;
= More MAME links =&lt;br /&gt;
&lt;br /&gt;
The official MAME source code repository is available [https://github.com/mamedev/mame/blob/master/src/mame/sinclair/specnext.cpp here].&lt;br /&gt;
&lt;br /&gt;
holub, the author of the Next emulation, maintains a fork [https://github.com/holub/mame here] that may contain new fixes and features before they are merged into the official repository.&lt;br /&gt;
&lt;br /&gt;
MAME [https://docs.mamedev.org/ documentation].&lt;br /&gt;
&lt;br /&gt;
Report any issues with MAME on the [https://mametesters.org/ bugtracker].&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Miscellaneous&amp;diff=14499</id>
		<title>Miscellaneous</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Miscellaneous&amp;diff=14499"/>
		<updated>2025-06-13T07:54:33Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: hdfmonkey: Changed Janko’s author name at his request&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== &#039;&#039;[http://simon.mooli.org.uk/nextech/ Simon N Goodwin&#039;s Spectrum Next Page]&#039;&#039; ===&lt;br /&gt;
: A host of utilites for NextBasic written by Simon, NextPort, Nextramon, &lt;br /&gt;
: Next MGT Reader amongst other treasures.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/kounch/vscode_zx Visual Studio Code Tasks and Scripts]&#039;&#039; ===&lt;br /&gt;
: Some VSC goodies by kounch to work with NextBasic and ZX Basic&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/stefanbylund/zxnext_bmp_tools Next BMP Tools]&#039;&#039; ===&lt;br /&gt;
: The Next BMP tools are BMP image conversion tools targeting the Sinclair ZX Spectrum Next written&lt;br /&gt;
: by Stefan Bylund&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://wiki.twistedraven.net/index.php?title=Downloads Octarine Studio]&#039;&#039; ===&lt;br /&gt;
: Octarine Studio by Guy Black is a PC based editing tool that currently supports palettes and tiles. &lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://www.specnext.com/forum/viewtopic.php?f=7&amp;amp;t=351 UDGeedNext Sprite Editor]&#039;&#039; ===&lt;br /&gt;
: Windows based sprite editor written by some guy I have never heard of. Currently supports 8 bit&lt;br /&gt;
: palettes. 9 bit and 4 bit sprites should be added at some point....&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[http://worldofpaul.com/speccyart/ Speccy Art]&#039;&#039; ===&lt;br /&gt;
: An online drawing experience that aims to help you create Sinclair ZX Spectrum-like images.&lt;br /&gt;
: Supports the classic ULA mode (256x192 pixels with 8x8 attribute squares and 15 classic ZX colours)&lt;br /&gt;
: Supports the Timex HiColour mode (256x192 pixels with 8x1 attribute rectangles and 15 classic ZX colours)&lt;br /&gt;
: Images can be saved and loaded through TAP files or exported into SCR/SHC files.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/varmfskii/zxnext_tools ZX Spectrum Next tools by Theodore (Alex) Evans]&#039;&#039; ===&lt;br /&gt;
: Multiple tools for various graphics conversions and processing&lt;br /&gt;
: zxnftp for transferring files between PC and Next via the ESP WiFi module&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://gitlab.com/zxnexttools/nim Next Image Manipulator by Matt Davies]&#039;&#039; ===&lt;br /&gt;
: windows command line tool to convert various image and palette formats to custom &amp;quot;nip/nim&amp;quot; binary formats which are simple enough to parse (or include directly into source with assemblers supporting binary includes)&lt;br /&gt;
: this is early version (already working, build it from source), but further expansion to support also tiles/etc may happen in future&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/gasman/hdfmonkey hdfmonkey]&#039;&#039; ===&lt;br /&gt;
: A Swiss Army Knife for working with FAT partitions on Spectrum emulator HDF images. The more recent [https://www.specnext.com/forum/viewtopic.php?p=16108 hdfmonkey jjjs builds by johnnyo] also support the [https://www.specnext.com/latestdistro/ imperfect SD card images of the distribution for emulators from specnext.com], and they include executable binaries for Windows, Linux, and macOS.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://zeroonetwenty.com/blueharvest/ Blue Harvest]&#039;&#039; ===&lt;br /&gt;
: A convenient macOS tool to keep SD cards free from macOS metadata. Free 30-day trial.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/MrKWatkins/ZXSpectrumNextTests ZXSpectrumNextTests by Kevin Watkins and Peter Helcmanovsky]&#039;&#039; ===&lt;br /&gt;
: Suite of tests exercising various aspects of ZX Spectrum Next&lt;br /&gt;
: Tests for: Next registers, Copper, Sprites, Layer2, ULA modes, Extended ULA, Layers mixing modes, Z80N instructions, ...&lt;br /&gt;
: ASM Sources for each test (sjasmplus assembler syntax)&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/Threetwosevensixseven/ZXSpectrumNextTests ZXSpectrumNextTests by Robin Verhagen-Guest]&#039;&#039; ===&lt;br /&gt;
: Suite of tests exercising various aspects of ZX Spectrum Next (yes, one more :) )&lt;br /&gt;
: Tests for: DMA, MMU paging, Layers mixing modes&lt;br /&gt;
: ASM Sources for each test (Zeus assembler syntax)&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&amp;lt;div id=&amp;quot;WASPtools&amp;quot; name=&amp;quot;WASPtools&amp;quot;&amp;gt;WASPtools by Phoebus Dokos&amp;lt;/div&amp;gt;&#039;&#039; ===&lt;br /&gt;
WASPtools is a suite of tools comprised of a palette manipulator, a sprite editor, a graphics converter, and tilemap editor (both virtual tilemaps for say Layer2, and the hardware tilemap mode).&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://zx.remysharp.com Online sprite, palette and tilemap editor by Remy Sharp]&#039;&#039; ===&lt;br /&gt;
: Browser based tooling that works fully offline&lt;br /&gt;
: Sprite editor with import and export tools&lt;br /&gt;
: Tile map editor with 16x16 and 8x8 tile support&lt;br /&gt;
: Full 512 palette import and export&lt;br /&gt;
: Also includes image conversion tools from PNG to 8 bit BMP and SL2 formats&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://marketplace.visualstudio.com/items?itemName=remysharp.nextbasic NextBASIC extension for VS Code by Remy Sharp]&#039;&#039; ===&lt;br /&gt;
: Syntax highlighting, folding and definition jumping&lt;br /&gt;
: Export and import .bas to .txt and visa versa&lt;br /&gt;
: Inline help, line number completion and inline error checking&lt;br /&gt;
: Launches Cspect with minimal configuration&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://www.specnext.com/forum/viewtopic.php?f=17&amp;amp;t=1715 NextSync WiFi file transferring by Jari Komppa]&#039;&#039; ===&lt;br /&gt;
: Run &amp;quot;server&amp;quot; code on your local PC (python 3 required)&lt;br /&gt;
: Run &amp;quot;.sync&amp;quot; on the Next&lt;br /&gt;
: Changed files will be copied from PC to Next by ESP WiFi module&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Miscellaneous&amp;diff=14480</id>
		<title>Miscellaneous</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Miscellaneous&amp;diff=14480"/>
		<updated>2025-06-12T21:28:44Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added info on Janko’s hdfmonkey fork, and on Blue Harvest.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== &#039;&#039;[http://simon.mooli.org.uk/nextech/ Simon N Goodwin&#039;s Spectrum Next Page]&#039;&#039; ===&lt;br /&gt;
: A host of utilites for NextBasic written by Simon, NextPort, Nextramon, &lt;br /&gt;
: Next MGT Reader amongst other treasures.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/kounch/vscode_zx Visual Studio Code Tasks and Scripts]&#039;&#039; ===&lt;br /&gt;
: Some VSC goodies by kounch to work with NextBasic and ZX Basic&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/stefanbylund/zxnext_bmp_tools Next BMP Tools]&#039;&#039; ===&lt;br /&gt;
: The Next BMP tools are BMP image conversion tools targeting the Sinclair ZX Spectrum Next written&lt;br /&gt;
: by Stefan Bylund&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://wiki.twistedraven.net/index.php?title=Downloads Octarine Studio]&#039;&#039; ===&lt;br /&gt;
: Octarine Studio by Guy Black is a PC based editing tool that currently supports palettes and tiles. &lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://www.specnext.com/forum/viewtopic.php?f=7&amp;amp;t=351 UDGeedNext Sprite Editor]&#039;&#039; ===&lt;br /&gt;
: Windows based sprite editor written by some guy I have never heard of. Currently supports 8 bit&lt;br /&gt;
: palettes. 9 bit and 4 bit sprites should be added at some point....&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[http://worldofpaul.com/speccyart/ Speccy Art]&#039;&#039; ===&lt;br /&gt;
: An online drawing experience that aims to help you create Sinclair ZX Spectrum-like images.&lt;br /&gt;
: Supports the classic ULA mode (256x192 pixels with 8x8 attribute squares and 15 classic ZX colours)&lt;br /&gt;
: Supports the Timex HiColour mode (256x192 pixels with 8x1 attribute rectangles and 15 classic ZX colours)&lt;br /&gt;
: Images can be saved and loaded through TAP files or exported into SCR/SHC files.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/varmfskii/zxnext_tools ZX Spectrum Next tools by Theodore (Alex) Evans]&#039;&#039; ===&lt;br /&gt;
: Multiple tools for various graphics conversions and processing&lt;br /&gt;
: zxnftp for transferring files between PC and Next via the ESP WiFi module&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://gitlab.com/zxnexttools/nim Next Image Manipulator by Matt Davies]&#039;&#039; ===&lt;br /&gt;
: windows command line tool to convert various image and palette formats to custom &amp;quot;nip/nim&amp;quot; binary formats which are simple enough to parse (or include directly into source with assemblers supporting binary includes)&lt;br /&gt;
: this is early version (already working, build it from source), but further expansion to support also tiles/etc may happen in future&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/gasman/hdfmonkey hdfmonkey]&#039;&#039; ===&lt;br /&gt;
: A Swiss Army Knife for working with FAT partitions on Spectrum emulator HDF images. Note: A more recent version of hdfmonkey maintained by Janko also supports the [https://www.specnext.com/latestdistro/ imperfect distribution images for emulators from specnext.com], and it includes executable binaries for Windows, macOS, and Linux. See [https://www.specnext.com/forum/viewtopic.php?p=16108 this hdfmonkey thread in the forum] for details.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://zeroonetwenty.com/blueharvest/ Blue Harvest]&#039;&#039; ===&lt;br /&gt;
: A convenient macOS tool to keep SD cards free from macOS metadata. Free 30-day trial.&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/MrKWatkins/ZXSpectrumNextTests ZXSpectrumNextTests by Kevin Watkins and Peter Helcmanovsky]&#039;&#039; ===&lt;br /&gt;
: Suite of tests exercising various aspects of ZX Spectrum Next&lt;br /&gt;
: Tests for: Next registers, Copper, Sprites, Layer2, ULA modes, Extended ULA, Layers mixing modes, Z80N instructions, ...&lt;br /&gt;
: ASM Sources for each test (sjasmplus assembler syntax)&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://github.com/Threetwosevensixseven/ZXSpectrumNextTests ZXSpectrumNextTests by Robin Verhagen-Guest]&#039;&#039; ===&lt;br /&gt;
: Suite of tests exercising various aspects of ZX Spectrum Next (yes, one more :) )&lt;br /&gt;
: Tests for: DMA, MMU paging, Layers mixing modes&lt;br /&gt;
: ASM Sources for each test (Zeus assembler syntax)&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;&amp;lt;div id=&amp;quot;WASPtools&amp;quot; name=&amp;quot;WASPtools&amp;quot;&amp;gt;WASPtools by Phoebus Dokos&amp;lt;/div&amp;gt;&#039;&#039; ===&lt;br /&gt;
WASPtools is a suite of tools comprised of a palette manipulator, a sprite editor, a graphics converter, and tilemap editor (both virtual tilemaps for say Layer2, and the hardware tilemap mode).&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://zx.remysharp.com Online sprite, palette and tilemap editor by Remy Sharp]&#039;&#039; ===&lt;br /&gt;
: Browser based tooling that works fully offline&lt;br /&gt;
: Sprite editor with import and export tools&lt;br /&gt;
: Tile map editor with 16x16 and 8x8 tile support&lt;br /&gt;
: Full 512 palette import and export&lt;br /&gt;
: Also includes image conversion tools from PNG to 8 bit BMP and SL2 formats&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://marketplace.visualstudio.com/items?itemName=remysharp.nextbasic NextBASIC extension for VS Code by Remy Sharp]&#039;&#039; ===&lt;br /&gt;
: Syntax highlighting, folding and definition jumping&lt;br /&gt;
: Export and import .bas to .txt and visa versa&lt;br /&gt;
: Inline help, line number completion and inline error checking&lt;br /&gt;
: Launches Cspect with minimal configuration&lt;br /&gt;
&lt;br /&gt;
=== &#039;&#039;[https://www.specnext.com/forum/viewtopic.php?f=17&amp;amp;t=1715 NextSync WiFi file transferring by Jari Komppa]&#039;&#039; ===&lt;br /&gt;
: Run &amp;quot;server&amp;quot; code on your local PC (python 3 required)&lt;br /&gt;
: Run &amp;quot;.sync&amp;quot; on the Next&lt;br /&gt;
: Changed files will be copied from PC to Next by ESP WiFi module&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=12024</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=12024"/>
		<updated>2024-02-19T16:01:41Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added heading to clarify that the speaker mod is for KS1 Nexts only&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next can create sound using [[Turbo Sound Next]] (3 AY-3-8912 sound chips) controlled by the BASIC PLAY keyword and the signal from these goes to the HDMI port or the &#039;ear&#039; socket. Additionally an internal speaker can be connected which will generate sound in the same manner as the original 48k Spectrum, controlled via the BEEP keyword, which will also output via HDMI/ear.&lt;br /&gt;
&lt;br /&gt;
A speaker attaches to connector J3 on the circuit board and requires a 2.54mm Pitch, 4 Way, 1 Row through-hole pin header. If you&#039;re fitting the board inside an original rubber key case, you&#039;ll probably need a right-angled connector due to the height required.&lt;br /&gt;
&lt;br /&gt;
The buzzer should be approximately 1 inch diameter with impedance of 16 ohm (which should equate to a basic &#039;PC BIOS&#039; piezo type speaker). J3 pins 1 and 2 are negative, pins 3 and 4 are positive.&lt;br /&gt;
&lt;br /&gt;
=== Increasing Speaker Volume ===&lt;br /&gt;
&#039;&#039;&#039;This modification only works on Kickstarter 1 (= Issue 2B) Nexts. It is &#039;&#039;not&#039;&#039; for Kickstarter 2 (= Issue 4) boards.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
On the Issue 2B boards, [https://www.specnext.com/forum/viewtopic.php?t=1860&amp;amp;hilit=beeper many users found the above speaker too quiet]. For higher volume levels, use an integrated amplifier/speaker board like the [https://www.adafruit.com/product/3885 Adafruit STEMMA Speaker] instead. A [https://www.adafruit.com/product/3893 3-pin JST PH 2.0 mm female header cable] makes disconnecting it again easy.&lt;br /&gt;
&lt;br /&gt;
With the right settings (see below), this will give you roughly original ZX Spectrum sound levels, though &#039;&#039;&#039;only for the beeper used in the classic ZX Spectrum 16/48k&#039;&#039;&#039;. AY sound volume on 128k games like Dizzy 6 or Next games like Baggers In Space is still fairly low but serviceable in a quiet environment. DAC sound (like in the TX-1696 demo) remains too quiet to be usable; use HDMI or the 3.5 mm audio jack instead. To use an internal speaker with those types of audio, you will need a more powerful speaker and amplifier board (and possibly some way to adjust its volume as you switch between audio types).&lt;br /&gt;
&lt;br /&gt;
[[File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg|thumb|center|An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next Issue 2B motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.]]&lt;br /&gt;
&lt;br /&gt;
Solder GND to [[Circuit_Diagrams#J15_-_Next_GPIO|J15 pin 20]], Vcc to J15 pin 19, and the signal input to J3 pin 4 (next to the speaker holes on the Next PCB). Attach the speaker board to the Next case using two pieces of self-adhesive velcro. Place it next to the PCB and near the ZX Spectrum Expansion Connector. See the photo above.&lt;br /&gt;
&lt;br /&gt;
Remove the Expansion Connector cover for more volume, and turn the potentiometer on the speaker board all the way up.&lt;br /&gt;
&lt;br /&gt;
Turn on your Next while holding down SPACE to enter the TBBlue boot ROM menu. Here, toggle &#039;&#039;BEEPer&#039;&#039; to &#039;&#039;Int&#039;&#039; to increase its volume to roughly match the original ZX Spectrum for classic 16/48k &amp;quot;beeper&amp;quot; games (AY and DAC sound will not play through the internal speaker in this case). You can also disable the internal speaker here.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=NextBASIC&amp;diff=11964</id>
		<title>NextBASIC</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=NextBASIC&amp;diff=11964"/>
		<updated>2024-01-13T01:04:17Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NextBASIC is an extended version of the classic Spectrum BASIC which adds extra commands supporting the new features of the NEXT.&lt;br /&gt;
&lt;br /&gt;
? after parameters indicate they are optional. Square brackets [] indicate scope of optional or repeated areas (parentheses are not used for this because they are part of the BASIC language). Bracketed sections in the effects only apply if the optional parameters are specified.&lt;br /&gt;
&lt;br /&gt;
== Basic Interaction Commands ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b LINE x,y || Copies lines x,y into bank b. Once this is done, these lines cannot be edited except by overwriting them with another BANK..LINE command. Cannot be used in a program.&lt;br /&gt;
|-&lt;br /&gt;
| BANK b LIST x? || Lists source code in bank b (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| BANK b MERGE || Adds all basic lines in bank b to main program&lt;br /&gt;
|-&lt;br /&gt;
| CONTINUE || Repeats last command or restarts from error location&lt;br /&gt;
|-&lt;br /&gt;
| CLEAR x? || Resets variables, clears screen, resets plot cursor (and sets ramtop to X)&lt;br /&gt;
|-&lt;br /&gt;
| ERASE f, l || Deletes all program lines between f and l. Cannot be used in a program.&lt;br /&gt;
|-&lt;br /&gt;
| LIST x? || Lists source code (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| LLIST x? || Lists source code to printer (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| NEW || Clear stored program&lt;br /&gt;
|-&lt;br /&gt;
| RUN x? || CLEAR then run program (from line x)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control Flow ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b GO TO x || Jump execution to line x stored in bank b. b=-1 for main program&lt;br /&gt;
|-&lt;br /&gt;
| BANK b GO SUB x || Jump execution to line x stored in bank b, storing current location on gosub stack. b=-1 for main program&lt;br /&gt;
|-&lt;br /&gt;
| DEF FN func(param[,param..])=expr || Creates a user defined function based on a parametrised expression. Will not work if moved into any bank other than the main program&lt;br /&gt;
|-&lt;br /&gt;
| DIM a(x[,y]..) || Defines a as an array of length x (and second dimension length y, etc..)&lt;br /&gt;
|-&lt;br /&gt;
| FOR var = start TO end [STEP step]? || Starts FOR loop between given numeric values (with given step)&lt;br /&gt;
|-&lt;br /&gt;
| GO TO x || Jump execution to line X in the same bank&lt;br /&gt;
|-&lt;br /&gt;
| GO SUB x || Jump execution to line X in the same bank, storing current location (and bank) on gosub stack&lt;br /&gt;
|-&lt;br /&gt;
| IF c THEN statements [ELSE statements] || Run statements only if expression c is true &lt;br /&gt;
|-&lt;br /&gt;
| LET var = expr || Sets variable var to expr&lt;br /&gt;
|-&lt;br /&gt;
| LOCAL var || Declares local variable &lt;br /&gt;
|-&lt;br /&gt;
| NEXT var || Marks end of FOR loop regarding VAR&lt;br /&gt;
|-&lt;br /&gt;
| REM comment || Code comment, ignored&lt;br /&gt;
|-&lt;br /&gt;
| REPEAT || Begin of loop&lt;br /&gt;
|-&lt;br /&gt;
| REPEAT UNTIL condition || Marks the end of REPEAT loop&lt;br /&gt;
|-&lt;br /&gt;
| RETURN || Restore execution location (line and bank) from gosub stack&lt;br /&gt;
|-&lt;br /&gt;
| WHILE condition || Condition for staying in loop&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Console I/O ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| COPY || Prints screen&lt;br /&gt;
|-&lt;br /&gt;
| INKEY$ || Returns currently pressed key&lt;br /&gt;
|-&lt;br /&gt;
| INPUT specifier [connector specifier].. || Output expression(s) and read a variable&lt;br /&gt;
|-&lt;br /&gt;
| INVERSE x || Enable or disable switching ink/paper color when printing (x=0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LPRINT specifier [connector specifier].. || Output expression(s) to printer&lt;br /&gt;
|-&lt;br /&gt;
| OVER x || Enable or disable overprinting (x=0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| PAUSE x || Waits x frames or until a key is pressed&lt;br /&gt;
|-&lt;br /&gt;
| PRINT specifier [connector specifier].. || Output expression(s)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Possible specifiers for PRINT and INPUT statements are:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Specifier !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| var || In PRINT, shows contents of var; in INPUT, inputs into this var&lt;br /&gt;
|-&lt;br /&gt;
| (var) || Shows contents of var (in both PRINT and INPUT)&lt;br /&gt;
|-&lt;br /&gt;
| AT x,y || Moves text cursor to the given text cell &lt;br /&gt;
|-&lt;br /&gt;
| TAB x || Inserts spaces until text cursor is in column x&lt;br /&gt;
|-&lt;br /&gt;
| INK x, PAPER x || Changes the appropriate color for the duration of the print/input statement&lt;br /&gt;
|-&lt;br /&gt;
| LINE x$ || INPUT only, reads a string without the prompting quotes&lt;br /&gt;
|-&lt;br /&gt;
| #x || Selects input/output channel number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And the connectors between these are:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Specifier !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| , || Separate with a tab&lt;br /&gt;
|-&lt;br /&gt;
| &#039; || Separate with a newline&lt;br /&gt;
|-&lt;br /&gt;
| ; || Use no separator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== File I/O ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| CAT || Displays disk/tape catalogue&lt;br /&gt;
|-&lt;br /&gt;
| FORMAT || Prepares inserted disk for usage, erasing it&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn || Load BASIC program from file named fn&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn DATA x() || Load data from fn into array x()&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn CODE addr || Load data from fn into memory at address addr&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn SCREEN$ || Load data from fn onto standard ULA screen&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn BANK b,addr || Load data from fn into memory bank b at addr&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn LAYER || Load data from fn onto current layer&lt;br /&gt;
|-&lt;br /&gt;
| MERGE fn || Loads BASIC lines from file named fn and integrates them with current program&lt;br /&gt;
|-&lt;br /&gt;
| SAVE fn (LINE l)? || Save BASIC program to file named fn (and set up autorun at line l)&lt;br /&gt;
|-&lt;br /&gt;
| SAVE fn (DATA/CODE/SCREEN$/BANK/LAYER..) || Save data as specified; CODE and BANK have an extra &amp;quot;length&amp;quot; parameter&lt;br /&gt;
|-&lt;br /&gt;
| VERIFY fn || Checks loaded basic program matches fn &lt;br /&gt;
|-&lt;br /&gt;
| VERIFY fn (DATA/CODE/BANK) || Checks data in memory/array matches contents of fn; does not work with SCREEN$/LAYER because the screen is inevitably changed during the verify operation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Inline data ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b RESTORE x || Sets DATA read point to start of line x in bank b&lt;br /&gt;
|-&lt;br /&gt;
| DATA x[,y].. || Stores data in program for later READing&lt;br /&gt;
|-&lt;br /&gt;
| READ var || Read next value from DATA statement into variable&lt;br /&gt;
|-&lt;br /&gt;
| RESTORE x || Sets DATA read point to start of line x&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BORDER n || Set ULA border to color N&lt;br /&gt;
|-&lt;br /&gt;
| BRIGHT n || Enable or disable bright colors. n must be 0 or 1. Not legal on non-ULA layers or if Enhanced ULA is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| CIRCLE x,y,r || Draw circle centered at x, y with radius r&lt;br /&gt;
|-&lt;br /&gt;
| CLS || Clears screen&lt;br /&gt;
|-&lt;br /&gt;
| DRAW [modifier or x,y].. || Draw line from plot cursor to given coordinate&lt;br /&gt;
|-&lt;br /&gt;
| FLASH n || Enable or disable ink/paper cycling. n must be 0 or 1. Not legal on non-ULA layers or if Enhanced ULA is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| INK c || Set ink (foreground) color for print and graphics commands. If Enhanced ULA is enabled, this can use any legal palette value. On Layer 2, it can use any value 0-255.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER x || Selects active layer for graphics operations. LAYER 0 is an unenhanced ULA screen. LAYER 1 is the ULA screen but with enhancements and with the origin at the top left (not the bottom left). LAYER 2 is, well, [[Layer 2]].&lt;br /&gt;
|-&lt;br /&gt;
| LAYER 1,x || Sets mode for Layer 1 based on x. 1 = Standard Spectrum, 2 = Timex hires, 3 = Timex hicolour, 0 = Lores layer.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER 2,x || Selects [[Layer 2]] and determines if it is displayed or not (x must be 0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER AT x, y || Sets the scroll display offset for the current layer.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER BANK f, b || Only when [[Layer 2]] is selected, selects the first bank for layer 2 (f) and shadow layer 2 (b). Note that a layer 2 screen occupies 3 banks.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER CLEAR || Resets all layer settings&lt;br /&gt;
|-&lt;br /&gt;
| LAYER DIM left, top, right, bottom || Sets visible area for current layer&lt;br /&gt;
|-&lt;br /&gt;
| LAYER ERASE x, y, w, h [,f]? || Fills a region at x,y, of size w,h, with palette index f (or the transparent value)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER OVER || Sets layer ordering&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE x || Choose which of the two palettes is used for the active layer (x must be 0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE n, i, v || Sets palette index i in palette in to color value v. V is always 9 bit, even if PALETTE DIM 8 is set.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE n BANK b, offset || Loads current layer&#039;s palette n (0 or 1) from bytes starting at offset in bank b. If PALETTE DIM 8 is set, each byte is one color. If PALETTE DIM 9 is set, each color needs two bytes, but only one bit of the second is used.&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE CLEAR || Resets all palettes and palette settings&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE DIM x || Sets number of color bits in the active palette; x must be 8 or 9&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE FORMAT x || Enables Enhanced ULA colors with x inks. X must be a bitmask which masks off bits on the right of a value (1, 3, 7, 15, 31, 63, 127 or 255)&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE OVER x || Sets the global transparency color to x&lt;br /&gt;
|-&lt;br /&gt;
| PAPER c || Set paper (background) color for print and graphics commands. Follows the same rules as INK.&lt;br /&gt;
|-&lt;br /&gt;
| PLOT [modifier or x,y].. || Plot listed points as single pixels on current layer&lt;br /&gt;
|-&lt;br /&gt;
| POINT x, y, var || Stores the color at point x, y &#039;&#039;&#039;on the ULA screen&#039;&#039;&#039; in variable var&lt;br /&gt;
|-&lt;br /&gt;
| POINT x, y || Returns the color at point x, y &#039;&#039;&#039;on the ULA screen&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Modifiers for graphics commands can be inline INK, PAPER, INVERSE, and OVER. INVERSE 1 causes drawing to be in the paper color. OVER 1 causes pixels in the line to be flipped.&lt;br /&gt;
&lt;br /&gt;
=== Sprites ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BANK x || Populates all 64 sprite patterns from bank b, taking 256 bytes per sprite and thus using all data in bank b.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BANK b, o, p, n || Define n sprite patterns, starting with p, with data from bank b starting at offset o.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE x || Choose the first or second palette for sprites. X must be 0 or 1.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE x BANK b, o || Load sprite palette x (0 or 1) from bank b at offset o. Data is read as with LAYER PALETTE.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE n, i, v || Set sprite palette n, index i, to color v. V is always 9-bit, even if PALETTE DIM 8 is in effect.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PRINT x || Enable or disable sprites. X must be 0 (disable) or 1 (enable).&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BORDER x || Enable or disable sprites crossing the border. X must be 0 (disable) or 1 (enable).&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE s, x, y, i, f || Set sprite f to image i at position x,y with flags f. f is bitmapped as byte 3 of data packets sent to {{PortNo|$xx57}}.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE CLEAR || Reset all sprite attributes and global settings.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tilemap support ===&lt;br /&gt;
&lt;br /&gt;
=== Sprites ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| TILE [AT x,y]? || Draw the entire screen from the tilemap (from tile offset (x,y))&lt;br /&gt;
|-&lt;br /&gt;
| TILE w,h [AT x,y]? [TO x2,y2]? || Draw a section of the tilemap w,h wide (from tile offset x,y in the tilemap) (to tile offset x2,y2 on the screen)&lt;br /&gt;
|-&lt;br /&gt;
| TILE BANK n || Set bank n as the root of tile graphics (which may occupy up to 4 banks in the case of 16x16 tiles).&lt;br /&gt;
|-&lt;br /&gt;
| TILE DIM n, o, v, t || Set bank n offset o as the root of tilemap data, with tilemap width v and tile size t (t must be 8 or 16 for 8x8 or 16x16 tiles)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Memory and Port Access ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK 1346 FORMAT || Re-enable RAMdisk having been disabled by previous BANK 1346 USR&lt;br /&gt;
|-&lt;br /&gt;
| BANK 1346 USR || Disable RAMdisk, allowing banks 1, 3, 4, and 6 to be used&lt;br /&gt;
|-&lt;br /&gt;
| BANK b COPY TO c || Copy entire bank b to bank c&lt;br /&gt;
|-&lt;br /&gt;
| BANK b COPY start, len TO c, start || Copy len bytes from start in bank b, to start in bank c&lt;br /&gt;
|-&lt;br /&gt;
| BANK b ERASE x? || Erase all data in bank by overwriting with zeros (or x)&lt;br /&gt;
|-&lt;br /&gt;
| BANK b ERASE off, len, value || Overwrite len bytes of data at off in bank b with value&lt;br /&gt;
|-&lt;br /&gt;
| BANK b PEEK addr || Returns value at given address in bank b (address is from start of bank)&lt;br /&gt;
|- &lt;br /&gt;
| BANK b POKE addr, value || Sets address in bank b to value (address is from start of bank)&lt;br /&gt;
|-&lt;br /&gt;
| IN port || Returns current value at port&lt;br /&gt;
|-&lt;br /&gt;
| PEEK addr || Returns value at given address&lt;br /&gt;
|-&lt;br /&gt;
| POKE addr, value || Sets address to value&lt;br /&gt;
|-&lt;br /&gt;
| OUT port, value || Sends value to port&lt;br /&gt;
|-&lt;br /&gt;
| REG r [, v]? || Return the value in NextReg register r (or set it to value v if provided)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Functions/Expressions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| + - * / ^ || Standard arithmetic operators&lt;br /&gt;
|-&lt;br /&gt;
| = &amp;lt; &amp;gt; &amp;lt;= &amp;gt;= &amp;lt;&amp;gt; || Standard comparison operators (arithmetic for numbers, alphabetic for strings)&lt;br /&gt;
|-&lt;br /&gt;
| a(x) || Returns x&#039;th element of array/string a&lt;br /&gt;
|-&lt;br /&gt;
| s(x? TO y?) || Return substring of s; if x or y are omitted, start or end is assumed&lt;br /&gt;
|-&lt;br /&gt;
| AND OR NOT || Standard boolean conjunctives&lt;br /&gt;
|-&lt;br /&gt;
| ABS x || Gets unsigned magnitude of x&lt;br /&gt;
|-&lt;br /&gt;
| ASN x, ACS x, ATN x || Returns inverse trigonometric ratio (arcsin, arccos, arctan)&lt;br /&gt;
|-&lt;br /&gt;
| ATTR x,y || Returns attribute cell value at cell x,y &lt;br /&gt;
|-&lt;br /&gt;
| BIN x || Converts binary number x to decimal&lt;br /&gt;
|-&lt;br /&gt;
| CHR$ x || Gets character for an ASCII code&lt;br /&gt;
|-&lt;br /&gt;
| CODE x || Gets ASCII code for a character&lt;br /&gt;
|-&lt;br /&gt;
| INT x || Rounds x down to integer&lt;br /&gt;
|-&lt;br /&gt;
| LEN x || Gets length of string&lt;br /&gt;
|-&lt;br /&gt;
| PI || Returns approximation of pi&lt;br /&gt;
|-&lt;br /&gt;
| RND || Returns a random number between 0 and 1&lt;br /&gt;
|-&lt;br /&gt;
| SCREEN$ x,y || Returns text character in text cell x,y&lt;br /&gt;
|-&lt;br /&gt;
| SIGN x || Divides x by its magnitude&lt;br /&gt;
|-&lt;br /&gt;
| SIN x, COS x, TAN x || Returns standard trigonometric ratio&lt;br /&gt;
|-&lt;br /&gt;
| SQR x || Returns square of x&lt;br /&gt;
|-&lt;br /&gt;
| STR$ x || Converts number into a string&lt;br /&gt;
|-&lt;br /&gt;
| USR x || If x is a string, gets the address of the first byte of the user defined graphic for the character. If x is a number, runs a machine code routine at address x and returns the value of BC after it exits.&lt;br /&gt;
|-&lt;br /&gt;
| VAL x || Converts string number or expression into a number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Tokens ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value (hex) !! Token&lt;br /&gt;
|-&lt;br /&gt;
| 0x87 || PEEK$&lt;br /&gt;
|-&lt;br /&gt;
| 0x88 || REG&lt;br /&gt;
|-&lt;br /&gt;
| 0x89 || DPOKE&lt;br /&gt;
|-&lt;br /&gt;
| 0x8a || DPEEK&lt;br /&gt;
|-&lt;br /&gt;
| 0x8b || MOD&lt;br /&gt;
|-&lt;br /&gt;
| 0x8c || &amp;lt;&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8d || &amp;gt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8e || UNTIL&lt;br /&gt;
|-&lt;br /&gt;
| 0x8f || ERROR&lt;br /&gt;
|-&lt;br /&gt;
| 0x90 || ON&lt;br /&gt;
|-&lt;br /&gt;
| 0x91 || DEFPROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x92 || ENDPROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x93 || PROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x94 || LOCAL&lt;br /&gt;
|-&lt;br /&gt;
| 0x95 || DRIVER&lt;br /&gt;
|-&lt;br /&gt;
| 0x96 || WHILE&lt;br /&gt;
|-&lt;br /&gt;
| 0x97 || REPEAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x98 || ELSE&lt;br /&gt;
|-&lt;br /&gt;
| 0x99 || REMOUNT&lt;br /&gt;
|-&lt;br /&gt;
| 0x9a || BANK&lt;br /&gt;
|-&lt;br /&gt;
| 0x9b || TILE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9c || LAYER&lt;br /&gt;
|-&lt;br /&gt;
| 0x9d || PALETTE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9e || SPRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9f || PWD&lt;br /&gt;
|-&lt;br /&gt;
| 0xa0 || CD&lt;br /&gt;
|-&lt;br /&gt;
| 0xa1 || MKDIR&lt;br /&gt;
|-&lt;br /&gt;
| 0xa2 || RMDIR&lt;br /&gt;
|-&lt;br /&gt;
| 0xA3 || SPECTRUM&lt;br /&gt;
|-&lt;br /&gt;
| 0xA4 || PLAY&lt;br /&gt;
|-&lt;br /&gt;
| 0xA5 || RND&lt;br /&gt;
|-&lt;br /&gt;
| 0xA6 || INKEY$&lt;br /&gt;
|-&lt;br /&gt;
| 0xA7 || PI&lt;br /&gt;
|-&lt;br /&gt;
| 0xA8 || FN&lt;br /&gt;
|-&lt;br /&gt;
| 0xA9 || POINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xAA || SCREEN$&lt;br /&gt;
|-&lt;br /&gt;
| 0xAB || ATTR&lt;br /&gt;
|-&lt;br /&gt;
| 0xAC || AT&lt;br /&gt;
|-&lt;br /&gt;
| 0xAD || TAB&lt;br /&gt;
|-&lt;br /&gt;
| 0xAE || VAL$&lt;br /&gt;
|-&lt;br /&gt;
| 0xAF || CODE&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0 || VAL&lt;br /&gt;
|-&lt;br /&gt;
| 0xB1 || LEN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB2 || SIN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB3 || COS&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4 || TAN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB5 || ASN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB6 || ACS&lt;br /&gt;
|-&lt;br /&gt;
| 0xB7 || ATN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8 || LN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB9 || EXP&lt;br /&gt;
|-&lt;br /&gt;
| 0xBA || INT&lt;br /&gt;
|-&lt;br /&gt;
| 0xBB || SQR&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC || SGN&lt;br /&gt;
|-&lt;br /&gt;
| 0xBD || ABS&lt;br /&gt;
|-&lt;br /&gt;
| 0xBE || PEEK&lt;br /&gt;
|-&lt;br /&gt;
| 0xBF || IN&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0 || USR&lt;br /&gt;
|-&lt;br /&gt;
| 0xC1 || STR$&lt;br /&gt;
|-&lt;br /&gt;
| 0xC2 || CHR$&lt;br /&gt;
|-&lt;br /&gt;
| 0xC3 || NOT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4 || BIN&lt;br /&gt;
|-&lt;br /&gt;
| 0xC5 || OR&lt;br /&gt;
|-&lt;br /&gt;
| 0xC6 || AND&lt;br /&gt;
|-&lt;br /&gt;
| 0xC7 || &amp;lt;=&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8 || &amp;gt;=&lt;br /&gt;
|-&lt;br /&gt;
| 0xC9 || &amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0xCA || LINE&lt;br /&gt;
|-&lt;br /&gt;
| 0xCB || THEN&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC || TO&lt;br /&gt;
|-&lt;br /&gt;
| 0xCD || STEP&lt;br /&gt;
|-&lt;br /&gt;
| 0xCE || DEF FN&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF || CAT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0 || FORMAT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD1 || MOVE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD2 || ERASE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD3 || OPEN #&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4 || CLOSE #&lt;br /&gt;
|-&lt;br /&gt;
| 0xD5 || MERGE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD6 || VERIFY&lt;br /&gt;
|-&lt;br /&gt;
| 0xD7 || BEEP&lt;br /&gt;
|-&lt;br /&gt;
| 0xD8 || CIRCLE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD9 || INK&lt;br /&gt;
|-&lt;br /&gt;
| 0xDA || PAPER&lt;br /&gt;
|-&lt;br /&gt;
| 0xDB || FLASH&lt;br /&gt;
|-&lt;br /&gt;
| 0xDC || BRIGHT&lt;br /&gt;
|-&lt;br /&gt;
| 0xDD || INVERSE&lt;br /&gt;
|-&lt;br /&gt;
| 0xDE || OVER&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF || OUT&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0 || LPRINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xE1 || LLIST&lt;br /&gt;
|-&lt;br /&gt;
| 0xE2 || STOP&lt;br /&gt;
|-&lt;br /&gt;
| 0xE3 || READ&lt;br /&gt;
|-&lt;br /&gt;
| 0xE4 || DATA&lt;br /&gt;
|-&lt;br /&gt;
| 0xE5 || RESTORE&lt;br /&gt;
|-&lt;br /&gt;
| 0xE6 || NEW&lt;br /&gt;
|-&lt;br /&gt;
| 0xE7 || BORDER&lt;br /&gt;
|-&lt;br /&gt;
| 0xE8 || CONTINUE&lt;br /&gt;
|-&lt;br /&gt;
| 0xE9 || DIM&lt;br /&gt;
|-&lt;br /&gt;
| 0xEA || REM&lt;br /&gt;
|-&lt;br /&gt;
| 0xEB || FOR&lt;br /&gt;
|-&lt;br /&gt;
| 0xEC || GO TO&lt;br /&gt;
|-&lt;br /&gt;
| 0xED || GO SUB&lt;br /&gt;
|-&lt;br /&gt;
| 0xEE || INPUT&lt;br /&gt;
|-&lt;br /&gt;
| 0xEF || LOAD&lt;br /&gt;
|-&lt;br /&gt;
| 0xF0 || LIST&lt;br /&gt;
|-&lt;br /&gt;
| 0xF1 || LET&lt;br /&gt;
|-&lt;br /&gt;
| 0xF2 || PAUSE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF3 || NEXT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF4 || POKE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF5 || PRINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF6 || PLOT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7 || RUN&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8 || SAVE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF9 || RANDOMIZE&lt;br /&gt;
|-&lt;br /&gt;
| 0xFA || IF&lt;br /&gt;
|-&lt;br /&gt;
| 0xFB || CLS&lt;br /&gt;
|-&lt;br /&gt;
| 0xFC || DRAW&lt;br /&gt;
|-&lt;br /&gt;
| 0xFD || CLEAR&lt;br /&gt;
|-&lt;br /&gt;
| 0xFE || RETURN&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF || COPY &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=NextBASIC&amp;diff=11963</id>
		<title>NextBASIC</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=NextBASIC&amp;diff=11963"/>
		<updated>2024-01-13T00:04:09Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added REG command under &amp;quot;Memory and Port Access&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NextBASIC is an extended version of the classic Spectrum BASIC which adds extra commands supporting the new features of the NEXT.&lt;br /&gt;
&lt;br /&gt;
? after parameters indicate they are optional. Square brackets [] indicate scope of optional or repeated areas (parentheses are not used for this because they are part of the BASIC language). Bracketed sections in the effects only apply if the optional parameters are specified.&lt;br /&gt;
&lt;br /&gt;
== Basic Interaction Commands ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b LINE x,y || Copies lines x,y into bank b. Once this is done, these lines cannot be edited except by overwriting them with another BANK..LINE command. Cannot be used in a program.&lt;br /&gt;
|-&lt;br /&gt;
| BANK b LIST x? || Lists source code in bank b (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| BANK b MERGE || Adds all basic lines in bank b to main program&lt;br /&gt;
|-&lt;br /&gt;
| CONTINUE || Repeats last command or restarts from error location&lt;br /&gt;
|-&lt;br /&gt;
| CLEAR x? || Resets variables, clears screen, resets plot cursor (and sets ramtop to X)&lt;br /&gt;
|-&lt;br /&gt;
| ERASE f, l || Deletes all program lines between f and l. Cannot be used in a program.&lt;br /&gt;
|-&lt;br /&gt;
| LIST x? || Lists source code (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| LLIST x? || Lists source code to printer (from line x)&lt;br /&gt;
|-&lt;br /&gt;
| NEW || Clear stored program&lt;br /&gt;
|-&lt;br /&gt;
| RUN x? || CLEAR then run program (from line x)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Control Flow ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b GO TO x || Jump execution to line x stored in bank b. b=-1 for main program&lt;br /&gt;
|-&lt;br /&gt;
| BANK b GO SUB x || Jump execution to line x stored in bank b, storing current location on gosub stack. b=-1 for main program&lt;br /&gt;
|-&lt;br /&gt;
| DEF FN func(param[,param..])=expr || Creates a user defined function based on a parametrised expression. Will not work if moved into any bank other than the main program&lt;br /&gt;
|-&lt;br /&gt;
| DIM a(x[,y]..) || Defines a as an array of length x (and second dimension length y, etc..)&lt;br /&gt;
|-&lt;br /&gt;
| FOR var = start TO end [STEP step]? || Starts FOR loop between given numeric values (with given step)&lt;br /&gt;
|-&lt;br /&gt;
| GO TO x || Jump execution to line X in the same bank&lt;br /&gt;
|-&lt;br /&gt;
| GO SUB x || Jump execution to line X in the same bank, storing current location (and bank) on gosub stack&lt;br /&gt;
|-&lt;br /&gt;
| IF c THEN statements [ELSE statements] || Run statements only if expression c is true &lt;br /&gt;
|-&lt;br /&gt;
| LET var = expr || Sets variable var to expr&lt;br /&gt;
|-&lt;br /&gt;
| LOCAL var || Declares local variable &lt;br /&gt;
|-&lt;br /&gt;
| NEXT var || Marks end of FOR loop regarding VAR&lt;br /&gt;
|-&lt;br /&gt;
| REM comment || Code comment, ignored&lt;br /&gt;
|-&lt;br /&gt;
| REPEAT || Begin of loop&lt;br /&gt;
|-&lt;br /&gt;
| REPEAT UNTIL condition || Marks the end of REPEAT loop&lt;br /&gt;
|-&lt;br /&gt;
| RETURN || Restore execution location (line and bank) from gosub stack&lt;br /&gt;
|-&lt;br /&gt;
| WHILE condition || Condition for staying in loop&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Console I/O ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| COPY || Prints screen&lt;br /&gt;
|-&lt;br /&gt;
| INKEY$ || Returns currently pressed key&lt;br /&gt;
|-&lt;br /&gt;
| INPUT specifier [connector specifier].. || Output expression(s) and read a variable&lt;br /&gt;
|-&lt;br /&gt;
| INVERSE x || Enable or disable switching ink/paper color when printing (x=0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LPRINT specifier [connector specifier].. || Output expression(s) to printer&lt;br /&gt;
|-&lt;br /&gt;
| OVER x || Enable or disable overprinting (x=0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| PAUSE x || Waits x frames or until a key is pressed&lt;br /&gt;
|-&lt;br /&gt;
| PRINT specifier [connector specifier].. || Output expression(s)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Possible specifiers for PRINT and INPUT statements are:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Specifier !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| var || In PRINT, shows contents of var; in INPUT, inputs into this var&lt;br /&gt;
|-&lt;br /&gt;
| (var) || Shows contents of var (in both PRINT and INPUT)&lt;br /&gt;
|-&lt;br /&gt;
| AT x,y || Moves text cursor to the given text cell &lt;br /&gt;
|-&lt;br /&gt;
| TAB x || Inserts spaces until text cursor is in column x&lt;br /&gt;
|-&lt;br /&gt;
| INK x, PAPER x || Changes the appropriate color for the duration of the print/input statement&lt;br /&gt;
|-&lt;br /&gt;
| LINE x$ || INPUT only, reads a string without the prompting quotes&lt;br /&gt;
|-&lt;br /&gt;
| #x || Selects input/output channel number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
And the connectors between these are:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Specifier !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| , || Separate with a tab&lt;br /&gt;
|-&lt;br /&gt;
| &#039; || Separate with a newline&lt;br /&gt;
|-&lt;br /&gt;
| ; || Use no separator&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== File I/O ==&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| CAT || Displays disk/tape catalogue&lt;br /&gt;
|-&lt;br /&gt;
| FORMAT || Prepares inserted disk for usage, erasing it&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn || Load BASIC program from file named fn&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn DATA x() || Load data from fn into array x()&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn CODE addr || Load data from fn into memory at address addr&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn SCREEN$ || Load data from fn onto standard ULA screen&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn BANK b,addr || Load data from fn into memory bank b at addr&lt;br /&gt;
|-&lt;br /&gt;
| LOAD fn LAYER || Load data from fn onto current layer&lt;br /&gt;
|-&lt;br /&gt;
| MERGE fn || Loads BASIC lines from file named fn and integrates them with current program&lt;br /&gt;
|-&lt;br /&gt;
| SAVE fn (LINE l)? || Save BASIC program to file named fn (and set up autorun at line l)&lt;br /&gt;
|-&lt;br /&gt;
| SAVE fn (DATA/CODE/SCREEN$/BANK/LAYER..) || Save data as specified; CODE and BANK have an extra &amp;quot;length&amp;quot; parameter&lt;br /&gt;
|-&lt;br /&gt;
| VERIFY fn || Checks loaded basic program matches fn &lt;br /&gt;
|-&lt;br /&gt;
| VERIFY fn (DATA/CODE/BANK) || Checks data in memory/array matches contents of fn; does not work with SCREEN$/LAYER because the screen is inevitably changed during the verify operation&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Inline data ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK b RESTORE x || Sets DATA read point to start of line x in bank b&lt;br /&gt;
|-&lt;br /&gt;
| DATA x[,y].. || Stores data in program for later READing&lt;br /&gt;
|-&lt;br /&gt;
| READ var || Read next value from DATA statement into variable&lt;br /&gt;
|-&lt;br /&gt;
| RESTORE x || Sets DATA read point to start of line x&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Graphics ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BORDER n || Set ULA border to color N&lt;br /&gt;
|-&lt;br /&gt;
| BRIGHT n || Enable or disable bright colors. n must be 0 or 1. Not legal on non-ULA layers or if Enhanced ULA is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| CIRCLE x,y,r || Draw circle centered at x, y with radius r&lt;br /&gt;
|-&lt;br /&gt;
| CLS || Clears screen&lt;br /&gt;
|-&lt;br /&gt;
| DRAW [modifier or x,y].. || Draw line from plot cursor to given coordinate&lt;br /&gt;
|-&lt;br /&gt;
| FLASH n || Enable or disable ink/paper cycling. n must be 0 or 1. Not legal on non-ULA layers or if Enhanced ULA is enabled.&lt;br /&gt;
|-&lt;br /&gt;
| INK c || Set ink (foreground) color for print and graphics commands. If Enhanced ULA is enabled, this can use any legal palette value. On Layer 2, it can use any value 0-255.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER x || Selects active layer for graphics operations. LAYER 0 is an unenhanced ULA screen. LAYER 1 is the ULA screen but with enhancements and with the origin at the top left (not the bottom left). LAYER 2 is, well, [[Layer 2]].&lt;br /&gt;
|-&lt;br /&gt;
| LAYER 1,x || Sets mode for Layer 1 based on x. 1 = Standard Spectrum, 2 = Timex hires, 3 = Timex hicolour, 0 = Lores layer.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER 2,x || Selects [[Layer 2]] and determines if it is displayed or not (x must be 0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER AT x, y || Sets the scroll display offset for the current layer.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER BANK f, b || Only when [[Layer 2]] is selected, selects the first bank for layer 2 (f) and shadow layer 2 (b). Note that a layer 2 screen occupies 3 banks.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER CLEAR || Resets all layer settings&lt;br /&gt;
|-&lt;br /&gt;
| LAYER DIM left, top, right, bottom || Sets visible area for current layer&lt;br /&gt;
|-&lt;br /&gt;
| LAYER ERASE x, y, w, h [,f]? || Fills a region at x,y, of size w,h, with palette index f (or the transparent value)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER OVER || Sets layer ordering&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE x || Choose which of the two palettes is used for the active layer (x must be 0 or 1)&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE n, i, v || Sets palette index i in palette in to color value v. V is always 9 bit, even if PALETTE DIM 8 is set.&lt;br /&gt;
|-&lt;br /&gt;
| LAYER PALETTE n BANK b, offset || Loads current layer&#039;s palette n (0 or 1) from bytes starting at offset in bank b. If PALETTE DIM 8 is set, each byte is one color. If PALETTE DIM 9 is set, each color needs two bytes, but only one bit of the second is used.&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE CLEAR || Resets all palettes and palette settings&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE DIM x || Sets number of color bits in the active palette; x must be 8 or 9&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE FORMAT x || Enables Enhanced ULA colors with x inks. X must be a bitmask which masks off bits on the right of a value (1, 3, 7, 15, 31, 63, 127 or 255)&lt;br /&gt;
|-&lt;br /&gt;
| PALETTE OVER x || Sets the global transparency color to x&lt;br /&gt;
|-&lt;br /&gt;
| PAPER c || Set paper (background) color for print and graphics commands. Follows the same rules as INK.&lt;br /&gt;
|-&lt;br /&gt;
| PLOT [modifier or x,y].. || Plot listed points as single pixels on current layer&lt;br /&gt;
|-&lt;br /&gt;
| POINT x, y, var || Stores the color at point x, y &#039;&#039;&#039;on the ULA screen&#039;&#039;&#039; in variable var&lt;br /&gt;
|-&lt;br /&gt;
| POINT x, y || Returns the color at point x, y &#039;&#039;&#039;on the ULA screen&#039;&#039;&#039;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Modifiers for graphics commands can be inline INK, PAPER, INVERSE, and OVER. INVERSE 1 causes drawing to be in the paper color. OVER 1 causes pixels in the line to be flipped.&lt;br /&gt;
&lt;br /&gt;
=== Sprites ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BANK x || Populates all 64 sprite patterns from bank b, taking 256 bytes per sprite and thus using all data in bank b.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BANK b, o, p, n || Define n sprite patterns, starting with p, with data from bank b starting at offset o.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE x || Choose the first or second palette for sprites. X must be 0 or 1.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE x BANK b, o || Load sprite palette x (0 or 1) from bank b at offset o. Data is read as with LAYER PALETTE.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PALETTE n, i, v || Set sprite palette n, index i, to color v. V is always 9-bit, even if PALETTE DIM 8 is in effect.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE PRINT x || Enable or disable sprites. X must be 0 (disable) or 1 (enable).&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE BORDER x || Enable or disable sprites crossing the border. X must be 0 (disable) or 1 (enable).&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE s, x, y, i, f || Set sprite f to image i at position x,y with flags f. f is bitmapped as byte 3 of data packets sent to {{PortNo|$xx57}}.&lt;br /&gt;
|-&lt;br /&gt;
| SPRITE CLEAR || Reset all sprite attributes and global settings.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Tilemap support ===&lt;br /&gt;
&lt;br /&gt;
=== Sprites ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| TILE [AT x,y]? || Draw the entire screen from the tilemap (from tile offset (x,y))&lt;br /&gt;
|-&lt;br /&gt;
| TILE w,h [AT x,y]? [TO x2,y2]? || Draw a section of the tilemap w,h wide (from tile offset x,y in the tilemap) (to tile offset x2,y2 on the screen)&lt;br /&gt;
|-&lt;br /&gt;
| TILE BANK n || Set bank n as the root of tile graphics (which may occupy up to 4 banks in the case of 16x16 tiles).&lt;br /&gt;
|-&lt;br /&gt;
| TILE DIM n, o, v, t || Set bank n offset o as the root of tilemap data, with tilemap width v and tile size t (t must be 8 or 16 for 8x8 or 16x16 tiles)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Memory and Port Access ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| BANK 1346 FORMAT || Re-enable RAMdisk having been disabled by previous BANK 1346 USR&lt;br /&gt;
|-&lt;br /&gt;
| BANK 1346 USR || Disable RAMdisk, allowing banks 1, 3, 4, and 6 to be used&lt;br /&gt;
|-&lt;br /&gt;
| BANK b COPY TO c || Copy entire bank b to bank c&lt;br /&gt;
|-&lt;br /&gt;
| BANK b COPY start, len TO c, start || Copy len bytes from start in bank b, to start in bank c&lt;br /&gt;
|-&lt;br /&gt;
| BANK b ERASE x? || Erase all data in bank by overwriting with zeros (or x)&lt;br /&gt;
|-&lt;br /&gt;
| BANK b ERASE off, len, value || Overwrite len bytes of data at off in bank b with value&lt;br /&gt;
|-&lt;br /&gt;
| BANK b PEEK addr || Returns value at given address in bank b (address is from start of bank)&lt;br /&gt;
|- &lt;br /&gt;
| BANK b POKE addr, value || Sets address in bank b to value (address is from start of bank)&lt;br /&gt;
|-&lt;br /&gt;
| IN port || Returns current value at port&lt;br /&gt;
|-&lt;br /&gt;
| PEEK addr || Returns value at given address&lt;br /&gt;
|-&lt;br /&gt;
| POKE addr, value || Sets address to value&lt;br /&gt;
|-&lt;br /&gt;
| OUT port, value || Sends value to port&lt;br /&gt;
|-&lt;br /&gt;
| REG r, v? || Return the value in NextReg register r (or set it to value v if provided)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Functions/Expressions ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Command !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| + - * / ^ || Standard arithmetic operators&lt;br /&gt;
|-&lt;br /&gt;
| = &amp;lt; &amp;gt; &amp;lt;= &amp;gt;= &amp;lt;&amp;gt; || Standard comparison operators (arithmetic for numbers, alphabetic for strings)&lt;br /&gt;
|-&lt;br /&gt;
| a(x) || Returns x&#039;th element of array/string a&lt;br /&gt;
|-&lt;br /&gt;
| s(x? TO y?) || Return substring of s; if x or y are omitted, start or end is assumed&lt;br /&gt;
|-&lt;br /&gt;
| AND OR NOT || Standard boolean conjunctives&lt;br /&gt;
|-&lt;br /&gt;
| ABS x || Gets unsigned magnitude of x&lt;br /&gt;
|-&lt;br /&gt;
| ASN x, ACS x, ATN x || Returns inverse trigonometric ratio (arcsin, arccos, arctan)&lt;br /&gt;
|-&lt;br /&gt;
| ATTR x,y || Returns attribute cell value at cell x,y &lt;br /&gt;
|-&lt;br /&gt;
| BIN x || Converts binary number x to decimal&lt;br /&gt;
|-&lt;br /&gt;
| CHR$ x || Gets character for an ASCII code&lt;br /&gt;
|-&lt;br /&gt;
| CODE x || Gets ASCII code for a character&lt;br /&gt;
|-&lt;br /&gt;
| INT x || Rounds x down to integer&lt;br /&gt;
|-&lt;br /&gt;
| LEN x || Gets length of string&lt;br /&gt;
|-&lt;br /&gt;
| PI || Returns approximation of pi&lt;br /&gt;
|-&lt;br /&gt;
| RND || Returns a random number between 0 and 1&lt;br /&gt;
|-&lt;br /&gt;
| SCREEN$ x,y || Returns text character in text cell x,y&lt;br /&gt;
|-&lt;br /&gt;
| SIGN x || Divides x by its magnitude&lt;br /&gt;
|-&lt;br /&gt;
| SIN x, COS x, TAN x || Returns standard trigonometric ratio&lt;br /&gt;
|-&lt;br /&gt;
| SQR x || Returns square of x&lt;br /&gt;
|-&lt;br /&gt;
| STR$ x || Converts number into a string&lt;br /&gt;
|-&lt;br /&gt;
| USR x || If x is a string, gets the address of the first byte of the user defined graphic for the character. If x is a number, runs a machine code routine at address x and returns the value of BC after it exits.&lt;br /&gt;
|-&lt;br /&gt;
| VAL x || Converts string number or expression into a number&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Tokens ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value (hex) !! Token&lt;br /&gt;
|-&lt;br /&gt;
| 0x87 || PEEK$&lt;br /&gt;
|-&lt;br /&gt;
| 0x88 || REG&lt;br /&gt;
|-&lt;br /&gt;
| 0x89 || DPOKE&lt;br /&gt;
|-&lt;br /&gt;
| 0x8a || DPEEK&lt;br /&gt;
|-&lt;br /&gt;
| 0x8b || MOD&lt;br /&gt;
|-&lt;br /&gt;
| 0x8c || &amp;lt;&amp;lt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8d || &amp;gt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0x8e || UNTIL&lt;br /&gt;
|-&lt;br /&gt;
| 0x8f || ERROR&lt;br /&gt;
|-&lt;br /&gt;
| 0x90 || ON&lt;br /&gt;
|-&lt;br /&gt;
| 0x91 || DEFPROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x92 || ENDPROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x93 || PROC&lt;br /&gt;
|-&lt;br /&gt;
| 0x94 || LOCAL&lt;br /&gt;
|-&lt;br /&gt;
| 0x95 || DRIVER&lt;br /&gt;
|-&lt;br /&gt;
| 0x96 || WHILE&lt;br /&gt;
|-&lt;br /&gt;
| 0x97 || REPEAT&lt;br /&gt;
|-&lt;br /&gt;
| 0x98 || ELSE&lt;br /&gt;
|-&lt;br /&gt;
| 0x99 || REMOUNT&lt;br /&gt;
|-&lt;br /&gt;
| 0x9a || BANK&lt;br /&gt;
|-&lt;br /&gt;
| 0x9b || TILE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9c || LAYER&lt;br /&gt;
|-&lt;br /&gt;
| 0x9d || PALETTE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9e || SPRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0x9f || PWD&lt;br /&gt;
|-&lt;br /&gt;
| 0xa0 || CD&lt;br /&gt;
|-&lt;br /&gt;
| 0xa1 || MKDIR&lt;br /&gt;
|-&lt;br /&gt;
| 0xa2 || RMDIR&lt;br /&gt;
|-&lt;br /&gt;
| 0xA3 || SPECTRUM&lt;br /&gt;
|-&lt;br /&gt;
| 0xA4 || PLAY&lt;br /&gt;
|-&lt;br /&gt;
| 0xA5 || RND&lt;br /&gt;
|-&lt;br /&gt;
| 0xA6 || INKEY$&lt;br /&gt;
|-&lt;br /&gt;
| 0xA7 || PI&lt;br /&gt;
|-&lt;br /&gt;
| 0xA8 || FN&lt;br /&gt;
|-&lt;br /&gt;
| 0xA9 || POINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xAA || SCREEN$&lt;br /&gt;
|-&lt;br /&gt;
| 0xAB || ATTR&lt;br /&gt;
|-&lt;br /&gt;
| 0xAC || AT&lt;br /&gt;
|-&lt;br /&gt;
| 0xAD || TAB&lt;br /&gt;
|-&lt;br /&gt;
| 0xAE || VAL$&lt;br /&gt;
|-&lt;br /&gt;
| 0xAF || CODE&lt;br /&gt;
|-&lt;br /&gt;
| 0xB0 || VAL&lt;br /&gt;
|-&lt;br /&gt;
| 0xB1 || LEN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB2 || SIN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB3 || COS&lt;br /&gt;
|-&lt;br /&gt;
| 0xB4 || TAN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB5 || ASN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB6 || ACS&lt;br /&gt;
|-&lt;br /&gt;
| 0xB7 || ATN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB8 || LN&lt;br /&gt;
|-&lt;br /&gt;
| 0xB9 || EXP&lt;br /&gt;
|-&lt;br /&gt;
| 0xBA || INT&lt;br /&gt;
|-&lt;br /&gt;
| 0xBB || SQR&lt;br /&gt;
|-&lt;br /&gt;
| 0xBC || SGN&lt;br /&gt;
|-&lt;br /&gt;
| 0xBD || ABS&lt;br /&gt;
|-&lt;br /&gt;
| 0xBE || PEEK&lt;br /&gt;
|-&lt;br /&gt;
| 0xBF || IN&lt;br /&gt;
|-&lt;br /&gt;
| 0xC0 || USR&lt;br /&gt;
|-&lt;br /&gt;
| 0xC1 || STR$&lt;br /&gt;
|-&lt;br /&gt;
| 0xC2 || CHR$&lt;br /&gt;
|-&lt;br /&gt;
| 0xC3 || NOT&lt;br /&gt;
|-&lt;br /&gt;
| 0xC4 || BIN&lt;br /&gt;
|-&lt;br /&gt;
| 0xC5 || OR&lt;br /&gt;
|-&lt;br /&gt;
| 0xC6 || AND&lt;br /&gt;
|-&lt;br /&gt;
| 0xC7 || &amp;lt;=&lt;br /&gt;
|-&lt;br /&gt;
| 0xC8 || &amp;gt;=&lt;br /&gt;
|-&lt;br /&gt;
| 0xC9 || &amp;lt;&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0xCA || LINE&lt;br /&gt;
|-&lt;br /&gt;
| 0xCB || THEN&lt;br /&gt;
|-&lt;br /&gt;
| 0xCC || TO&lt;br /&gt;
|-&lt;br /&gt;
| 0xCD || STEP&lt;br /&gt;
|-&lt;br /&gt;
| 0xCE || DEF FN&lt;br /&gt;
|-&lt;br /&gt;
| 0xCF || CAT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD0 || FORMAT&lt;br /&gt;
|-&lt;br /&gt;
| 0xD1 || MOVE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD2 || ERASE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD3 || OPEN #&lt;br /&gt;
|-&lt;br /&gt;
| 0xD4 || CLOSE #&lt;br /&gt;
|-&lt;br /&gt;
| 0xD5 || MERGE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD6 || VERIFY&lt;br /&gt;
|-&lt;br /&gt;
| 0xD7 || BEEP&lt;br /&gt;
|-&lt;br /&gt;
| 0xD8 || CIRCLE&lt;br /&gt;
|-&lt;br /&gt;
| 0xD9 || INK&lt;br /&gt;
|-&lt;br /&gt;
| 0xDA || PAPER&lt;br /&gt;
|-&lt;br /&gt;
| 0xDB || FLASH&lt;br /&gt;
|-&lt;br /&gt;
| 0xDC || BRIGHT&lt;br /&gt;
|-&lt;br /&gt;
| 0xDD || INVERSE&lt;br /&gt;
|-&lt;br /&gt;
| 0xDE || OVER&lt;br /&gt;
|-&lt;br /&gt;
| 0xDF || OUT&lt;br /&gt;
|-&lt;br /&gt;
| 0xE0 || LPRINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xE1 || LLIST&lt;br /&gt;
|-&lt;br /&gt;
| 0xE2 || STOP&lt;br /&gt;
|-&lt;br /&gt;
| 0xE3 || READ&lt;br /&gt;
|-&lt;br /&gt;
| 0xE4 || DATA&lt;br /&gt;
|-&lt;br /&gt;
| 0xE5 || RESTORE&lt;br /&gt;
|-&lt;br /&gt;
| 0xE6 || NEW&lt;br /&gt;
|-&lt;br /&gt;
| 0xE7 || BORDER&lt;br /&gt;
|-&lt;br /&gt;
| 0xE8 || CONTINUE&lt;br /&gt;
|-&lt;br /&gt;
| 0xE9 || DIM&lt;br /&gt;
|-&lt;br /&gt;
| 0xEA || REM&lt;br /&gt;
|-&lt;br /&gt;
| 0xEB || FOR&lt;br /&gt;
|-&lt;br /&gt;
| 0xEC || GO TO&lt;br /&gt;
|-&lt;br /&gt;
| 0xED || GO SUB&lt;br /&gt;
|-&lt;br /&gt;
| 0xEE || INPUT&lt;br /&gt;
|-&lt;br /&gt;
| 0xEF || LOAD&lt;br /&gt;
|-&lt;br /&gt;
| 0xF0 || LIST&lt;br /&gt;
|-&lt;br /&gt;
| 0xF1 || LET&lt;br /&gt;
|-&lt;br /&gt;
| 0xF2 || PAUSE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF3 || NEXT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF4 || POKE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF5 || PRINT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF6 || PLOT&lt;br /&gt;
|-&lt;br /&gt;
| 0xF7 || RUN&lt;br /&gt;
|-&lt;br /&gt;
| 0xF8 || SAVE&lt;br /&gt;
|-&lt;br /&gt;
| 0xF9 || RANDOMIZE&lt;br /&gt;
|-&lt;br /&gt;
| 0xFA || IF&lt;br /&gt;
|-&lt;br /&gt;
| 0xFB || CLS&lt;br /&gt;
|-&lt;br /&gt;
| 0xFC || DRAW&lt;br /&gt;
|-&lt;br /&gt;
| 0xFD || CLEAR&lt;br /&gt;
|-&lt;br /&gt;
| 0xFE || RETURN&lt;br /&gt;
|-&lt;br /&gt;
| 0xFF || COPY &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11869</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11869"/>
		<updated>2023-09-06T07:20:38Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added note on low DAC volume and need for even more powerful amps. Clarified boot rom options.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next can create sound using [[Turbo Sound Next]] (3 AY-3-8912 sound chips) controlled by the BASIC PLAY keyword and the signal from these goes to the HDMI port or the &#039;ear&#039; socket. Additionally an internal speaker can be connected which will generate sound in the same manner as the original 48k Spectrum, controlled via the BEEP keyword, which will also output via HDMI/ear.&lt;br /&gt;
&lt;br /&gt;
A speaker attaches to connector J3 on the circuit board and requires a 2.54mm Pitch, 4 Way, 1 Row through-hole pin header. If you&#039;re fitting the board inside an original rubber key case, you&#039;ll probably need a right-angled connector due to the height required.&lt;br /&gt;
&lt;br /&gt;
The buzzer should be approximately 1 inch diameter with impedance of 16 ohm (which should equate to a basic &#039;PC BIOS&#039; piezo type speaker). J3 pins 1 and 2 are negative, pins 3 and 4 are positive.&lt;br /&gt;
&lt;br /&gt;
On the Issue 2B boards, [https://www.specnext.com/forum/viewtopic.php?t=1860&amp;amp;hilit=beeper many users found the above speaker too quiet]. For higher volume levels, use an integrated amplifier/speaker board like the [https://www.adafruit.com/product/3885 Adafruit STEMMA Speaker] instead. A [https://www.adafruit.com/product/3893 3-pin JST PH 2.0 mm female header cable] makes disconnecting it again easy.&lt;br /&gt;
&lt;br /&gt;
With the right settings (see below), this will give you roughly original ZX Spectrum sound levels, though only &#039;&#039;&#039;for the beeper used in the classic ZX Spectrum 16/48k&#039;&#039;&#039;. AY sound volume on 128k games like Dizzy 6 or Next games like Baggers In Space is still fairly low but serviceable in a quiet environment. DAC sound (like in the TX-1696 demo) remains too quiet to be usable; use HDMI or the 3.5 mm audio jack instead. To use an internal speaker with those types of audio, you will need a more powerful speaker and amplifier board (and possibly some way to adjust its volume as you switch between audio types).&lt;br /&gt;
&lt;br /&gt;
[[File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg|thumb|center|An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next Issue 2B motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.]]&lt;br /&gt;
&lt;br /&gt;
Solder GND to [[Circuit_Diagrams#J15_-_Next_GPIO|J15 pin 20]], Vcc to J15 pin 19, and the signal input to J3 pin 4 (next to the speaker holes on the Next PCB). Attach the speaker board to the Next case using two pieces of self-adhesive velcro. Place it next to the PCB and near the ZX Spectrum Expansion Connector. See the photo above.&lt;br /&gt;
&lt;br /&gt;
Remove the Expansion Connector cover for more volume, and turn the potentiometer on the speaker board all the way up.&lt;br /&gt;
&lt;br /&gt;
Turn on your Next while holding down SPACE to enter the TBBlue boot ROM menu. Here, toggle &#039;&#039;BEEPer&#039;&#039; to &#039;&#039;Int&#039;&#039; to increase its volume to roughly match the original ZX Spectrum for classic 16/48k &amp;quot;beeper&amp;quot; games (AY and DAC sound will not play through the internal speaker in this case). You can also disable the internal speaker here.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11868</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11868"/>
		<updated>2023-09-02T08:42:07Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added info on low volume for AY sound even with amp board&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next can create sound using [[Turbo Sound Next]] (3 AY-3-8912 sound chips) controlled by the BASIC PLAY keyword and the signal from these goes to the HDMI port or the &#039;ear&#039; socket. Additionally an internal speaker can be connected which will generate sound in the same manner as the original 48k Spectrum, controlled via the BEEP keyword, which will also output via HDMI/ear.&lt;br /&gt;
&lt;br /&gt;
A speaker attaches to connector J3 on the circuit board and requires a 2.54mm Pitch, 4 Way, 1 Row through-hole pin header. If you&#039;re fitting the board inside an original rubber key case, you&#039;ll probably need a right-angled connector due to the height required.&lt;br /&gt;
&lt;br /&gt;
The buzzer should be approximately 1 inch diameter with impedance of 16 ohm (which should equate to a basic &#039;PC BIOS&#039; piezo type speaker). J3 pins 1 and 2 are negative, pins 3 and 4 are positive.&lt;br /&gt;
&lt;br /&gt;
On the Issue 2B boards, [https://www.specnext.com/forum/viewtopic.php?t=1860&amp;amp;hilit=beeper many users found the above speaker too quiet]. For higher volume levels, use an integrated amplifier/speaker board like the [https://www.adafruit.com/product/3885 Adafruit STEMMA Speaker] instead. A [https://www.adafruit.com/product/3893 3-pin JST PH 2.0 mm female header cable] makes disconnecting it again easy.&lt;br /&gt;
&lt;br /&gt;
With the right settings (see below), this will give you roughly original ZX Spectrum sound levels for the beeper used in the classic ZX Spectrum 16/48k. AY sound volume on 128k games like Dizzy 6 or Next games like Baggers In Space is still fairly low but serviceable in a quiet environment.&lt;br /&gt;
&lt;br /&gt;
[[File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg|thumb|center|An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next Issue 2B motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.]]&lt;br /&gt;
&lt;br /&gt;
Solder GND to [[Circuit_Diagrams#J15_-_Next_GPIO|J15 pin 20]], Vcc to J15 pin 19, and the signal input to J3 pin 4 next to the speaker holes on the PCB. Attach the speaker board to the Next case using two pieces of self-adhesive velcro. Place it next to the PCB and near the ZX Spectrum Expansion Connector. See the photo above.&lt;br /&gt;
&lt;br /&gt;
Remove the Expansion Connector cover for more volume, and turn the potentiometer on the speaker board all the way up.&lt;br /&gt;
&lt;br /&gt;
If you hold down SPACE after power cycling, you enter the TBBlue boot ROM menu. Here you can disable the internal speaker or, if you play classic 16/48k games that don&#039;t use AY sound, toggle &#039;&#039;BEEPer&#039;&#039; to &#039;&#039;Int&#039;&#039; to increase its volume to roughly match the original ZX Spectrum.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11867</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11867"/>
		<updated>2023-08-31T19:59:53Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added information on how to enter boot menu, and how to increase volume by setting &amp;quot;BEEPer&amp;quot; to &amp;quot;Int&amp;quot;.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next can create sound using [[Turbo Sound Next]] (3 AY-3-8912 sound chips) controlled by the BASIC PLAY keyword and the signal from these goes to the HDMI port or the &#039;ear&#039; socket. Additionally an internal speaker can be connected which will generate sound in the same manner as the original 48k Spectrum, controlled via the BEEP keyword, which will also output via HDMI/ear.&lt;br /&gt;
&lt;br /&gt;
A speaker attaches to connector J3 on the circuit board and requires a 2.54mm Pitch, 4 Way, 1 Row through-hole pin header. If you&#039;re fitting the board inside an original rubber key case, you&#039;ll probably need a right-angled connector due to the height required.&lt;br /&gt;
&lt;br /&gt;
The buzzer should be approximately 1 inch diameter with impedance of 16 ohm (which should equate to a basic &#039;PC BIOS&#039; piezo type speaker). J3 pins 1 and 2 are negative, pins 3 and 4 are positive.&lt;br /&gt;
&lt;br /&gt;
On the Issue 2B boards, [https://www.specnext.com/forum/viewtopic.php?t=1860&amp;amp;hilit=beeper many users found the above speaker too quiet]. For volume levels similar to the original ZX Spectrum, use an integrated amplifier/speaker board like the [https://www.adafruit.com/product/3885 Adafruit STEMMA Speaker] instead. A [https://www.adafruit.com/product/3893 3-pin JST PH 2.0 mm female header cable] makes disconnecting it again easy.&lt;br /&gt;
&lt;br /&gt;
[[File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg|thumb|center|An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next Issue 2B motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.]]&lt;br /&gt;
&lt;br /&gt;
Solder GND to [[Circuit_Diagrams#J15_-_Next_GPIO|J15 pin 20]], Vcc to J15 pin 19, and the signal input to J3 pin 4 next to the speaker holes on the PCB. Attach the speaker board to the Next case using two pieces of self-adhesive velcro. Place it next to the PCB and near the ZX Spectrum Expansion Connector. See the photo above.&lt;br /&gt;
&lt;br /&gt;
Remove the Expansion Connector cover for more volume, and turn the potentiometer on the speaker board all the way up.&lt;br /&gt;
&lt;br /&gt;
If you hold down SPACE after power cycling, you enter the TBBlue boot ROM menu. Here you can disable the internal speaker or, if you play classic 16/48k games that don&#039;t use AY sound, toggle &#039;&#039;BEEPer&#039;&#039; to &#039;&#039;Int&#039;&#039; to increase its volume to roughly match the original ZX Spectrum.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11855</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=11855"/>
		<updated>2023-08-30T20:19:08Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: Added option to use an integrated amplifier/speaker board&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next can create sound using [[Turbo Sound Next]] (3 AY-3-8912 sound chips) controlled by the BASIC PLAY keyword and the signal from these goes to the HDMI port or the &#039;ear&#039; socket. Additionally an internal speaker can be connected which will generate sound in the same manner as the original 48k Spectrum, controlled via the BEEP keyword, which will also output via HDMI/ear.&lt;br /&gt;
&lt;br /&gt;
A speaker attaches to connector J3 on the circuit board and requires a 2.54mm Pitch, 4 Way, 1 Row through-hole pin header. If you&#039;re fitting the board inside an original rubber key case, you&#039;ll probably need a right-angled connector due to the height required.&lt;br /&gt;
&lt;br /&gt;
The buzzer should be approximately 1 inch diameter with impedance of 16 ohm (which should equate to a basic &#039;PC BIOS&#039; piezo type speaker). J3 pins 1 and 2 are negative, pins 3 and 4 are positive.&lt;br /&gt;
&lt;br /&gt;
On the Issue 2B boards, [https://www.specnext.com/forum/viewtopic.php?t=1860&amp;amp;hilit=beeper many users found the above speaker too quiet]. For volume levels similar to the original ZX Spectrum, use an integrated amplifier/speaker board like the [https://www.adafruit.com/product/3885 Adafruit STEMMA Speaker] instead. A [https://www.adafruit.com/product/3893 3-pin JST PH 2.0 mm female header cable] makes disconnecting it again easy.&lt;br /&gt;
&lt;br /&gt;
[[File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg|thumb|center|An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next Issue 2B motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.]]&lt;br /&gt;
&lt;br /&gt;
Solder GND to [[Circuit_Diagrams#J15_-_Next_GPIO|J15 pin 20]], Vcc to J15 pin 19, and the signal input to J3 pin 4 next to the speaker holes on the PCB. Attach the speaker board to the Next case using two pieces of self-adhesive velcro. Place it next to the PCB and near the ZX Spectrum Expansion Connector. See the photo above.&lt;br /&gt;
&lt;br /&gt;
Remove the Expansion Connector cover for better sound, and turn the potentiometer on the speaker board all the way up.&lt;br /&gt;
&lt;br /&gt;
The internal speaker can be disabled from the TBBlue boot ROM options menu.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg&amp;diff=11854</id>
		<title>File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=File:ZX-Spectrum-Next-Internal-Adafruit-Speaker-Amplifier.jpg&amp;diff=11854"/>
		<updated>2023-08-30T20:03:44Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An Adafruit STEMMA Speaker with integrated amplifier connected to the Spectrum Next motherboard and held in place inside the case with self-adhesive velcro strips. Cable colors do not reflect GND and Vcc correctly, but the cable sleeves do.&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Circuit_Diagrams&amp;diff=11852</id>
		<title>Circuit Diagrams</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Circuit_Diagrams&amp;diff=11852"/>
		<updated>2023-08-25T13:53:14Z</updated>

		<summary type="html">&lt;p&gt;Orcmeal: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Schematics ==&lt;br /&gt;
&lt;br /&gt;
The KS1 and KS2 schematics can be downloaded [https://gitlab.com/thesmog358/tbblue/-/tree/master/docs/schematics?inline=false here].&lt;br /&gt;
&lt;br /&gt;
The three tail matrix keyboard schematic can be downloaded [https://github.com/Threetwosevensixseven/NXtel/wiki/images/NS58A-5-01-04.pdf here].&lt;br /&gt;
&lt;br /&gt;
== J13 - Daughter board connector ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:DaughterLocation.jpg]]&lt;br /&gt;
|valign=top| [[Image:Circuit_daughter_board.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J15 - Next GPIO ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:NEXT_GPIO_location.jpg]]&lt;br /&gt;
|valign=top width=50%| [[Image:NEXT_GPIO.png|461px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN5 - Expansion bus (edge connector) ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Expansion_bus_location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Expansion_bus.png|461px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J10/J11 - Memory Expansion Ports ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Mem_Expansion_location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Mem_Expansion.png|461px]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J4/J7 J8/J14 - Joystick Ports ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Joystick_Ports_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Joystick_Ports.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN1 - VGA Video Port ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Video_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Video_Port.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
* In VGA mode (scandoubler enabled), H-SYNC and V-SYNC are carried separately on their respective pins.&lt;br /&gt;
* In RGB mode (scandoubler disabled), H-SYNC carries composite sync, and V-SYNC carries 1.&lt;br /&gt;
* Pin 14 carries 3V3, which can be connected to SCART pin 16 to indicate RGB to the display.&lt;br /&gt;
* There is no convenient source of voltages between 9.5-12V to indicate 4:3 aspect ratio to the display on SCART pin 8, so this is usually left unconnected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN8 - Digital Port ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%|[[Image:Digital Port Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Next Digital Port.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN2/CN6/CN7 - SD Reader (Mainboard) (CN6 on reverse) ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:SD_Reader_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:SD_Reader_Main.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN10/CN11/CN12 - SD Reader (Daughterboard) (CN12 on reverse) ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:SD_Reader_Daughter_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:SD_Reader.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Accelerator Board ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Accelerator_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Accelerator_Port.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Real Time Clock (RTC) ==&lt;br /&gt;
&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:RTC_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:RTC_Port.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN9 - ESP8266-01/RS-232 Port ==&lt;br /&gt;
{| width=100%&lt;br /&gt;
|valign=top width=50%| [[Image:Wifi_Port_Location.jpg]]&lt;br /&gt;
|valign=top| [[Image:Next_ESP_Port.png]]&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Orcmeal</name></author>
	</entry>
</feed>