<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>http://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Daz</id>
	<title>SpecNext Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Daz"/>
	<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/Special:Contributions/Daz"/>
	<updated>2026-05-30T23:36:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Mouse&amp;diff=11628</id>
		<title>Mouse</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Mouse&amp;diff=11628"/>
		<updated>2020-12-21T12:11:19Z</updated>

		<summary type="html">&lt;p&gt;Daz: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next has a PS/2 port for connecting a PS/2 keyboard or mouse (or both via a splitter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: Do not plug in or remove PS/2 devices with the power on.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A USB mouse plugged in via a USB-to-PS/2 converter will only work if the mouse itself supports the PS/2 protocol.&lt;br /&gt;
&lt;br /&gt;
=== PS/2 Port and modes of operation ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;ps2&amp;quot; setting in the /machines/next/config.ini file determines the PS/2 port mode:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PS2=0&#039;&#039;&#039; is KEYBOARD mode where a PS/2 keyboard is plugged into the Next, or with a splitter you can use both a mouse and a keyboard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PS2=1&#039;&#039;&#039; is MOUSE mode where the mouse should be plugged in directly. Do not use a splitter in this mode as it can have funny effects.&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;quot;ps2mode&amp;quot; dot command to see which mode is active. The best place to set the value is in the tbblue .ini file, but if you start in the wrong mode then on the Next (or a membrane) keyboard you can type ps2mode -m to select MOUSE or ps2mode -k to select KEYBOARD.&lt;br /&gt;
&lt;br /&gt;
=== Driver ===&lt;br /&gt;
The NextZXOS distribution includes a mouse driver from version 1.95 onwards. &lt;br /&gt;
&lt;br /&gt;
All you need is the file MOUSE.DRV in the NextZXOS folder. The mouse can then be used from BASIC with the new DRIVER command.&lt;br /&gt;
&lt;br /&gt;
This mouse driver is driver number 126. There will be a supported list of driver codes and any that use streams (this does not) will need to be allocated one from 65-90/A-Z or the lower case range (or both) so this avoids that area.&lt;br /&gt;
&lt;br /&gt;
The driver is stopped and started with the &#039;install&#039; and &#039;uninstall&#039; DOT commands in the BIN directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;.install /nextos/mouse.drv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sample BASIC programs ===&lt;br /&gt;
&lt;br /&gt;
There is a demo program called NXMOUSE.BAS that uses Sprite and Text features for you to play with (in the /demos/mouse folder). The NXMOUSET.BAS program uses some of the features of the sprite cursor and lets you play with acceleration settings in Timex HiRes mode.&lt;br /&gt;
&lt;br /&gt;
They both use sprites from the BREAKOUT test but, you can change line 300 to load any set you wish.  Note that if you&lt;br /&gt;
hold the &#039;s&#039; button and move it around at times the sprite cursor will seem to disappear - that is because you have reached the maximum 12 sprites per display line.&lt;br /&gt;
&lt;br /&gt;
You could modify the code to remove the tail of previously used sprites if you want but, it is quite fun to play with.&lt;br /&gt;
&lt;br /&gt;
=== Mouse Driver API ===&lt;br /&gt;
&lt;br /&gt;
DRIVER supports the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,1 TO %b,x,y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will get the current location of the mouse on a 192 x 640 grid with 0,0 in the top left of the outer border where sprites can go.  It uses the higher X number to allow use in Timex mode where there are twice as many horizontal pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;%b@111&amp;lt;/pre&amp;gt; will be the three buttons bit activated in combination so 1,2,4 or 3,5,6,7 for combinations.&lt;br /&gt;
&amp;lt;pre&amp;gt;%b&amp;gt;&amp;gt;4&amp;lt;/pre&amp;gt; will be the current value of the wheel mouse from 0 to 15.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,2{,sprite{,pattern}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The optional sprite number 0-63 and pattern number 0-63 will default to 0. This will cause that sprite to always be displayed (anywhere that clipping is not in effect) at the current X,Y coordinate - over a Timex screen it will sit between two pixels of course.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Will disable the sprite cursor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,4{,attribute}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will display an attribute based character cursor using the ULA attributes - this will cope with some screen changes but, not scrolling so remember to disable it when changing the screen wholesale.&lt;br /&gt;
&lt;br /&gt;
So using the new features of NextOS to include a binary number (@) in an integer statement (%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,4,%@11100111&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Will set a Bright, Flashing, Green and White cursor. The first two 1&#039;s are Bright and Flash the next two groups of three are the paper and ink:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FTGRBGRB&amp;lt;/pre&amp;gt; - where T=Bright.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will remove the Attribute based cursor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,6,x_threshold&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Where x_threshold is forced to be in the range 0-255 by using LSB only:&lt;br /&gt;
&lt;br /&gt;
* 0 Means always accelerate the X direction&lt;br /&gt;
* 255 Means never accelerate the X direction&lt;br /&gt;
&lt;br /&gt;
By default x_threshold is set at 32 which will trigger more rapid movement if you move the mouse quickly. You can adjust to suit your own preference.&lt;br /&gt;
&lt;br /&gt;
The Y does not have the option as 0-192 pixels probably would not benefit but, it is not ruled out and you have the source to hack...&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Based on the distribution readme by Tim Gilberts.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=11512</id>
		<title>File Formats</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=11512"/>
		<updated>2020-08-29T12:53:39Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added note on tzx files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;NextZXOS can directly read and load these kind of files: bas, tap, z80, sna, snx, dot, o, p. Many other file types are supported by the use of external dot commands.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[https://www.worldofspectrum.org/faq/reference/z80format.htm .z80]&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. Files can be loaded using the NextZXOS browser, the NextZXOS SPECTRUM keyword, the esxDOS NMI menu, and the exDOS .snapload command.&lt;br /&gt;
* &#039;&#039;&#039;[https://faqwiki.zxnet.co.uk/wiki/SNA_format .sna]&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. Both 48K and 128K SNA files are supported. Files can be loaded using the NextZXOS browser, the NextZXOS SPECTRUM keyword, the esxDOS NMI menu, and the exDOS .snapload command. When loading in NextZXOS, any private data appended to the file is ignored during loading, and the program code may later read it by reopening itself using a hardcoded filename. If private data is appended to them then they cannot be loaded by esxDOS. Also the NextZXOS will reconfigure the machine based on the type of the SNA file, for example the {{PortNo|$7FFD}} memory banking is locked when 48K SNA file is loaded, etc.. (all of this can be reconfigured through Next registers to unlock/enable all features back, but the initial state is designed to provide maximum compatibility with legacy/original SW)&lt;br /&gt;
* &#039;&#039;&#039;.snx&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. It is identical to a 128K .sna file, but when loaded using the browser or the SPECTRUM command, NextZXOS leaves file handle 0 open for further use by the program. The program is expected close the handle before exiting. .snx files may also have private data appended to them. They are not supported by esxDOS.&lt;br /&gt;
* &#039;&#039;&#039;.o&#039;&#039;&#039; is a ZX80 snapshot&lt;br /&gt;
* &#039;&#039;&#039;.p&#039;&#039;&#039; is a ZX81 snapshot&lt;br /&gt;
* &#039;&#039;&#039;[[NEX file format|.nex]]&#039;&#039;&#039; is good for a program that takes over the machine. With some care, it can also be used to load a program without overwriting sysvars, allowing NextZXOS API calls to be used. It can be loaded using the NextZXOS file browser and the .nexload dot command. The [[Emulators|CSpect]] emulator can open .nex files natively from the F2 dialog. esxDOS cannot open .nex files.&lt;br /&gt;
* &#039;&#039;&#039;.dot&#039;&#039;&#039; is good for dot commands and programs that can coexist with BASIC/NextZXOS and can return to BASIC safely (i.e. counterpart to nex)&lt;br /&gt;
* &#039;&#039;&#039;[[TAP file format|.tap]]&#039;&#039;&#039; is a simple container format that can hold many files, is compatible with emulators and supported by many tools. When loading .tap files using the NextZXOS browser, a menu is displayed asking whether you want to load in standard, USR0 or 48K mode.&lt;br /&gt;
* &#039;&#039;&#039;.bas&#039;&#039;&#039; is the native SD-card format for BASIC programs (first 128 bytes of the file form standard +3DOS header).&lt;br /&gt;
* .&#039;&#039;&#039;scr&#039;&#039;&#039; is used for a standard Spectrum screenshot created with &#039;&#039;SAVE &amp;quot;picture.scr&amp;quot; SCREEN$&#039;&#039; (256x192, 15 colours per character cell). Note that if saved from BASIC, .scr files will have a 128 byte +3DOS header (7,040 bytes), but .scr files created in external PC tools may not have a +3DOS header (6,912 bytes). The NextZXOS browser and the BASIC &#039;&#039;LOAD&#039;&#039; statement can cope with both headered and headerless .scr files.&lt;br /&gt;
* &#039;&#039;&#039;.shc&#039;&#039;&#039; is used for a screenshot in Timex 8x1 Hi-colour mode (256x192, 15 colors).&lt;br /&gt;
* &#039;&#039;&#039;.shr&#039;&#039;&#039; is used for a screenshot in Timex Hi-res mode (512x192, mono).&lt;br /&gt;
* &#039;&#039;&#039;.slr&#039;&#039;&#039; is used for a lo-res screenshot (128x96, 256 colours).&lt;br /&gt;
* &#039;&#039;&#039;.sl2&#039;&#039;&#039; is used for a Layer 2 screenshot (256x192, 256 colour) (when stored by NextBASIC, the binary content of file is: regular 128 bytes +3DOS header, then 256*192 bytes with pixel data, NO palette data = in total 49280 bytes).&lt;br /&gt;
* &#039;&#039;&#039;.pal&#039;&#039;&#039; is a 9-bit palette format (256 pairs of bytes in %RRRGGGBB, %P000000B format). Files can be loaded and saved from the Screenshots menu in NextZXOS after pressing the M1 button or F9. The P bit sets priority when used in layer 2 palettes. Palette entries with P=1 cause their pixels to appear above everything else, regardless of globally-set layer priorities.&lt;br /&gt;
* &#039;&#039;&#039;.npl&#039;&#039;&#039; is a 9-bit palette format. The first 512 bytes are identical to a .pal file. The 513th byte designates transparency - for sprite palettes, the transparency byte is a real index, and for other palettes it is a colour mask. .npl files can be created, saved and loaded by [[Miscellaneous#WASPtools|WASPtools]].&lt;br /&gt;
* &#039;&#039;&#039;.nxi&#039;&#039;&#039; is layer 2 screen format, with optional palette. If the file size is 49,152 bytes, the file contains 256x192 pixels of layer 2 data, indexed with palette values. This is essentially a memory dump of the six sequential layer 2 MMU banks. If the size is 49,664 bytes, the pixel data is prepended with 512 bytes of palette data (256 pairs of bytes in %RRRGGGBB, %P000000B format). .nxi files can be processed by PLOTIT, Dnext, [https://github.com/stefanbylund/zxnext_bmp_tools zxnext_bmp_tools] and Jim Bagley&#039;s tools.&lt;br /&gt;
&lt;br /&gt;
The most notable of the other file formats is tzx. Although the browser recognises tzx files, they can only be loaded if you have a Raspberry Pi installed in your Next. See the [[FAQ]] for details.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=10872</id>
		<title>ESXDOS</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=10872"/>
		<updated>2019-09-10T21:12:38Z</updated>

		<summary type="html">&lt;p&gt;Daz: Folder case&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= esxDOS =&lt;br /&gt;
&lt;br /&gt;
esxDOS is one of the operating systems that can be run on the Next.  It provides a POSIX-like API to access the SD card as disk and it provides a familiar interface to the disk from BASIC. esxDOS from version 0.8.6 supports the Real Time Clock of the Next; a new version 0.9.x is being written with features like Long File Name (LFN) support. esxDOS currently only supports the so-called USR0 mode in BASIC (single keyword/48K Basic) - there is an experimental .128 command to allow the editor to be started.&lt;br /&gt;
&lt;br /&gt;
You do not need to install esxDOS if you just want to run software designed for it as NextZXOS implements the esxDOS Application Programming Interface (API) so programs will work anyway. This includes running &amp;quot;dot commands&amp;quot;. You can copy your dot command files to the /DOT folder of the SD card. Note that NextZXOS already includes several dot commands that are newer than the ones included with esxDOS, so you may want to use these. Many of these work on&lt;br /&gt;
both systems. For esxDOS compliant versions, use the ones located under c:/dot/extra.&lt;br /&gt;
&lt;br /&gt;
If you want to use its other features like BetaDisk support or just want to see what it is like you will need to follow the instructions to install it as another identity on the Next.&lt;br /&gt;
&lt;br /&gt;
Instructions to Install esxDos on the Next&lt;br /&gt;
&lt;br /&gt;
1. Download the esxDOS distribution (minimum version 0.8.6) from www.esxdos.org&lt;br /&gt;
&lt;br /&gt;
2. Within NextZXOS, create two folders on the root of your SD card, named &amp;quot;bin&amp;quot; and &amp;quot;sys&amp;quot; by giving:&lt;br /&gt;
&lt;br /&gt;
  mkdir &amp;quot;c:/BIN&amp;quot;&lt;br /&gt;
  mkdir &amp;quot;c:/SYS&amp;quot;&lt;br /&gt;
  mkdir &amp;quot;c:/TMP&amp;quot;&lt;br /&gt;
&lt;br /&gt;
3. Using a PC, unzip the contents of esxdos.zip then rename esxmmc.bin as esxmmc.rom &lt;br /&gt;
&lt;br /&gt;
4. Copy the .bin file into /tbblue/ on the SD card&lt;br /&gt;
&lt;br /&gt;
5. Copy the contents of the &amp;quot;BIN&amp;quot; and &amp;quot;SYS&amp;quot; folders in the esxDOS distribution into their respective places on the SD card. &lt;br /&gt;
&lt;br /&gt;
6. [todo --- modify the /tbblue/config.ini file ?]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=10871</id>
		<title>ESXDOS</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=10871"/>
		<updated>2019-09-10T16:02:02Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added esxDOS install steps but need someone with a dev board to verify them&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= esxDos =&lt;br /&gt;
&lt;br /&gt;
esxDOS is one of the operating systems that can be run on the Next.  It provides a POSIX-like API to access the SD card as disk and it provides a familiar interface to the disk from BASIC.  The current version of esxDOS is 0.8.6 - which supports the Real Time Clock of the Next; a new version 0.9.x is being written with features like Long File Name (LFN) support. esxDOS currently only supports the so-called USR0 mode in BASIC (single keyword/48K Basic) - there is an experimental .128 command to allow the editor to be started.&lt;br /&gt;
&lt;br /&gt;
You do not need to install esxDOS if you just want to run software designed for it as NextZXOS implements the esxDOS Application Programming Interface (API) so programs will work anyway. This includes running &amp;quot;dot commands&amp;quot;. You can copy your dot command files to the /DOT folder of the SD card. Note that NextZXOS already includes several dot commands that are newer than the ones included with esxDOS, so you may want to use these. Many of these work on&lt;br /&gt;
both systems. For esxDOS compliant versions, use the ones located under c:/dot/extra.&lt;br /&gt;
&lt;br /&gt;
If you want to use its other features like BetaDisk support or just want to see what it is like you will need to follow the instructions to install it as another identity on the Next.&lt;br /&gt;
&lt;br /&gt;
Instructions to Install esxDos on the Next&lt;br /&gt;
&lt;br /&gt;
1. Download the esxDOS distribution (minimum version 0.8.6) from www.esxdos.org&lt;br /&gt;
&lt;br /&gt;
2. Within NextZXOS, create two folders on the root of your SD card, named &amp;quot;bin&amp;quot; and &amp;quot;sys&amp;quot; by giving:&lt;br /&gt;
&lt;br /&gt;
  mkdir &amp;quot;c:/bin&amp;quot;&lt;br /&gt;
  mkdir &amp;quot;c:/sys&amp;quot;&lt;br /&gt;
&lt;br /&gt;
3. Using a PC, unzip the contents of esxdos.zip then rename esxmmc.bin as esxmmc.rom &lt;br /&gt;
&lt;br /&gt;
4. Copy the .bin file into /tbblue/ on the SD card&lt;br /&gt;
&lt;br /&gt;
5. Copy the contents of the &amp;quot;bin&amp;quot; and &amp;quot;sys&amp;quot; folders in the esxDOS distribution into their respective places on the SD card. &lt;br /&gt;
&lt;br /&gt;
6. [todo --- modify the /tbblue/config.ini file ?]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=3660</id>
		<title>ESXDOS</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESXDOS&amp;diff=3660"/>
		<updated>2019-07-30T14:04:51Z</updated>

		<summary type="html">&lt;p&gt;Daz: Expanded info on dot commands&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= esxDos =&lt;br /&gt;
&lt;br /&gt;
esxDOS is one of the operating systems that can be run on the Next.  It provides a POSIX-like API to access the SD card as disk and it provides a familiar interface to the disk from BASIC.  The current version of esxDOS is 0.8.6 - which supports the Real Time Clock of the Next; a new version 0.9.x is being written with features like Long File Name (LFN) support. esxDOS currently only supports the so-called USR0 mode in BASIC (single keyword/48K Basic) - there is an experimental .128 command to allow the editor to be started.&lt;br /&gt;
&lt;br /&gt;
You do not need to install esxDOS if you just want to run software designed for it as NextZXOS implements the esxDOS Application Programming Interface (API) so programs will work anyway. This includes running &amp;quot;dot commands&amp;quot;. You can copy your dot command files to the /DOT folder of the SD card. Note that NextZXOS already includes several dot commands that are newer than the ones included with esxDOS, so you may want to use these. Many of these work on&lt;br /&gt;
both systems. For esxDOS compliant versions, use the ones located under c:/dot/extra.&lt;br /&gt;
&lt;br /&gt;
If you want to use its other features like BetaDisk support or just want to see what it is like you will need to follow the instructions to install it as another identity on the Next.&lt;br /&gt;
&lt;br /&gt;
Instructions to Install esxDos on the Next... [TODO]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1396</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1396"/>
		<updated>2019-07-04T13:11:07Z</updated>

		<summary type="html">&lt;p&gt;Daz: FPGA page link&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the [[FPGA]]&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the [[ESP8266-01|ESP Wi-fi module]], and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the [[RTC|real time clock]] module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed (2 x 10 IDC 2.54mm spc. Male Pin Header). Pull up/down resistors may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:NEXT_GPIO.png|thumb|GPIO pinout image]]&lt;br /&gt;
&lt;br /&gt;
In June 2019 it was announced that pins 4 and 17 of J15 would be used for two additional keyboard connections on full cased Nexts. Final specs have not yet been finalised.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1395</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1395"/>
		<updated>2019-07-04T12:59:34Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the [[ESP8266-01|ESP Wi-fi module]], and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the [[RTC|real time clock]] module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed (2 x 10 IDC 2.54mm spc. Male Pin Header). Pull up/down resistors may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:NEXT_GPIO.png|thumb|GPIO pinout image]]&lt;br /&gt;
&lt;br /&gt;
In June 2019 it was announced that pins 4 and 17 of J15 would be used for two additional keyboard connections on full cased Nexts. Final specs have not yet been finalised.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1377</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1377"/>
		<updated>2019-06-24T20:39:50Z</updated>

		<summary type="html">&lt;p&gt;Daz: Keyboard pins heads-up&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the ESP Wi-fi module, and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the real time clock module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed (2 x 10 IDC 2.54mm spc. Male Pin Header). Pull up/down resisters may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:NEXT_GPIO.png|thumb|GPIO pinout image]]&lt;br /&gt;
&lt;br /&gt;
In June 2019 it was announced that two pins of J15 would be used for two additional keyboard connections on full cased Nexts. Final specs have not yet been finalised.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=1373</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=1373"/>
		<updated>2019-06-21T12:45:40Z</updated>

		<summary type="html">&lt;p&gt;Daz: Grammar&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;
The internal speaker can be disabled from the TBBlue boot ROM options menu.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=1372</id>
		<title>Beeper (hardware)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Beeper_(hardware)&amp;diff=1372"/>
		<updated>2019-06-21T12:44:26Z</updated>

		<summary type="html">&lt;p&gt;Daz: Initial version - all the info I could scrape up from the forums/FB&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 of the connector.&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;
The internal speaker can be disabled from the TBBlue boot ROM options menu.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1371</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1371"/>
		<updated>2019-06-20T15:24:48Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added J15 header info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the ESP Wi-fi module, and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the real time clock module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed (2 x 10 IDC 2.54mm spc. Male Pin Header). Pull up/down resisters may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:NEXT_GPIO.png|thumb|GPIO pinout image]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Main_Page&amp;diff=1370</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Main_Page&amp;diff=1370"/>
		<updated>2019-06-20T15:00:06Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== References ==&lt;br /&gt;
&lt;br /&gt;
=== System architecture ===&lt;br /&gt;
* [[Extended Z80 instruction set]]&lt;br /&gt;
* [[Memory map]] and switching mechanics&lt;br /&gt;
* [[Reference machines]] and timing&lt;br /&gt;
* [[Boot Sequence]]&lt;br /&gt;
* [[Board feature control]] and port list&lt;br /&gt;
* [[Interrupts]]&lt;br /&gt;
* [[RPi0 Acceleration]]&lt;br /&gt;
* [[DMA|zxnDMA]]&lt;br /&gt;
* [[Copper]]&lt;br /&gt;
* [[File Formats]]&lt;br /&gt;
* [[Z80 programming]]&lt;br /&gt;
&lt;br /&gt;
=== Video ===&lt;br /&gt;
* [[Video Modes]]&lt;br /&gt;
* [[Tilemap]]&lt;br /&gt;
* [[Sprites]]&lt;br /&gt;
* [[Layer 2]]&lt;br /&gt;
* [[Palettes]]&lt;br /&gt;
* [[Blend Modes]]&lt;br /&gt;
&lt;br /&gt;
=== Audio ===&lt;br /&gt;
* [[Turbo Sound Next]]&lt;br /&gt;
* [[SpecDrum/DAC]]&lt;br /&gt;
* [[Beeper (audio) | Beeper]]&lt;br /&gt;
&lt;br /&gt;
=== Firmware ===&lt;br /&gt;
* [https://gitlab.com/thesmog358/tbblue TBBlue Official Distribution git repository]&lt;br /&gt;
* [[NextZXOS]]&lt;br /&gt;
* [[ESXDOS]]&lt;br /&gt;
* [[NextBASIC]]&lt;br /&gt;
* [[System Variables]]&lt;br /&gt;
&lt;br /&gt;
=== Electronics ===&lt;br /&gt;
* [[Circuit Diagrams]]&lt;br /&gt;
&lt;br /&gt;
=== Development Tools ===&lt;br /&gt;
* [[Emulators]]&lt;br /&gt;
* [[Assemblers]]&lt;br /&gt;
* [[Compilers]]&lt;br /&gt;
* [[Miscellaneous]]&lt;br /&gt;
&lt;br /&gt;
=== Hardware Expansion ===&lt;br /&gt;
&lt;br /&gt;
Your next computer can be expanded internally to add additional functionality. &lt;br /&gt;
* [[RTC | RTC - Real Time Clock]] &lt;br /&gt;
* [[Raspberry Pi Zero | Accelerator - Raspberry Pi Zero]]&lt;br /&gt;
* [[ESP8266-01 | ESP8266-01 - Wifi Module]] &lt;br /&gt;
* [[Expansion | Expansion Slot]]&lt;br /&gt;
* [[GPIO Socket (J15)]]&lt;br /&gt;
* [[JTAG Socket]]&lt;br /&gt;
* [[2MB RAM Expansion]]&lt;br /&gt;
* [[Beeper (hardware) | Beeper]]&lt;br /&gt;
* &#039;&#039;[https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=544 Specnext Forums] &lt;br /&gt;
: A link to the forums discussing hardware additions&lt;br /&gt;
&lt;br /&gt;
=== Peripherals ===&lt;br /&gt;
&lt;br /&gt;
* [[Mouse]]&lt;br /&gt;
&lt;br /&gt;
= Community =&lt;br /&gt;
&lt;br /&gt;
* [https://www.specnext.com/forum/ Official forums]&lt;br /&gt;
* [https://www.facebook.com/groups/specnext Facebook group]&lt;br /&gt;
* [https://specnext.slack.com/ Slack chat] ([https://join.slack.com/t/specnext/shared_invite/enQtMjQ2ODgzNTI5MzAzLWE2NzhhNjUzZGZhNWIxZWIyMTY4N2JmNTY3MWM4ZTkxOWY2M2UwZDQzN2FhYTEzNjFiY2I5MDA1MTc3NjVmYTI sign up])&lt;br /&gt;
&lt;br /&gt;
= Sources =&lt;br /&gt;
* [[Bibliography]]&lt;br /&gt;
&lt;br /&gt;
= Wiki &amp;quot;to do&amp;quot; list =&lt;br /&gt;
* [[Wiki TODO list]] (can be used also as warning which pages may contain outdated information)&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Mouse&amp;diff=1369</id>
		<title>Mouse</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Mouse&amp;diff=1369"/>
		<updated>2019-06-20T14:59:18Z</updated>

		<summary type="html">&lt;p&gt;Daz: Initial version based on Tim Gilberts &amp;quot;MOUSEreadme.txt&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The Spectrum Next has a PS/2 port for connecting a PS/2 keyboard or mouse (or both via a splitter).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: Do not plug in or remove PS/2 devices with the power on.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A USB mouse plugged in via a USB-to-PS/2 converter will only work if the mouse itself supports the PS/2 protocol.&lt;br /&gt;
&lt;br /&gt;
=== PS/2 Port and modes of operation ===&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;ps2&amp;quot; setting in the /tbblue/config.ini file determines how the PS/2 port mode:&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PS2=0&#039;&#039;&#039; is KEYBOARD mode where a PS/2 keyboard is plugged into the Next, or with a splitter you can use both a mouse and a keyboard.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PS2=1&#039;&#039;&#039; is MOUSE mode where the mouse should be plugged in directly. Do not use a splitter in this mode as it can have funny effects.&lt;br /&gt;
&lt;br /&gt;
You can use the &amp;quot;ps2mode&amp;quot; dot command to see which mode is active. The best place to set the value is in the tbblue .ini file, but if you start in the wrong mode then on the Next (or a membrane) keyboard you can type ps2mode -m to select MOUSE or ps2mode -k to select KEYBOARD.&lt;br /&gt;
&lt;br /&gt;
=== Driver ===&lt;br /&gt;
The NextZXOS distribution includes a mouse driver from version 1.95 onwards. &lt;br /&gt;
&lt;br /&gt;
All you need is the file MOUSE.DRV in the NextZXOS folder. The mouse can then be used from BASIC with the new DRIVER command.&lt;br /&gt;
&lt;br /&gt;
This mouse driver is driver number 126. There will be a supported list of driver codes and any that use streams (this does not) will need to be allocated one from 65-90/A-Z or the lower case range (or both) so this avoids that area.&lt;br /&gt;
&lt;br /&gt;
The driver is stopped and started with the &#039;install&#039; and &#039;uninstall&#039; DOT commands in the BIN directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;.install /nextos/mouse.drv&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Sample BASIC programs ===&lt;br /&gt;
&lt;br /&gt;
There is a demo program called NXMOUSE.BAS that uses Sprite and Text features for you to play with (in the /demos/mouse folder). The NXMOUSET.BAS program uses some of the features of the sprite cursor and lets you play with acceleration settings in Timex HiRes mode.&lt;br /&gt;
&lt;br /&gt;
They both use sprites from the BREAKOUT test but, you can change line 300 to load any set you wish.  Note that if you&lt;br /&gt;
hold the &#039;s&#039; button and move it around at times the sprite cursor will seem to disappear - that is because you have reached the maximum 12 sprites per display line.&lt;br /&gt;
&lt;br /&gt;
You could modify the code to remove the tail of previously used sprites if you want but, it is quite fun to play with.&lt;br /&gt;
&lt;br /&gt;
=== Mouse Driver API ===&lt;br /&gt;
&lt;br /&gt;
DRIVER supports the following parameters:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,1 TO %b,x,y&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will get the current location of the mouse on a 192 x 640 grid with 0,0 in the top left of the outer border where sprites can go.  It uses the higher X number to allow use in Timex mode where there are twice as many horizontal pixels.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;%b@111&amp;lt;/pre&amp;gt; will be the three buttons bit activated in combination so 1,2,4 or 3,5,6,7 for combinations.&lt;br /&gt;
&amp;lt;pre&amp;gt;%b&amp;gt;&amp;gt;4&amp;lt;/pre&amp;gt; will be the current value of the wheel mouse from 0 to 15.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,2{,sprite{,pattern}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The optional sprite number 0-63 and pattern number 0-63 will default to 0. This will cause that sprite to always be displayed (anywhere that clipping is not in effect) at the current X,Y coordinate - over a Timex screen it will sit between two pixels of course.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,3&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Will disable the sprite cursor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,4{,attribute}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
will display an attribute based character cursor using the ULA attributes - this will cope with some screen changes but, not scrolling so remember to disable it when changing the screen wholesale.&lt;br /&gt;
&lt;br /&gt;
So using the new features of NextOS to include a binary number (@) in an integer statement (%)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,4,%@11100111&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Will set a Bright, Flashing, Green and White cursor. The first two 1&#039;s are Bright and Flash the next two groups of three are the paper and ink:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;FTGRBGRB&amp;lt;/pre&amp;gt; - where T=Bright.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,5&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
will remove the Attribute based cursor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;DRIVER 126,6,x_threshold&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Where x_threshold is forced to be in the range 0-255 by using LSB only:&lt;br /&gt;
&lt;br /&gt;
* 0 Means always accelerate the X direction&lt;br /&gt;
* 255 Means never accelerate the X direction&lt;br /&gt;
&lt;br /&gt;
By default x_threshold is set at 32 which will trigger more rapid movement if you move the mouse quickly. You can adjust to suit your own preference.&lt;br /&gt;
&lt;br /&gt;
The Y does not have the option as 0-192 pixels probably would not benefit but, it is not ruled out and you have the source to hack...&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
Based on the distribution readme by Tim Gilberts.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=DMA&amp;diff=1368</id>
		<title>DMA</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=DMA&amp;diff=1368"/>
		<updated>2019-06-20T11:21:25Z</updated>

		<summary type="html">&lt;p&gt;Daz: Fix heading levels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Overview ==&lt;br /&gt;
The ZX Spectrum Next DMA (zxnDMA) is a single channel DMA device that implements a subset of the Z80 DMA functionality. The subset is large enough to be compatible with common uses of the similar Datagear interface available for standard ZX Spectrum computers and compatibles. It also adds a burst mode capability that can deliver audio at programmable sample rates to the DAC device.&lt;br /&gt;
&lt;br /&gt;
== Accessing the zxnDMA ==&lt;br /&gt;
The zxnDMA is mapped to a single Read/Write IO Port 0x6B which is the same one used by the Datagear but unlike the Datagear it doesn&#039;t also map itself to a second port 0x0B similar to the MB-02 interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PORT 0x6b: zxnDMA&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Description  ==&lt;br /&gt;
The normal Z80 DMA (Z8410) chip is a pipelined device and because of that it has numerous off-by-one idiosyncrasies and requirements on the order that certain commands should be carried out. These issues are not duplicated in the zxnDMA. You can continue to program the zxnDMA as if it is were a Z8410 DMA device but it can also be programmed in a simpler manner.&lt;br /&gt;
&lt;br /&gt;
The single channel of the zxnDMA chip consists of two ports named A and B. Transfers can occur in either direction between ports A and B, each port can describe a target in memory or IO, and each can be configured to autoincrement, autodecrement or stay fixed after a byte is transferred.&lt;br /&gt;
&lt;br /&gt;
A special feature of the zxnDMA can force each byte transfer to take a fixed amount of time so that the zxnDMA can be used to deliver sampled audio.&lt;br /&gt;
&lt;br /&gt;
== Modes of Operation ==&lt;br /&gt;
The zxnDMA can operate in a z80-DMA compatibility mode.&lt;br /&gt;
&lt;br /&gt;
The z80-DMA compatibility mode is selected by setting bit 6 of nextreg 0x06. In this mode, all transfers involve length+1 bytes which is the same behaviour as the z80-DMA chip. In zxn-DMA mode, the transfer length is exactly the number of bytes programmed. This mode is mainly present to accommodate existing spectrum software that uses the z80-DMA and for cp/m programs that may have a z80-DMA option.&lt;br /&gt;
&lt;br /&gt;
The zxnDMA can also operate in either burst or continuous modes.&lt;br /&gt;
&lt;br /&gt;
Continuous mode means the DMA chip runs to completion without allowing the CPU to run. When the CPU starts the DMA, the DMA operation will complete before the CPU executes its next instruction.&lt;br /&gt;
&lt;br /&gt;
Burst mode nominally means the DMA lets the CPU run if either port is not ready. This condition can&#039;t happen in the zxnDMA chip except when operated in the special fixed time transfer mode. In this mode, the zxnDMA will let the CPU run while it waits for the fixed time to expire between bytes transferred.&lt;br /&gt;
&lt;br /&gt;
Note that there is no byte transfer mode as in the Z80 DMA.&lt;br /&gt;
&lt;br /&gt;
== Programming the zxnDMA ==&lt;br /&gt;
Like the Z80 DMA chip, the zxnDMA has seven write registers named WR0-WR6 that control the device. Each register WR0-WR6 can have zero or more parameters associated with it.&lt;br /&gt;
&lt;br /&gt;
In a first write to the zxnDMA port, the write value is compared against a bitmask to determine which of the WR0-WR6 is the target. Remaining bits in the written value can contain data as well as a list of associated parameter bits. The parameter bits determine if further writes are expected to deliver parameter values. If there are multiple parameter bits set, the expected order of parameter values written is determined by parameter bit position from right to left (bit 0 through bit 7). Once all parameters are written, the zxnDMA again expects a regular register write selecting WR0-WR6.&lt;br /&gt;
&lt;br /&gt;
The table below describes the registers and the bitmask required to select them on the zxnDMA.&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
! Register Group&lt;br /&gt;
! Register Function Description&lt;br /&gt;
! Bitmask&lt;br /&gt;
! Notes&lt;br /&gt;
|- &lt;br /&gt;
| WR0&lt;br /&gt;
| Direction, Operation and Port A configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXXXAA&amp;lt;/pre&amp;gt;&lt;br /&gt;
| AA must NOT be 00&lt;br /&gt;
|- &lt;br /&gt;
| WR1&lt;br /&gt;
| Port A configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXX100&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR2&lt;br /&gt;
| Port B configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXX000&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR3&lt;br /&gt;
| Activation&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX00&amp;lt;/pre&amp;gt;&lt;br /&gt;
| It’s best to use WR6&lt;br /&gt;
|- &lt;br /&gt;
| WR4&lt;br /&gt;
| Port B, Timing and Interrupt configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX01&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR5&lt;br /&gt;
| Ready and Stop configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;10XXX010&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR6&lt;br /&gt;
| Command Register&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX11&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== zxnDMA Registers ==&lt;br /&gt;
These are described below following the same convention used by Zilog for its DMA chip:&lt;br /&gt;
&lt;br /&gt;
=== WR0 – Write Register Group 0 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   0   0  Do not use&lt;br /&gt;
     |   |   |   |   |   0   1  Transfer (Prefer this for Z80 DMA compatibility)&lt;br /&gt;
     |   |   |   |   |   1   0  Do not use (Behaves like Transfer, Search on Z80 DMA)&lt;br /&gt;
     |   |   |   |   |                       &lt;br /&gt;
     |   |   |   |   |   1   1  Do not use (Behaves like Transfer, Search/Transfer on Z80 DMA)&lt;br /&gt;
     |   |   |   |   |                      &lt;br /&gt;
     |   |   |   |   0 = Port B -&amp;amp;gt; Port A (Byte transfer direction)&lt;br /&gt;
     |   |   |   |   1 = Port A -&amp;amp;gt; Port B&lt;br /&gt;
     |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A STARTING ADDRESS (LOW BYTE)&lt;br /&gt;
     |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A STARTING ADDRESS (HIGH BYTE)&lt;br /&gt;
     |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  BLOCK LENGTH (LOW BYTE)&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  BLOCK LENGTH (HIGH BYTE)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several registers are accessible from WR0. The first write to WR0 is to the base register byte. Bits D6:D3 are optionally set to indicate that associated registers in this group will be written next. The order the writes come in are from D3 to D6 (right to left). For example, if bits D6 and D3 are set, the next two writes will be directed to PORT A STARTING ADDRESS LOW followed by BLOCK LENGTH HIGH.&lt;br /&gt;
&lt;br /&gt;
=== WR1 – Write Register Group 1 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   1   0   0&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   0 = Port A is memory&lt;br /&gt;
     |   |   |   1 = Port A is IO&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   0   0 = Port A address decrements&lt;br /&gt;
     |   0   1 = Port A address increments&lt;br /&gt;
     |   1   0 = Port A address is fixed&lt;br /&gt;
     |   1   1 = Port A address is fixed&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A VARIABLE TIMING BYTE&lt;br /&gt;
 0   0   0   0   0   0   |   |&lt;br /&gt;
                         0   0 = Cycle Length = 4&lt;br /&gt;
                         0   1 = Cycle Length = 3&lt;br /&gt;
                         1   0 = Cycle Length = 2&lt;br /&gt;
                         1   1 = Do not use&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cycle length is the number of cycles used in a read or write operation. The first cycle asserts signals and the last cycle releases them. There is no half cycle timing for the control signals.&lt;br /&gt;
&lt;br /&gt;
=== WR2 – Write Register Group 2 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   0   0   0&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   0 = Port B is memory&lt;br /&gt;
     |   |   |   1 = Port B is IO&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   0   0 = Port B address decrements&lt;br /&gt;
     |   0   1 = Port B address increments&lt;br /&gt;
     |   1   0 = Port B address is fixed&lt;br /&gt;
     |   1   1 = Port B address is fixed&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B VARIABLE TIMING BYTE&lt;br /&gt;
 0   0   |   0   0   0   |   |&lt;br /&gt;
         |               0   0 = Cycle Length = 4&lt;br /&gt;
         |               0   1 = Cycle Length = 3&lt;br /&gt;
         |               1   0 = Cycle Length = 2&lt;br /&gt;
         |               1   1 = Do not use&lt;br /&gt;
         |&lt;br /&gt;
         V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  ZXN PRESCALAR (FIXED TIME TRANSFER)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The ZXN PRESCALAR is a feature of the zxnDMA implementation. If non-zero, a delay will be inserted after each byte is transferred such that the total time needed for each transfer is determined by the prescalar. This works in both the continuous mode and the burst mode. If the DMA is operated in burst mode, the DMA will give up any waiting time to the CPU so that the CPU can run while the DMA is idle.&lt;br /&gt;
&lt;br /&gt;
The rate of transfer is given by the formula “Frate = 875kHz / prescalar” or, rearranged, “prescalar = 875kHz / Frate”. The formula is framed in terms of a sample rate (Frate) but Frate can be inverted to set a transfer time for each byte instead. The 875kHz constant is a nominal value assuming a 28MHz system clock; the system clock actually varies from this depending on the video timing selected by the user (HDMI, VGA0-6) so for complete accuracy the constant should be prorated according to documentation for nextreg 0x11.&lt;br /&gt;
&lt;br /&gt;
In a DMA audio setting, selecting a sample rate of 16kHz would mean setting the prescalar value to 55. This sample period is constant across changes in CPU speed.&lt;br /&gt;
&lt;br /&gt;
=== WR3 – Write Register Group 3 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   |   0   0   0   0   0   0&lt;br /&gt;
     |&lt;br /&gt;
     1 = DMA Enable&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Z80 DMA defines more fields but they are ignored by the zxnDMA. The two other registers defined by the Z80 DMA in this group on D4 and D3 are implemented by the zxnDMA but they do nothing.&lt;br /&gt;
&lt;br /&gt;
It is preferred to start the DMA by writing an &#039;Enable DMA&#039; command to WR6.&lt;br /&gt;
&lt;br /&gt;
=== WR4 – Write Register Group 4 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   |   |   0   |   |   0   1&lt;br /&gt;
     |   |       |   |&lt;br /&gt;
     0   0 = Do not use (Behaves like Continuous mode, Byte mode on Z80 DMA)&lt;br /&gt;
     0   1 = Continuous mode&lt;br /&gt;
     1   0 = Burst mode&lt;br /&gt;
     1   1 = Do not use&lt;br /&gt;
                 |   |&lt;br /&gt;
                 |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B STARTING ADDRESS (LOW BYTE)&lt;br /&gt;
                 |&lt;br /&gt;
                 V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B STARTING ADDRESS (HIGH BYTE)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Z80 DMA defines three more registers in this group through D4 that define interrupt behaviour. Interrups and pulse generation are not implemented in the zxnDMA nor are these registers available for writing.&lt;br /&gt;
&lt;br /&gt;
=== WR5 – Write Register Group 5 ===&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   0   |   |   0   0   1   0&lt;br /&gt;
         |   |&lt;br /&gt;
         |   0 = /ce only&lt;br /&gt;
         |   1 = /ce &amp;amp; /wait multiplexed&lt;br /&gt;
         |&lt;br /&gt;
         0 = Stop on end of block&lt;br /&gt;
         1 = Auto restart on end of block&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The /ce &amp;amp; /wait mode is implemented in the zxnDMA but is not currently used. This mode has an external device using the DMA&#039;s /ce pin to insert wait states during the DMA&#039;s transfer.&lt;br /&gt;
&lt;br /&gt;
The auto restart feature causes the DMA to automatically reload its source and destination addresses and reset its byte counter to zero to repeat the last transfer when a previous one is finished.&lt;br /&gt;
&lt;br /&gt;
=== WR6 – Command Register ===&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   ?   ?   ?   ?   ?   1   1&lt;br /&gt;
     |   |   |   |   |&lt;br /&gt;
     1   0   0   0   0 = 0xC3 = Reset&lt;br /&gt;
     1   0   0   0   1 = 0xC7 = Reset Port A Timing&lt;br /&gt;
     1   0   0   1   0 = 0xCB = Reset Port B Timing&lt;br /&gt;
     0   1   1   1   1 = 0xBF = Read Status Byte&lt;br /&gt;
     0   0   0   1   0 = 0x8B = Reinitialize Status Byte&lt;br /&gt;
     0   1   0   0   1 = 0xA7 = Initialize Read Sequence&lt;br /&gt;
     1   0   0   1   1 = 0xCF = Load&lt;br /&gt;
     1   0   1   0   0 = 0xD3 = Continue&lt;br /&gt;
     0   0   0   0   1 = 0x87 = Enable DMA&lt;br /&gt;
     0   0   0   0   0 = 0x83 = Disable DMA&lt;br /&gt;
 +-- 0   1   1   1   0 = 0xBB = Read Mask Follows&lt;br /&gt;
 |&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  READ MASK&lt;br /&gt;
 0   |   |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Status Byte&lt;br /&gt;
     |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Byte Counter Low&lt;br /&gt;
     |   |   |   |   |&lt;br /&gt;
     |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Byte Counter High&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port A Address Low&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port A Address High&lt;br /&gt;
     |   |&lt;br /&gt;
     |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port B Address Low&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port B Address High&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unimplemented Z80 DMA commands are ignored.&lt;br /&gt;
&lt;br /&gt;
Prior to starting the DMA, a LOAD command must be issued to copy the Port A and Port B addresses into the DMA&#039;s internal pointers. Then an &#039;Enable DMA&#039; command is issued to start the DMA.&lt;br /&gt;
&lt;br /&gt;
The &#039;Continue&#039; command resets the DMA&#039;s byte counter so that a following &#039;Enable DMA&#039; allows the DMA to repeat the last transfer but using the current internal address pointers. I.e. it continues from where the last copy operation left off.&lt;br /&gt;
&lt;br /&gt;
Registers can be read via an IO read from the DMA port after setting the read mask. (At power up the read mask is set to 0x7f). Register values are the current internal DMA counter values. So &#039;Port Address A Low&#039; is the lower 8-bits of Port A’s next transfer address. Once the end of the read mask is reached, further reads loop around to the first one.&lt;br /&gt;
&lt;br /&gt;
The format of the DMA status byte is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;00E1101T&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E is set to 0 if the total block length has been transferred at least once.&lt;br /&gt;
&lt;br /&gt;
T is set to 1 if at least one byte has been transferred.&lt;br /&gt;
&lt;br /&gt;
== Operating speed ==&lt;br /&gt;
The zxnDMA operates at the same speed as the CPU, that is 3.5MHz, 7MHz or 14MHz. This is a contended clock that is modified by the ULA and the auto-slowdown by [[Layer 2|Layer2]].&lt;br /&gt;
&lt;br /&gt;
Auto-slowdown occurs without user intervention if speed exceeds 7Mhz and the active Layer2 display is being generated (higher speed operation resumes when the active Layer2 display is not generated). Programmers do NOT need to account for speed differences regarding DMA transfers as this happens automatically.&lt;br /&gt;
&lt;br /&gt;
Because of this, the cycle lengths for Ports A and B can be set to their minimum values without ill effects. The cycle lengths specified for Ports A and B are intended to selectively slow down read or write cycles for hardware that cannot operate at the DMA&#039;s full speed.&lt;br /&gt;
&lt;br /&gt;
== The DMA and Interrupts ==&lt;br /&gt;
The zxnDMA cannot currently generate [[Interrupts|interrupts]].&lt;br /&gt;
&lt;br /&gt;
The other side of this is that while the DMA controls the bus, the Z80 cannot respond to interrupts. On the Z80, the NMI interrupt is edge triggered so if an NMI occurs the fact that it occurred is stored internally in the Z80 so that it will respond when it is woken up. On the other hand, maskable interrupts are level triggered. That is, the Z80 must be active to regularly sample the /INT line to determine if a maskable interrupt is occurring. On the Spectrum and the ZX Next, the ULA (and line interrupt) are only asserted for a fixed amount of time ~30 cycles at 3.5MHz. If the DMA is executing a transfer while the interrupt is asserted, the CPU will not be able to see this and it will most likely miss the interrupt. In burst mode, the CPU will never miss these interrupts, although this may change if multiple channels are implemented.&lt;br /&gt;
&lt;br /&gt;
== Programming examples ==&lt;br /&gt;
A simple way to program the DMA is to walk down the list of registers WR0-WR5, sending desired settings to each. Then start the DMA by sending a LOAD command followed by an ENABLE_DMA command to WR6. Once more familiar with the DMA, you will discover that the amount of information sent can be reduced to what changes between transfers.&lt;br /&gt;
&lt;br /&gt;
=== Assembly ===&lt;br /&gt;
Short example program to DMA memory to the screen, then DMA a sprite image from memory to sprite RAM, and then showing said sprite scrolling across the screen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;;------------------------------------------------------------------------------&lt;br /&gt;
device zxspectrum48&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; DEFINE testing&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; DMA (Register 6)&lt;br /&gt;
;&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
;zxnDMA programming example&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
;(c) Jim Bagley&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
DMA_RESET                      equ $c3&lt;br /&gt;
DMA_RESET_PORT_A_TIMING        equ $c7&lt;br /&gt;
DMA_RESET_PORT_B_TIMING        equ $cb&lt;br /&gt;
DMA_LOAD                       equ $cf ; %11001111&lt;br /&gt;
DMA_CONTINUE                   equ $d3&lt;br /&gt;
DMA_DISABLE_INTERUPTS          equ $af&lt;br /&gt;
DMA_ENABLE_INTERUPTS           equ $ab&lt;br /&gt;
DMA_RESET_DISABLE_INTERUPTS    equ $a3&lt;br /&gt;
DMA_ENABLE_AFTER_RETI          equ $b7&lt;br /&gt;
DMA_READ_STATUS_BYTE           equ $bf&lt;br /&gt;
DMA_REINIT_STATUS_BYTE         equ $8b&lt;br /&gt;
DMA_START_READ_SEQUENCE        equ $a7&lt;br /&gt;
DMA_FORCE_READY                equ $b3&lt;br /&gt;
DMA_DISABLE                    equ $83&lt;br /&gt;
DMA_ENABLE                     equ $87&lt;br /&gt;
DMA_WRITE_REGISTER_COMMAND     equ $bb&lt;br /&gt;
DMA_BURST                      equ %11001101&lt;br /&gt;
DMA_CONTINUOUS                 equ %10101101&lt;br /&gt;
ZXN_DMA_PORT                   equ $6b&lt;br /&gt;
SPRITE_STATUS_SLOT_SELECT      equ $303B&lt;br /&gt;
SPRITE_IMAGE_PORT              equ $5b&lt;br /&gt;
SPRITE_INFO_PORT               equ $57&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    IFDEF testing&lt;br /&gt;
        org $6000&lt;br /&gt;
    ELSE&lt;br /&gt;
        org $2000&lt;br /&gt;
    ENDIF&lt;br /&gt;
&lt;br /&gt;
start&lt;br /&gt;
    ld   hl,$0000&lt;br /&gt;
    ld   de,$4000&lt;br /&gt;
    ld   bc,$800&lt;br /&gt;
    call TransferDMA                  ; copy some random data to the screen pointing&lt;br /&gt;
                                      ; to ROM for now, for the purpose of showing &lt;br /&gt;
                                      ; how to do a DMA copy.&lt;br /&gt;
    ld   a,0                          ; sprite image number we want to update&lt;br /&gt;
    ld   bc,SPRITE_STATUS_SLOT_SELECT&lt;br /&gt;
    out  (c),a                        ; set the sprite image number&lt;br /&gt;
    ld   bc,1*256                     ; number to transfer (1)&lt;br /&gt;
    ld   hl,testsprite                ; from &lt;br /&gt;
    call TransferDMASprite            ; transfer to sprite ram&lt;br /&gt;
&lt;br /&gt;
    nextreg 21,1                      ; turn sprite on. for more info on this check &lt;br /&gt;
                                      ; out https://www.specnext.com/tbblue-io-port-system/&lt;br /&gt;
    ld   de,0&lt;br /&gt;
    ld   (xpos),de                    ; set initial X position ( doesn&#039;t need it for&lt;br /&gt;
                                      ; this demo, but if you run the .loop again it&lt;br /&gt;
                                      ; will continue from where it was&lt;br /&gt;
    ld   a,$20&lt;br /&gt;
    ld   (ypos),a                     ; set initial Y position&lt;br /&gt;
&lt;br /&gt;
.loop&lt;br /&gt;
    ld   a,0                          ; sprite number we want to position&lt;br /&gt;
    ld   bc,SPRITE_STATUS_SLOT_SELECT&lt;br /&gt;
    out  (c),a&lt;br /&gt;
    ld   de,(xpos)&lt;br /&gt;
    ld   hl,(ypos)                    ; ignores H so doing this rather than &lt;br /&gt;
                                      ; ld a,(ypos):ld l,a&lt;br /&gt;
    ld   bc,(image)                   ; not flipped or palette shifted&lt;br /&gt;
    call SetSprite&lt;br /&gt;
&lt;br /&gt;
    halt&lt;br /&gt;
&lt;br /&gt;
    ld   de,(xpos)&lt;br /&gt;
    inc  de&lt;br /&gt;
    ld   (xpos),de&lt;br /&gt;
    ld   a,d&lt;br /&gt;
    cp   $01&lt;br /&gt;
    jr   nz,.loop                     ; if high byte of xpos is not 1 (right of &lt;br /&gt;
                                      ; screen )&lt;br /&gt;
    ld   a,e&lt;br /&gt;
    cp   $20+1&lt;br /&gt;
    jr   nz,.loop                     ; if low byte is not $21 just off the right of&lt;br /&gt;
                                      ; the screen, $20 is off screen but as the &lt;br /&gt;
                                      ; INC DE is just above and not updated sprite&lt;br /&gt;
                                      ; after it, it needs to be $21&lt;br /&gt;
    xor  a&lt;br /&gt;
    ret                               ; return back to basic with OK&lt;br /&gt;
&lt;br /&gt;
xpos dw 0                             ; x position&lt;br /&gt;
ypos db 0                             ; y position&lt;br /&gt;
                                      ; these next two BITS and IMAGE are swapped &lt;br /&gt;
                                      ; as bits needs to go into B register image &lt;br /&gt;
                                      ; db 0+$80 ; use image 0 (for the image we &lt;br /&gt;
                                      ; transfered)+$80 to set the sprite to active&lt;br /&gt;
bits db 0                             ; not flipped or palette shifted&lt;br /&gt;
&lt;br /&gt;
c1 = %11100000&lt;br /&gt;
c2 = %11000000&lt;br /&gt;
c3 = %10100000&lt;br /&gt;
c4 = %10000000&lt;br /&gt;
c5 = %01100000&lt;br /&gt;
c6 = %01000000&lt;br /&gt;
c7 = %00100000&lt;br /&gt;
c8 = %00000000&lt;br /&gt;
&lt;br /&gt;
testsprite&lt;br /&gt;
    db c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1&lt;br /&gt;
    db c1,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c1&lt;br /&gt;
    db c1,c2,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c4,c4,c4,c4,c4,c4,c4,c4,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c5,c5,c5,c5,c5,c5,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c6,c6,c6,c6,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c7,c7,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c8,c8,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c8,c8,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c7,c7,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c6,c6,c6,c6,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c5,c5,c5,c5,c5,c5,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c4,c4,c4,c4,c4,c4,c4,c4,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c2,c1&lt;br /&gt;
    db c1,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c1&lt;br /&gt;
    db c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1&lt;br /&gt;
&lt;br /&gt;
;-------------------------------------------------&lt;br /&gt;
; de = X&lt;br /&gt;
; l = Y&lt;br /&gt;
; b = bits&lt;br /&gt;
; c = sprite image&lt;br /&gt;
SetSprite&lt;br /&gt;
    push bc&lt;br /&gt;
    ld bc,SPRITE_INFO_PORT&lt;br /&gt;
    out (c),e ; Xpos&lt;br /&gt;
    out (c),l ; Ypos&lt;br /&gt;
    pop hl&lt;br /&gt;
    ld a,d&lt;br /&gt;
    and 1&lt;br /&gt;
    or h&lt;br /&gt;
    out (c),a&lt;br /&gt;
    ld a,l:or $80&lt;br /&gt;
    out (c),a ; image&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
;--------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; de = destination&lt;br /&gt;
; bc = length&lt;br /&gt;
;--------------------------------&lt;br /&gt;
    TransferDMA&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASource),hl&lt;br /&gt;
	ld (DMADest),de&lt;br /&gt;
	ld (DMALength),bc&lt;br /&gt;
    ld hl,DMACode&lt;br /&gt;
	ld b,DMACode_Len&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACode db DMA_DISABLE&lt;br /&gt;
        db %01111101                  ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                      ; + block length&lt;br /&gt;
DMASource dw 0                        ; R0-Port A, Start address &lt;br /&gt;
                                      ; (source address)&lt;br /&gt;
DMALength dw 0                        ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                  ; R1-write A time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; 2t&lt;br /&gt;
        db %01010000                  ; R2-write B time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R2-Cycle length port B&lt;br /&gt;
        db DMA_CONTINUOUS             ; R4-Continuous mode (use this for block &lt;br /&gt;
                                      ; transfer), write dest adress&lt;br /&gt;
DMADest dw 0                          ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                  ; R5-Restart on end of block, RDY active &lt;br /&gt;
                                      ; LOW&lt;br /&gt;
        db DMA_LOAD                   ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                 ; R6-Enable DMA&lt;br /&gt;
        &lt;br /&gt;
DMACode_Len                    equ $-DMACode&lt;br /&gt;
&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; bc = length&lt;br /&gt;
; set port to write to with TBBLUE_REGISTER_SELECT&lt;br /&gt;
; prior to call&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
TransferDMAPort&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASourceP),hl&lt;br /&gt;
	ld (DMALengthP),bc&lt;br /&gt;
    ld hl,DMACodeP&lt;br /&gt;
	ld b,DMACode_LenP&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACodeP db DMA_DISABLE&lt;br /&gt;
        db %01111101                  ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                      ; + block length&lt;br /&gt;
DMASourceP dw 0                       ; R0-Port A, Start address (source address)&lt;br /&gt;
DMALengthP dw 0                       ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                  ; R1-read A time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R1-Cycle length port A&lt;br /&gt;
        db %01101000                  ; R2-write B time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R2-Cycle length port B&lt;br /&gt;
        db %10101101                  ; R4-Continuous mode (use this for block &lt;br /&gt;
                                      ; transfer), write dest adress&lt;br /&gt;
        dw $253b                      ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                  ; R5-Restart on end of block, RDY active&lt;br /&gt;
                                      ; LOW&lt;br /&gt;
        db DMA_LOAD                   ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                 ; R6-Enable DMA&lt;br /&gt;
        &lt;br /&gt;
DMACode_LenP                   equ $-DMACodeP&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; bc = length&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
TransferDMASprite&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASourceS),hl&lt;br /&gt;
	ld (DMALengthS),bc&lt;br /&gt;
    ld hl,DMACodeS&lt;br /&gt;
	ld b,DMACode_LenS&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACodeS db DMA_DISABLE&lt;br /&gt;
        db %01111101                   ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                       ; + block length&lt;br /&gt;
DMASourceS dw 0                        ; R0-Port A, Start address (source address)&lt;br /&gt;
DMALengthS dw 0                        ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                   ; R1-read A time byte, increment, to &lt;br /&gt;
                                       ; memory, bitmask&lt;br /&gt;
        db %00000010                   ; R1-Cycle length port A&lt;br /&gt;
        db %01101000                   ; R2-write B time byte, increment, to &lt;br /&gt;
                                       ; memory, bitmask&lt;br /&gt;
        db %00000010                   ; R2-Cycle length port B&lt;br /&gt;
        db %10101101                   ; R4-Continuous mode (use this for block&lt;br /&gt;
                                       ; transfer), write dest adress&lt;br /&gt;
        dw SPRITE_IMAGE_PORT           ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                   ; R5-Restart on end of block, RDY active&lt;br /&gt;
                                       ; LOW&lt;br /&gt;
        db DMA_LOAD                    ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                  ; R6-Enable DMA&lt;br /&gt;
DMACode_LenS                   equ $-DMACodeS&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; de = dest, a = fill value, bc = lenth&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
DMAFill&lt;br /&gt;
    di&lt;br /&gt;
    ld (FillValue),a&lt;br /&gt;
	ld (DMACDest),de&lt;br /&gt;
	ld (DMACLength),bc&lt;br /&gt;
    ld hl,DMACCode&lt;br /&gt;
	ld b,DMACCode_Len&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
FillValue db 22&lt;br /&gt;
DMACCode db DMA_DISABLE&lt;br /&gt;
        db %01111101&lt;br /&gt;
DMACSource dw FillValue&lt;br /&gt;
DMACLength dw 0&lt;br /&gt;
        db %00100100,%00010000,%10101101&lt;br /&gt;
DMACDest dw 0&lt;br /&gt;
        db DMA_LOAD,DMA_ENABLE&lt;br /&gt;
DMACCode_Len equ $-DMACCode&lt;br /&gt;
&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; End of file&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    IFDEF testing&lt;br /&gt;
        savesna &amp;quot;DMAtest.sna&amp;quot;,start&lt;br /&gt;
    ELSE&lt;br /&gt;
fin&lt;br /&gt;
        savebin &amp;quot;DMATEST&amp;quot;,start,fin-start&lt;br /&gt;
    ENDIF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on original text by: Allen Albright &amp;amp; Mike Dailly with input by Jim Bagley, Lyndon J Sharp and Phoebus R. Dokos&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=DMA&amp;diff=1367</id>
		<title>DMA</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=DMA&amp;diff=1367"/>
		<updated>2019-06-20T11:20:14Z</updated>

		<summary type="html">&lt;p&gt;Daz: Completely replaced text with that from distro/specnext.com at suggestion of SevenFFF&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== The ZX Spectrum Next DMA (zxnDMA)== &lt;br /&gt;
&lt;br /&gt;
=== Overview ===&lt;br /&gt;
The ZX Spectrum Next DMA (zxnDMA) is a single channel DMA device that implements a subset of the Z80 DMA functionality. The subset is large enough to be compatible with common uses of the similar Datagear interface available for standard ZX Spectrum computers and compatibles. It also adds a burst mode capability that can deliver audio at programmable sample rates to the DAC device.&lt;br /&gt;
&lt;br /&gt;
=== Accessing the zxnDMA ===&lt;br /&gt;
The zxnDMA is mapped to a single Read/Write IO Port 0x6B which is the same one used by the Datagear but unlike the Datagear it doesn&#039;t also map itself to a second port 0x0B similar to the MB-02 interface.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;PORT 0x6b: zxnDMA&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Description  ===&lt;br /&gt;
The normal Z80 DMA (Z8410) chip is a pipelined device and because of that it has numerous off-by-one idiosyncrasies and requirements on the order that certain commands should be carried out. These issues are not duplicated in the zxnDMA. You can continue to program the zxnDMA as if it is were a Z8410 DMA device but it can also be programmed in a simpler manner.&lt;br /&gt;
&lt;br /&gt;
The single channel of the zxnDMA chip consists of two ports named A and B. Transfers can occur in either direction between ports A and B, each port can describe a target in memory or IO, and each can be configured to autoincrement, autodecrement or stay fixed after a byte is transferred.&lt;br /&gt;
&lt;br /&gt;
A special feature of the zxnDMA can force each byte transfer to take a fixed amount of time so that the zxnDMA can be used to deliver sampled audio.&lt;br /&gt;
&lt;br /&gt;
=== Modes of Operation ===&lt;br /&gt;
The zxnDMA can operate in a z80-DMA compatibility mode.&lt;br /&gt;
&lt;br /&gt;
The z80-DMA compatibility mode is selected by setting bit 6 of nextreg 0x06. In this mode, all transfers involve length+1 bytes which is the same behaviour as the z80-DMA chip. In zxn-DMA mode, the transfer length is exactly the number of bytes programmed. This mode is mainly present to accommodate existing spectrum software that uses the z80-DMA and for cp/m programs that may have a z80-DMA option.&lt;br /&gt;
&lt;br /&gt;
The zxnDMA can also operate in either burst or continuous modes.&lt;br /&gt;
&lt;br /&gt;
Continuous mode means the DMA chip runs to completion without allowing the CPU to run. When the CPU starts the DMA, the DMA operation will complete before the CPU executes its next instruction.&lt;br /&gt;
&lt;br /&gt;
Burst mode nominally means the DMA lets the CPU run if either port is not ready. This condition can&#039;t happen in the zxnDMA chip except when operated in the special fixed time transfer mode. In this mode, the zxnDMA will let the CPU run while it waits for the fixed time to expire between bytes transferred.&lt;br /&gt;
&lt;br /&gt;
Note that there is no byte transfer mode as in the Z80 DMA.&lt;br /&gt;
&lt;br /&gt;
=== Programming the zxnDMA ===&lt;br /&gt;
Like the Z80 DMA chip, the zxnDMA has seven write registers named WR0-WR6 that control the device. Each register WR0-WR6 can have zero or more parameters associated with it.&lt;br /&gt;
&lt;br /&gt;
In a first write to the zxnDMA port, the write value is compared against a bitmask to determine which of the WR0-WR6 is the target. Remaining bits in the written value can contain data as well as a list of associated parameter bits. The parameter bits determine if further writes are expected to deliver parameter values. If there are multiple parameter bits set, the expected order of parameter values written is determined by parameter bit position from right to left (bit 0 through bit 7). Once all parameters are written, the zxnDMA again expects a regular register write selecting WR0-WR6.&lt;br /&gt;
&lt;br /&gt;
The table below describes the registers and the bitmask required to select them on the zxnDMA.&lt;br /&gt;
&lt;br /&gt;
{| &lt;br /&gt;
! Register Group&lt;br /&gt;
! Register Function Description&lt;br /&gt;
! Bitmask&lt;br /&gt;
! Notes&lt;br /&gt;
|- &lt;br /&gt;
| WR0&lt;br /&gt;
| Direction, Operation and Port A configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXXXAA&amp;lt;/pre&amp;gt;&lt;br /&gt;
| AA must NOT be 00&lt;br /&gt;
|- &lt;br /&gt;
| WR1&lt;br /&gt;
| Port A configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXX100&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR2&lt;br /&gt;
| Port B configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;0XXXX000&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR3&lt;br /&gt;
| Activation&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX00&amp;lt;/pre&amp;gt;&lt;br /&gt;
| It’s best to use WR6&lt;br /&gt;
|- &lt;br /&gt;
| WR4&lt;br /&gt;
| Port B, Timing and Interrupt configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX01&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR5&lt;br /&gt;
| Ready and Stop configuration&lt;br /&gt;
| &amp;lt;pre&amp;gt;10XXX010&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|- &lt;br /&gt;
| WR6&lt;br /&gt;
| Command Register&lt;br /&gt;
| &amp;lt;pre&amp;gt;1XXXXX11&amp;lt;/pre&amp;gt;&lt;br /&gt;
| &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== zxnDMA Registers ===&lt;br /&gt;
These are described below following the same convention used by Zilog for its DMA chip:&lt;br /&gt;
&lt;br /&gt;
==== WR0 – Write Register Group 0 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   0   0  Do not use&lt;br /&gt;
     |   |   |   |   |   0   1  Transfer (Prefer this for Z80 DMA compatibility)&lt;br /&gt;
     |   |   |   |   |   1   0  Do not use (Behaves like Transfer, Search on Z80 DMA)&lt;br /&gt;
     |   |   |   |   |                       &lt;br /&gt;
     |   |   |   |   |   1   1  Do not use (Behaves like Transfer, Search/Transfer on Z80 DMA)&lt;br /&gt;
     |   |   |   |   |                      &lt;br /&gt;
     |   |   |   |   0 = Port B -&amp;amp;gt; Port A (Byte transfer direction)&lt;br /&gt;
     |   |   |   |   1 = Port A -&amp;amp;gt; Port B&lt;br /&gt;
     |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A STARTING ADDRESS (LOW BYTE)&lt;br /&gt;
     |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A STARTING ADDRESS (HIGH BYTE)&lt;br /&gt;
     |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  BLOCK LENGTH (LOW BYTE)&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  BLOCK LENGTH (HIGH BYTE)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Several registers are accessible from WR0. The first write to WR0 is to the base register byte. Bits D6:D3 are optionally set to indicate that associated registers in this group will be written next. The order the writes come in are from D3 to D6 (right to left). For example, if bits D6 and D3 are set, the next two writes will be directed to PORT A STARTING ADDRESS LOW followed by BLOCK LENGTH HIGH.&lt;br /&gt;
&lt;br /&gt;
==== WR1 – Write Register Group 1 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   1   0   0&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   0 = Port A is memory&lt;br /&gt;
     |   |   |   1 = Port A is IO&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   0   0 = Port A address decrements&lt;br /&gt;
     |   0   1 = Port A address increments&lt;br /&gt;
     |   1   0 = Port A address is fixed&lt;br /&gt;
     |   1   1 = Port A address is fixed&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT A VARIABLE TIMING BYTE&lt;br /&gt;
 0   0   0   0   0   0   |   |&lt;br /&gt;
                         0   0 = Cycle Length = 4&lt;br /&gt;
                         0   1 = Cycle Length = 3&lt;br /&gt;
                         1   0 = Cycle Length = 2&lt;br /&gt;
                         1   1 = Do not use&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The cycle length is the number of cycles used in a read or write operation. The first cycle asserts signals and the last cycle releases them. There is no half cycle timing for the control signals.&lt;br /&gt;
&lt;br /&gt;
==== WR2 – Write Register Group 2 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 0   |   |   |   |   0   0   0&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   0 = Port B is memory&lt;br /&gt;
     |   |   |   1 = Port B is IO&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   0   0 = Port B address decrements&lt;br /&gt;
     |   0   1 = Port B address increments&lt;br /&gt;
     |   1   0 = Port B address is fixed&lt;br /&gt;
     |   1   1 = Port B address is fixed&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B VARIABLE TIMING BYTE&lt;br /&gt;
 0   0   |   0   0   0   |   |&lt;br /&gt;
         |               0   0 = Cycle Length = 4&lt;br /&gt;
         |               0   1 = Cycle Length = 3&lt;br /&gt;
         |               1   0 = Cycle Length = 2&lt;br /&gt;
         |               1   1 = Do not use&lt;br /&gt;
         |&lt;br /&gt;
         V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  ZXN PRESCALAR (FIXED TIME TRANSFER)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The ZXN PRESCALAR is a feature of the zxnDMA implementation. If non-zero, a delay will be inserted after each byte is transferred such that the total time needed for each transfer is determined by the prescalar. This works in both the continuous mode and the burst mode. If the DMA is operated in burst mode, the DMA will give up any waiting time to the CPU so that the CPU can run while the DMA is idle.&lt;br /&gt;
&lt;br /&gt;
The rate of transfer is given by the formula “Frate = 875kHz / prescalar” or, rearranged, “prescalar = 875kHz / Frate”. The formula is framed in terms of a sample rate (Frate) but Frate can be inverted to set a transfer time for each byte instead. The 875kHz constant is a nominal value assuming a 28MHz system clock; the system clock actually varies from this depending on the video timing selected by the user (HDMI, VGA0-6) so for complete accuracy the constant should be prorated according to documentation for nextreg 0x11.&lt;br /&gt;
&lt;br /&gt;
In a DMA audio setting, selecting a sample rate of 16kHz would mean setting the prescalar value to 55. This sample period is constant across changes in CPU speed.&lt;br /&gt;
&lt;br /&gt;
==== WR3 – Write Register Group 3 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   |   0   0   0   0   0   0&lt;br /&gt;
     |&lt;br /&gt;
     1 = DMA Enable&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Z80 DMA defines more fields but they are ignored by the zxnDMA. The two other registers defined by the Z80 DMA in this group on D4 and D3 are implemented by the zxnDMA but they do nothing.&lt;br /&gt;
&lt;br /&gt;
It is preferred to start the DMA by writing an &#039;Enable DMA&#039; command to WR6.&lt;br /&gt;
&lt;br /&gt;
==== WR4 – Write Register Group 4 ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   |   |   0   |   |   0   1&lt;br /&gt;
     |   |       |   |&lt;br /&gt;
     0   0 = Do not use (Behaves like Continuous mode, Byte mode on Z80 DMA)&lt;br /&gt;
     0   1 = Continuous mode&lt;br /&gt;
     1   0 = Burst mode&lt;br /&gt;
     1   1 = Do not use&lt;br /&gt;
                 |   |&lt;br /&gt;
                 |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B STARTING ADDRESS (LOW BYTE)&lt;br /&gt;
                 |&lt;br /&gt;
                 V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  PORT B STARTING ADDRESS (HIGH BYTE)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The Z80 DMA defines three more registers in this group through D4 that define interrupt behaviour. Interrups and pulse generation are not implemented in the zxnDMA nor are these registers available for writing.&lt;br /&gt;
&lt;br /&gt;
==== WR5 – Write Register Group 5 ====&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   0   |   |   0   0   1   0&lt;br /&gt;
         |   |&lt;br /&gt;
         |   0 = /ce only&lt;br /&gt;
         |   1 = /ce &amp;amp; /wait multiplexed&lt;br /&gt;
         |&lt;br /&gt;
         0 = Stop on end of block&lt;br /&gt;
         1 = Auto restart on end of block&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The /ce &amp;amp; /wait mode is implemented in the zxnDMA but is not currently used. This mode has an external device using the DMA&#039;s /ce pin to insert wait states during the DMA&#039;s transfer.&lt;br /&gt;
&lt;br /&gt;
The auto restart feature causes the DMA to automatically reload its source and destination addresses and reset its byte counter to zero to repeat the last transfer when a previous one is finished.&lt;br /&gt;
&lt;br /&gt;
==== WR6 – Command Register ====&lt;br /&gt;
&amp;lt;pre&amp;gt;D7  D6  D5  D4  D3  D2  D1  D0  BASE REGISTER BYTE&lt;br /&gt;
 1   ?   ?   ?   ?   ?   1   1&lt;br /&gt;
     |   |   |   |   |&lt;br /&gt;
     1   0   0   0   0 = 0xC3 = Reset&lt;br /&gt;
     1   0   0   0   1 = 0xC7 = Reset Port A Timing&lt;br /&gt;
     1   0   0   1   0 = 0xCB = Reset Port B Timing&lt;br /&gt;
     0   1   1   1   1 = 0xBF = Read Status Byte&lt;br /&gt;
     0   0   0   1   0 = 0x8B = Reinitialize Status Byte&lt;br /&gt;
     0   1   0   0   1 = 0xA7 = Initialize Read Sequence&lt;br /&gt;
     1   0   0   1   1 = 0xCF = Load&lt;br /&gt;
     1   0   1   0   0 = 0xD3 = Continue&lt;br /&gt;
     0   0   0   0   1 = 0x87 = Enable DMA&lt;br /&gt;
     0   0   0   0   0 = 0x83 = Disable DMA&lt;br /&gt;
 +-- 0   1   1   1   0 = 0xBB = Read Mask Follows&lt;br /&gt;
 |&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  READ MASK&lt;br /&gt;
 0   |   |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Status Byte&lt;br /&gt;
     |   |   |   |   |   |&lt;br /&gt;
     |   |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Byte Counter Low&lt;br /&gt;
     |   |   |   |   |&lt;br /&gt;
     |   |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Byte Counter High&lt;br /&gt;
     |   |   |   |&lt;br /&gt;
     |   |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port A Address Low&lt;br /&gt;
     |   |   |&lt;br /&gt;
     |   |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port A Address High&lt;br /&gt;
     |   |&lt;br /&gt;
     |   V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port B Address Low&lt;br /&gt;
     |&lt;br /&gt;
     V&lt;br /&gt;
D7  D6  D5  D4  D3  D2  D1  D0  Port B Address High&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Unimplemented Z80 DMA commands are ignored.&lt;br /&gt;
&lt;br /&gt;
Prior to starting the DMA, a LOAD command must be issued to copy the Port A and Port B addresses into the DMA&#039;s internal pointers. Then an &#039;Enable DMA&#039; command is issued to start the DMA.&lt;br /&gt;
&lt;br /&gt;
The &#039;Continue&#039; command resets the DMA&#039;s byte counter so that a following &#039;Enable DMA&#039; allows the DMA to repeat the last transfer but using the current internal address pointers. I.e. it continues from where the last copy operation left off.&lt;br /&gt;
&lt;br /&gt;
Registers can be read via an IO read from the DMA port after setting the read mask. (At power up the read mask is set to 0x7f). Register values are the current internal DMA counter values. So &#039;Port Address A Low&#039; is the lower 8-bits of Port A’s next transfer address. Once the end of the read mask is reached, further reads loop around to the first one.&lt;br /&gt;
&lt;br /&gt;
The format of the DMA status byte is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;00E1101T&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
E is set to 0 if the total block length has been transferred at least once.&lt;br /&gt;
&lt;br /&gt;
T is set to 1 if at least one byte has been transferred.&lt;br /&gt;
&lt;br /&gt;
=== Operating speed ===&lt;br /&gt;
The zxnDMA operates at the same speed as the CPU, that is 3.5MHz, 7MHz or 14MHz. This is a contended clock that is modified by the ULA and the auto-slowdown by [[Layer 2|Layer2]].&lt;br /&gt;
&lt;br /&gt;
Auto-slowdown occurs without user intervention if speed exceeds 7Mhz and the active Layer2 display is being generated (higher speed operation resumes when the active Layer2 display is not generated). Programmers do NOT need to account for speed differences regarding DMA transfers as this happens automatically.&lt;br /&gt;
&lt;br /&gt;
Because of this, the cycle lengths for Ports A and B can be set to their minimum values without ill effects. The cycle lengths specified for Ports A and B are intended to selectively slow down read or write cycles for hardware that cannot operate at the DMA&#039;s full speed.&lt;br /&gt;
&lt;br /&gt;
=== The DMA and Interrupts ===&lt;br /&gt;
The zxnDMA cannot currently generate [[Interrupts|interrupts]].&lt;br /&gt;
&lt;br /&gt;
The other side of this is that while the DMA controls the bus, the Z80 cannot respond to interrupts. On the Z80, the NMI interrupt is edge triggered so if an NMI occurs the fact that it occurred is stored internally in the Z80 so that it will respond when it is woken up. On the other hand, maskable interrupts are level triggered. That is, the Z80 must be active to regularly sample the /INT line to determine if a maskable interrupt is occurring. On the Spectrum and the ZX Next, the ULA (and line interrupt) are only asserted for a fixed amount of time ~30 cycles at 3.5MHz. If the DMA is executing a transfer while the interrupt is asserted, the CPU will not be able to see this and it will most likely miss the interrupt. In burst mode, the CPU will never miss these interrupts, although this may change if multiple channels are implemented.&lt;br /&gt;
&lt;br /&gt;
=== Programming examples ===&lt;br /&gt;
A simple way to program the DMA is to walk down the list of registers WR0-WR5, sending desired settings to each. Then start the DMA by sending a LOAD command followed by an ENABLE_DMA command to WR6. Once more familiar with the DMA, you will discover that the amount of information sent can be reduced to what changes between transfers.&lt;br /&gt;
&lt;br /&gt;
==== Assembly ====&lt;br /&gt;
Short example program to DMA memory to the screen, then DMA a sprite image from memory to sprite RAM, and then showing said sprite scrolling across the screen.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;;------------------------------------------------------------------------------&lt;br /&gt;
device zxspectrum48&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; DEFINE testing&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; DMA (Register 6)&lt;br /&gt;
;&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
;zxnDMA programming example&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
;(c) Jim Bagley&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
DMA_RESET                      equ $c3&lt;br /&gt;
DMA_RESET_PORT_A_TIMING        equ $c7&lt;br /&gt;
DMA_RESET_PORT_B_TIMING        equ $cb&lt;br /&gt;
DMA_LOAD                       equ $cf ; %11001111&lt;br /&gt;
DMA_CONTINUE                   equ $d3&lt;br /&gt;
DMA_DISABLE_INTERUPTS          equ $af&lt;br /&gt;
DMA_ENABLE_INTERUPTS           equ $ab&lt;br /&gt;
DMA_RESET_DISABLE_INTERUPTS    equ $a3&lt;br /&gt;
DMA_ENABLE_AFTER_RETI          equ $b7&lt;br /&gt;
DMA_READ_STATUS_BYTE           equ $bf&lt;br /&gt;
DMA_REINIT_STATUS_BYTE         equ $8b&lt;br /&gt;
DMA_START_READ_SEQUENCE        equ $a7&lt;br /&gt;
DMA_FORCE_READY                equ $b3&lt;br /&gt;
DMA_DISABLE                    equ $83&lt;br /&gt;
DMA_ENABLE                     equ $87&lt;br /&gt;
DMA_WRITE_REGISTER_COMMAND     equ $bb&lt;br /&gt;
DMA_BURST                      equ %11001101&lt;br /&gt;
DMA_CONTINUOUS                 equ %10101101&lt;br /&gt;
ZXN_DMA_PORT                   equ $6b&lt;br /&gt;
SPRITE_STATUS_SLOT_SELECT      equ $303B&lt;br /&gt;
SPRITE_IMAGE_PORT              equ $5b&lt;br /&gt;
SPRITE_INFO_PORT               equ $57&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    IFDEF testing&lt;br /&gt;
        org $6000&lt;br /&gt;
    ELSE&lt;br /&gt;
        org $2000&lt;br /&gt;
    ENDIF&lt;br /&gt;
&lt;br /&gt;
start&lt;br /&gt;
    ld   hl,$0000&lt;br /&gt;
    ld   de,$4000&lt;br /&gt;
    ld   bc,$800&lt;br /&gt;
    call TransferDMA                  ; copy some random data to the screen pointing&lt;br /&gt;
                                      ; to ROM for now, for the purpose of showing &lt;br /&gt;
                                      ; how to do a DMA copy.&lt;br /&gt;
    ld   a,0                          ; sprite image number we want to update&lt;br /&gt;
    ld   bc,SPRITE_STATUS_SLOT_SELECT&lt;br /&gt;
    out  (c),a                        ; set the sprite image number&lt;br /&gt;
    ld   bc,1*256                     ; number to transfer (1)&lt;br /&gt;
    ld   hl,testsprite                ; from &lt;br /&gt;
    call TransferDMASprite            ; transfer to sprite ram&lt;br /&gt;
&lt;br /&gt;
    nextreg 21,1                      ; turn sprite on. for more info on this check &lt;br /&gt;
                                      ; out https://www.specnext.com/tbblue-io-port-system/&lt;br /&gt;
    ld   de,0&lt;br /&gt;
    ld   (xpos),de                    ; set initial X position ( doesn&#039;t need it for&lt;br /&gt;
                                      ; this demo, but if you run the .loop again it&lt;br /&gt;
                                      ; will continue from where it was&lt;br /&gt;
    ld   a,$20&lt;br /&gt;
    ld   (ypos),a                     ; set initial Y position&lt;br /&gt;
&lt;br /&gt;
.loop&lt;br /&gt;
    ld   a,0                          ; sprite number we want to position&lt;br /&gt;
    ld   bc,SPRITE_STATUS_SLOT_SELECT&lt;br /&gt;
    out  (c),a&lt;br /&gt;
    ld   de,(xpos)&lt;br /&gt;
    ld   hl,(ypos)                    ; ignores H so doing this rather than &lt;br /&gt;
                                      ; ld a,(ypos):ld l,a&lt;br /&gt;
    ld   bc,(image)                   ; not flipped or palette shifted&lt;br /&gt;
    call SetSprite&lt;br /&gt;
&lt;br /&gt;
    halt&lt;br /&gt;
&lt;br /&gt;
    ld   de,(xpos)&lt;br /&gt;
    inc  de&lt;br /&gt;
    ld   (xpos),de&lt;br /&gt;
    ld   a,d&lt;br /&gt;
    cp   $01&lt;br /&gt;
    jr   nz,.loop                     ; if high byte of xpos is not 1 (right of &lt;br /&gt;
                                      ; screen )&lt;br /&gt;
    ld   a,e&lt;br /&gt;
    cp   $20+1&lt;br /&gt;
    jr   nz,.loop                     ; if low byte is not $21 just off the right of&lt;br /&gt;
                                      ; the screen, $20 is off screen but as the &lt;br /&gt;
                                      ; INC DE is just above and not updated sprite&lt;br /&gt;
                                      ; after it, it needs to be $21&lt;br /&gt;
    xor  a&lt;br /&gt;
    ret                               ; return back to basic with OK&lt;br /&gt;
&lt;br /&gt;
xpos dw 0                             ; x position&lt;br /&gt;
ypos db 0                             ; y position&lt;br /&gt;
                                      ; these next two BITS and IMAGE are swapped &lt;br /&gt;
                                      ; as bits needs to go into B register image &lt;br /&gt;
                                      ; db 0+$80 ; use image 0 (for the image we &lt;br /&gt;
                                      ; transfered)+$80 to set the sprite to active&lt;br /&gt;
bits db 0                             ; not flipped or palette shifted&lt;br /&gt;
&lt;br /&gt;
c1 = %11100000&lt;br /&gt;
c2 = %11000000&lt;br /&gt;
c3 = %10100000&lt;br /&gt;
c4 = %10000000&lt;br /&gt;
c5 = %01100000&lt;br /&gt;
c6 = %01000000&lt;br /&gt;
c7 = %00100000&lt;br /&gt;
c8 = %00000000&lt;br /&gt;
&lt;br /&gt;
testsprite&lt;br /&gt;
    db c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1&lt;br /&gt;
    db c1,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c1&lt;br /&gt;
    db c1,c2,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c4,c4,c4,c4,c4,c4,c4,c4,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c5,c5,c5,c5,c5,c5,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c6,c6,c6,c6,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c7,c7,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c8,c8,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c8,c8,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c7,c7,c7,c7,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c6,c6,c6,c6,c6,c6,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c5,c5,c5,c5,c5,c5,c5,c5,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c4,c4,c4,c4,c4,c4,c4,c4,c4,c4,c3,c2,c1&lt;br /&gt;
    db c1,c2,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c3,c2,c1&lt;br /&gt;
    db c1,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c2,c1&lt;br /&gt;
    db c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1,c1&lt;br /&gt;
&lt;br /&gt;
;-------------------------------------------------&lt;br /&gt;
; de = X&lt;br /&gt;
; l = Y&lt;br /&gt;
; b = bits&lt;br /&gt;
; c = sprite image&lt;br /&gt;
SetSprite&lt;br /&gt;
    push bc&lt;br /&gt;
    ld bc,SPRITE_INFO_PORT&lt;br /&gt;
    out (c),e ; Xpos&lt;br /&gt;
    out (c),l ; Ypos&lt;br /&gt;
    pop hl&lt;br /&gt;
    ld a,d&lt;br /&gt;
    and 1&lt;br /&gt;
    or h&lt;br /&gt;
    out (c),a&lt;br /&gt;
    ld a,l:or $80&lt;br /&gt;
    out (c),a ; image&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
;--------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; de = destination&lt;br /&gt;
; bc = length&lt;br /&gt;
;--------------------------------&lt;br /&gt;
    TransferDMA&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASource),hl&lt;br /&gt;
	ld (DMADest),de&lt;br /&gt;
	ld (DMALength),bc&lt;br /&gt;
    ld hl,DMACode&lt;br /&gt;
	ld b,DMACode_Len&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACode db DMA_DISABLE&lt;br /&gt;
        db %01111101                  ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                      ; + block length&lt;br /&gt;
DMASource dw 0                        ; R0-Port A, Start address &lt;br /&gt;
                                      ; (source address)&lt;br /&gt;
DMALength dw 0                        ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                  ; R1-write A time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; 2t&lt;br /&gt;
        db %01010000                  ; R2-write B time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R2-Cycle length port B&lt;br /&gt;
        db DMA_CONTINUOUS             ; R4-Continuous mode (use this for block &lt;br /&gt;
                                      ; transfer), write dest adress&lt;br /&gt;
DMADest dw 0                          ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                  ; R5-Restart on end of block, RDY active &lt;br /&gt;
                                      ; LOW&lt;br /&gt;
        db DMA_LOAD                   ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                 ; R6-Enable DMA&lt;br /&gt;
        &lt;br /&gt;
DMACode_Len                    equ $-DMACode&lt;br /&gt;
&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; bc = length&lt;br /&gt;
; set port to write to with TBBLUE_REGISTER_SELECT&lt;br /&gt;
; prior to call&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
TransferDMAPort&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASourceP),hl&lt;br /&gt;
	ld (DMALengthP),bc&lt;br /&gt;
    ld hl,DMACodeP&lt;br /&gt;
	ld b,DMACode_LenP&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACodeP db DMA_DISABLE&lt;br /&gt;
        db %01111101                  ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                      ; + block length&lt;br /&gt;
DMASourceP dw 0                       ; R0-Port A, Start address (source address)&lt;br /&gt;
DMALengthP dw 0                       ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                  ; R1-read A time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R1-Cycle length port A&lt;br /&gt;
        db %01101000                  ; R2-write B time byte, increment, to &lt;br /&gt;
                                      ; memory, bitmask&lt;br /&gt;
        db %00000010                  ; R2-Cycle length port B&lt;br /&gt;
        db %10101101                  ; R4-Continuous mode (use this for block &lt;br /&gt;
                                      ; transfer), write dest adress&lt;br /&gt;
        dw $253b                      ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                  ; R5-Restart on end of block, RDY active&lt;br /&gt;
                                      ; LOW&lt;br /&gt;
        db DMA_LOAD                   ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                 ; R6-Enable DMA&lt;br /&gt;
        &lt;br /&gt;
DMACode_LenP                   equ $-DMACodeP&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; hl = source&lt;br /&gt;
; bc = length&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
TransferDMASprite&lt;br /&gt;
    di&lt;br /&gt;
    ld (DMASourceS),hl&lt;br /&gt;
	ld (DMALengthS),bc&lt;br /&gt;
    ld hl,DMACodeS&lt;br /&gt;
	ld b,DMACode_LenS&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
DMACodeS db DMA_DISABLE&lt;br /&gt;
        db %01111101                   ; R0-Transfer mode, A -&amp;gt; B, write adress &lt;br /&gt;
                                       ; + block length&lt;br /&gt;
DMASourceS dw 0                        ; R0-Port A, Start address (source address)&lt;br /&gt;
DMALengthS dw 0                        ; R0-Block length (length in bytes)&lt;br /&gt;
        db %01010100                   ; R1-read A time byte, increment, to &lt;br /&gt;
                                       ; memory, bitmask&lt;br /&gt;
        db %00000010                   ; R1-Cycle length port A&lt;br /&gt;
        db %01101000                   ; R2-write B time byte, increment, to &lt;br /&gt;
                                       ; memory, bitmask&lt;br /&gt;
        db %00000010                   ; R2-Cycle length port B&lt;br /&gt;
        db %10101101                   ; R4-Continuous mode (use this for block&lt;br /&gt;
                                       ; transfer), write dest adress&lt;br /&gt;
        dw SPRITE_IMAGE_PORT           ; R4-Dest address (destination address)&lt;br /&gt;
        db %10000010                   ; R5-Restart on end of block, RDY active&lt;br /&gt;
                                       ; LOW&lt;br /&gt;
        db DMA_LOAD                    ; R6-Load&lt;br /&gt;
        db DMA_ENABLE                  ; R6-Enable DMA&lt;br /&gt;
DMACode_LenS                   equ $-DMACodeS&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; de = dest, a = fill value, bc = lenth&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
DMAFill&lt;br /&gt;
    di&lt;br /&gt;
    ld (FillValue),a&lt;br /&gt;
	ld (DMACDest),de&lt;br /&gt;
	ld (DMACLength),bc&lt;br /&gt;
    ld hl,DMACCode&lt;br /&gt;
	ld b,DMACCode_Len&lt;br /&gt;
	ld c,ZXN_DMA_PORT&lt;br /&gt;
	otir&lt;br /&gt;
    ei&lt;br /&gt;
    ret&lt;br /&gt;
&lt;br /&gt;
FillValue db 22&lt;br /&gt;
DMACCode db DMA_DISABLE&lt;br /&gt;
        db %01111101&lt;br /&gt;
DMACSource dw FillValue&lt;br /&gt;
DMACLength dw 0&lt;br /&gt;
        db %00100100,%00010000,%10101101&lt;br /&gt;
DMACDest dw 0&lt;br /&gt;
        db DMA_LOAD,DMA_ENABLE&lt;br /&gt;
DMACCode_Len equ $-DMACCode&lt;br /&gt;
&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
; End of file&lt;br /&gt;
;------------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
    IFDEF testing&lt;br /&gt;
        savesna &amp;quot;DMAtest.sna&amp;quot;,start&lt;br /&gt;
    ELSE&lt;br /&gt;
fin&lt;br /&gt;
        savebin &amp;quot;DMATEST&amp;quot;,start,fin-start&lt;br /&gt;
    ENDIF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Based on original text by: Allen Albright &amp;amp; Mike Dailly with input by Jim Bagley, Lyndon J Sharp and Phoebus R. Dokos&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1364</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1364"/>
		<updated>2019-06-19T14:06:16Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the ESP Wi-fi module, and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the real time clock module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed. Pull up/down resisters may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:NEXT_GPIO.png|thumb|GPIO pinout image]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1363</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1363"/>
		<updated>2019-06-19T13:42:51Z</updated>

		<summary type="html">&lt;p&gt;Daz: Image links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the ESP Wi-fi module, and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the real time clock module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed. Pull up/down resisters may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
[[Image:NEXT GPIO location.jpg|thumb|J15 position on circuit board]]&lt;br /&gt;
[[Image:https://www.specnext.com/forum/download/file.php?id=403|thumb|GPIO pinout image (from SpecNext.com forums)]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1362</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=1362"/>
		<updated>2019-06-19T13:39:16Z</updated>

		<summary type="html">&lt;p&gt;Daz: Initial version - all the info I could scrape up, but needs more depth...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The GPIO socket, marked J15 on the circuit board, allows access to several different power and data lines:&lt;br /&gt;
&lt;br /&gt;
* I2C serial protocol&lt;br /&gt;
* UART&lt;br /&gt;
* Spare pins on the FPGA&lt;br /&gt;
* 5v, 3.3v and GND&lt;br /&gt;
&lt;br /&gt;
The UART is also used for the ESP Wi-fi module, and can&#039;t be used from the GPIO without removing the ESP module. I2C is also used to communicate with the real time clock module. &lt;br /&gt;
&lt;br /&gt;
The GPIO is not populated and requires a socket to be installed. Pull up/down resisters may be required for some pins to limit current.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
https://www.specnext.com/forum/download/file.php?id=403|J15 pinout image (from SpecNext.com forums)&lt;br /&gt;
/w/images/e/e6/NEXT_GPIO_location.jpg|J15 position on circuit board&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1354</id>
		<title>File Formats</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1354"/>
		<updated>2019-06-11T20:54:22Z</updated>

		<summary type="html">&lt;p&gt;Daz: Typo fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The NextZXOS can directly read and load these kind of files: bas, tap, z80, sna, snx, dot, o, p. Many other file types are supported by the use of external dot commands.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;[https://www.worldofspectrum.org/faq/reference/z80format.htm .z80]&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. Files can be loaded using the NextZXOS browser, the NextZXOS SPECTRUM keyword, the esxDOS NMI menu, and the exDOS .snapload command.&lt;br /&gt;
* &#039;&#039;&#039;[https://faqwiki.zxnet.co.uk/wiki/SNA_format .sna]&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. Both 48K and 128K SNA files are supported. Files can be loaded using the NextZXOS browser, the NextZXOS SPECTRUM keyword, the esxDOS NMI menu, and the exDOS .snapload command. When loading in NextZXOS, any private data appended to the file is ignored during loading, and the program code may later read it by reopening itself using a hardcoded filename. If private data is appended to them then they cannot be loaded by esxDOS.&lt;br /&gt;
* &#039;&#039;&#039;.snx&#039;&#039;&#039; is a Spectrum snapshot file, more suitable as emulator compatibility than a real format. It is identical to a 128K .sna file, but when loaded using the browser or the SPECTRUM command, NextZXOS leaves file handle 0 open for further use by the program. The program is expected close the handle before exiting. .snx files may also have private data appended to them. They are not supported by esxDOS.&lt;br /&gt;
* &#039;&#039;&#039;.o&#039;&#039;&#039; is a ZX80 snapshot&lt;br /&gt;
* &#039;&#039;&#039;.p&#039;&#039;&#039; is a ZX81 snapshot&lt;br /&gt;
* &#039;&#039;&#039;[[NEX file format|.nex]]&#039;&#039;&#039; is good for a program that takes over the machine. With some care, it can also be used to load a program without overwriting sysvars, allowing NextZXOS API calls to be used. It can be loaded using the NextZXOS file browser and the .nexload dot command. The [[Emulators|CSpect]] emulator can open .nex files natively from the F2 dialog. esxDOS cannot open .nex files.&lt;br /&gt;
* &#039;&#039;&#039;.dot&#039;&#039;&#039; is good for dot commands and programs that can coexist with BASIC/NextZXOS and can return to BASIC safely (i.e. counterpart to nex)&lt;br /&gt;
* &#039;&#039;&#039;[[TAP file format|.tap]]&#039;&#039;&#039; is a simple container format that can hold many files, is compatible with emulators and supported by many tools. When loading .tap files using the NextZXOS browser, a menu is displayed asking whether you want to load in standard, USR0 or 48K mode.&lt;br /&gt;
* &#039;&#039;&#039;.bas&#039;&#039;&#039; is the native SD-card format for BASIC programs (first 128 bytes of the file form standard +3DOS header).&lt;br /&gt;
* .&#039;&#039;&#039;scr&#039;&#039;&#039; is used for a standard Spectrum screenshot created with &#039;&#039;SAVE &amp;quot;picture.scr&amp;quot; SCREEN$&#039;&#039; (256x192, 15 colours per character cell). &lt;br /&gt;
* &#039;&#039;&#039;.shc&#039;&#039;&#039; is used for a screenshot in Timex 8x1 Hi-colour mode (256x192, 15 colors).&lt;br /&gt;
* &#039;&#039;&#039;.shr&#039;&#039;&#039; is used for a screenshot in Timex Hi-res mode (512x192, mono).&lt;br /&gt;
* &#039;&#039;&#039;.slr&#039;&#039;&#039; is used for a lo-res screenshot (128x96, 256 colours).&lt;br /&gt;
* &#039;&#039;&#039;.sl2&#039;&#039;&#039; is used for a Layer 2 screenshot (256x192, 256 colour).&lt;br /&gt;
* &#039;&#039;&#039;.pal&#039;&#039;&#039; is a 9-bit palette format (256 pairs of bytes in %RRRGGGBB, %P000000B format). Files can be loaded and saved from the Screenshots menu in NextZXOS after pressing the M1 button or F9. The P bit sets priority when used in layer 2 palettes. Palette entries with P=1 cause their pixels to appear above everything else, regardless of globally-set layer priorities.&lt;br /&gt;
* &#039;&#039;&#039;.npl&#039;&#039;&#039; is a 9-bit palette format. The first 512 bytes are identical to a .pal file. The 513th byte designates transparency - for sprite palettes, the transparency byte is a real index, and for other palettes it is a colour mask. .npl files can be created, saved and loaded by [[Miscellaneous#WASPtools|WASPtools]].&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Template:Emulator&amp;diff=1353</id>
		<title>Template:Emulator</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Template:Emulator&amp;diff=1353"/>
		<updated>2019-06-11T11:38:39Z</updated>

		<summary type="html">&lt;p&gt;Daz: Fix wifi link in template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{#cargo_declare:&lt;br /&gt;
_table = Emulator&lt;br /&gt;
|name = String&lt;br /&gt;
|author = String&lt;br /&gt;
|description = String&lt;br /&gt;
|os = String&lt;br /&gt;
|downloadurl = String&lt;br /&gt;
|sourceurl = String&lt;br /&gt;
|sourceavail = String&lt;br /&gt;
|supportlores = String&lt;br /&gt;
|supportrasterint = String&lt;br /&gt;
|supporttripleay = String&lt;br /&gt;
|supportopcodes = String&lt;br /&gt;
|supportsid = String&lt;br /&gt;
|supportspecdrum = String&lt;br /&gt;
|supportwifi = String&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
{{#subobject:{{{name}}}&lt;br /&gt;
 |name={{{name|}}}&lt;br /&gt;
 |author={{{author|}}}&lt;br /&gt;
 |description={{{description|}}}&lt;br /&gt;
 |os={{{os|}}}&lt;br /&gt;
 |downloadurl={{{downloadurl|}}}&lt;br /&gt;
 |sourceurl={{{sourceurl|}}}&lt;br /&gt;
 |sourceavail={{{sourceavail|}}}&lt;br /&gt;
 |supportrasterint={{{supportrasterint|}}}&lt;br /&gt;
}}&lt;br /&gt;
{{#cargo_store:&lt;br /&gt;
 _table = Emulator&lt;br /&gt;
 |name={{{name|}}}&lt;br /&gt;
 |author={{{author|}}}&lt;br /&gt;
 |os={{{os|}}}&lt;br /&gt;
 |description={{{description|}}}&lt;br /&gt;
 |downloadurl={{{downloadurl|}}}&lt;br /&gt;
 |sourceurl={{{sourceurl|}}}&lt;br /&gt;
 |sourceavail={{{sourceavail|}}}&lt;br /&gt;
 |supportrasterint={{{supportrasterint|}}}&lt;br /&gt;
 |supporttripleay={{{supporttripleay|}}}&lt;br /&gt;
 |supportopcodes={{{supportopcodes|}}}&lt;br /&gt;
 |supportsid={{{supportsid|}}}&lt;br /&gt;
 |supportspecdrum={{{supportspecdrum|}}}&lt;br /&gt;
 |supportwifi={{{supportwifi|}}}&lt;br /&gt;
}}&lt;br /&gt;
|valign=&#039;top&#039;|&#039;&#039;&#039;{{{name|}}}&#039;&#039;&#039; - &#039;&#039;{{{author|}}}&#039;&#039;&amp;lt;br/&amp;gt;{{{description|}}}&amp;lt;br/&amp;gt;{{#if:{{{downloadurl|}}}|[{{{downloadurl|}}} download]&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; }}{{#if:{{{sourceurl|}}}|[{{{sourceurl|}}} source]&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; }}&lt;br /&gt;
|valign=&#039;top&#039;|{{{os|}}}&lt;br /&gt;
|valign=&#039;top&#039;|{{{sourceavail|}}}&lt;br /&gt;
|valian=&#039;top&#039;|{{Capability|{{{supportsprites|}}}|[[Sprites]]}}{{Capability|{{{supportlores|}}}|[[Video Modes|Lores Layer]]}}{{Capability|{{{supportlayer2|}}}|[[Layer 2]]}}{{Capability|{{{supportrasterint|}}}|Raster interrupt}}{{Capability|{{{supporttripleay|}}}|[[Turbo Sound Next|3xAY audio]]}}{{Capability|{{{supportopcodes|}}}|[[Extended Z80 instruction set|Next Opcodes]]}}{{Capability|{{{supportsid|}}}|[[Turbo Sound Next|SID audio]]}}{{Capability|{{{supportspecdrum|}}}|Specdrum/Covox DAC}}{{Capability|{{{supportwifi|}}}|[[ESP8266-01|Wifi Module]]}}&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Emulators&amp;diff=1352</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Emulators&amp;diff=1352"/>
		<updated>2019-06-11T11:37:44Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added &amp;quot;supportwifi&amp;quot; to CSpect&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{EmulatorListTop}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=CSpect&lt;br /&gt;
 |author=Mike Dailly&lt;br /&gt;
 |downloadurl=http://dailly.blogspot.co.uk/&lt;br /&gt;
 |description=Emulates many features of the Next and includes an assembler (pre-made SD card images  [http://www.zxspectrumnext.online/cspect/index.html here])&lt;br /&gt;
 |os=Windows&amp;lt;br&amp;gt;(mac/linux partially works through mono)&lt;br /&gt;
 |sourceavail=N&lt;br /&gt;
 |supportsprites=~&lt;br /&gt;
 |supportlores=Y&lt;br /&gt;
 |supportlayer2=Y&lt;br /&gt;
 |supportopcodes=Y&lt;br /&gt;
 |supporttripleay=Y&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
 |supportwifi=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=ZEsarUX&lt;br /&gt;
 |author=César Hernández Bañó&lt;br /&gt;
 |downloadurl=https://github.com/chernandezba/zesarux/releases&lt;br /&gt;
 |sourceurl=https://github.com/chernandezba/zesarux&lt;br /&gt;
 |description=A full feature emulator including a debugger - frequently updated to support Next updates&lt;br /&gt;
 |os=Any&lt;br /&gt;
 |sourceavail=Y&lt;br /&gt;
 |supportsprites=~&lt;br /&gt;
 |supportlores=Y&lt;br /&gt;
 |supportlayer2=Y&lt;br /&gt;
 |supportopcodes=Y&lt;br /&gt;
 |supporttripleay=Y&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
 |supportspecdrum=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=NX&lt;br /&gt;
 |author=Matt Davies&lt;br /&gt;
 |downloadurl=https://github.com/next-dev/nx&lt;br /&gt;
 |sourceurl=https://github.com/next-dev/nx&lt;br /&gt;
 |description=An in-development emulator&lt;br /&gt;
 |os=Windows / Mac&lt;br /&gt;
 |sourceavail=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=Zeus &lt;br /&gt;
 |author=Design Design&lt;br /&gt;
 |downloadurl=http://www.desdes.com/products/oldfiles/zeus.htm&lt;br /&gt;
 |description=A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.&lt;br /&gt;
 |os=Windows&lt;br /&gt;
 |sourceavail=N&lt;br /&gt;
 |supportsprites=~&lt;br /&gt;
 |supportlores=N&lt;br /&gt;
 |supportlayer2=N&lt;br /&gt;
 |supportopcodes=Y&lt;br /&gt;
 |supporttripleay=N&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
 |supportspecdrum=N&lt;br /&gt;
 |supportsmmu=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{EmulatorListBottom}}&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Template:Emulator&amp;diff=1351</id>
		<title>Template:Emulator</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Template:Emulator&amp;diff=1351"/>
		<updated>2019-06-11T11:36:08Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added &amp;quot;supportwifi&amp;quot; flag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{#cargo_declare:&lt;br /&gt;
_table = Emulator&lt;br /&gt;
|name = String&lt;br /&gt;
|author = String&lt;br /&gt;
|description = String&lt;br /&gt;
|os = String&lt;br /&gt;
|downloadurl = String&lt;br /&gt;
|sourceurl = String&lt;br /&gt;
|sourceavail = String&lt;br /&gt;
|supportlores = String&lt;br /&gt;
|supportrasterint = String&lt;br /&gt;
|supporttripleay = String&lt;br /&gt;
|supportopcodes = String&lt;br /&gt;
|supportsid = String&lt;br /&gt;
|supportspecdrum = String&lt;br /&gt;
|supportwifi = String&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
{{#subobject:{{{name}}}&lt;br /&gt;
 |name={{{name|}}}&lt;br /&gt;
 |author={{{author|}}}&lt;br /&gt;
 |description={{{description|}}}&lt;br /&gt;
 |os={{{os|}}}&lt;br /&gt;
 |downloadurl={{{downloadurl|}}}&lt;br /&gt;
 |sourceurl={{{sourceurl|}}}&lt;br /&gt;
 |sourceavail={{{sourceavail|}}}&lt;br /&gt;
 |supportrasterint={{{supportrasterint|}}}&lt;br /&gt;
}}&lt;br /&gt;
{{#cargo_store:&lt;br /&gt;
 _table = Emulator&lt;br /&gt;
 |name={{{name|}}}&lt;br /&gt;
 |author={{{author|}}}&lt;br /&gt;
 |os={{{os|}}}&lt;br /&gt;
 |description={{{description|}}}&lt;br /&gt;
 |downloadurl={{{downloadurl|}}}&lt;br /&gt;
 |sourceurl={{{sourceurl|}}}&lt;br /&gt;
 |sourceavail={{{sourceavail|}}}&lt;br /&gt;
 |supportrasterint={{{supportrasterint|}}}&lt;br /&gt;
 |supporttripleay={{{supporttripleay|}}}&lt;br /&gt;
 |supportopcodes={{{supportopcodes|}}}&lt;br /&gt;
 |supportsid={{{supportsid|}}}&lt;br /&gt;
 |supportspecdrum={{{supportspecdrum|}}}&lt;br /&gt;
 |supportwifi={{{supportwifi|}}}&lt;br /&gt;
}}&lt;br /&gt;
|valign=&#039;top&#039;|&#039;&#039;&#039;{{{name|}}}&#039;&#039;&#039; - &#039;&#039;{{{author|}}}&#039;&#039;&amp;lt;br/&amp;gt;{{{description|}}}&amp;lt;br/&amp;gt;{{#if:{{{downloadurl|}}}|[{{{downloadurl|}}} download]&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; }}{{#if:{{{sourceurl|}}}|[{{{sourceurl|}}} source]&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp; }}&lt;br /&gt;
|valign=&#039;top&#039;|{{{os|}}}&lt;br /&gt;
|valign=&#039;top&#039;|{{{sourceavail|}}}&lt;br /&gt;
|valian=&#039;top&#039;|{{Capability|{{{supportsprites|}}}|[[Sprites]]}}{{Capability|{{{supportlores|}}}|[[Video Modes|Lores Layer]]}}{{Capability|{{{supportlayer2|}}}|[[Layer 2]]}}{{Capability|{{{supportrasterint|}}}|Raster interrupt}}{{Capability|{{{supporttripleay|}}}|[[Turbo Sound Next|3xAY audio]]}}{{Capability|{{{supportopcodes|}}}|[[Extended Z80 instruction set|Next Opcodes]]}}{{Capability|{{{supportsid|}}}|[[Turbo Sound Next|SID audio]]}}{{Capability|{{{supportspecdrum|}}}|Specdrum/Covox DAC}}{{Capability|{{{supportwifi|}}}|[[ESP8266-01 - Wifi Module|Wifi Module]]}}&lt;br /&gt;
|-&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1327</id>
		<title>File Formats</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1327"/>
		<updated>2019-05-31T14:05:26Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added layer resolutions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The NextZXOS can read and load these kind of files: bas, tap, nex, z80, sna, snx, dot, o, p&lt;br /&gt;
&lt;br /&gt;
* .z80, .sna and .snx are Spectrum snapshots, more suitable as emulator compatibility than a real format&lt;br /&gt;
* .o is a ZX80 snapshot&lt;br /&gt;
* .p is a ZX81 snapshot&lt;br /&gt;
* [[NEX file format|.nex]] is good for a program that takes over the machine&lt;br /&gt;
* .dot is good for dot commands and programs that can coexist with BASIC/NextZXOS and can return to BASIC safely (i.e. counterpart to nex)&lt;br /&gt;
* [[TAP file format|.tap]] is a simple container format that can hold many files, is compatible with emulators and supported by many tools.&lt;br /&gt;
* .bas is the native SD-card format for BASIC programs (first 128 bytes of the file form standard +3DOS header).&lt;br /&gt;
* .scr is used for a standard Spectrum screenshot created with &#039;&#039;SAVE &amp;quot;picture.scr&amp;quot; SCREEN$&#039;&#039; (256x192, 15 colours per character cell). &lt;br /&gt;
* .shc is used for a screenshot in Timex 8x1 Hi-colour mode (256x192, 15 colors).&lt;br /&gt;
* .shr is used for a screenshot in Timex Hi-res mode (512x192, mono).&lt;br /&gt;
* .slr is used for a lo-res screenshot (128x96, 256 colours).&lt;br /&gt;
* .sl2 is used for a Layer 2 screenshot (256x192, 256 colour).&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1326</id>
		<title>File Formats</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=1326"/>
		<updated>2019-05-31T13:02:11Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added more file formats.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The NextZXOS can read and load these kind of files: bas, tap, nex, z80, sna, snx, dot, o, p&lt;br /&gt;
&lt;br /&gt;
* .z80, .sna and .snx are Spectrum snapshots, more suitable as emulator compatibility than a real format&lt;br /&gt;
* .o is a ZX80 snapshot&lt;br /&gt;
* .p is a ZX81 snapshot&lt;br /&gt;
* [[NEX file format|.nex]] is good for a program that takes over the machine&lt;br /&gt;
* .dot is good for dot commands and programs that can coexist with BASIC/NextZXOS and can return to BASIC safely (i.e. counterpart to nex)&lt;br /&gt;
* [[TAP file format|.tap]] is a simple container format that can hold many files, is compatible with emulators and supported by many tools.&lt;br /&gt;
* .bas is the native SD-card format for BASIC programs (first 128 bytes of the file form standard +3DOS header).&lt;br /&gt;
* .scr is used for a standard Spectrum screenshot (SAVE &amp;quot;picture.scr&amp;quot; SCREEN$)&lt;br /&gt;
* .shc is used for a screenshot in Timex 8x1 Hi-colour mode.&lt;br /&gt;
* .shr is used for a screenshot in Timex Hi-res mode.&lt;br /&gt;
* .slr is used for a lo-res screenshot.&lt;br /&gt;
* .sl2 is used for a layer 2 screenshot.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1317</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1317"/>
		<updated>2019-05-20T12:53:05Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Spectrum key		|| PS/2 Key 	|| Action &lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 	|| Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 	|| On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 	|| Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 	|| CIPSEND mode on/off, also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 	|| Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0	|| Delete &lt;br /&gt;
|-&lt;br /&gt;
| SYMBOL SHIFT + SPACE ||  CONTROL+SPACE  || Exit Program&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
If you believe the baud rate is set incorrectly on the module, from version 2.2e of .UART, there is a command to search all possible settings from about 4000 to 2.2M baud:&lt;br /&gt;
&lt;br /&gt;
 .UART -f&lt;br /&gt;
&lt;br /&gt;
Once you have the module reporting &#039;ERROR&#039; you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 &lt;br /&gt;
&lt;br /&gt;
and press &#039;&#039;ENTER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You now need to use &#039;&#039;GRAPHICS&#039;&#039; (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  &lt;br /&gt;
&lt;br /&gt;
This will give 1,2 or 3 (where STA=1, AP=2, Both=3). Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Here are some more common AT commands:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIFSR || Echo the current IP address on the network&lt;br /&gt;
|-&lt;br /&gt;
| AT+GMR || Echo the current versions of the software on your module&lt;br /&gt;
|-&lt;br /&gt;
| AT+CWQAP || Forget the WiFi network and password&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Server == &lt;br /&gt;
&lt;br /&gt;
Let&#039;s try connecting to a server on the internet:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;www.google.com&amp;quot;,80 &lt;br /&gt;
&lt;br /&gt;
That is just the first stage and means there is now a pipe from the ESP to the Google server. Before it does anything you need to send it something. If you do feel brave before you close the connection then you can send:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSEND=7&lt;br /&gt;
&lt;br /&gt;
at the &amp;quot;&amp;gt;&amp;quot; prompt which appears you should type:&lt;br /&gt;
&lt;br /&gt;
 GET / &lt;br /&gt;
&lt;br /&gt;
These 5 characters need to be followed by a character 13-Carriage Return and a 10-linefeed. I.E. Just press return twice.&lt;br /&gt;
&lt;br /&gt;
AT+CIPSEND=length allows you to get the &amp;quot;&amp;gt;&amp;quot; prompt and type &#039;length&#039; characters. Incoming replies will be &amp;quot;+ IPD,length:&amp;quot; followed by the data (no space). Finally you will need to close down the connection:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPCLOSE&lt;br /&gt;
&lt;br /&gt;
This is very fiddly so .UART and TERMINAL include a mode called CIPSEND that does all the decoding for you.&lt;br /&gt;
&lt;br /&gt;
If you press INV VIDEO (SHIFT+4) then the system will send an ATE0 to stop the ESP echoing everything and then anything you type will be sent followed by a Return and Newline.&lt;br /&gt;
&lt;br /&gt;
You can also on TERMINAL use EDIT (SHIFT+1) to go into immediate mode, where everything you type is sent as you do it. In this mode to send a LF you need to Symbol Shift + ENTER after pressing ENTER (or SHIFT and 6 / down-arrow) to send a  10 / LF / Newline.  This makes AT commands more complex but this mode is more useful to use the program as a traditional text terminal.&lt;br /&gt;
&lt;br /&gt;
Anything the other end replies with will just appear. Note that at 14MHz you will get more text before the system begins to lose data due to the delays in printing what is received. Far more works on TERMINAL than .UART.&lt;br /&gt;
&lt;br /&gt;
This mode is good enough to be a simple text terminal for a shell on a linux box or any test system.&lt;br /&gt;
&lt;br /&gt;
If you connect to Google again and use CIPSEND mode then send four lines EXACTLY like this:&lt;br /&gt;
&lt;br /&gt;
 GET / HTTP/1.1\r\n&lt;br /&gt;
 Host: www.google.com\r\n&lt;br /&gt;
 Connection: close\r\n&lt;br /&gt;
 \r\n&lt;br /&gt;
&lt;br /&gt;
(where the \r\n represent what CIPSEND will do when you press ENTER)&lt;br /&gt;
&lt;br /&gt;
Your screen will fill with the RAW data that makes up the very simple Google home page...&lt;br /&gt;
&lt;br /&gt;
In order to get back to talking to the ESP you will now need to exit CIPSEND mode by pressing INV VIDEO (SHIFT+4) again.&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Non-HTTP Server ==&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;dict.org&amp;quot;,2628&lt;br /&gt;
&lt;br /&gt;
Should get you:&lt;br /&gt;
&lt;br /&gt;
220 ..............some WELCOME.....&lt;br /&gt;
&lt;br /&gt;
Go into CIPSEND mode with INV. VIDEO (SHIFT+4) and type:&lt;br /&gt;
&lt;br /&gt;
 DEFINE wn server\r\n&lt;br /&gt;
&lt;br /&gt;
And you should get:&lt;br /&gt;
&lt;br /&gt;
 150 1 definitions retrieved&lt;br /&gt;
 151 &amp;quot;server&amp;quot; wn &amp;quot;WordNet (r) 2.0&amp;quot;&lt;br /&gt;
 server&lt;br /&gt;
     n 1: a person whose occupation is to serve at table (as in a&lt;br /&gt;
          restaurant) [syn: {waiter}]&lt;br /&gt;
     2: (court games) the player who serves to start a point&lt;br /&gt;
     3: (computer science) a computer that provides client stations&lt;br /&gt;
        with access to files and printers as shared resources to a&lt;br /&gt;
        computer network [syn: {host}]&lt;br /&gt;
     4: utensil used in serving food or drink&lt;br /&gt;
 .&lt;br /&gt;
 250 ok [d/m/c = 1/0/18; 0.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
Now send:&lt;br /&gt;
&lt;br /&gt;
 QUIT&lt;br /&gt;
&lt;br /&gt;
and you will get&lt;br /&gt;
&lt;br /&gt;
 221 bye [d/m/c = 0/0/0; 16.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1316</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1316"/>
		<updated>2019-05-20T12:50:04Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added UART -f option as per https://www.facebook.com/groups/specnext/permalink/871158003241521/&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Spectrum key		|| PS/2 Key 	|| Action &lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 	|| Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 	|| On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 	|| Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 	|| CIPSEND mode on/off, also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 	|| Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0	|| Delete &lt;br /&gt;
|-&lt;br /&gt;
| SYMBOL SHIFT + SPACE ||  CONTROL+SPACE  || Exit Program&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
If you believe the baud rate is set incorrectly on the module, from version 2.2e of .UART, there is a command to search all possible settings from about 4000 to 2.2M baud:&lt;br /&gt;
&lt;br /&gt;
 .UART -f&lt;br /&gt;
&lt;br /&gt;
Once you have the module reporting &#039;ERROR&#039; you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 &lt;br /&gt;
&lt;br /&gt;
and press &#039;&#039;ENTER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You now need to use GRAPHICS (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  &lt;br /&gt;
&lt;br /&gt;
This will give 1,2 or 3 (where STA=1, AP=2, Both=3). Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Here are some more common AT commands:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIFSR || Echo the current IP address on the network&lt;br /&gt;
|-&lt;br /&gt;
| AT+GMR || Echo the current versions of the software on your module&lt;br /&gt;
|-&lt;br /&gt;
| AT+CWQAP || Forget the WiFi network and password&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Server == &lt;br /&gt;
&lt;br /&gt;
Let&#039;s try connecting to a server on the internet:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;www.google.com&amp;quot;,80 &lt;br /&gt;
&lt;br /&gt;
That is just the first stage and means there is now a pipe from the ESP to the Google server. Before it does anything you need to send it something. If you do feel brave before you close the connection then you can send:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSEND=7&lt;br /&gt;
&lt;br /&gt;
at the &amp;quot;&amp;gt;&amp;quot; prompt which appears you should type:&lt;br /&gt;
&lt;br /&gt;
 GET / &lt;br /&gt;
&lt;br /&gt;
These 5 characters need to be followed by a character 13-Carriage Return and a 10-linefeed. I.E. Just press return twice.&lt;br /&gt;
&lt;br /&gt;
AT+CIPSEND=length allows you to get the &amp;quot;&amp;gt;&amp;quot; prompt and type &#039;length&#039; characters. Incoming replies will be &amp;quot;+ IPD,length:&amp;quot; followed by the data (no space). Finally you will need to close down the connection:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPCLOSE&lt;br /&gt;
&lt;br /&gt;
This is very fiddly so .UART and TERMINAL include a mode called CIPSEND that does all the decoding for you.&lt;br /&gt;
&lt;br /&gt;
If you press INV VIDEO (SHIFT+4) then the system will send an ATE0 to stop the ESP echoing everything and then anything you type will be sent followed by a Return and Newline.&lt;br /&gt;
&lt;br /&gt;
You can also on TERMINAL use EDIT (SHIFT+1) to go into immediate mode, where everything you type is sent as you do it. In this mode to send a LF you need to Symbol Shift + ENTER after pressing ENTER (or SHIFT and 6 / down-arrow) to send a  10 / LF / Newline.  This makes AT commands more complex but this mode is more useful to use the program as a traditional text terminal.&lt;br /&gt;
&lt;br /&gt;
Anything the other end replies with will just appear. Note that at 14MHz you will get more text before the system begins to lose data due to the delays in printing what is received. Far more works on TERMINAL than .UART.&lt;br /&gt;
&lt;br /&gt;
This mode is good enough to be a simple text terminal for a shell on a linux box or any test system.&lt;br /&gt;
&lt;br /&gt;
If you connect to Google again and use CIPSEND mode then send four lines EXACTLY like this:&lt;br /&gt;
&lt;br /&gt;
 GET / HTTP/1.1\r\n&lt;br /&gt;
 Host: www.google.com\r\n&lt;br /&gt;
 Connection: close\r\n&lt;br /&gt;
 \r\n&lt;br /&gt;
&lt;br /&gt;
(where the \r\n represent what CIPSEND will do when you press ENTER)&lt;br /&gt;
&lt;br /&gt;
Your screen will fill with the RAW data that makes up the very simple Google home page...&lt;br /&gt;
&lt;br /&gt;
In order to get back to talking to the ESP you will now need to exit CIPSEND mode by pressing INV VIDEO (SHIFT+4) again.&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Non-HTTP Server ==&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;dict.org&amp;quot;,2628&lt;br /&gt;
&lt;br /&gt;
Should get you:&lt;br /&gt;
&lt;br /&gt;
220 ..............some WELCOME.....&lt;br /&gt;
&lt;br /&gt;
Go into CIPSEND mode with INV. VIDEO (SHIFT+4) and type:&lt;br /&gt;
&lt;br /&gt;
 DEFINE wn server\r\n&lt;br /&gt;
&lt;br /&gt;
And you should get:&lt;br /&gt;
&lt;br /&gt;
 150 1 definitions retrieved&lt;br /&gt;
 151 &amp;quot;server&amp;quot; wn &amp;quot;WordNet (r) 2.0&amp;quot;&lt;br /&gt;
 server&lt;br /&gt;
     n 1: a person whose occupation is to serve at table (as in a&lt;br /&gt;
          restaurant) [syn: {waiter}]&lt;br /&gt;
     2: (court games) the player who serves to start a point&lt;br /&gt;
     3: (computer science) a computer that provides client stations&lt;br /&gt;
        with access to files and printers as shared resources to a&lt;br /&gt;
        computer network [syn: {host}]&lt;br /&gt;
     4: utensil used in serving food or drink&lt;br /&gt;
 .&lt;br /&gt;
 250 ok [d/m/c = 1/0/18; 0.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
Now send:&lt;br /&gt;
&lt;br /&gt;
 QUIT&lt;br /&gt;
&lt;br /&gt;
and you will get&lt;br /&gt;
&lt;br /&gt;
 221 bye [d/m/c = 0/0/0; 16.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=2MB_RAM_Expansion&amp;diff=1279</id>
		<title>2MB RAM Expansion</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=2MB_RAM_Expansion&amp;diff=1279"/>
		<updated>2019-05-02T12:34:19Z</updated>

		<summary type="html">&lt;p&gt;Daz: Initial version&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An Issue 2 Spectrum Next has 1024Kb of RAM in two 512Kb modules, which can be expanded to with a further two modules for a total internal maximum of 2Mb.&lt;br /&gt;
&lt;br /&gt;
The RAM modules known to work with a Next are:&lt;br /&gt;
&lt;br /&gt;
* 71V424S10Y(G) by Integrated Device Technology, Inc (IDT).&lt;br /&gt;
* AS7C34096A-10JCN (10JIN) by Alliance Semiconductor Corp.&lt;br /&gt;
&lt;br /&gt;
(Core version 0.7 fixed a timing problem with the memory access, this list assumes you have at least this version.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;IMPORTANT&#039;&#039;&#039;: when fitting RAM note that the memory expansion sockets are slightly longer than the memory chip (40 pin sockets for 36 pin modules). This is because sockets of the precise size are no longer produced. The chip should be slotted into the left-hand side of the socket as shown here:&lt;br /&gt;
&lt;br /&gt;
https://www.specnext.com/wp-content/uploads/2017/12/ram_final.jpg&lt;br /&gt;
&lt;br /&gt;
Note the four connectors to the right (two on top and two on the bottom) are left empty, as the memory chip is aligned to the left. There is a small depression/hole in one corner of the memory chips. There is a cut out section on one corner of the sockets. These need to align.&lt;br /&gt;
&lt;br /&gt;
NextZXOS shows the available RAM in the bottom corner of the start-up menu.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1272</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1272"/>
		<updated>2019-04-30T15:30:32Z</updated>

		<summary type="html">&lt;p&gt;Daz: WIP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Spectrum key		|| PS/2 Key 	|| Action &lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 	|| Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 	|| On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 	|| Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 	|| CIPSEND mode on/off, also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 	|| Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0	||  &lt;br /&gt;
|-&lt;br /&gt;
| Exit Program	|| Symbol Shift and Space together.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
Once you have that you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 &lt;br /&gt;
&lt;br /&gt;
and press &#039;&#039;ENTER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You now need to use GRAPHICS (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  &lt;br /&gt;
&lt;br /&gt;
This will give 1,2 or 3 (where STA=1, AP=2, Both=3). Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Here are some more common AT commands:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIFSR || Echo the current IP address on the network&lt;br /&gt;
|-&lt;br /&gt;
| AT+GMR || Echo the current versions of the software on your module&lt;br /&gt;
|-&lt;br /&gt;
| AT+CWQAP || Forget the WiFi network and password&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Server == &lt;br /&gt;
&lt;br /&gt;
Let&#039;s try connecting to a server on the internet:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;www.google.com&amp;quot;,80 &lt;br /&gt;
&lt;br /&gt;
That is just the first stage and means there is now a pipe from the ESP to the Google server. Before it does anything you need to send it something. If you do feel brave before you close the connection then you can send:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSEND=7&lt;br /&gt;
&lt;br /&gt;
at the &amp;quot;&amp;gt;&amp;quot; prompt which appears you should type:&lt;br /&gt;
&lt;br /&gt;
 GET / &lt;br /&gt;
&lt;br /&gt;
These 5 characters need to be followed by a character 13-Carriage Return and a 10-linefeed. I.E. Just press return twice.&lt;br /&gt;
&lt;br /&gt;
AT+CIPSEND=length allows you to get the &amp;quot;&amp;gt;&amp;quot; prompt and type &#039;length&#039; characters. Incoming replies will be &amp;quot;+ IPD,length:&amp;quot; followed by the data (no space). Finally you will need to close down the connection:&lt;br /&gt;
&lt;br /&gt;
 AT+CIPCLOSE&lt;br /&gt;
&lt;br /&gt;
This is very fiddly so .UART and TERMINAL include a mode called CIPSEND that does all the decoding for you.&lt;br /&gt;
&lt;br /&gt;
If you press INV VIDEO (SHIFT+4) then the system will send an ATE0 to stop the ESP echoing everything and then anything you type will be sent followed by a Return and Newline.&lt;br /&gt;
&lt;br /&gt;
You can also on TERMINAL use EDIT (SHIFT+1) to go into immediate mode, where everything you type is sent as you do it. In this mode to send a LF you need to Symbol Shift + ENTER after pressing ENTER (or SHIFT and 6 / down-arrow) to send a  10 / LF / Newline.  This makes AT commands more complex but this mode is more useful to use the program as a traditional text terminal.&lt;br /&gt;
&lt;br /&gt;
Anything the other end replies with will just appear. Note that at 14MHz you will get more text before the system begins to lose data due to the delays in printing what is received. Far more works on TERMINAL than .UART.&lt;br /&gt;
&lt;br /&gt;
This mode is good enough to be a simple text terminal for a shell on a linux box or any test system.&lt;br /&gt;
&lt;br /&gt;
If you connect to Google again and use CIPSEND mode then send four lines EXACTLY like this:&lt;br /&gt;
&lt;br /&gt;
 GET / HTTP/1.1\r\n&lt;br /&gt;
 Host: www.google.com\r\n&lt;br /&gt;
 Connection: close\r\n&lt;br /&gt;
 \r\n&lt;br /&gt;
&lt;br /&gt;
(where the \r\n represent what CIPSEND will do when you press ENTER)&lt;br /&gt;
&lt;br /&gt;
Your screen will fill with the RAW data that makes up the very simple Google home page...&lt;br /&gt;
&lt;br /&gt;
In order to get back to talking to the ESP you will now need to exit CIPSEND mode by pressing INV VIDEO (SHIFT+4) again.&lt;br /&gt;
&lt;br /&gt;
== Connecting to a Non-HTTP Server ==&lt;br /&gt;
&lt;br /&gt;
 AT+CIPSTART=&amp;quot;TCP&amp;quot;,&amp;quot;dict.org&amp;quot;,2628&lt;br /&gt;
&lt;br /&gt;
Should get you:&lt;br /&gt;
&lt;br /&gt;
220 ..............some WELCOME.....&lt;br /&gt;
&lt;br /&gt;
Go into CIPSEND mode with INV. VIDEO (SHIFT+4) and type:&lt;br /&gt;
&lt;br /&gt;
 DEFINE wn server\r\n&lt;br /&gt;
&lt;br /&gt;
And you should get:&lt;br /&gt;
&lt;br /&gt;
 150 1 definitions retrieved&lt;br /&gt;
 151 &amp;quot;server&amp;quot; wn &amp;quot;WordNet (r) 2.0&amp;quot;&lt;br /&gt;
 server&lt;br /&gt;
     n 1: a person whose occupation is to serve at table (as in a&lt;br /&gt;
          restaurant) [syn: {waiter}]&lt;br /&gt;
     2: (court games) the player who serves to start a point&lt;br /&gt;
     3: (computer science) a computer that provides client stations&lt;br /&gt;
        with access to files and printers as shared resources to a&lt;br /&gt;
        computer network [syn: {host}]&lt;br /&gt;
     4: utensil used in serving food or drink&lt;br /&gt;
 .&lt;br /&gt;
 250 ok [d/m/c = 1/0/18; 0.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
Now send:&lt;br /&gt;
&lt;br /&gt;
 QUIT&lt;br /&gt;
&lt;br /&gt;
and you will get&lt;br /&gt;
&lt;br /&gt;
 221 bye [d/m/c = 0/0/0; 16.000r 0.000u 0.000s]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1271</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1271"/>
		<updated>2019-04-30T15:06:57Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| Spectrum key		|| PS/2 Key 	|| Action &lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 	|| Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 	|| On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 	|| Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 	|| CIPSEND mode on/off, also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 	|| Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0	||  &lt;br /&gt;
|-&lt;br /&gt;
| Exit Program	|| Symbol Shift and Space together.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
Once you have that you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 &lt;br /&gt;
&lt;br /&gt;
and press &#039;&#039;ENTER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You now need to use GRAPHICS (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  &lt;br /&gt;
&lt;br /&gt;
This will give 1,2 or 3 (where STA=1, AP=2, Both=3). Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Here are some more common AT commands:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| AT+CIFSR || Echo the current IP address on the network&lt;br /&gt;
|-&lt;br /&gt;
| AT+GMR || Echo the current versions of the software on your module&lt;br /&gt;
|-&lt;br /&gt;
| AT+CWQAP || Forget the WiFi network and password&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1270</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1270"/>
		<updated>2019-04-30T12:14:33Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 - Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 - On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 - Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 - CIPSEND mode on/off also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 - Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0&lt;br /&gt;
|-&lt;br /&gt;
| Exit Program	|| Symbol Shift and Space together.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
Once you have that you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 &lt;br /&gt;
&lt;br /&gt;
and press &#039;&#039;ENTER&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
You now need to use GRAPHICS (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  &lt;br /&gt;
&lt;br /&gt;
This will give 1,2 or 3 (where STA=1, AP=2, Both=3). Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Get the current IP address on the network:&lt;br /&gt;
 AT+CIFSR&lt;br /&gt;
&lt;br /&gt;
Tell you the current versions of the software on your module:&lt;br /&gt;
 AT+GMR&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1256</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1256"/>
		<updated>2019-04-28T12:59:23Z</updated>

		<summary type="html">&lt;p&gt;Daz: WIP&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.) The UART on the Next board (built inside the FPGA logic) can control the RX/TX lines from 2400 bps up to 115200 bps (the default speed). The ESP module uses the &amp;quot;AT instruction set&amp;quot; of a typical modem and the official PDF is available here: https://www.espressif.com/sites/default/files/documentation/4a-esp8266_at_instruction_set_en.pdf&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 - Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 - On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 - Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 - CIPSEND mode on/off also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 - Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0&lt;br /&gt;
|-&lt;br /&gt;
| Exit Program	|| Symbol Shift and Space together.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Basic Connection ==&lt;br /&gt;
&lt;br /&gt;
Run the .UART command, or better LOAD &amp;quot;TERMINAL.BAS&amp;quot; and RUN it.&lt;br /&gt;
&lt;br /&gt;
First of all when you press &#039;&#039;ENTER&#039;&#039; you should get &#039;ERROR&#039; because you didn&#039;t send a valid command to the ESP module. If you don&#039;t then it may be a number of things:&lt;br /&gt;
&lt;br /&gt;
* You are using the TBU and firmware BEFORE 0.8 and NextOS 1.92 - if so this will only work at 3.5Mhz so slow the machine down and restart .UART.&lt;br /&gt;
* You are using a TBU and firmware with a Core .29 or greater, with an OLD copy of the .UART program which wrote the BAUD rate differently - if so when you cycle through the speeds (EDIT/SHIFT+1) you will find it may &#039;work&#039; at 38400 - it is actually a fluke as the old value for that rate is quite close to the value needed for 115200 on the new system.&lt;br /&gt;
* Your module may have come with a default baud rate other than the 115200 of the Next. Using GRAPHICS (SHIFT+9) you can cycle through each option pressing &#039;&#039;ENTER&#039;&#039; until you see &amp;quot;ERROR!&amp;quot; (If you can physically see the module then many have a little blue light that flashes when receiving.)&lt;br /&gt;
&lt;br /&gt;
Once you have that you should be able to type &#039;AT&#039; and press &#039;&#039;ENTER&#039;&#039;. That should give &amp;quot;OK&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Probably the first thing you want to do is tell the module to use the default speed of the next so type:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=115200,8,1,0,0 and press &#039;&#039;ENTER&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You now need to used GRAPHICS (SHIFT+9) to go back around to 115200 so that &#039;&#039;ENTER&#039;&#039; gives ERROR and AT &#039;&#039;ENTER&#039;&#039; gives OK again....&lt;br /&gt;
&lt;br /&gt;
We just used one of the AT commands:&lt;br /&gt;
&lt;br /&gt;
 AT+UART=&amp;lt;baudrate&amp;gt;,&amp;lt;databits&amp;gt;,&amp;lt;stopbits&amp;gt;,&amp;lt;parity&amp;gt;,&amp;lt;flow control&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Getting on the Network ==&lt;br /&gt;
&lt;br /&gt;
Now to connect to a Wi-Fi access point:&lt;br /&gt;
&lt;br /&gt;
First let&#039;s check that the system is in STAtion mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=?  will give 1,2 or 3 (where STA=1, AP=2, Both=3)&lt;br /&gt;
&lt;br /&gt;
Mode 1 or 3 is fine but, more config is needed in mode 2.&lt;br /&gt;
&lt;br /&gt;
Set the mode:&lt;br /&gt;
&lt;br /&gt;
 AT+CWMODE=1&lt;br /&gt;
&lt;br /&gt;
List Access Points:&lt;br /&gt;
 AT+CWLAP&lt;br /&gt;
&lt;br /&gt;
To join an Access Point:&lt;br /&gt;
 AT+CWJAP=&amp;quot;wifinetwork&amp;quot;,&amp;quot;password&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Note that the module will retain the Wi-Fi connection and you can just do an AT+RST which will reset the module and give a CONNECTED and GOT IP.&lt;br /&gt;
&lt;br /&gt;
Get the current IP address on the network:&lt;br /&gt;
 AT+CIFSR&lt;br /&gt;
&lt;br /&gt;
Tell you the current versions of the software on your module:&lt;br /&gt;
 AT+GMR&lt;br /&gt;
&lt;br /&gt;
== Other Hardware ==&lt;br /&gt;
&lt;br /&gt;
In addition to controlling the ESP-01 Wi-Fi module, the .UART command also provides facilities to use the serial connection port, either directly through some form of serial converter (e.g. a USB to TTL serial) or standard RS232 module (probably based on the MAX232). &lt;br /&gt;
&lt;br /&gt;
A USB serial connection allows you to do all sorts of clever things - it is possible to connect up to a PC like this for transferring data.  In fact if you were an early purchaser you probably bought one with your ESP-01 as it is the one needed to program it. &lt;br /&gt;
&lt;br /&gt;
If you use one of the easy to get TTL modules then you can communicate with PC&#039;s and other older machines - E.g. a real Spectrum with Interface 1... KevB is using one for his PC - see article on the forum at https://www.specnext.com/forum/viewtopic.php?f=6&amp;amp;t=895  &lt;br /&gt;
&lt;br /&gt;
It should be possible just to hook up to an external Raspberry PI for example and use a serial console connection allowing you to use the ZX Next as the keyboard... as the voltages match it should be fine just to connect the UART RX/TX and GND to the PI&#039;s PIN&#039;s 4/5/6 GND/TXD0-GPIO14/RXD0-GPIO15. See https://elinux.org/RPi_Serial_Connection&lt;br /&gt;
&lt;br /&gt;
There is a diagram of the GPIO header here: https://elinux.org/RPi_Low-level_peripherals&lt;br /&gt;
&lt;br /&gt;
Be aware of the differences with a Pi 3.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Further Reading ==&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1236</id>
		<title>ESP8266-01</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=ESP8266-01&amp;diff=1236"/>
		<updated>2019-04-27T14:26:07Z</updated>

		<summary type="html">&lt;p&gt;Daz: Work in progress...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Wi-Fi module and Real Time Clock (RTC) were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them. Although the RTC requires soldering components to the board, but the Wi-Fi module is a push-fit component.&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding Wi-Fi to a board requires only a ESP8266 ESP-01 module. This supports 802.11 b/g/n at 2.5 Ghz including the WPA and WPA2 security protocols. The mounting point for the module is just behind the VGA port.&lt;br /&gt;
&lt;br /&gt;
ESP modules have an updatable firmware. In general the standard firmware, should work out of the box with the Spectrum Next. If you&#039;re buying a module, check it has a standard firmware.&lt;br /&gt;
&lt;br /&gt;
The Wi-Fi makes use of the on-board UART (Universal Asynchronous Receiver-Transmitter) of the Spectrum Next (you can use this without a WiFi module for serial connections as as well.)&lt;br /&gt;
&lt;br /&gt;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
This information relates to [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] 2.00.26 and later (2019-01-27).&lt;br /&gt;
&lt;br /&gt;
The distribution contains dot commands (including &amp;quot;UART&amp;quot;) and the &amp;quot;TERMINALS.BAS&amp;quot; program for working with the Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
.UART is a simple DOT command that works in NextZXOS (and ESXDOS) to allow you to talk to a connected device which could be a Wi-Fi module.  Due to the limitations of the 512 byte hardware buffer ,it can only be used for small amounts of data and is mainly intended to allow diagnosis. It does include a simple CIPSEND mode that allows connections to be made with an ESP Wi-Fi module.&lt;br /&gt;
&lt;br /&gt;
UART.DRV is an interrupt driven driver (NextZXOS only) which can provide a 16K software buffer which means much less incoming data is lost.  There is both a simple demo IUDEMO and a terminal program (not a DOT command) that provides an alternative to .UART that can handle much more data.  This is intended for users of the port without the Wi-Fi module really but can be used to setup the ESP.&lt;br /&gt;
&lt;br /&gt;
The TERMINAL.BAS program is much better than .UART and you will have better results following through some of the examples below.&lt;br /&gt;
&lt;br /&gt;
You can also begin to play with the real feature of the Internet Toolbox which is the ESPAT driver for BASIC (again NextZXOS only). It can be used with the BASIC ESPTERM program to chat over an IP link and the ESPHTTP sample program shows how a web page can be retrieved from BASIC (but not rendered.)&lt;br /&gt;
&lt;br /&gt;
The Source code to the IRQ stub is provided to allow the ESPAT code to be used in games that take over the machine, providing a gaming API.&lt;br /&gt;
&lt;br /&gt;
Be sure to check out NXTel the Viewdata (Prestel/Teletext) terminal that allows the Next to connect and get news pages from Viewdata servers already online.&lt;br /&gt;
&lt;br /&gt;
=== .UART ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Key mapping&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| EDIT		|| SHIFT+1 - Cycle output mode &lt;br /&gt;
|-&lt;br /&gt;
| CAPS LOCK	|| SHIFT+2 - On/off toggle (on by default)&lt;br /&gt;
|-&lt;br /&gt;
| TRUE VIDEO	|| SHIFT+3 - Debug mode for CIPSEND on/off (silent)&lt;br /&gt;
|-&lt;br /&gt;
| INV VIDEO	|| SHIFT+4 - CIPSEND mode on/off also does an ATE0&lt;br /&gt;
|-&lt;br /&gt;
| GRAPHICS	|| SHIFT+9 - Change BAUD rate &lt;br /&gt;
|-&lt;br /&gt;
| DELETE	|| SHIFT+0&lt;br /&gt;
|-&lt;br /&gt;
| Exit Program	|| Symbol Shift and Space together.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For further information, see [https://www.specnext.com/the-next-on-the-network/ &amp;quot;The Next on the Network&amp;quot; at SpecNext.com] and in the TBBlue Distribution the file &amp;quot;\docs\extra-hw\wifi\WIFIand UARTReadME1st.txt&amp;quot;&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Palette_Value_(9_bit_colour)_Register&amp;diff=1223</id>
		<title>Palette Value (9 bit colour) Register</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Palette_Value_(9_bit_colour)_Register&amp;diff=1223"/>
		<updated>2019-04-26T15:15:31Z</updated>

		<summary type="html">&lt;p&gt;Daz: &amp;quot;Enhanced ULA&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$44&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Use to set 9-bit (2-byte) colours of the Enhanced ULA palette, or to read second byte of colour.&lt;br /&gt;
}}&lt;br /&gt;
Two consecutive writes are needed to write the 9 bit colour:&lt;br /&gt;
* 1st write: bits 7-0 = RRRGGGBB&lt;br /&gt;
* 2nd write: bits 7-1 are reserved, must be 0 (except bit 7 for Layer 2), bit 0 = lsb B&lt;br /&gt;
&lt;br /&gt;
(to detect whether first or second write is expected, one can read bit 7 of {{NextRegNo|$03}}, in case your code is not aware of current state)&lt;br /&gt;
&lt;br /&gt;
If writing the Layer 2 palette colour, in the second byte, bit 7 is &amp;quot;priority&amp;quot; bit. Priority colour will be always on top (drawn above all other layers), even on a priority arrangement like &amp;quot;USL&amp;quot; . If you need the exact same colour with priority and non priority, you will need to program the same colour twice, changing bit 7 to 0 for the non priority colour alternative.&lt;br /&gt;
&lt;br /&gt;
After the write of second byte, the palette index is auto-incremented, if the auto-increment is enabled by {{NextRegNo|$43}}.&lt;br /&gt;
&lt;br /&gt;
The read will always read the second byte of colour (%p000000B) and it will not modify the index.&lt;br /&gt;
&lt;br /&gt;
The modified palette remains until a Hard Reset.&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=Emulators&amp;diff=1220</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=Emulators&amp;diff=1220"/>
		<updated>2019-04-26T15:12:41Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added &amp;quot;Zeus&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{EmulatorListTop}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=CSpect&lt;br /&gt;
 |author=Mike Dailly&lt;br /&gt;
 |downloadurl=http://dailly.blogspot.co.uk/&lt;br /&gt;
 |description=Emulates many features of the Next and includes an assembler&lt;br /&gt;
 |os=Windows&lt;br /&gt;
 |sourceavail=N&lt;br /&gt;
 |supportsprites=Y&lt;br /&gt;
 |supportlores=Y&lt;br /&gt;
 |supportlayer2=Y&lt;br /&gt;
 |supportopcodes=Y&lt;br /&gt;
 |supporttripleay=Y&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=ZEsarUX&lt;br /&gt;
 |author=César Hernández Bañó&lt;br /&gt;
 |downloadurl=https://sourceforge.net/projects/zesarux/&lt;br /&gt;
 |sourceurl=https://sourceforge.net/p/zesarux/code/ci/master/tree/&lt;br /&gt;
 |description=A full feature emulator including a debugger - frequently updated to support Next updates&lt;br /&gt;
 |os=Any&lt;br /&gt;
 |sourceavail=Y&lt;br /&gt;
 |supportsprites=Y&lt;br /&gt;
 |supportlores=Y&lt;br /&gt;
 |supportlayer2=Y&lt;br /&gt;
 |supportopcodes=~&lt;br /&gt;
 |supporttripleay=Y&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
 |supportspecdrum=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=NX&lt;br /&gt;
 |author=Matt Davies&lt;br /&gt;
 |downloadurl=https://github.com/next-dev/nx&lt;br /&gt;
 |sourceurl=https://github.com/next-dev/nx&lt;br /&gt;
 |description=An in-development emulator&lt;br /&gt;
 |os=Windows / Mac&lt;br /&gt;
 |sourceavail=Y&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Emulator|name=Zeus &lt;br /&gt;
 |author=Design Design&lt;br /&gt;
 |downloadurl=http://www.desdes.com/products/oldfiles/zeus.htm&lt;br /&gt;
 |description=A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.&lt;br /&gt;
 |os=Windows&lt;br /&gt;
 |sourceavail=N&lt;br /&gt;
 |supportsprites=Y&lt;br /&gt;
 |supportlores=N&lt;br /&gt;
 |supportlayer2=N&lt;br /&gt;
 |supportopcodes=~&lt;br /&gt;
 |supporttripleay=N&lt;br /&gt;
 |supportsid=N&lt;br /&gt;
 |supportspecdrum=N&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{EmulatorListBottom}}&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1216</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1216"/>
		<updated>2019-04-26T13:48:49Z</updated>

		<summary type="html">&lt;p&gt;Daz: Headings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
== Hardware Requirements ==&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* 12pF Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
(6pF Crystals have been reported to work)&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&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;
== Software Support ==&lt;br /&gt;
&lt;br /&gt;
The [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] contains dot commands &amp;quot;DATE&amp;quot; and &amp;quot;TIME&amp;quot; for working with the RTC:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| .DATE &amp;quot;31/12/2017&amp;quot; || Set the date to new years eve&lt;br /&gt;
|-&lt;br /&gt;
| .DATE || Print the current date&lt;br /&gt;
|-&lt;br /&gt;
| .TIME &amp;quot;00:30:00:&amp;quot; || Set the time to 30 minutes after midnight&lt;br /&gt;
|-&lt;br /&gt;
| .TIME || Print the current time&lt;br /&gt;
|-&lt;br /&gt;
| .TIME -h || Print help message&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you use these without a RTC soldered to the board they will just give an error that no signature is found or No ACK received. You can however use the option TIME -d to get the contents of the chip which will be junk if the RTC is not fitted but, but may help to diagnose any problems getting it working.&lt;br /&gt;
&lt;br /&gt;
When the RTC is fitted, the date and time automatically appear in the NextOS menus. The &amp;quot;.ls&amp;quot; command will print a file listing with dates, and &amp;quot;cat exp&amp;quot; will show times as well.&lt;br /&gt;
&lt;br /&gt;
You can get the contents of a dot command into a string using this NextBASIC:&lt;br /&gt;
&lt;br /&gt;
 DIM a$(100):OPEN #2,&amp;quot;v&amp;gt;a$&amp;quot;:.TIME:CLOSE #2:PRINT a$&lt;br /&gt;
&lt;br /&gt;
You can effectively &amp;quot;touch&amp;quot; a file in BASIC to update its timestamp with:&lt;br /&gt;
&lt;br /&gt;
 OPEN #4,&amp;quot;u&amp;gt;filename&amp;quot;:CLOSE #4&lt;br /&gt;
&lt;br /&gt;
The RTC is connected to the I2C bus. Also supplied is a DOT command called I2CSCAN - this will search the I2C bus for any devices found which can help in seeing what is connected. You should see at least one device at 0x68 if the RTC chip is connected. If you see others when you have nothing on J15 then make sure you have the latest TBU, any Capacitor mod etc - if so and you still have others detected then please contribute to the RTC posts on Facebook or the [https://www.specnext.com/forum Forum].&lt;br /&gt;
&lt;br /&gt;
Further information, including ESXDOS support, can be found on the TBBlue Distribution in the file \docs\extra-hw\rtc\RTCI2CTIMEDATEreadme.txt&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1215</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1215"/>
		<updated>2019-04-26T13:27:58Z</updated>

		<summary type="html">&lt;p&gt;Daz: Added dot commands&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* 12pF Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
(6pF Crystals have been reported to work)&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&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;
The [https://www.specnext.com/latestdistro/ TBBlue SD Distribution] contains dot commands &amp;quot;DATE&amp;quot; and &amp;quot;TIME&amp;quot; for working with the RTC:&lt;br /&gt;
&lt;br /&gt;
{|&lt;br /&gt;
|-&lt;br /&gt;
| .DATE &amp;quot;31/12/2017&amp;quot; || Set the date to new years eve&lt;br /&gt;
|-&lt;br /&gt;
| .DATE || Print the current date&lt;br /&gt;
|-&lt;br /&gt;
| .TIME &amp;quot;00:30:00:&amp;quot; || Set the time to 30 minutes after midnight&lt;br /&gt;
|-&lt;br /&gt;
| .TIME || Print the current time&lt;br /&gt;
|-&lt;br /&gt;
| .TIME -h || Print help message&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If you use these without a RTC soldered to the board they will just give an error that no signature is found or No ACK received. You can however use the option TIME -d to get the contents of the chip which will be junk if the RTC is not fitted but, but may help to diagnose any problems getting it working.&lt;br /&gt;
&lt;br /&gt;
When the RTC is fitted, the date and time automatically appear in the NextOS menus. The &amp;quot;.ls&amp;quot; command will print a file listing with dates, and &amp;quot;cat exp&amp;quot; will show times as well.&lt;br /&gt;
&lt;br /&gt;
You can get the contents of a dot command into a string using this NextBASIC:&lt;br /&gt;
&lt;br /&gt;
 DIM a$(100):OPEN #2,&amp;quot;v&amp;gt;a$&amp;quot;:.TIME:CLOSE #2:PRINT a$&lt;br /&gt;
&lt;br /&gt;
You can effectively &amp;quot;touch&amp;quot; a file in BASIC to update its timestamp with:&lt;br /&gt;
&lt;br /&gt;
 OPEN #4,&amp;quot;u&amp;gt;filename&amp;quot;:CLOSE #4&lt;br /&gt;
&lt;br /&gt;
The RTC is connected to the I2C bus. Also supplied is a DOT command called I2CSCAN - this will search the I2C bus for any devices found which can help in seeing what is connected. You should see at least one device at 0x68 if the RTC chip is connected. If you see others when you have nothing on J15 then make sure you have the latest TBU, any Capacitor mod etc - if so and you still have others detected then please contribute to the RTC posts on Facebook or the [https://www.specnext.com/forum Forum].&lt;br /&gt;
&lt;br /&gt;
Further information, including ESXDOS support, can be found on the TBBlue Distribution in the file \docs\extra-hw\rtc\RTCI2CTIMEDATEreadme.txt&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1214</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1214"/>
		<updated>2019-04-26T12:36:16Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&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;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1213</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1213"/>
		<updated>2019-04-26T12:34:37Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&lt;br /&gt;
&lt;br /&gt;
[[Image:/w/images/1/15/RTC Port Location.jpg]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1212</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1212"/>
		<updated>2019-04-26T12:33:39Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&lt;br /&gt;
&lt;br /&gt;
[[File:/w/images/1/15/RTC Port Location.jpg|frame|RTC mounting location]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1211</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1211"/>
		<updated>2019-04-26T12:30:53Z</updated>

		<summary type="html">&lt;p&gt;Daz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&lt;br /&gt;
&lt;br /&gt;
[[File:Https://specnext.dev/w/images/1/15/RTC Port Location.jpg|thumb|RTC mounting location]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
	<entry>
		<id>http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1210</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="http://wiki.specnext.dev/index.php?title=RTC&amp;diff=1210"/>
		<updated>2019-04-26T12:29:58Z</updated>

		<summary type="html">&lt;p&gt;Daz: Components required for adding a RTC.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A Real Time Clock (RTC) and Wi-Fi module were optional additions to the full cased Spectrum Next at the time of the original Kickstarter. They can be added to development boards and units that don&#039;t already have them, although the RTC requires soldering components to the board (whilst the Wi-Fi module is push-fit).&lt;br /&gt;
&lt;br /&gt;
Adding a RTC requires the following components:&lt;br /&gt;
&lt;br /&gt;
* Crystal   &lt;br /&gt;
* DS1307 IC&lt;br /&gt;
* 8 pin DIL Socket  &lt;br /&gt;
* CR2032 Holder  &lt;br /&gt;
* CR2032 Battery&lt;br /&gt;
&lt;br /&gt;
This is the mounting position on the PCB:&lt;br /&gt;
&lt;br /&gt;
[[File:Https://specnext.dev/w/images/1/15/RTC Port Location.jpg|thumb|RTC location on Spectrum Next PCB]]&lt;/div&gt;</summary>
		<author><name>Daz</name></author>
	</entry>
</feed>