<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sol+HSA</id>
	<title>SpecNext Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.specnext.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sol+HSA"/>
	<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/Special:Contributions/Sol_HSA"/>
	<updated>2026-06-01T21:33:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Mouse&amp;diff=41484</id>
		<title>Mouse</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Mouse&amp;diff=41484"/>
		<updated>2025-12-15T13:56:39Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: Assembler use link added&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 set this on boot by holding down SPACE, then pressing &amp;quot;E&amp;quot; to edit, moving down to &amp;quot;PS2&amp;quot; with the down arrow, and changing from Keyboard to Mouse with the right arrow.&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;
===Use from assembler===&lt;br /&gt;
&lt;br /&gt;
The relevant ports for mouse use are documented here:&lt;br /&gt;
https://gitlab.com/SpectrumNext/ZX_Spectrum_Next_FPGA/-/blob/master/cores/zxnext/ports.txt#L505&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 /nextzxos/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;br /&gt;
&lt;br /&gt;
===Wireless Mice===&lt;br /&gt;
&lt;br /&gt;
Most ps/2 mice commonly seen today are wired. One model of wireless mouse known to work well with the Next is the &#039;&#039;&#039;Microsoft Cordless WheelMouse &amp;amp; Receiver, Serial &amp;amp; PS/2, C57-00001&#039;&#039;&#039;. Brand-new old stock units can often be obtained on eBay.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Circuit_Diagrams&amp;diff=41137</id>
		<title>Circuit Diagrams</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Circuit_Diagrams&amp;diff=41137"/>
		<updated>2025-10-07T14:57:18Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: gallerize images&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Schematics ==&lt;br /&gt;
&lt;br /&gt;
The KS1 and KS2 schematics can be downloaded [https://gitlab.com/thesmog358/tbblue/-/tree/master/docs/schematics?inline=false here].&lt;br /&gt;
&lt;br /&gt;
The three tail matrix keyboard schematic can be downloaded [https://github.com/Threetwosevensixseven/NXtel/wiki/images/NS58A-5-01-04.pdf here].&lt;br /&gt;
&lt;br /&gt;
== J13 - Daughter board connector - Issue 2A/2B ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
DaughterLocation.jpg|Daughter board location&lt;br /&gt;
Circuit_daughter_board.png|Daughter board&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J13 - Daughter board connector - Issue 4 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
J13-I4-DaughterLocation.png|J13-I4 daughter location&lt;br /&gt;
J13-I4-CircuitDaughterBoard.png|J14-I4 circuit daughterboard&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J15 - Next GPIO - Issue 2A/2B ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
NEXT_GPIO_location.jpg|Next GPIO location&lt;br /&gt;
NEXT_GPIO.png|Next GPIO&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J15 - Next GPIO - Issue 4 ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
J15-I4-GPIOLocation.png|J15-I4 GPIO Location&lt;br /&gt;
J15-I4-CircuitGPIO.png|J16-I4 Circuit GPIO&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN5 - Expansion bus (edge connector) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Expansion_bus_location.jpg|Expansion bus location&lt;br /&gt;
Expansion_bus.png|Expansion bus&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J10/J11 - Memory Expansion Ports ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Mem_Expansion_location.jpg|Mem Expansion location&lt;br /&gt;
Mem_Expansion.png|Mem Expanstion&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== J4/J7 J8/J14 - Joystick Ports ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Joystick_Ports_Location.jpg|Joystick Ports Location&lt;br /&gt;
Joystick_Ports.png|Joystick Ports&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN1 - VGA Video Port ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Video_Port_Location.jpg|Video Port Location&lt;br /&gt;
Video_Port.png|Video Port&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
* In VGA mode (scandoubler enabled), H-SYNC and V-SYNC are carried separately on their respective pins.&lt;br /&gt;
* In RGB mode (scandoubler disabled), H-SYNC carries composite sync, and V-SYNC carries 1.&lt;br /&gt;
* Pin 14 carries 3V3, which can be connected to SCART pin 16 to indicate RGB to the display.&lt;br /&gt;
* There is no convenient source of voltages between 9.5-12V to indicate 4:3 aspect ratio to the display on SCART pin 8, so this is usually left unconnected.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN8 - Digital Port ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Digital Port Location.jpg|Digital Port Location&lt;br /&gt;
Next Digital Port.png|Next Digital Port&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN2/CN6/CN7 - SD Reader (Mainboard) (CN6 on reverse) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
SD_Reader_Port_Location.jpg|SD reader port location&lt;br /&gt;
SD_Reader_Main.png|SD reader main&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN10/CN11/CN12 - SD Reader (Daughterboard) (CN12 on reverse) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
SD_Reader_Daughter_Port_Location.jpg|SD reader daughter port location&lt;br /&gt;
SD_Reader.png|SD reader&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Accelerator Board ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Accelerator_Port_Location.jpg|Accelerator port location&lt;br /&gt;
Accelerator_Port.png|Accelerator port&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Real Time Clock (RTC) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
RTC_Port_Location.jpg|RTC port location&lt;br /&gt;
RTC_Port.png|RTC port&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== CN9 - ESP8266-01/RS-232 Port ==&lt;br /&gt;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
Wifi_Port_Location.jpg|Wifi port location&lt;br /&gt;
Next_ESP_Port.png|Next ESP port&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=41136</id>
		<title>GPIO Socket (J15)</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=GPIO_Socket_(J15)&amp;diff=41136"/>
		<updated>2025-10-07T14:47:53Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: gallerize images&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;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
NEXT GPIO location.jpg|J15 position on circuit board&lt;br /&gt;
NEXT_GPIO.png|GPIO pinout image&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&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.  This is factory fitted on 2B boards with a two slot connector for the additional two lines on a third membrane tail.  The extra data is handled by the VHDL in the FPGA so it still appears as a standard 48K Membrane but, without the complexity of three layers needed.&lt;br /&gt;
&lt;br /&gt;
This change does mean it is slightly harder to use J15 as the socket overlaps some ajoining holes slightly.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=RTC&amp;diff=41135</id>
		<title>RTC</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=RTC&amp;diff=41135"/>
		<updated>2025-10-07T14:46:28Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: gallerize images&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;
&amp;lt;gallery&amp;gt;&lt;br /&gt;
RTC_Port_Location.jpg|port location&lt;br /&gt;
RTC_Port.png|pinout&lt;br /&gt;
&amp;lt;/gallery&amp;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;
You can also set the time with the .NXTP command if you have WIFI setup and configured.&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, as long as it has been set the date and time automatically appear in the NextZXOS 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 then they are likely parts of the HDMI connection or maybe you have something connected on J15.&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 and \docs\nextzxos\NextZXOS_and_esxDOS_APIs.pdf&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41134</id>
		<title>Extended Z80 instruction set</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41134"/>
		<updated>2025-10-07T14:39:23Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: link fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a general list of Z80 and Z80N instructions with descriptions. The instructions specific to Z80N have the [[#Z80N_instructions_opcodes|encodings described first]].&lt;br /&gt;
&lt;br /&gt;
For a table of summaries without additional descriptions see the [[Z80 Instruction Table]]. There&#039;s also an external [https://table.specnext.dev/ Z80N opcode value matrix on specnext.dev].&lt;br /&gt;
&lt;br /&gt;
=== Z80N instructions opcodes ===&lt;br /&gt;
&lt;br /&gt;
This is a table of the instructions and the encodings of all &#039;&#039;&#039;Next-specific&#039;&#039;&#039; Z80 instructions:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Instruction !!data-sort-type=&amp;quot;text&amp;quot;| Encoding (2-4 bytes) (hex) !! T-States !! Description !! 4 letter&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;SWAPNIB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 23&amp;lt;/code&amp;gt;  || 8 || Swap the nibbles (4-bits) of A || SWAP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;MIRROR A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 24&amp;lt;/code&amp;gt;  || 8  || Mirror bits 0..7 to 7..0 of A || MIRR&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;TEST $im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 27&amp;lt;/code&amp;gt; value  || 11 || Change flags as AND A but A stays unaffected ||style=&amp;quot;color:DarkGrey;&amp;quot;|  TEST&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSLA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 28&amp;lt;/code&amp;gt;  || 8  || Shift left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSLA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 29&amp;lt;/code&amp;gt;  || 8  || Shift right signed DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRL DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2A&amp;lt;/code&amp;gt;  || 8  || Shift right DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRF DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2B&amp;lt;/code&amp;gt;  || 8  || Shift right DE, filling 1 for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRF&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BRLC DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2C&amp;lt;/code&amp;gt;  || 8  || Rotate left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BRLC&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;MUL D,E&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 30&amp;lt;/code&amp;gt;  || 8  || Multiply D with E, result in DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  MUL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 31&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 32&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 33&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 34 low high&amp;lt;/code&amp;gt;   || 16  || Add a constant to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 35 low high&amp;lt;/code&amp;gt;  || 16   || Add a constant to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 36 low high&amp;lt;/code&amp;gt;  || 16  || Add a constant to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 8A  high low&amp;lt;/code&amp;gt;  || 23  || Push a constant ||style=&amp;quot;color:DarkGrey;&amp;quot;|  PUSH&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;OUTINB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 90&amp;lt;/code&amp;gt;  || 16  || OUTI, but don&#039;t change B || OTIB&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,$im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 91 register value&amp;lt;/code&amp;gt;  || 20  || Write v to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 92 register&amp;lt;/code&amp;gt; || 17  || Write A to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELDN&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 93&amp;lt;/code&amp;gt;  || 8  || HL as a pixel address moved one line down || PXDN&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELAD&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 94&amp;lt;/code&amp;gt;  || 8  || HL := as ULA pixel address from D==Y E==X || PXAD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;SETAE&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 95&amp;lt;/code&amp;gt;  || 8  || Get A as a mask for ULA pixel from E || STAE&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;JP (C)&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 98&amp;lt;/code&amp;gt;  || 13  || IN (C) then jump to a 64 byte section ||style=&amp;quot;color:DarkGrey;&amp;quot;|  JP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A4&amp;lt;/code&amp;gt;  || 16  || Extended LDI byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDIX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDWS&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A5&amp;lt;/code&amp;gt;  || 14  || Byte copy as for Layer 2 ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDWS&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED AC&amp;lt;/code&amp;gt;  || 16  || Extended LDD byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDDX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B4&amp;lt;/code&amp;gt;  || 21/16  || Extended LDIR || LIRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDPIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B7&amp;lt;/code&amp;gt;  || 21/16  || Byte copy as for a pattern fill || LPRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED BC&amp;lt;/code&amp;gt;  || 21/16  || Extended LDDR || LDRX&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
More details and the explanations of all Z80 instructions implemented in the Next Z80 CPU follow.&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
&lt;br /&gt;
* The encoding of the operand of the &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt; is unique: it is the only operand encoded as big-endian.&lt;br /&gt;
* The timings (T-States) are based on some limited testing and may not be accurate.&lt;br /&gt;
* The shorter aliases of the official mnemonics (the 4-letter column) are those suggested in an initiative led by Matt Davies, the author of Odin assembler, editor and debugger tool for ZX Next.&lt;br /&gt;
* A relevant early source for this table could be [https://github.com/z88dk/z88dk/issues/312#issuecomment-322659205 a Christmas 2018 edit of a comment in a discussion of an issue 312 of z88dk].&lt;br /&gt;
&lt;br /&gt;
=== Notation ===&lt;br /&gt;
* In the descriptions &#039;&#039;any 8-bit register&#039;&#039; means A, B, C, D, E, H, and L. The registers named F, I and R aren&#039;t a part of this set even if they are technically 8 bit registers. Additionally, IXH, IXL, IYH, IYL, which are the high and low byte parts of IX and IY, can be used in some of the instructions as 8-bit registers although this wasn&#039;t documented for the original Z80.&lt;br /&gt;
* IXY means IX or IY.&lt;br /&gt;
* For the status field:&lt;br /&gt;
** S means Standard. It&#039;s in the Z80 manual. Everything should support it.&lt;br /&gt;
** U means Undocumented. It works on Z80 chips, but it&#039;s not in the manual. These have been known for years and were acknowledged by Zilog, so they should work on everything, but some assemblers may vary the syntax.&lt;br /&gt;
** E means Extension. It &#039;&#039;only&#039;&#039; works on the Z80 core on the Next. It&#039;ll probably only be accepted by assemblers that have been updated specifically for the Next.&lt;br /&gt;
* Each of the flag effects is documented as follows:&lt;br /&gt;
** - means the flag is unchanged.&lt;br /&gt;
** 1 or 0 mean the flag is set or reset as appropriate.&lt;br /&gt;
** ? means we don&#039;t know what effect the instruction has on the flag.&lt;br /&gt;
** ! means the instruction has an unusual effect on the flag which is documented in the description.&lt;br /&gt;
** S means the effect on the flag is &amp;quot;standard&amp;quot;. C is set if a carry/borrow occurred beyond the MSB; Z is set if the result of the operation is zero; H is set if a carry/borrow occurred beyond bit 3.&lt;br /&gt;
** P, V, and L are used for the P/V flag which has several standard effects. P means it&#039;s parity. V means it&#039;s overflow. L means it checks BC as loop counter for some of the block copy and search instructions: P/V = (BC != 0)&lt;br /&gt;
&lt;br /&gt;
=== Register and Data manipulation ===&lt;br /&gt;
;LD (LoaD)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, r&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||r := r&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r,n &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||7 ||r := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (HL) &amp;lt;/code&amp;gt;||Register ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||r := HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||S ||- ||- ||- ||- ||- ||- ||19 ||r := (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL),r &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||7 ||HL* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d),r &amp;lt;/code&amp;gt;||Indexed ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+D)* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL), n &amp;lt;/code&amp;gt;||Indirect ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||HL* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d), n &amp;lt;/code&amp;gt;||Indexed ||Immediate ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+d)* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (BC/DE) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||A := rr*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (nn) &amp;lt;/code&amp;gt;||Accumulator ||Address ||S ||- ||- ||- ||- ||- ||- ||13 ||A := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (BC/DE), A &amp;lt;/code&amp;gt;||Indirect ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||7 ||rr* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), A &amp;lt;/code&amp;gt;||Address ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||13 ||(nn)* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, I &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := I; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, R &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := R; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD I, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||I := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD R, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||R := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/HL/SP, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD IXY, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||14 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD HL, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||16 ||HL := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/SP/IXY, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||20 ||rr := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), HL &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||16 ||(nn)* := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), BC/DE/SP/IXY &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||20 ||(nn)* := rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||6 ||SP := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, IXY &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||10 ||SP := IXY&lt;br /&gt;
|}&lt;br /&gt;
:The basic data load/transfer instruction. Transfers data from the location specified by the second argument, to the location specified by the first. Available combinations are as follows:&lt;br /&gt;
:* Any 8-bit register can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of any other 8-bit register except I and R;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by HL;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory offset-indexed by IX or IY.&lt;br /&gt;
:* Additionally, the accumulator A (only) can be:&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by BC or DE;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address;&lt;br /&gt;
:** loaded with the contents of I or R.&lt;br /&gt;
:* Any 16-bit register pair can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address.&lt;br /&gt;
:* Additionally, SP (only) can be:&lt;br /&gt;
:** loaded with the contents of HL, IX, or IY.&lt;br /&gt;
:** The planned &#039;&#039;&#039;ld hl, sp&#039;&#039;&#039; didn&#039;t make it to Next yet, one possible workaround is: &#039;&#039;&#039;ld hl,0&#039;&#039;&#039;; &#039;&#039;&#039;add hl,sp&#039;&#039;&#039;;&lt;br /&gt;
:* Memory referred to by HL or through IX can be assigned immediate values.&lt;br /&gt;
:Although 16-bit register pairs cannot be directly moved between each other, they can be moved by moving the two 8-bit registers. (SP gets a special case because it can&#039;t be addressed via 8-bit registers.) Some assemblers will provide built-in macro instructions allowing, for example, &#039;&#039;&#039;ld bc, de&#039;&#039;&#039;.&lt;br /&gt;
:LD instructions do not alter any flags unless I or R are loaded into A.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EX (EXchange)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX DE, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(DE,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX AF, AF&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||! ||! ||! ||! ||! ||! ||4 ||swap(AF,AF&#039;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), HL &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||swap(SP*,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), IXY &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||23 ||swap(SP*,IXY)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges the contents of two sources. The only permitted combinations are&lt;br /&gt;
:* Exchanging DE and HL;&lt;br /&gt;
:* Exchanging AF and AF&#039;;&lt;br /&gt;
:* Exchanging HL, IX, or IY with the contents of memory pointed to by SP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EXX (EXchange all)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EXX &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(BC,BC&#039;);swap(DE,DE&#039;);swap(HL,HL&#039;)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges BC, DE, and HL with their shadow registers. AF and AF&#039; are not exchanged. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH BC/DE/HL/AF &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||15 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH nn &amp;lt;/code&amp;gt;||Immediate ||- ||E ||- ||- ||- ||- ||- ||- ||23 ||SP-=2; SP*:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Pushes the given argument on the stack. This can be any 16-bit register pair except SP. SP is reduced by 2 and then the argument is written to the new location SP points to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP BC/DE/HL &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP AF &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||! ||! ||! ||! ||! ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||rr:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Pops the given argument from the stack. This can be any 16-bit register pair except SP. The current value at SP is copied to the register pair and then SP is raised by 2.&lt;br /&gt;
:Popping into AF does set value of flag register F directly to low 8 bits of value from stack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Block Copy ===&lt;br /&gt;
;LDI (LoaD and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE++; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Copies the byte pointed to by HL to the address pointed to by DE, then adds 1 to DE and HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIR (LoaD and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||21x+16 ||do LDI while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops LDI until BC reaches zero. Note the last iteration starts when BC=1 and ends with BC=0 (starting the LDIR with BC=0 will start 64kiB transfer, most likely overwriting vital parts of system memory and/or code itself).&lt;br /&gt;
:Flag effects are the same as LDI except that P/V will always be reset, because BC by definition reaches 0 before this instruction ends (normally - unless something overwrites LDIR opcode while BC&amp;gt;0).&lt;br /&gt;
:Interrupts may interrupt LDIR instruction while looping (after each single LDI sub-part finished) and LDIR will resume after and finish loop properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDD (LoaD and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE--; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDI, but subtracts 1 from DE and HL instead of adding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDDR (LoaD and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||0 ||0 ||- ||- ||21x+16 ||do LDD while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDIR but loops LDD instead of LDI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDWS&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDWS &amp;lt;/code&amp;gt;||- ||- ||E ||- ||0 ||! ||S ||S ||S ||14 ||DE*:=HL*; INC L; INC D;&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcode. Copies the byte pointed to by HL to the address pointed to by DE and increments only L and D. This is used for vertically copying bytes to the Layer 2 display.&lt;br /&gt;
:The flags are identical to what the &#039;&#039;&#039;INC D&#039;&#039;&#039; instruction would produce.&lt;br /&gt;
:Note the source data are read only from single 256B (aligned) block of memory, because only L is incremented, not HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIX, LDIRX, LDDX, LDDRX&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL++; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDIX while(BC&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL--; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDDX while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcodes. Behave similarly as their non-X equivalents except the byte is not copied if it is equal to A and LDDX/LDDRX advance DE by incrementing it (like LDI), while HL is decremented (like LDD).&lt;br /&gt;
:Second difference to non-X instructions (as usual with next-only opcodes due to implementation), the extended ones don&#039;t modify any flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDPIRX &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDPIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do{t:=(HL&amp;amp;$FFF8+E&amp;amp;7)*; {if t!=A DE*:=t;} DE++; BC--}while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Similar to LDIRX except the source byte address is not just HL, but is obtained by using the top 13 bits of HL and the lower 3 bits of DE and HL does not increment during whole loop (HL works as base address of aligned 8 byte lookup table, DE works as destination and also wrapping index 0..7 into table). This is intended for &amp;quot;pattern fill&amp;quot; functionality.&lt;br /&gt;
&lt;br /&gt;
=== Block Search ===&lt;br /&gt;
;CPI (ComPare and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Compares the byte pointed to by HL with the contents of A and sets Z if it matches or S if the comparison goes negative. Then adds 1 to HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPIR (ComPare and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPI while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops CPI until either Z is set (A is found in the byte pointed to by HL) or P/V is reset (BC reached 0).&lt;br /&gt;
:Flag effects are the same as CPI except that one of the two terminating flag conditions will always be true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPD (ComPare and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPI, but subtracts 1 from HL instead of adding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPDR (ComPare and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPD while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPIR but loops CPD instead of CPI. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
;ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||11 ||HL+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD IXY, BC/DE/IXY/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||15 ||IXY+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, A &amp;lt;/code&amp;gt;||Register ||Register ||E ||? ||- ||- ||- ||- ||- ||8 ||rr+=unsigned A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||E ||- ||- ||- ||- ||- ||- ||16 ||rr+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together. Legal combinations are:&lt;br /&gt;
:* When adding 8-bit values the first parameter must be A and the second may be:&lt;br /&gt;
:** The contents of an 8-bit register;&lt;br /&gt;
:** An immediate value;&lt;br /&gt;
:** The contents of memory pointed to by HL or by indexing based on IX or IY.&lt;br /&gt;
:* When adding 16-bit values the first parameter must be HL, IX or IY and the second must be another 16-bit register pair. If the first parameter is IX or IY, the second cannot be HL or the other index register. &lt;br /&gt;
:* For 16 bit additions (regular Z80), H is set if a carry occurred in bit 11 (ie, a half carry in the high byte)&lt;br /&gt;
:* On the Spectrum Next the extended opcodes also allow the first parameter to be HL, DE, or BC and the second to be A (A will be zero extended to 16 bits) or an 16bit immediate value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;ADC (ADd with Carry)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||V ||! ||S ||S ||15 ||HL+=rr+(CF?1:0)&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together, adding an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of ADC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if carry from bit 11; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
;SUB&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A -= r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A -= (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts a value from A. Legal combinations are the same as for ADD for 8-bit, except that A does not need to be specified as the first parameter because subtraction can only be done from A. SUB cannot be used for 16-bit numbers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SBC (SuBtract with Carry, er, borrow)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=(r+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(n+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(HL*+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=((IXY+d)+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||1 ||V ||! ||S ||S ||15 ||HL-=(rr+(CF?1:0))&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts values, subtracting an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of SBC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if borrow from bit 12; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;AND, OR, XOR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||1 ||S ||S ||4 ||A := A &amp;amp; r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||1 ||S ||S ||19 ||A := A &amp;amp; (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A OR r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A OR (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A ^ r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A ^ (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Performs the appropriate bitwise operator on A. Legal combinations are the same as SUB. &lt;br /&gt;
&lt;br /&gt;
:XOR A is faster and shorter than LD A,0&lt;br /&gt;
&lt;br /&gt;
;MIRROR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MIRROR A &amp;lt;/code&amp;gt;||Register ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A[76543210]:=A[01234567]&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Mirrors (reverses the order) of bits in the accumulator. Older core versions supported MIRROR DE, but this was removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CP (ComPare)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=r?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=n?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=HL*?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=(IXY+d)?&lt;br /&gt;
|}&lt;br /&gt;
:Sets the flags as if a SUB was performed but does not perform it. Legal combinations are the same as SUB. This is commonly used to set the flags to perform an equality or greater/less test.&lt;br /&gt;
:* CP is &#039;&#039;not&#039;&#039; equivalent to &amp;quot;if&amp;quot; in high level languages. Flag based jumps can follow any instruction that sets the flags, not just CP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;TEST&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;TEST n &amp;lt;/code&amp;gt;||Immediate ||- ||E ||S ||? ||P ||S ||S ||S ||11 ||A&amp;amp;n?&lt;br /&gt;
|}&lt;br /&gt;
: Next extended opcode. Similar to CP, but performs an AND instead of a subtraction. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INC (INCrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||0 ||! ||S ||S ||S ||4 ||r++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||0 ||! ||S ||S ||S ||11 ||HL*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||0 ||! ||S ||S ||S ||23 ||(IXY+d)*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr++&lt;br /&gt;
|}&lt;br /&gt;
:Increments the target by one. The argument can be any 8-bit register, any 16-bit register pair, or the address pointed to by HL or indexed via IX or IY. P/V is set if the target held $7F. N is reset.&lt;br /&gt;
:* INC A is faster than ADD 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DEC (DECrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||1 ||! ||S ||S ||S ||4 ||r--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||1 ||! ||S ||S ||S ||11 ||HL*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||1 ||! ||S ||S ||S ||23 ||(IXY+D)*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr--&lt;br /&gt;
|}&lt;br /&gt;
:Decrements the target by one. Allowed arguments are the same as INC. Flag effects are the same as INC except H refers to borrow, not carry; and P/V is set if the target held $80.&lt;br /&gt;
:* DEC A is faster than SUB 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLC (Rotate Left Circular)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Rotates the target bitwise left by one position. The MSB is copied to bit 0, and also to Carry. Can be applied to any 8-bit register or to a location in memory pointed to by HL or indexed via IX or IY. The final alternative is undocumented, and stores the result in a register as well as performing the operation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RL (Rotate Left)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=CF; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC, except the MSB is copied to Carry only, and the previous contents of Carry are copied to bit 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRC, RR (Rotate Right Circular, Rotate Right)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=CF; CF:=x; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC and RL except they rotate right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLA (Shift Left Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RL except bit 0 is set to zero, not the previous contents of Carry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRA (Shift Right Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;gt;&amp;gt;1 OR r[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;gt;&amp;gt;1 OR HL*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1 OR (IXY+d)*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1 OR (IX+d)*[7]; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RR except the MSB is left unchanged (on the assumption that it&#039;s the sign bit), not replaced with the previous contents of Carry. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRL (Shift Right Logical)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||0 ||8 ||r:=unsigned(r)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||0 ||15 ||HL*:=unsigned(HL*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1; r:=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as SLA except it shifts right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLCA, RLA, RRCA, RRA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=CF; CF:=x&lt;br /&gt;
|}&lt;br /&gt;
:Same as their matching instruction except they work only on A, are faster, and do not alter S, Z or P/V.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLL (Shift Left Logical)&lt;br /&gt;
:This mnemonic has no associated opcode. There is no difference between a logical and arithmetic shift left, so both can use SLA, but some assemblers will allow SLL as an equivalent. Unfortunately, some will also assemble it as SL1. So it&#039;s probably worth just avoiding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SL1 or SLI (Shift Left and Add 1) or (Shift Left and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r &amp;lt;/code&amp;gt;||Register ||- ||U ||! ||0 ||P ||0 ||S ||S ||8 ||r:=(r&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||U ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=(HL*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1; r=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes that behave like SLA, but set bit 0 to 1 instead of 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLD (Rotate Left bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[0123]:=A[0123]; HL*[7654]:=x[0123]; A[0123]:=x[7654]  &lt;br /&gt;
|}&lt;br /&gt;
:Rotates the lower nibble of the byte pointed to by HL, the upper nibble of that byte, and the lower nibble of A, in that order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRD (Rotate Right bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[7654]:=A[0123]; HL*[0123]:=x[7654]; A[0123]:=x[0123]&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLD, but the order is: the lower nibble pointed to by HL, the lower nibble of the A, and the upper nibble of the byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Barrel (variable amount) shift and rotate (cores v2+ only)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSLA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=signed(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRL DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=unsigned(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRF DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=~(unsigned(~DE)&amp;gt;&amp;gt;(B&amp;amp;31)) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BRLC DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;15) OR DE&amp;gt;&amp;gt;(16-B&amp;amp;15) ||8&lt;br /&gt;
|}&lt;br /&gt;
:Shift instructions use only bits 4..0 of B, BSLA shifts DE left, BSRA/BSRL/BSRF shifts DE right in arithmetic/logical/fill-one way. BRLC rotates DE left by B places, uses only bits 3..0 of B (to rotate right, use B=16-places).&lt;br /&gt;
&lt;br /&gt;
If you are implementing BSRF in C (or similar), be careful with implicit variable type promotion. You will need to do something like this: DE:=~((uint16_t)~DE&amp;gt;&amp;gt;(B&amp;amp;31))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPL (ComPLement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPL &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||- ||1 ||- ||- ||4 ||A:=~A&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the contents of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEG (NEGate)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEG &amp;lt;/code&amp;gt;||- ||- ||S ||! ||1 ||! ||S ||S ||S ||8 ||A:=0-A&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts the contents of the accumulator from zero, making it negative for the purpose of two&#039;s complement. P/V is set if A previously held $80. C is set if accumulator did not previously hold $00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CCF (Complement Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CCF &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||! ||- ||- ||4 ||CF:=!CF&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the carry flag. (Does not, as might be assumed, clear it!) Also sets H to the previous value of the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SCF (Set Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SCF &amp;lt;/code&amp;gt;||- ||- ||S ||1 ||0 ||- ||0 ||- ||- ||4 ||CF:=1&lt;br /&gt;
|}&lt;br /&gt;
:Sets the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;BIT (test BIT)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||0 ||? ||1 ||! ||? ||8 ||r[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Indirect ||S ||- ||0 ||? ||1 ||! ||? ||12 ||HL*[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||0 ||? ||1 ||! ||? ||20 ||(IXY+d)*[b]==1?&lt;br /&gt;
|}&lt;br /&gt;
:Tests if a bit is set on target value. The first parameter states which bit. The second can be any 8-bit register, or the location in memory pointed to by HL or indexed by IX or IY. Sets Z if specified bit was 0. S and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SET (SET bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* OR (1&amp;lt;&amp;lt;b); r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SETAE &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=unsigned($80)&amp;gt;&amp;gt;(E&amp;amp;7)&lt;br /&gt;
|}&lt;br /&gt;
:Sets the numbered bit on target value. The possible targets are the same as BIT. The three parameter variant is undocumented and stores the result in a register as well as performing the SET.&lt;br /&gt;
:SETAE is a Next extended opcode which takes the bit number to set from E (only the low 3 bits) and sets whole A to value of that bit, but counted from top to bottom (E=0 will produce A:=$80, E=7 will produce A:=$01). This works as pixel mask for ULA bitmap modes, when E is 0..255 x-coordinate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RES (RESet bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b)); r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Resets the numbered bit on target value. The possible targets are the same as BIT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DAA (Decimal Adjust Accumulator)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DAA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||- ||P ||! ||S ||S ||8 ||if(A&amp;amp;$0F&amp;gt;$09 or HF) A±=$06; if(A&amp;amp;$F0&amp;gt;$90 or CF) A±=$60 (± depends on NF)&lt;br /&gt;
|}&lt;br /&gt;
:Modifies the contents of the accumulator based on the flags left by previous operation to correct for binary coded decimal (BCD).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;MUL (MULtiply)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MUL d,e &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||DE:=D*E&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Multiplies D by E, storing 16 bit result into DE. Does not alter any flags (the opcode is not compatible with any of the R800/Z180/eZ80/... variants of MUL, it is solely Next specific).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SWAPNIB (SWAP NIBbles)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SWAPNIB &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=A[3210]&amp;lt;&amp;lt;4 OR A[7654]&amp;gt;&amp;gt;4&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Swaps the high and low nibbles of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELAD (PIXEL ADdress)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELAD &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||HL:=$4000+((D&amp;amp;$C0)&amp;lt;&amp;lt;5)+((D&amp;amp;$07)&amp;lt;&amp;lt;8)+((D&amp;amp;$38)&amp;lt;&amp;lt;2)+(E&amp;gt;&amp;gt;3)&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Takes E and D as the X,Y coordinate of a point and calculates the address of the byte containing this pixel in the pixel area of standard ULA screen 0, storing it in HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELDN (PIXEL DowN)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELDN &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||if(HL&amp;amp;$0700!=$0700) HL+=256;&amp;lt;br&amp;gt;&lt;br /&gt;
else if(HL&amp;amp;$e0!=$e0) HL:=HL&amp;amp;$F8FF+$20;&amp;lt;br&amp;gt;&lt;br /&gt;
else HL:=HL&amp;amp;$F81F+$0800&lt;br /&gt;
|}&lt;br /&gt;
:Updates the address in HL to move down by one line of pixels.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
;JP (JumP)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (HL) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC:=HL (not PC:=HL*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (IXY) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||PC:=IXY (not PC:=IXY*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (C) &amp;lt;/code&amp;gt;||Register ||- ||E ||? ||? ||? ||? ||? ||? ||13 ||PC:=PC&amp;amp;$C000+IN(C)&amp;lt;&amp;lt;6&lt;br /&gt;
|}&lt;br /&gt;
:Jumps (sets the PC) to the given address. The address can be given immediately or read from HL, IX, or IY. Note that although the variants that use register pairs &#039;&#039;look&#039;&#039; like they are using indirect addressing, JP (HL) jumps to the address stored in the register HL, not the address stored at the address HL points to. The JP (C) sets bottom 14 bits of current PC&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; to value read from I/O port: PC[13:0] = (IN (C) &amp;lt;&amp;lt; 6) (can be used to execute code block read from a disk stream) * &amp;quot;current PC&amp;quot; is address of next instruction after JP (C), as the PC is advanced by fetching op code from memory and is already advanced when execution happens - if the JP instruction resides at the very end of 16k memory block (..FE or ..FF address), then newly composed PC value will land into following 16k block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JP cc (JumP conditionally)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP Z/NZ/NC/C/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||if cc PC:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Conditionally jumps (sets the PC) to the given address. The condition is set in terms of the flags: Zero (Z, NZ), Carry (C, NC), Parity (PO, PE), and Sign (P/M). The address can only be given immediately for a conditional jump.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JR (Jump Relative)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ||PC+=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR C/NC/Z/NZ, nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ;   7 if not cc ||if cc PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Jumps to an alternate address by &#039;&#039;adding&#039;&#039; the parameter to the PC - in other words the parameter is an adjustment, not an absolute address. When used in an assembler with labels the syntax should be the same as JP. The JR address can only be given immediately. Conditions are legal, but only those based on carry and zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DJNZ (Decrement reg. b and Jump if Not Zero)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DJNZ n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||13 ||B--; if B!=0 PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Decrements B then performs JR NZ.. to the given address. Used for encapsulating loops.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CALL&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ||SP-=2; SP*:=PC; PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL Z/NZ/C/NC/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ;   10 if not cc ||if cc {SP-=2; SP*:=PC; PC:=nn}&lt;br /&gt;
|}&lt;br /&gt;
:Like JP (including the ability to have conditions), but PUSHes the PC before jumping. Used for subroutine calls. &lt;br /&gt;
:* If a subroutine ends with a CALL to another subroutine immediately before the RET, it is more efficient to JP to the other subroutine and allow its RET to return from the whole combination. This might make high-level programmers queasy but your compiler already does it (tail call optimization)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RET (RETurn)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET Z/NZ/C/NC/PO/PE/P/M &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||11 ;   5 if not cc ||if cc {PC:=SP*; SP+=2}&lt;br /&gt;
|}&lt;br /&gt;
:POPs the PC from the stack, returning from a previous CALL. This can also accept the same conditions as JP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETI (RETurn from Interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from an interrupt service routine (same as RET instruction, but also does signal to I/O device that the interrupt routine is completed).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETN (RETurn from Non-maskable interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETN &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||IFF1:=IFF2; PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from a non-maskable interrupt service routine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RST (ReSTart)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RST n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||CALL n&lt;br /&gt;
|}&lt;br /&gt;
:Performs a CALL to a routine located at one of eight fixed locations ($00, $08, ..., $38) in the zero page. This is located in ROM, and on the Spectrum only a limited number of values are useful to call built-in ROM routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOP (No OPeration)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NOP &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC+=1&lt;br /&gt;
|}&lt;br /&gt;
:Does &amp;quot;nothing&amp;quot; (just usual housekeeping like refreshing memory and advancing program counter to next instruction).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;HALT&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HALT &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||waits for interrupt&lt;br /&gt;
|}&lt;br /&gt;
:Suspends the CPU until an interrupt is received (maskable interrupts must be enabled to break the wait). While CPU is waiting for interrupt, the fake NOP instruction is being executed, to keep memory refresh going on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DI (Disable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=0; IFF2:=0&lt;br /&gt;
|}&lt;br /&gt;
:Disables maskable interrupts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EI (Enable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=1; IFF2:=1&lt;br /&gt;
|}&lt;br /&gt;
:Enables maskable interrupts (after next instruction, i.e. for example &amp;quot;EI RET&amp;quot; - the interrupt may happen only after RET instruction is finished (or &amp;quot;EI DI&amp;quot; pair of instructions will not allow any maskable interrupt to happen).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IM (Interrupt Mode)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IM n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||Interrupt mode:=n&lt;br /&gt;
|}&lt;br /&gt;
:Sets interrupt handling mode. The default for Next is 1. 2 is used for user defined interrupt service routines. IM 0 is useless on Next (and pretty much everything else, to be honest)&lt;br /&gt;
&lt;br /&gt;
=== Input and Output ===&lt;br /&gt;
;IN r, (c); OUT (c), r&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN r, (c) &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||0 ||P ||0 ||S ||S ||12 ||r := in(BC)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),r &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||12 ||out(BC,r)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs a byte value from the 16-bit port number given in BC. R can be any 8-bit register. Note that the port number is given in BC even though the instruction refers only to C. Some assemblers will allow the instruction to be written with &amp;quot;(bc)&amp;quot; instead of &amp;quot;(c)&amp;quot; as a reminder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN (c); OUT (c), 0&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN (c) &amp;lt;/code&amp;gt;||Register ||- ||U ||- ||0 ||P ||0 ||S ||S ||12 ||in(BC)?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),0 &amp;lt;/code&amp;gt;||Register ||Immediate ||U ||- ||- ||- ||- ||- ||- ||12 ||out(BC,0)&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes. The IN variation performs an input, but does not store the result, only setting the flags. The OUT variation outputs 0 on the port. This is the only number that can be output to a port in immediate mode. The Next FPGA does output zero, but some Z80 chips manufactured differently from early batches output different value like 255, so it is not recommended to use OUT (C),0 if you want to reuse your code also on classic ZX Spectrum or publish it as example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN a, (n); OUT (n), a&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN A, (n) &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||- ||- ||- ||- ||- ||- ||11 ||A := in(An)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (n),A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||11 ||out(An,A)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs the byte value in A from a 16-bit port number where the lower byte is N and the upper byte is A. This is only likely to be useful in cases where the upper byte of the port number is not relevant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INI (INput and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL++; B--&lt;br /&gt;
|}&lt;br /&gt;
:Inputs a value from port BC into memory at the address stored in HL, then increments HL and decrements B. Because B is decremented and is part of the port number, the port number for future INI instructions will change unless it is reset. Z is set if B reached 0; C, S, H, and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INIR (INput and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do INI while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Loops INIR until B reaches 0, so that if INIR starts with B=0 it loops 256 times. Because B is decremented during this process and is part of the port number, this is unlikely to be useful except when the upper byte of the port number is not relevant. Interrupts are recognized during execution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IND, INDR (INput and Decrement, INput and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IND &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL--; B--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do IND while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI and INIR except that HL is decremented instead of incremented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTI (Out and Increment), OTIR (Out and Increment Repeated), OUTD (Out and Decrement), OTDR (Out and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTI while (B&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTD &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTD while (B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI, INIR, IND, INDR except that they output instead of input and B is decremented &#039;&#039;&#039;before&#039;&#039;&#039; the output instead of after. Condition check on B is performed &#039;&#039;&#039;after&#039;&#039;&#039;, so that if OTIR starts with B=0 it loops 256 times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTINB (Out and Increment with No B)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTINB &amp;lt;/code&amp;gt;||- ||- ||E ||? ||? ||? ||? ||? ||? ||16 ||out(BC,HL*); HL++&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Behaves like OUTI, but doesn&#039;t decrement B.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEXTREG&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n,n&#039; &amp;lt;/code&amp;gt;||Immediate ||Immediate ||E ||- ||- ||- ||- ||- ||- ||20 ||HwNextReg_n:=n&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n, A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||E ||- ||- ||- ||- ||- ||- ||17 ||HwNextReg_n:=A&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Directly sets the [[Board feature control|Next Feature Control Registers]] without going through ports [[TBBlue_Register_Select]] and [[TBBlue Register Access]].&lt;br /&gt;
&lt;br /&gt;
=== A note on some Z80-N specific observations ===&lt;br /&gt;
2021-09-16: figuring out the hard way, the three Z80N instructions `ADD HL/DE/BC,A` actually do NOT preserve carry flag, but change it to undefined value (verified with core 3.1.5). There&#039;s also strong suspicion (but not verified yet), that LDIX/LDDX/LDIRX/LDDRX/LDPIRX do affects flags the same way as LDI/LDIR - to be verified.&lt;br /&gt;
&lt;br /&gt;
2025-01-25: Testing 3.02.x 1) &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt; affect the flags similarly to &amp;lt;code&amp;gt;LDI&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDD&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LDDR&amp;lt;/code&amp;gt;. 2) &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt; most probably always reset the carry flag.&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
&lt;br /&gt;
This section lists the changes of the specification of the behavior of Z80N instructions, compared to the previous content of this wiki page.&lt;br /&gt;
&lt;br /&gt;
2022-01-11: The previous versions of this page didn&#039;t match what was [http://www.z80.info/zip/z80-documented.pdf documented] for several years, that regular Z80 INI/IND/INIR/INDR/OUTI/OUTD/OTIR/OTDR instructions do modify carry flag (contrary to the official Z80 documentation and many Internet resources describing Z80 instructions).&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41133</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41133"/>
		<updated>2025-10-07T14:34:30Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: linkify known bugs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===== WARNING: =====&lt;br /&gt;
&lt;br /&gt;
The current Next emulators are work-in-progress, missing several features of real HW Next, and emulating other features in less than cycle-accurate way (which become a &amp;quot;norm&amp;quot; for classic ZX Spectrum after two decades of emulators development). The differences in results between real Next and CSpect or ZEsarUX are to be expected - as a developer test your SW also with real HW to find any problems early. It may also help to read the known-bugs pages to have some rough idea what works and how accurately. There&#039;re also multiple test-suites and free games and demos which you can try to go through and compare the emulator output with real machine, to get familiar with the differences and adjust your workflow and expectations.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also make sure to explore the command line options and configuration of each emulator, as there are multiple ways how to run them with different fidelity of emulation. When in doubt, you are welcome to join the official ZX Spectrum Next discord chat and ask for help at #emulator-help channel.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently the most UI and performance friendly emulator seems to be #CSpect, the most features/accurate emulation of core3.1.5 (but far from perfect) has ZESERUse (fork of ZEsarUX).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Name||Author||Url||Known bugs||Description||OS||Source&lt;br /&gt;
|-&lt;br /&gt;
|CSpect||Mike Dailly||https://mdf200.itch.io/cspect||[[CSpect:known bugs]]||Emulates many features of the Next and includes a fully featured debugger, complete with 24bit breakpoints and an assembler||Windows(mac/linux mostlyworks through mono)||N&lt;br /&gt;
|-&lt;br /&gt;
|ZEsarUX||César Hernández Bañó||https://github.com/chernandezba/zesarux/releases Source: https://github.com/chernandezba/zesarux||[[ZEsarUX:known bugs]]||A full feature emulator including a debugger - sometimes updated to support Next (TBBlue)||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZESERUse||César Hernández Bañó + Peter Helcmanovsky||Source: https://github.com/ped7g/zesarux/tree/tbblue_small_fixes2||[[ZESERUse:known bugs]]||Currently most complete core3.1.5 emulation based on ZEsarUX 8.2 version (for windows executable check official Next discord or build it yourself - make sure you are building the &amp;quot;tbblue_small_fixes2&amp;quot; branch).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZENext||César Hernández Bañó + Garry Lancaster||https://gitlab.com/garrylancaster/zenext|| |||ZX Next-only fork of ZEsarUX emulating most of the core 3.1.10 features to make it run NextZXOS 2.07 (missing some features like CTC timers).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|Zeus||Design Design||http://www.desdes.com/products/oldfiles/zeus.htm|| || A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.||Windows||N&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41132</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41132"/>
		<updated>2025-10-07T14:30:23Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: remove emulatorlisttop&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
===== WARNING: =====&lt;br /&gt;
&lt;br /&gt;
The current Next emulators are work-in-progress, missing several features of real HW Next, and emulating other features in less than cycle-accurate way (which become a &amp;quot;norm&amp;quot; for classic ZX Spectrum after two decades of emulators development). The differences in results between real Next and CSpect or ZEsarUX are to be expected - as a developer test your SW also with real HW to find any problems early. It may also help to read the known-bugs pages to have some rough idea what works and how accurately. There&#039;re also multiple test-suites and free games and demos which you can try to go through and compare the emulator output with real machine, to get familiar with the differences and adjust your workflow and expectations.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also make sure to explore the command line options and configuration of each emulator, as there are multiple ways how to run them with different fidelity of emulation. When in doubt, you are welcome to join the official ZX Spectrum Next discord chat and ask for help at #emulator-help channel.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently the most UI and performance friendly emulator seems to be #CSpect, the most features/accurate emulation of core3.1.5 (but far from perfect) has ZESERUse (fork of ZEsarUX).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Name||Author||Url||Known bugs||Description||OS||Source&lt;br /&gt;
|-&lt;br /&gt;
|CSpect||Mike Dailly||https://mdf200.itch.io/cspect||CSpect:known bugs||Emulates many features of the Next and includes a fully featured debugger, complete with 24bit breakpoints and an assembler||Windows(mac/linux mostlyworks through mono)||N&lt;br /&gt;
|-&lt;br /&gt;
|ZEsarUX||César Hernández Bañó||https://github.com/chernandezba/zesarux/releases Source: https://github.com/chernandezba/zesarux||ZEsarUX:known bugs||A full feature emulator including a debugger - sometimes updated to support Next (TBBlue)||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZESERUse||César Hernández Bañó + Peter Helcmanovsky||Source: https://github.com/ped7g/zesarux/tree/tbblue_small_fixes2||ZESERUse:known bugs||Currently most complete core3.1.5 emulation based on ZEsarUX 8.2 version (for windows executable check official Next discord or build it yourself - make sure you are building the &amp;quot;tbblue_small_fixes2&amp;quot; branch).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZENext||César Hernández Bañó + Garry Lancaster||https://gitlab.com/garrylancaster/zenext|| |||ZX Next-only fork of ZEsarUX emulating most of the core 3.1.10 features to make it run NextZXOS 2.07 (missing some features like CTC timers).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|Zeus||Design Design||http://www.desdes.com/products/oldfiles/zeus.htm|| || A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.||Windows||N&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41131</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41131"/>
		<updated>2025-10-07T14:28:56Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: couple empty cells&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{EmulatorListTop}}&lt;br /&gt;
&lt;br /&gt;
===== WARNING: =====&lt;br /&gt;
&lt;br /&gt;
The current Next emulators are work-in-progress, missing several features of real HW Next, and emulating other features in less than cycle-accurate way (which become a &amp;quot;norm&amp;quot; for classic ZX Spectrum after two decades of emulators development). The differences in results between real Next and CSpect or ZEsarUX are to be expected - as a developer test your SW also with real HW to find any problems early. It may also help to read the known-bugs pages to have some rough idea what works and how accurately. There&#039;re also multiple test-suites and free games and demos which you can try to go through and compare the emulator output with real machine, to get familiar with the differences and adjust your workflow and expectations.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also make sure to explore the command line options and configuration of each emulator, as there are multiple ways how to run them with different fidelity of emulation. When in doubt, you are welcome to join the official ZX Spectrum Next discord chat and ask for help at #emulator-help channel.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently the most UI and performance friendly emulator seems to be #CSpect, the most features/accurate emulation of core3.1.5 (but far from perfect) has ZESERUse (fork of ZEsarUX).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Name||Author||Url||Known bugs||Description||OS||Source&lt;br /&gt;
|-&lt;br /&gt;
|CSpect||Mike Dailly||https://mdf200.itch.io/cspect||CSpect:known bugs||Emulates many features of the Next and includes a fully featured debugger, complete with 24bit breakpoints and an assembler||Windows(mac/linux mostlyworks through mono)||N&lt;br /&gt;
|-&lt;br /&gt;
|ZEsarUX||César Hernández Bañó||https://github.com/chernandezba/zesarux/releases Source: https://github.com/chernandezba/zesarux||ZEsarUX:known bugs||A full feature emulator including a debugger - sometimes updated to support Next (TBBlue)||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZESERUse||César Hernández Bañó + Peter Helcmanovsky||Source: https://github.com/ped7g/zesarux/tree/tbblue_small_fixes2||ZESERUse:known bugs||Currently most complete core3.1.5 emulation based on ZEsarUX 8.2 version (for windows executable check official Next discord or build it yourself - make sure you are building the &amp;quot;tbblue_small_fixes2&amp;quot; branch).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZENext||César Hernández Bañó + Garry Lancaster||https://gitlab.com/garrylancaster/zenext|| |||ZX Next-only fork of ZEsarUX emulating most of the core 3.1.10 features to make it run NextZXOS 2.07 (missing some features like CTC timers).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|Zeus||Design Design||http://www.desdes.com/products/oldfiles/zeus.htm|| || A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.||Windows||N&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41130</id>
		<title>Emulators</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Emulators&amp;diff=41130"/>
		<updated>2025-10-07T12:53:25Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: rebuilt tables&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{EmulatorListTop}}&lt;br /&gt;
&lt;br /&gt;
===== WARNING: =====&lt;br /&gt;
&lt;br /&gt;
The current Next emulators are work-in-progress, missing several features of real HW Next, and emulating other features in less than cycle-accurate way (which become a &amp;quot;norm&amp;quot; for classic ZX Spectrum after two decades of emulators development). The differences in results between real Next and CSpect or ZEsarUX are to be expected - as a developer test your SW also with real HW to find any problems early. It may also help to read the known-bugs pages to have some rough idea what works and how accurately. There&#039;re also multiple test-suites and free games and demos which you can try to go through and compare the emulator output with real machine, to get familiar with the differences and adjust your workflow and expectations.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also make sure to explore the command line options and configuration of each emulator, as there are multiple ways how to run them with different fidelity of emulation. When in doubt, you are welcome to join the official ZX Spectrum Next discord chat and ask for help at #emulator-help channel.&lt;br /&gt;
&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Currently the most UI and performance friendly emulator seems to be #CSpect, the most features/accurate emulation of core3.1.5 (but far from perfect) has ZESERUse (fork of ZEsarUX).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Name||Author||Url||Known bugs||Description||OS||Source&lt;br /&gt;
|-&lt;br /&gt;
|CSpect||Mike Dailly||https://mdf200.itch.io/cspect||CSpect:known bugs||Emulates many features of the Next and includes a fully featured debugger, complete with 24bit breakpoints and an assembler||Windows(mac/linux mostlyworks through mono)||N&lt;br /&gt;
|-&lt;br /&gt;
|ZEsarUX||César Hernández Bañó||https://github.com/chernandezba/zesarux/releases Source: https://github.com/chernandezba/zesarux||ZEsarUX:known bugs||A full feature emulator including a debugger - sometimes updated to support Next (TBBlue)||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZESERUse||César Hernández Bañó + Peter Helcmanovsky||Source: https://github.com/ped7g/zesarux/tree/tbblue_small_fixes2||ZESERUse:known bugs||Currently most complete core3.1.5 emulation based on ZEsarUX 8.2 version (for windows executable check official Next discord or build it yourself - make sure you are building the &amp;quot;tbblue_small_fixes2&amp;quot; branch).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|ZENext||César Hernández Bañó + Garry Lancaster||https://gitlab.com/garrylancaster/zenext||ZX Next-only fork of ZEsarUX emulating most of the core 3.1.10 features to make it run NextZXOS 2.07 (missing some features like CTC timers).||Any||Y&lt;br /&gt;
|-&lt;br /&gt;
|Zeus||Design Design||http://www.desdes.com/products/oldfiles/zeus.htm||A PC cross-assembler which includes a Z80 emulator, which can emulate the ZX Spectrum 48K/128K hardware.||Windows||N&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41129</id>
		<title>Extended Z80 instruction set</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41129"/>
		<updated>2025-10-07T12:18:11Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: remove one }}&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a general list of Z80 and Z80N instructions with descriptions. The instructions specific to Z80N have the [[#Z80N_instructions_opcodes|encodings described first]].&lt;br /&gt;
&lt;br /&gt;
For a table of summaries without additional descriptions see the [[Z80 Instruction Table]]. There&#039;s also a [[Special:RunQuery/OpcodeQuery|special search for opcodes in the same table]] and an external [https://table.specnext.dev/ Z80N opcode value matrix on specnext.dev].&lt;br /&gt;
&lt;br /&gt;
=== Z80N instructions opcodes ===&lt;br /&gt;
&lt;br /&gt;
This is a table of the instructions and the encodings of all &#039;&#039;&#039;Next-specific&#039;&#039;&#039; Z80 instructions:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Instruction !!data-sort-type=&amp;quot;text&amp;quot;| Encoding (2-4 bytes) (hex) !! T-States !! Description !! 4 letter&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;SWAPNIB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 23&amp;lt;/code&amp;gt;  || 8 || Swap the nibbles (4-bits) of A || SWAP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;MIRROR A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 24&amp;lt;/code&amp;gt;  || 8  || Mirror bits 0..7 to 7..0 of A || MIRR&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;TEST $im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 27&amp;lt;/code&amp;gt; value  || 11 || Change flags as AND A but A stays unaffected ||style=&amp;quot;color:DarkGrey;&amp;quot;|  TEST&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSLA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 28&amp;lt;/code&amp;gt;  || 8  || Shift left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSLA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 29&amp;lt;/code&amp;gt;  || 8  || Shift right signed DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRL DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2A&amp;lt;/code&amp;gt;  || 8  || Shift right DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRF DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2B&amp;lt;/code&amp;gt;  || 8  || Shift right DE, filling 1 for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRF&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BRLC DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2C&amp;lt;/code&amp;gt;  || 8  || Rotate left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BRLC&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;MUL D,E&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 30&amp;lt;/code&amp;gt;  || 8  || Multiply D with E, result in DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  MUL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 31&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 32&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 33&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 34 low high&amp;lt;/code&amp;gt;   || 16  || Add a constant to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 35 low high&amp;lt;/code&amp;gt;  || 16   || Add a constant to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 36 low high&amp;lt;/code&amp;gt;  || 16  || Add a constant to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 8A  high low&amp;lt;/code&amp;gt;  || 23  || Push a constant ||style=&amp;quot;color:DarkGrey;&amp;quot;|  PUSH&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;OUTINB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 90&amp;lt;/code&amp;gt;  || 16  || OUTI, but don&#039;t change B || OTIB&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,$im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 91 register value&amp;lt;/code&amp;gt;  || 20  || Write v to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 92 register&amp;lt;/code&amp;gt; || 17  || Write A to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELDN&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 93&amp;lt;/code&amp;gt;  || 8  || HL as a pixel address moved one line down || PXDN&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELAD&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 94&amp;lt;/code&amp;gt;  || 8  || HL := as ULA pixel address from D==Y E==X || PXAD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;SETAE&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 95&amp;lt;/code&amp;gt;  || 8  || Get A as a mask for ULA pixel from E || STAE&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;JP (C)&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 98&amp;lt;/code&amp;gt;  || 13  || IN (C) then jump to a 64 byte section ||style=&amp;quot;color:DarkGrey;&amp;quot;|  JP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A4&amp;lt;/code&amp;gt;  || 16  || Extended LDI byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDIX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDWS&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A5&amp;lt;/code&amp;gt;  || 14  || Byte copy as for Layer 2 ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDWS&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED AC&amp;lt;/code&amp;gt;  || 16  || Extended LDD byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDDX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B4&amp;lt;/code&amp;gt;  || 21/16  || Extended LDIR || LIRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDPIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B7&amp;lt;/code&amp;gt;  || 21/16  || Byte copy as for a pattern fill || LPRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED BC&amp;lt;/code&amp;gt;  || 21/16  || Extended LDDR || LDRX&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
More details and the explanations of all Z80 instructions implemented in the Next Z80 CPU follow.&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
&lt;br /&gt;
* The encoding of the operand of the &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt; is unique: it is the only operand encoded as big-endian.&lt;br /&gt;
* The timings (T-States) are based on some limited testing and may not be accurate.&lt;br /&gt;
* The shorter aliases of the official mnemonics (the 4-letter column) are those suggested in an initiative led by Matt Davies, the author of Odin assembler, editor and debugger tool for ZX Next.&lt;br /&gt;
* A relevant early source for this table could be [https://github.com/z88dk/z88dk/issues/312#issuecomment-322659205 a Christmas 2018 edit of a comment in a discussion of an issue 312 of z88dk].&lt;br /&gt;
&lt;br /&gt;
=== Notation ===&lt;br /&gt;
* In the descriptions &#039;&#039;any 8-bit register&#039;&#039; means A, B, C, D, E, H, and L. The registers named F, I and R aren&#039;t a part of this set even if they are technically 8 bit registers. Additionally, IXH, IXL, IYH, IYL, which are the high and low byte parts of IX and IY, can be used in some of the instructions as 8-bit registers although this wasn&#039;t documented for the original Z80.&lt;br /&gt;
* IXY means IX or IY.&lt;br /&gt;
* For the status field:&lt;br /&gt;
** S means Standard. It&#039;s in the Z80 manual. Everything should support it.&lt;br /&gt;
** U means Undocumented. It works on Z80 chips, but it&#039;s not in the manual. These have been known for years and were acknowledged by Zilog, so they should work on everything, but some assemblers may vary the syntax.&lt;br /&gt;
** E means Extension. It &#039;&#039;only&#039;&#039; works on the Z80 core on the Next. It&#039;ll probably only be accepted by assemblers that have been updated specifically for the Next.&lt;br /&gt;
* Each of the flag effects is documented as follows:&lt;br /&gt;
** - means the flag is unchanged.&lt;br /&gt;
** 1 or 0 mean the flag is set or reset as appropriate.&lt;br /&gt;
** ? means we don&#039;t know what effect the instruction has on the flag.&lt;br /&gt;
** ! means the instruction has an unusual effect on the flag which is documented in the description.&lt;br /&gt;
** S means the effect on the flag is &amp;quot;standard&amp;quot;. C is set if a carry/borrow occurred beyond the MSB; Z is set if the result of the operation is zero; H is set if a carry/borrow occurred beyond bit 3.&lt;br /&gt;
** P, V, and L are used for the P/V flag which has several standard effects. P means it&#039;s parity. V means it&#039;s overflow. L means it checks BC as loop counter for some of the block copy and search instructions: P/V = (BC != 0)&lt;br /&gt;
&lt;br /&gt;
=== Register and Data manipulation ===&lt;br /&gt;
;LD (LoaD)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, r&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||r := r&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r,n &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||7 ||r := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (HL) &amp;lt;/code&amp;gt;||Register ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||r := HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||S ||- ||- ||- ||- ||- ||- ||19 ||r := (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL),r &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||7 ||HL* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d),r &amp;lt;/code&amp;gt;||Indexed ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+D)* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL), n &amp;lt;/code&amp;gt;||Indirect ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||HL* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d), n &amp;lt;/code&amp;gt;||Indexed ||Immediate ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+d)* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (BC/DE) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||A := rr*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (nn) &amp;lt;/code&amp;gt;||Accumulator ||Address ||S ||- ||- ||- ||- ||- ||- ||13 ||A := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (BC/DE), A &amp;lt;/code&amp;gt;||Indirect ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||7 ||rr* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), A &amp;lt;/code&amp;gt;||Address ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||13 ||(nn)* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, I &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := I; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, R &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := R; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD I, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||I := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD R, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||R := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/HL/SP, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD IXY, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||14 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD HL, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||16 ||HL := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/SP/IXY, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||20 ||rr := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), HL &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||16 ||(nn)* := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), BC/DE/SP/IXY &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||20 ||(nn)* := rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||6 ||SP := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, IXY &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||10 ||SP := IXY&lt;br /&gt;
|}&lt;br /&gt;
:The basic data load/transfer instruction. Transfers data from the location specified by the second argument, to the location specified by the first. Available combinations are as follows:&lt;br /&gt;
:* Any 8-bit register can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of any other 8-bit register except I and R;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by HL;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory offset-indexed by IX or IY.&lt;br /&gt;
:* Additionally, the accumulator A (only) can be:&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by BC or DE;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address;&lt;br /&gt;
:** loaded with the contents of I or R.&lt;br /&gt;
:* Any 16-bit register pair can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address.&lt;br /&gt;
:* Additionally, SP (only) can be:&lt;br /&gt;
:** loaded with the contents of HL, IX, or IY.&lt;br /&gt;
:** The planned &#039;&#039;&#039;ld hl, sp&#039;&#039;&#039; didn&#039;t make it to Next yet, one possible workaround is: &#039;&#039;&#039;ld hl,0&#039;&#039;&#039;; &#039;&#039;&#039;add hl,sp&#039;&#039;&#039;;&lt;br /&gt;
:* Memory referred to by HL or through IX can be assigned immediate values.&lt;br /&gt;
:Although 16-bit register pairs cannot be directly moved between each other, they can be moved by moving the two 8-bit registers. (SP gets a special case because it can&#039;t be addressed via 8-bit registers.) Some assemblers will provide built-in macro instructions allowing, for example, &#039;&#039;&#039;ld bc, de&#039;&#039;&#039;.&lt;br /&gt;
:LD instructions do not alter any flags unless I or R are loaded into A.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EX (EXchange)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX DE, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(DE,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX AF, AF&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||! ||! ||! ||! ||! ||! ||4 ||swap(AF,AF&#039;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), HL &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||swap(SP*,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), IXY &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||23 ||swap(SP*,IXY)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges the contents of two sources. The only permitted combinations are&lt;br /&gt;
:* Exchanging DE and HL;&lt;br /&gt;
:* Exchanging AF and AF&#039;;&lt;br /&gt;
:* Exchanging HL, IX, or IY with the contents of memory pointed to by SP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EXX (EXchange all)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EXX &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(BC,BC&#039;);swap(DE,DE&#039;);swap(HL,HL&#039;)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges BC, DE, and HL with their shadow registers. AF and AF&#039; are not exchanged. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH BC/DE/HL/AF &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||15 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH nn &amp;lt;/code&amp;gt;||Immediate ||- ||E ||- ||- ||- ||- ||- ||- ||23 ||SP-=2; SP*:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Pushes the given argument on the stack. This can be any 16-bit register pair except SP. SP is reduced by 2 and then the argument is written to the new location SP points to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP BC/DE/HL &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP AF &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||! ||! ||! ||! ||! ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||rr:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Pops the given argument from the stack. This can be any 16-bit register pair except SP. The current value at SP is copied to the register pair and then SP is raised by 2.&lt;br /&gt;
:Popping into AF does set value of flag register F directly to low 8 bits of value from stack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Block Copy ===&lt;br /&gt;
;LDI (LoaD and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE++; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Copies the byte pointed to by HL to the address pointed to by DE, then adds 1 to DE and HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIR (LoaD and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||21x+16 ||do LDI while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops LDI until BC reaches zero. Note the last iteration starts when BC=1 and ends with BC=0 (starting the LDIR with BC=0 will start 64kiB transfer, most likely overwriting vital parts of system memory and/or code itself).&lt;br /&gt;
:Flag effects are the same as LDI except that P/V will always be reset, because BC by definition reaches 0 before this instruction ends (normally - unless something overwrites LDIR opcode while BC&amp;gt;0).&lt;br /&gt;
:Interrupts may interrupt LDIR instruction while looping (after each single LDI sub-part finished) and LDIR will resume after and finish loop properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDD (LoaD and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE--; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDI, but subtracts 1 from DE and HL instead of adding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDDR (LoaD and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||0 ||0 ||- ||- ||21x+16 ||do LDD while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDIR but loops LDD instead of LDI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDWS&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDWS &amp;lt;/code&amp;gt;||- ||- ||E ||- ||0 ||! ||S ||S ||S ||14 ||DE*:=HL*; INC L; INC D;&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcode. Copies the byte pointed to by HL to the address pointed to by DE and increments only L and D. This is used for vertically copying bytes to the Layer 2 display.&lt;br /&gt;
:The flags are identical to what the &#039;&#039;&#039;INC D&#039;&#039;&#039; instruction would produce.&lt;br /&gt;
:Note the source data are read only from single 256B (aligned) block of memory, because only L is incremented, not HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIX, LDIRX, LDDX, LDDRX&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL++; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDIX while(BC&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL--; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDDX while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcodes. Behave similarly as their non-X equivalents except the byte is not copied if it is equal to A and LDDX/LDDRX advance DE by incrementing it (like LDI), while HL is decremented (like LDD).&lt;br /&gt;
:Second difference to non-X instructions (as usual with next-only opcodes due to implementation), the extended ones don&#039;t modify any flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDPIRX &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDPIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do{t:=(HL&amp;amp;$FFF8+E&amp;amp;7)*; {if t!=A DE*:=t;} DE++; BC--}while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Similar to LDIRX except the source byte address is not just HL, but is obtained by using the top 13 bits of HL and the lower 3 bits of DE and HL does not increment during whole loop (HL works as base address of aligned 8 byte lookup table, DE works as destination and also wrapping index 0..7 into table). This is intended for &amp;quot;pattern fill&amp;quot; functionality.&lt;br /&gt;
&lt;br /&gt;
=== Block Search ===&lt;br /&gt;
;CPI (ComPare and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Compares the byte pointed to by HL with the contents of A and sets Z if it matches or S if the comparison goes negative. Then adds 1 to HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPIR (ComPare and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPI while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops CPI until either Z is set (A is found in the byte pointed to by HL) or P/V is reset (BC reached 0).&lt;br /&gt;
:Flag effects are the same as CPI except that one of the two terminating flag conditions will always be true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPD (ComPare and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPI, but subtracts 1 from HL instead of adding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPDR (ComPare and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPD while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPIR but loops CPD instead of CPI. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
;ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||11 ||HL+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD IXY, BC/DE/IXY/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||15 ||IXY+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, A &amp;lt;/code&amp;gt;||Register ||Register ||E ||? ||- ||- ||- ||- ||- ||8 ||rr+=unsigned A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||E ||- ||- ||- ||- ||- ||- ||16 ||rr+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together. Legal combinations are:&lt;br /&gt;
:* When adding 8-bit values the first parameter must be A and the second may be:&lt;br /&gt;
:** The contents of an 8-bit register;&lt;br /&gt;
:** An immediate value;&lt;br /&gt;
:** The contents of memory pointed to by HL or by indexing based on IX or IY.&lt;br /&gt;
:* When adding 16-bit values the first parameter must be HL, IX or IY and the second must be another 16-bit register pair. If the first parameter is IX or IY, the second cannot be HL or the other index register. &lt;br /&gt;
:* For 16 bit additions (regular Z80), H is set if a carry occurred in bit 11 (ie, a half carry in the high byte)&lt;br /&gt;
:* On the Spectrum Next the extended opcodes also allow the first parameter to be HL, DE, or BC and the second to be A (A will be zero extended to 16 bits) or an 16bit immediate value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;ADC (ADd with Carry)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||V ||! ||S ||S ||15 ||HL+=rr+(CF?1:0)&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together, adding an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of ADC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if carry from bit 11; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
;SUB&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A -= r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A -= (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts a value from A. Legal combinations are the same as for ADD for 8-bit, except that A does not need to be specified as the first parameter because subtraction can only be done from A. SUB cannot be used for 16-bit numbers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SBC (SuBtract with Carry, er, borrow)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=(r+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(n+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(HL*+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=((IXY+d)+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||1 ||V ||! ||S ||S ||15 ||HL-=(rr+(CF?1:0))&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts values, subtracting an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of SBC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if borrow from bit 12; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;AND, OR, XOR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||1 ||S ||S ||4 ||A := A &amp;amp; r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||1 ||S ||S ||19 ||A := A &amp;amp; (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A OR r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A OR (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A ^ r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A ^ (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Performs the appropriate bitwise operator on A. Legal combinations are the same as SUB. &lt;br /&gt;
&lt;br /&gt;
:XOR A is faster and shorter than LD A,0&lt;br /&gt;
&lt;br /&gt;
;MIRROR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MIRROR A &amp;lt;/code&amp;gt;||Register ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A[76543210]:=A[01234567]&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Mirrors (reverses the order) of bits in the accumulator. Older core versions supported MIRROR DE, but this was removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CP (ComPare)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=r?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=n?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=HL*?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=(IXY+d)?&lt;br /&gt;
|}&lt;br /&gt;
:Sets the flags as if a SUB was performed but does not perform it. Legal combinations are the same as SUB. This is commonly used to set the flags to perform an equality or greater/less test.&lt;br /&gt;
:* CP is &#039;&#039;not&#039;&#039; equivalent to &amp;quot;if&amp;quot; in high level languages. Flag based jumps can follow any instruction that sets the flags, not just CP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;TEST&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;TEST n &amp;lt;/code&amp;gt;||Immediate ||- ||E ||S ||? ||P ||S ||S ||S ||11 ||A&amp;amp;n?&lt;br /&gt;
|}&lt;br /&gt;
: Next extended opcode. Similar to CP, but performs an AND instead of a subtraction. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INC (INCrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||0 ||! ||S ||S ||S ||4 ||r++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||0 ||! ||S ||S ||S ||11 ||HL*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||0 ||! ||S ||S ||S ||23 ||(IXY+d)*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr++&lt;br /&gt;
|}&lt;br /&gt;
:Increments the target by one. The argument can be any 8-bit register, any 16-bit register pair, or the address pointed to by HL or indexed via IX or IY. P/V is set if the target held $7F. N is reset.&lt;br /&gt;
:* INC A is faster than ADD 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DEC (DECrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||1 ||! ||S ||S ||S ||4 ||r--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||1 ||! ||S ||S ||S ||11 ||HL*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||1 ||! ||S ||S ||S ||23 ||(IXY+D)*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr--&lt;br /&gt;
|}&lt;br /&gt;
:Decrements the target by one. Allowed arguments are the same as INC. Flag effects are the same as INC except H refers to borrow, not carry; and P/V is set if the target held $80.&lt;br /&gt;
:* DEC A is faster than SUB 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLC (Rotate Left Circular)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Rotates the target bitwise left by one position. The MSB is copied to bit 0, and also to Carry. Can be applied to any 8-bit register or to a location in memory pointed to by HL or indexed via IX or IY. The final alternative is undocumented, and stores the result in a register as well as performing the operation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RL (Rotate Left)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=CF; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC, except the MSB is copied to Carry only, and the previous contents of Carry are copied to bit 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRC, RR (Rotate Right Circular, Rotate Right)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=CF; CF:=x; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC and RL except they rotate right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLA (Shift Left Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RL except bit 0 is set to zero, not the previous contents of Carry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRA (Shift Right Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;gt;&amp;gt;1 OR r[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;gt;&amp;gt;1 OR HL*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1 OR (IXY+d)*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1 OR (IX+d)*[7]; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RR except the MSB is left unchanged (on the assumption that it&#039;s the sign bit), not replaced with the previous contents of Carry. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRL (Shift Right Logical)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||0 ||8 ||r:=unsigned(r)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||0 ||15 ||HL*:=unsigned(HL*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1; r:=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as SLA except it shifts right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLCA, RLA, RRCA, RRA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=CF; CF:=x&lt;br /&gt;
|}&lt;br /&gt;
:Same as their matching instruction except they work only on A, are faster, and do not alter S, Z or P/V.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLL (Shift Left Logical)&lt;br /&gt;
:This mnemonic has no associated opcode. There is no difference between a logical and arithmetic shift left, so both can use SLA, but some assemblers will allow SLL as an equivalent. Unfortunately, some will also assemble it as SL1. So it&#039;s probably worth just avoiding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SL1 or SLI (Shift Left and Add 1) or (Shift Left and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r &amp;lt;/code&amp;gt;||Register ||- ||U ||! ||0 ||P ||0 ||S ||S ||8 ||r:=(r&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||U ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=(HL*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1; r=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes that behave like SLA, but set bit 0 to 1 instead of 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLD (Rotate Left bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[0123]:=A[0123]; HL*[7654]:=x[0123]; A[0123]:=x[7654]  &lt;br /&gt;
|}&lt;br /&gt;
:Rotates the lower nibble of the byte pointed to by HL, the upper nibble of that byte, and the lower nibble of A, in that order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRD (Rotate Right bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[7654]:=A[0123]; HL*[0123]:=x[7654]; A[0123]:=x[0123]&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLD, but the order is: the lower nibble pointed to by HL, the lower nibble of the A, and the upper nibble of the byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Barrel (variable amount) shift and rotate (cores v2+ only)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSLA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=signed(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRL DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=unsigned(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRF DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=~(unsigned(~DE)&amp;gt;&amp;gt;(B&amp;amp;31)) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BRLC DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;15) OR DE&amp;gt;&amp;gt;(16-B&amp;amp;15) ||8&lt;br /&gt;
|}&lt;br /&gt;
:Shift instructions use only bits 4..0 of B, BSLA shifts DE left, BSRA/BSRL/BSRF shifts DE right in arithmetic/logical/fill-one way. BRLC rotates DE left by B places, uses only bits 3..0 of B (to rotate right, use B=16-places).&lt;br /&gt;
&lt;br /&gt;
If you are implementing BSRF in C (or similar), be careful with implicit variable type promotion. You will need to do something like this: DE:=~((uint16_t)~DE&amp;gt;&amp;gt;(B&amp;amp;31))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPL (ComPLement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPL &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||- ||1 ||- ||- ||4 ||A:=~A&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the contents of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEG (NEGate)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEG &amp;lt;/code&amp;gt;||- ||- ||S ||! ||1 ||! ||S ||S ||S ||8 ||A:=0-A&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts the contents of the accumulator from zero, making it negative for the purpose of two&#039;s complement. P/V is set if A previously held $80. C is set if accumulator did not previously hold $00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CCF (Complement Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CCF &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||! ||- ||- ||4 ||CF:=!CF&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the carry flag. (Does not, as might be assumed, clear it!) Also sets H to the previous value of the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SCF (Set Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SCF &amp;lt;/code&amp;gt;||- ||- ||S ||1 ||0 ||- ||0 ||- ||- ||4 ||CF:=1&lt;br /&gt;
|}&lt;br /&gt;
:Sets the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;BIT (test BIT)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||0 ||? ||1 ||! ||? ||8 ||r[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Indirect ||S ||- ||0 ||? ||1 ||! ||? ||12 ||HL*[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||0 ||? ||1 ||! ||? ||20 ||(IXY+d)*[b]==1?&lt;br /&gt;
|}&lt;br /&gt;
:Tests if a bit is set on target value. The first parameter states which bit. The second can be any 8-bit register, or the location in memory pointed to by HL or indexed by IX or IY. Sets Z if specified bit was 0. S and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SET (SET bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* OR (1&amp;lt;&amp;lt;b); r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SETAE &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=unsigned($80)&amp;gt;&amp;gt;(E&amp;amp;7)&lt;br /&gt;
|}&lt;br /&gt;
:Sets the numbered bit on target value. The possible targets are the same as BIT. The three parameter variant is undocumented and stores the result in a register as well as performing the SET.&lt;br /&gt;
:SETAE is a Next extended opcode which takes the bit number to set from E (only the low 3 bits) and sets whole A to value of that bit, but counted from top to bottom (E=0 will produce A:=$80, E=7 will produce A:=$01). This works as pixel mask for ULA bitmap modes, when E is 0..255 x-coordinate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RES (RESet bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b)); r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Resets the numbered bit on target value. The possible targets are the same as BIT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DAA (Decimal Adjust Accumulator)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DAA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||- ||P ||! ||S ||S ||8 ||if(A&amp;amp;$0F&amp;gt;$09 or HF) A±=$06; if(A&amp;amp;$F0&amp;gt;$90 or CF) A±=$60 (± depends on NF)&lt;br /&gt;
|}&lt;br /&gt;
:Modifies the contents of the accumulator based on the flags left by previous operation to correct for binary coded decimal (BCD).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;MUL (MULtiply)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MUL d,e &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||DE:=D*E&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Multiplies D by E, storing 16 bit result into DE. Does not alter any flags (the opcode is not compatible with any of the R800/Z180/eZ80/... variants of MUL, it is solely Next specific).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SWAPNIB (SWAP NIBbles)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SWAPNIB &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=A[3210]&amp;lt;&amp;lt;4 OR A[7654]&amp;gt;&amp;gt;4&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Swaps the high and low nibbles of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELAD (PIXEL ADdress)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELAD &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||HL:=$4000+((D&amp;amp;$C0)&amp;lt;&amp;lt;5)+((D&amp;amp;$07)&amp;lt;&amp;lt;8)+((D&amp;amp;$38)&amp;lt;&amp;lt;2)+(E&amp;gt;&amp;gt;3)&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Takes E and D as the X,Y coordinate of a point and calculates the address of the byte containing this pixel in the pixel area of standard ULA screen 0, storing it in HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELDN (PIXEL DowN)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELDN &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||if(HL&amp;amp;$0700!=$0700) HL+=256;&amp;lt;br&amp;gt;&lt;br /&gt;
else if(HL&amp;amp;$e0!=$e0) HL:=HL&amp;amp;$F8FF+$20;&amp;lt;br&amp;gt;&lt;br /&gt;
else HL:=HL&amp;amp;$F81F+$0800&lt;br /&gt;
|}&lt;br /&gt;
:Updates the address in HL to move down by one line of pixels.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
;JP (JumP)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (HL) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC:=HL (not PC:=HL*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (IXY) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||PC:=IXY (not PC:=IXY*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (C) &amp;lt;/code&amp;gt;||Register ||- ||E ||? ||? ||? ||? ||? ||? ||13 ||PC:=PC&amp;amp;$C000+IN(C)&amp;lt;&amp;lt;6&lt;br /&gt;
|}&lt;br /&gt;
:Jumps (sets the PC) to the given address. The address can be given immediately or read from HL, IX, or IY. Note that although the variants that use register pairs &#039;&#039;look&#039;&#039; like they are using indirect addressing, JP (HL) jumps to the address stored in the register HL, not the address stored at the address HL points to. The JP (C) sets bottom 14 bits of current PC&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; to value read from I/O port: PC[13:0] = (IN (C) &amp;lt;&amp;lt; 6) (can be used to execute code block read from a disk stream) * &amp;quot;current PC&amp;quot; is address of next instruction after JP (C), as the PC is advanced by fetching op code from memory and is already advanced when execution happens - if the JP instruction resides at the very end of 16k memory block (..FE or ..FF address), then newly composed PC value will land into following 16k block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JP cc (JumP conditionally)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP Z/NZ/NC/C/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||if cc PC:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Conditionally jumps (sets the PC) to the given address. The condition is set in terms of the flags: Zero (Z, NZ), Carry (C, NC), Parity (PO, PE), and Sign (P/M). The address can only be given immediately for a conditional jump.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JR (Jump Relative)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ||PC+=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR C/NC/Z/NZ, nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ;   7 if not cc ||if cc PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Jumps to an alternate address by &#039;&#039;adding&#039;&#039; the parameter to the PC - in other words the parameter is an adjustment, not an absolute address. When used in an assembler with labels the syntax should be the same as JP. The JR address can only be given immediately. Conditions are legal, but only those based on carry and zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DJNZ (Decrement reg. b and Jump if Not Zero)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DJNZ n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||13 ||B--; if B!=0 PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Decrements B then performs JR NZ.. to the given address. Used for encapsulating loops.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CALL&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ||SP-=2; SP*:=PC; PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL Z/NZ/C/NC/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ;   10 if not cc ||if cc {SP-=2; SP*:=PC; PC:=nn}&lt;br /&gt;
|}&lt;br /&gt;
:Like JP (including the ability to have conditions), but PUSHes the PC before jumping. Used for subroutine calls. &lt;br /&gt;
:* If a subroutine ends with a CALL to another subroutine immediately before the RET, it is more efficient to JP to the other subroutine and allow its RET to return from the whole combination. This might make high-level programmers queasy but your compiler already does it (tail call optimization)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RET (RETurn)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET Z/NZ/C/NC/PO/PE/P/M &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||11 ;   5 if not cc ||if cc {PC:=SP*; SP+=2}&lt;br /&gt;
|}&lt;br /&gt;
:POPs the PC from the stack, returning from a previous CALL. This can also accept the same conditions as JP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETI (RETurn from Interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from an interrupt service routine (same as RET instruction, but also does signal to I/O device that the interrupt routine is completed).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETN (RETurn from Non-maskable interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETN &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||IFF1:=IFF2; PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from a non-maskable interrupt service routine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RST (ReSTart)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RST n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||CALL n&lt;br /&gt;
|}&lt;br /&gt;
:Performs a CALL to a routine located at one of eight fixed locations ($00, $08, ..., $38) in the zero page. This is located in ROM, and on the Spectrum only a limited number of values are useful to call built-in ROM routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOP (No OPeration)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NOP &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC+=1&lt;br /&gt;
|}&lt;br /&gt;
:Does &amp;quot;nothing&amp;quot; (just usual housekeeping like refreshing memory and advancing program counter to next instruction).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;HALT&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HALT &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||waits for interrupt&lt;br /&gt;
|}&lt;br /&gt;
:Suspends the CPU until an interrupt is received (maskable interrupts must be enabled to break the wait). While CPU is waiting for interrupt, the fake NOP instruction is being executed, to keep memory refresh going on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DI (Disable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=0; IFF2:=0&lt;br /&gt;
|}&lt;br /&gt;
:Disables maskable interrupts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EI (Enable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=1; IFF2:=1&lt;br /&gt;
|}&lt;br /&gt;
:Enables maskable interrupts (after next instruction, i.e. for example &amp;quot;EI RET&amp;quot; - the interrupt may happen only after RET instruction is finished (or &amp;quot;EI DI&amp;quot; pair of instructions will not allow any maskable interrupt to happen).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IM (Interrupt Mode)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IM n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||Interrupt mode:=n&lt;br /&gt;
|}&lt;br /&gt;
:Sets interrupt handling mode. The default for Next is 1. 2 is used for user defined interrupt service routines. IM 0 is useless on Next (and pretty much everything else, to be honest)&lt;br /&gt;
&lt;br /&gt;
=== Input and Output ===&lt;br /&gt;
;IN r, (c); OUT (c), r&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN r, (c) &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||0 ||P ||0 ||S ||S ||12 ||r := in(BC)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),r &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||12 ||out(BC,r)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs a byte value from the 16-bit port number given in BC. R can be any 8-bit register. Note that the port number is given in BC even though the instruction refers only to C. Some assemblers will allow the instruction to be written with &amp;quot;(bc)&amp;quot; instead of &amp;quot;(c)&amp;quot; as a reminder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN (c); OUT (c), 0&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN (c) &amp;lt;/code&amp;gt;||Register ||- ||U ||- ||0 ||P ||0 ||S ||S ||12 ||in(BC)?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),0 &amp;lt;/code&amp;gt;||Register ||Immediate ||U ||- ||- ||- ||- ||- ||- ||12 ||out(BC,0)&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes. The IN variation performs an input, but does not store the result, only setting the flags. The OUT variation outputs 0 on the port. This is the only number that can be output to a port in immediate mode. The Next FPGA does output zero, but some Z80 chips manufactured differently from early batches output different value like 255, so it is not recommended to use OUT (C),0 if you want to reuse your code also on classic ZX Spectrum or publish it as example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN a, (n); OUT (n), a&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN A, (n) &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||- ||- ||- ||- ||- ||- ||11 ||A := in(An)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (n),A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||11 ||out(An,A)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs the byte value in A from a 16-bit port number where the lower byte is N and the upper byte is A. This is only likely to be useful in cases where the upper byte of the port number is not relevant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INI (INput and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL++; B--&lt;br /&gt;
|}&lt;br /&gt;
:Inputs a value from port BC into memory at the address stored in HL, then increments HL and decrements B. Because B is decremented and is part of the port number, the port number for future INI instructions will change unless it is reset. Z is set if B reached 0; C, S, H, and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INIR (INput and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do INI while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Loops INIR until B reaches 0, so that if INIR starts with B=0 it loops 256 times. Because B is decremented during this process and is part of the port number, this is unlikely to be useful except when the upper byte of the port number is not relevant. Interrupts are recognized during execution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IND, INDR (INput and Decrement, INput and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IND &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL--; B--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do IND while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI and INIR except that HL is decremented instead of incremented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTI (Out and Increment), OTIR (Out and Increment Repeated), OUTD (Out and Decrement), OTDR (Out and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTI while (B&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTD &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTD while (B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI, INIR, IND, INDR except that they output instead of input and B is decremented &#039;&#039;&#039;before&#039;&#039;&#039; the output instead of after. Condition check on B is performed &#039;&#039;&#039;after&#039;&#039;&#039;, so that if OTIR starts with B=0 it loops 256 times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTINB (Out and Increment with No B)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTINB &amp;lt;/code&amp;gt;||- ||- ||E ||? ||? ||? ||? ||? ||? ||16 ||out(BC,HL*); HL++&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Behaves like OUTI, but doesn&#039;t decrement B.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEXTREG&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n,n&#039; &amp;lt;/code&amp;gt;||Immediate ||Immediate ||E ||- ||- ||- ||- ||- ||- ||20 ||HwNextReg_n:=n&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n, A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||E ||- ||- ||- ||- ||- ||- ||17 ||HwNextReg_n:=A&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Directly sets the [[Board feature control|Next Feature Control Registers]] without going through ports {{PortNo|$243B}} and {{PortNo|$253B}}.&lt;br /&gt;
&lt;br /&gt;
=== A note on some Z80-N specific observations ===&lt;br /&gt;
2021-09-16: figuring out the hard way, the three Z80N instructions `ADD HL/DE/BC,A` actually do NOT preserve carry flag, but change it to undefined value (verified with core 3.1.5). There&#039;s also strong suspicion (but not verified yet), that LDIX/LDDX/LDIRX/LDDRX/LDPIRX do affects flags the same way as LDI/LDIR - to be verified.&lt;br /&gt;
&lt;br /&gt;
2025-01-25: Testing 3.02.x 1) &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt; affect the flags similarly to &amp;lt;code&amp;gt;LDI&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDD&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LDDR&amp;lt;/code&amp;gt;. 2) &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt; most probably always reset the carry flag.&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
&lt;br /&gt;
This section lists the changes of the specification of the behavior of Z80N instructions, compared to the previous content of this wiki page.&lt;br /&gt;
&lt;br /&gt;
2022-01-11: The previous versions of this page didn&#039;t match what was [http://www.z80.info/zip/z80-documented.pdf documented] for several years, that regular Z80 INI/IND/INIR/INDR/OUTI/OUTD/OTIR/OTDR instructions do modify carry flag (contrary to the official Z80 documentation and many Internet resources describing Z80 instructions).&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41128</id>
		<title>Extended Z80 instruction set</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41128"/>
		<updated>2025-10-07T11:58:52Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: removed margin:auto&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a general list of Z80 and Z80N instructions with descriptions. The instructions specific to Z80N have the [[#Z80N_instructions_opcodes|encodings described first]].&lt;br /&gt;
&lt;br /&gt;
For a table of summaries without additional descriptions see the [[Z80 Instruction Table]]. There&#039;s also a [[Special:RunQuery/OpcodeQuery|special search for opcodes in the same table]] and an external [https://table.specnext.dev/ Z80N opcode value matrix on specnext.dev].&lt;br /&gt;
&lt;br /&gt;
=== Z80N instructions opcodes ===&lt;br /&gt;
&lt;br /&gt;
This is a table of the instructions and the encodings of all &#039;&#039;&#039;Next-specific&#039;&#039;&#039; Z80 instructions:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Instruction !!data-sort-type=&amp;quot;text&amp;quot;| Encoding (2-4 bytes) (hex) !! T-States !! Description !! 4 letter&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;SWAPNIB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 23&amp;lt;/code&amp;gt;  || 8 || Swap the nibbles (4-bits) of A || SWAP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;MIRROR A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 24&amp;lt;/code&amp;gt;  || 8  || Mirror bits 0..7 to 7..0 of A || MIRR&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;TEST $im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 27&amp;lt;/code&amp;gt; value  || 11 || Change flags as AND A but A stays unaffected ||style=&amp;quot;color:DarkGrey;&amp;quot;|  TEST&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSLA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 28&amp;lt;/code&amp;gt;  || 8  || Shift left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSLA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 29&amp;lt;/code&amp;gt;  || 8  || Shift right signed DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRL DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2A&amp;lt;/code&amp;gt;  || 8  || Shift right DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRF DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2B&amp;lt;/code&amp;gt;  || 8  || Shift right DE, filling 1 for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRF&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BRLC DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2C&amp;lt;/code&amp;gt;  || 8  || Rotate left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BRLC&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;MUL D,E&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 30&amp;lt;/code&amp;gt;  || 8  || Multiply D with E, result in DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  MUL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 31&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 32&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 33&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 34 low high&amp;lt;/code&amp;gt;   || 16  || Add a constant to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 35 low high&amp;lt;/code&amp;gt;  || 16   || Add a constant to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 36 low high&amp;lt;/code&amp;gt;  || 16  || Add a constant to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 8A  high low&amp;lt;/code&amp;gt;  || 23  || Push a constant ||style=&amp;quot;color:DarkGrey;&amp;quot;|  PUSH&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;OUTINB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 90&amp;lt;/code&amp;gt;  || 16  || OUTI, but don&#039;t change B || OTIB&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,$im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 91 register value&amp;lt;/code&amp;gt;  || 20  || Write v to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 92 register&amp;lt;/code&amp;gt; || 17  || Write A to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELDN&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 93&amp;lt;/code&amp;gt;  || 8  || HL as a pixel address moved one line down || PXDN&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELAD&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 94&amp;lt;/code&amp;gt;  || 8  || HL := as ULA pixel address from D==Y E==X || PXAD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;SETAE&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 95&amp;lt;/code&amp;gt;  || 8  || Get A as a mask for ULA pixel from E || STAE&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;JP (C)&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 98&amp;lt;/code&amp;gt;  || 13  || IN (C) then jump to a 64 byte section ||style=&amp;quot;color:DarkGrey;&amp;quot;|  JP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A4&amp;lt;/code&amp;gt;  || 16  || Extended LDI byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDIX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDWS&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A5&amp;lt;/code&amp;gt;  || 14  || Byte copy as for Layer 2 ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDWS&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED AC&amp;lt;/code&amp;gt;  || 16  || Extended LDD byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDDX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B4&amp;lt;/code&amp;gt;  || 21/16  || Extended LDIR || LIRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDPIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B7&amp;lt;/code&amp;gt;  || 21/16  || Byte copy as for a pattern fill || LPRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED BC&amp;lt;/code&amp;gt;  || 21/16  || Extended LDDR || LDRX&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
More details and the explanations of all Z80 instructions implemented in the Next Z80 CPU follow.&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
&lt;br /&gt;
* The encoding of the operand of the &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt; is unique: it is the only operand encoded as big-endian.&lt;br /&gt;
* The timings (T-States) are based on some limited testing and may not be accurate.&lt;br /&gt;
* The shorter aliases of the official mnemonics (the 4-letter column) are those suggested in an initiative led by Matt Davies, the author of Odin assembler, editor and debugger tool for ZX Next.&lt;br /&gt;
* A relevant early source for this table could be [https://github.com/z88dk/z88dk/issues/312#issuecomment-322659205 a Christmas 2018 edit of a comment in a discussion of an issue 312 of z88dk].&lt;br /&gt;
&lt;br /&gt;
=== Notation ===&lt;br /&gt;
* In the descriptions &#039;&#039;any 8-bit register&#039;&#039; means A, B, C, D, E, H, and L. The registers named F, I and R aren&#039;t a part of this set even if they are technically 8 bit registers. Additionally, IXH, IXL, IYH, IYL, which are the high and low byte parts of IX and IY, can be used in some of the instructions as 8-bit registers although this wasn&#039;t documented for the original Z80.&lt;br /&gt;
* IXY means IX or IY.&lt;br /&gt;
* For the status field:&lt;br /&gt;
** S means Standard. It&#039;s in the Z80 manual. Everything should support it.&lt;br /&gt;
** U means Undocumented. It works on Z80 chips, but it&#039;s not in the manual. These have been known for years and were acknowledged by Zilog, so they should work on everything, but some assemblers may vary the syntax.&lt;br /&gt;
** E means Extension. It &#039;&#039;only&#039;&#039; works on the Z80 core on the Next. It&#039;ll probably only be accepted by assemblers that have been updated specifically for the Next.&lt;br /&gt;
* Each of the flag effects is documented as follows:&lt;br /&gt;
** - means the flag is unchanged.&lt;br /&gt;
** 1 or 0 mean the flag is set or reset as appropriate.&lt;br /&gt;
** ? means we don&#039;t know what effect the instruction has on the flag.&lt;br /&gt;
** ! means the instruction has an unusual effect on the flag which is documented in the description.&lt;br /&gt;
** S means the effect on the flag is &amp;quot;standard&amp;quot;. C is set if a carry/borrow occurred beyond the MSB; Z is set if the result of the operation is zero; H is set if a carry/borrow occurred beyond bit 3.&lt;br /&gt;
** P, V, and L are used for the P/V flag which has several standard effects. P means it&#039;s parity. V means it&#039;s overflow. L means it checks BC as loop counter for some of the block copy and search instructions: P/V = (BC != 0)&lt;br /&gt;
&lt;br /&gt;
=== Register and Data manipulation ===&lt;br /&gt;
;LD (LoaD)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, r&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||r := r&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r,n &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||7 ||r := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (HL) &amp;lt;/code&amp;gt;||Register ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||r := HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||S ||- ||- ||- ||- ||- ||- ||19 ||r := (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL),r &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||7 ||HL* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d),r &amp;lt;/code&amp;gt;||Indexed ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+D)* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL), n &amp;lt;/code&amp;gt;||Indirect ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||HL* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d), n &amp;lt;/code&amp;gt;||Indexed ||Immediate ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+d)* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (BC/DE) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||A := rr*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (nn) &amp;lt;/code&amp;gt;||Accumulator ||Address ||S ||- ||- ||- ||- ||- ||- ||13 ||A := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (BC/DE), A &amp;lt;/code&amp;gt;||Indirect ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||7 ||rr* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), A &amp;lt;/code&amp;gt;||Address ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||13 ||(nn)* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, I &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := I; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, R &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := R; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD I, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||I := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD R, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||R := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/HL/SP, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD IXY, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||14 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD HL, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||16 ||HL := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/SP/IXY, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||20 ||rr := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), HL &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||16 ||(nn)* := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), BC/DE/SP/IXY &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||20 ||(nn)* := rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||6 ||SP := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, IXY &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||10 ||SP := IXY&lt;br /&gt;
|}&lt;br /&gt;
:The basic data load/transfer instruction. Transfers data from the location specified by the second argument, to the location specified by the first. Available combinations are as follows:&lt;br /&gt;
:* Any 8-bit register can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of any other 8-bit register except I and R;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by HL;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory offset-indexed by IX or IY.&lt;br /&gt;
:* Additionally, the accumulator A (only) can be:&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by BC or DE;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address;&lt;br /&gt;
:** loaded with the contents of I or R.&lt;br /&gt;
:* Any 16-bit register pair can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address.&lt;br /&gt;
:* Additionally, SP (only) can be:&lt;br /&gt;
:** loaded with the contents of HL, IX, or IY.&lt;br /&gt;
:** The planned &#039;&#039;&#039;ld hl, sp&#039;&#039;&#039; didn&#039;t make it to Next yet, one possible workaround is: &#039;&#039;&#039;ld hl,0&#039;&#039;&#039;; &#039;&#039;&#039;add hl,sp&#039;&#039;&#039;;&lt;br /&gt;
:* Memory referred to by HL or through IX can be assigned immediate values.&lt;br /&gt;
:Although 16-bit register pairs cannot be directly moved between each other, they can be moved by moving the two 8-bit registers. (SP gets a special case because it can&#039;t be addressed via 8-bit registers.) Some assemblers will provide built-in macro instructions allowing, for example, &#039;&#039;&#039;ld bc, de&#039;&#039;&#039;.&lt;br /&gt;
:LD instructions do not alter any flags unless I or R are loaded into A.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EX (EXchange)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX DE, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(DE,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX AF, AF&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||! ||! ||! ||! ||! ||! ||4 ||swap(AF,AF&#039;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), HL &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||swap(SP*,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), IXY &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||23 ||swap(SP*,IXY)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges the contents of two sources. The only permitted combinations are&lt;br /&gt;
:* Exchanging DE and HL;&lt;br /&gt;
:* Exchanging AF and AF&#039;;&lt;br /&gt;
:* Exchanging HL, IX, or IY with the contents of memory pointed to by SP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EXX (EXchange all)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EXX &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(BC,BC&#039;);swap(DE,DE&#039;);swap(HL,HL&#039;)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges BC, DE, and HL with their shadow registers. AF and AF&#039; are not exchanged. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH BC/DE/HL/AF &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||15 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH nn &amp;lt;/code&amp;gt;||Immediate ||- ||E ||- ||- ||- ||- ||- ||- ||23 ||SP-=2; SP*:=nn&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
:Pushes the given argument on the stack. This can be any 16-bit register pair except SP. SP is reduced by 2 and then the argument is written to the new location SP points to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP BC/DE/HL &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP AF &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||! ||! ||! ||! ||! ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||rr:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Pops the given argument from the stack. This can be any 16-bit register pair except SP. The current value at SP is copied to the register pair and then SP is raised by 2.&lt;br /&gt;
:Popping into AF does set value of flag register F directly to low 8 bits of value from stack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Block Copy ===&lt;br /&gt;
;LDI (LoaD and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE++; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Copies the byte pointed to by HL to the address pointed to by DE, then adds 1 to DE and HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIR (LoaD and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||21x+16 ||do LDI while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops LDI until BC reaches zero. Note the last iteration starts when BC=1 and ends with BC=0 (starting the LDIR with BC=0 will start 64kiB transfer, most likely overwriting vital parts of system memory and/or code itself).&lt;br /&gt;
:Flag effects are the same as LDI except that P/V will always be reset, because BC by definition reaches 0 before this instruction ends (normally - unless something overwrites LDIR opcode while BC&amp;gt;0).&lt;br /&gt;
:Interrupts may interrupt LDIR instruction while looping (after each single LDI sub-part finished) and LDIR will resume after and finish loop properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDD (LoaD and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE--; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDI, but subtracts 1 from DE and HL instead of adding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDDR (LoaD and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||0 ||0 ||- ||- ||21x+16 ||do LDD while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDIR but loops LDD instead of LDI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDWS&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDWS &amp;lt;/code&amp;gt;||- ||- ||E ||- ||0 ||! ||S ||S ||S ||14 ||DE*:=HL*; INC L; INC D;&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcode. Copies the byte pointed to by HL to the address pointed to by DE and increments only L and D. This is used for vertically copying bytes to the Layer 2 display.&lt;br /&gt;
:The flags are identical to what the &#039;&#039;&#039;INC D&#039;&#039;&#039; instruction would produce.&lt;br /&gt;
:Note the source data are read only from single 256B (aligned) block of memory, because only L is incremented, not HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIX, LDIRX, LDDX, LDDRX&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL++; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDIX while(BC&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL--; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDDX while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcodes. Behave similarly as their non-X equivalents except the byte is not copied if it is equal to A and LDDX/LDDRX advance DE by incrementing it (like LDI), while HL is decremented (like LDD).&lt;br /&gt;
:Second difference to non-X instructions (as usual with next-only opcodes due to implementation), the extended ones don&#039;t modify any flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDPIRX &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDPIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do{t:=(HL&amp;amp;$FFF8+E&amp;amp;7)*; {if t!=A DE*:=t;} DE++; BC--}while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Similar to LDIRX except the source byte address is not just HL, but is obtained by using the top 13 bits of HL and the lower 3 bits of DE and HL does not increment during whole loop (HL works as base address of aligned 8 byte lookup table, DE works as destination and also wrapping index 0..7 into table). This is intended for &amp;quot;pattern fill&amp;quot; functionality.&lt;br /&gt;
&lt;br /&gt;
=== Block Search ===&lt;br /&gt;
;CPI (ComPare and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Compares the byte pointed to by HL with the contents of A and sets Z if it matches or S if the comparison goes negative. Then adds 1 to HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPIR (ComPare and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPI while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops CPI until either Z is set (A is found in the byte pointed to by HL) or P/V is reset (BC reached 0).&lt;br /&gt;
:Flag effects are the same as CPI except that one of the two terminating flag conditions will always be true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPD (ComPare and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPI, but subtracts 1 from HL instead of adding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPDR (ComPare and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPD while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPIR but loops CPD instead of CPI. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
;ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||11 ||HL+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD IXY, BC/DE/IXY/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||15 ||IXY+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, A &amp;lt;/code&amp;gt;||Register ||Register ||E ||? ||- ||- ||- ||- ||- ||8 ||rr+=unsigned A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||E ||- ||- ||- ||- ||- ||- ||16 ||rr+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together. Legal combinations are:&lt;br /&gt;
:* When adding 8-bit values the first parameter must be A and the second may be:&lt;br /&gt;
:** The contents of an 8-bit register;&lt;br /&gt;
:** An immediate value;&lt;br /&gt;
:** The contents of memory pointed to by HL or by indexing based on IX or IY.&lt;br /&gt;
:* When adding 16-bit values the first parameter must be HL, IX or IY and the second must be another 16-bit register pair. If the first parameter is IX or IY, the second cannot be HL or the other index register. &lt;br /&gt;
:* For 16 bit additions (regular Z80), H is set if a carry occurred in bit 11 (ie, a half carry in the high byte)&lt;br /&gt;
:* On the Spectrum Next the extended opcodes also allow the first parameter to be HL, DE, or BC and the second to be A (A will be zero extended to 16 bits) or an 16bit immediate value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;ADC (ADd with Carry)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||V ||! ||S ||S ||15 ||HL+=rr+(CF?1:0)&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together, adding an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of ADC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if carry from bit 11; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
;SUB&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A -= r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A -= (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts a value from A. Legal combinations are the same as for ADD for 8-bit, except that A does not need to be specified as the first parameter because subtraction can only be done from A. SUB cannot be used for 16-bit numbers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SBC (SuBtract with Carry, er, borrow)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=(r+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(n+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(HL*+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=((IXY+d)+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||1 ||V ||! ||S ||S ||15 ||HL-=(rr+(CF?1:0))&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts values, subtracting an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of SBC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if borrow from bit 12; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;AND, OR, XOR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||1 ||S ||S ||4 ||A := A &amp;amp; r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||1 ||S ||S ||19 ||A := A &amp;amp; (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A OR r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A OR (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A ^ r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A ^ (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Performs the appropriate bitwise operator on A. Legal combinations are the same as SUB. &lt;br /&gt;
&lt;br /&gt;
:XOR A is faster and shorter than LD A,0&lt;br /&gt;
&lt;br /&gt;
;MIRROR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MIRROR A &amp;lt;/code&amp;gt;||Register ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A[76543210]:=A[01234567]&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Mirrors (reverses the order) of bits in the accumulator. Older core versions supported MIRROR DE, but this was removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CP (ComPare)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=r?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=n?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=HL*?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=(IXY+d)?&lt;br /&gt;
|}&lt;br /&gt;
:Sets the flags as if a SUB was performed but does not perform it. Legal combinations are the same as SUB. This is commonly used to set the flags to perform an equality or greater/less test.&lt;br /&gt;
:* CP is &#039;&#039;not&#039;&#039; equivalent to &amp;quot;if&amp;quot; in high level languages. Flag based jumps can follow any instruction that sets the flags, not just CP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;TEST&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;TEST n &amp;lt;/code&amp;gt;||Immediate ||- ||E ||S ||? ||P ||S ||S ||S ||11 ||A&amp;amp;n?&lt;br /&gt;
|}&lt;br /&gt;
: Next extended opcode. Similar to CP, but performs an AND instead of a subtraction. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INC (INCrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||0 ||! ||S ||S ||S ||4 ||r++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||0 ||! ||S ||S ||S ||11 ||HL*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||0 ||! ||S ||S ||S ||23 ||(IXY+d)*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr++&lt;br /&gt;
|}&lt;br /&gt;
:Increments the target by one. The argument can be any 8-bit register, any 16-bit register pair, or the address pointed to by HL or indexed via IX or IY. P/V is set if the target held $7F. N is reset.&lt;br /&gt;
:* INC A is faster than ADD 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DEC (DECrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||1 ||! ||S ||S ||S ||4 ||r--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||1 ||! ||S ||S ||S ||11 ||HL*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||1 ||! ||S ||S ||S ||23 ||(IXY+D)*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr--&lt;br /&gt;
|}&lt;br /&gt;
:Decrements the target by one. Allowed arguments are the same as INC. Flag effects are the same as INC except H refers to borrow, not carry; and P/V is set if the target held $80.&lt;br /&gt;
:* DEC A is faster than SUB 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLC (Rotate Left Circular)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Rotates the target bitwise left by one position. The MSB is copied to bit 0, and also to Carry. Can be applied to any 8-bit register or to a location in memory pointed to by HL or indexed via IX or IY. The final alternative is undocumented, and stores the result in a register as well as performing the operation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RL (Rotate Left)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=CF; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC, except the MSB is copied to Carry only, and the previous contents of Carry are copied to bit 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRC, RR (Rotate Right Circular, Rotate Right)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=CF; CF:=x; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC and RL except they rotate right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLA (Shift Left Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RL except bit 0 is set to zero, not the previous contents of Carry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRA (Shift Right Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;gt;&amp;gt;1 OR r[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;gt;&amp;gt;1 OR HL*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1 OR (IXY+d)*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1 OR (IX+d)*[7]; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RR except the MSB is left unchanged (on the assumption that it&#039;s the sign bit), not replaced with the previous contents of Carry. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRL (Shift Right Logical)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||0 ||8 ||r:=unsigned(r)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||0 ||15 ||HL*:=unsigned(HL*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1; r:=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as SLA except it shifts right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLCA, RLA, RRCA, RRA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=CF; CF:=x&lt;br /&gt;
|}&lt;br /&gt;
:Same as their matching instruction except they work only on A, are faster, and do not alter S, Z or P/V.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLL (Shift Left Logical)&lt;br /&gt;
:This mnemonic has no associated opcode. There is no difference between a logical and arithmetic shift left, so both can use SLA, but some assemblers will allow SLL as an equivalent. Unfortunately, some will also assemble it as SL1. So it&#039;s probably worth just avoiding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SL1 or SLI (Shift Left and Add 1) or (Shift Left and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r &amp;lt;/code&amp;gt;||Register ||- ||U ||! ||0 ||P ||0 ||S ||S ||8 ||r:=(r&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||U ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=(HL*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1; r=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes that behave like SLA, but set bit 0 to 1 instead of 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLD (Rotate Left bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[0123]:=A[0123]; HL*[7654]:=x[0123]; A[0123]:=x[7654]  &lt;br /&gt;
|}&lt;br /&gt;
:Rotates the lower nibble of the byte pointed to by HL, the upper nibble of that byte, and the lower nibble of A, in that order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRD (Rotate Right bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[7654]:=A[0123]; HL*[0123]:=x[7654]; A[0123]:=x[0123]&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLD, but the order is: the lower nibble pointed to by HL, the lower nibble of the A, and the upper nibble of the byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Barrel (variable amount) shift and rotate (cores v2+ only)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSLA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=signed(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRL DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=unsigned(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRF DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=~(unsigned(~DE)&amp;gt;&amp;gt;(B&amp;amp;31)) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BRLC DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;15) OR DE&amp;gt;&amp;gt;(16-B&amp;amp;15) ||8&lt;br /&gt;
|}&lt;br /&gt;
:Shift instructions use only bits 4..0 of B, BSLA shifts DE left, BSRA/BSRL/BSRF shifts DE right in arithmetic/logical/fill-one way. BRLC rotates DE left by B places, uses only bits 3..0 of B (to rotate right, use B=16-places).&lt;br /&gt;
&lt;br /&gt;
If you are implementing BSRF in C (or similar), be careful with implicit variable type promotion. You will need to do something like this: DE:=~((uint16_t)~DE&amp;gt;&amp;gt;(B&amp;amp;31))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPL (ComPLement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPL &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||- ||1 ||- ||- ||4 ||A:=~A&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the contents of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEG (NEGate)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEG &amp;lt;/code&amp;gt;||- ||- ||S ||! ||1 ||! ||S ||S ||S ||8 ||A:=0-A&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts the contents of the accumulator from zero, making it negative for the purpose of two&#039;s complement. P/V is set if A previously held $80. C is set if accumulator did not previously hold $00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CCF (Complement Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CCF &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||! ||- ||- ||4 ||CF:=!CF&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the carry flag. (Does not, as might be assumed, clear it!) Also sets H to the previous value of the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SCF (Set Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SCF &amp;lt;/code&amp;gt;||- ||- ||S ||1 ||0 ||- ||0 ||- ||- ||4 ||CF:=1&lt;br /&gt;
|}&lt;br /&gt;
:Sets the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;BIT (test BIT)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||0 ||? ||1 ||! ||? ||8 ||r[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Indirect ||S ||- ||0 ||? ||1 ||! ||? ||12 ||HL*[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||0 ||? ||1 ||! ||? ||20 ||(IXY+d)*[b]==1?&lt;br /&gt;
|}&lt;br /&gt;
:Tests if a bit is set on target value. The first parameter states which bit. The second can be any 8-bit register, or the location in memory pointed to by HL or indexed by IX or IY. Sets Z if specified bit was 0. S and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SET (SET bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* OR (1&amp;lt;&amp;lt;b); r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SETAE &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=unsigned($80)&amp;gt;&amp;gt;(E&amp;amp;7)&lt;br /&gt;
|}&lt;br /&gt;
:Sets the numbered bit on target value. The possible targets are the same as BIT. The three parameter variant is undocumented and stores the result in a register as well as performing the SET.&lt;br /&gt;
:SETAE is a Next extended opcode which takes the bit number to set from E (only the low 3 bits) and sets whole A to value of that bit, but counted from top to bottom (E=0 will produce A:=$80, E=7 will produce A:=$01). This works as pixel mask for ULA bitmap modes, when E is 0..255 x-coordinate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RES (RESet bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b)); r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Resets the numbered bit on target value. The possible targets are the same as BIT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DAA (Decimal Adjust Accumulator)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DAA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||- ||P ||! ||S ||S ||8 ||if(A&amp;amp;$0F&amp;gt;$09 or HF) A±=$06; if(A&amp;amp;$F0&amp;gt;$90 or CF) A±=$60 (± depends on NF)&lt;br /&gt;
|}&lt;br /&gt;
:Modifies the contents of the accumulator based on the flags left by previous operation to correct for binary coded decimal (BCD).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;MUL (MULtiply)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MUL d,e &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||DE:=D*E&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Multiplies D by E, storing 16 bit result into DE. Does not alter any flags (the opcode is not compatible with any of the R800/Z180/eZ80/... variants of MUL, it is solely Next specific).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SWAPNIB (SWAP NIBbles)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SWAPNIB &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=A[3210]&amp;lt;&amp;lt;4 OR A[7654]&amp;gt;&amp;gt;4&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Swaps the high and low nibbles of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELAD (PIXEL ADdress)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELAD &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||HL:=$4000+((D&amp;amp;$C0)&amp;lt;&amp;lt;5)+((D&amp;amp;$07)&amp;lt;&amp;lt;8)+((D&amp;amp;$38)&amp;lt;&amp;lt;2)+(E&amp;gt;&amp;gt;3)&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Takes E and D as the X,Y coordinate of a point and calculates the address of the byte containing this pixel in the pixel area of standard ULA screen 0, storing it in HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELDN (PIXEL DowN)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELDN &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||if(HL&amp;amp;$0700!=$0700) HL+=256;&amp;lt;br&amp;gt;&lt;br /&gt;
else if(HL&amp;amp;$e0!=$e0) HL:=HL&amp;amp;$F8FF+$20;&amp;lt;br&amp;gt;&lt;br /&gt;
else HL:=HL&amp;amp;$F81F+$0800&lt;br /&gt;
|}&lt;br /&gt;
:Updates the address in HL to move down by one line of pixels.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
;JP (JumP)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (HL) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC:=HL (not PC:=HL*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (IXY) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||PC:=IXY (not PC:=IXY*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (C) &amp;lt;/code&amp;gt;||Register ||- ||E ||? ||? ||? ||? ||? ||? ||13 ||PC:=PC&amp;amp;$C000+IN(C)&amp;lt;&amp;lt;6&lt;br /&gt;
|}&lt;br /&gt;
:Jumps (sets the PC) to the given address. The address can be given immediately or read from HL, IX, or IY. Note that although the variants that use register pairs &#039;&#039;look&#039;&#039; like they are using indirect addressing, JP (HL) jumps to the address stored in the register HL, not the address stored at the address HL points to. The JP (C) sets bottom 14 bits of current PC&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; to value read from I/O port: PC[13:0] = (IN (C) &amp;lt;&amp;lt; 6) (can be used to execute code block read from a disk stream) * &amp;quot;current PC&amp;quot; is address of next instruction after JP (C), as the PC is advanced by fetching op code from memory and is already advanced when execution happens - if the JP instruction resides at the very end of 16k memory block (..FE or ..FF address), then newly composed PC value will land into following 16k block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JP cc (JumP conditionally)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP Z/NZ/NC/C/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||if cc PC:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Conditionally jumps (sets the PC) to the given address. The condition is set in terms of the flags: Zero (Z, NZ), Carry (C, NC), Parity (PO, PE), and Sign (P/M). The address can only be given immediately for a conditional jump.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JR (Jump Relative)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ||PC+=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR C/NC/Z/NZ, nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ;   7 if not cc ||if cc PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Jumps to an alternate address by &#039;&#039;adding&#039;&#039; the parameter to the PC - in other words the parameter is an adjustment, not an absolute address. When used in an assembler with labels the syntax should be the same as JP. The JR address can only be given immediately. Conditions are legal, but only those based on carry and zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DJNZ (Decrement reg. b and Jump if Not Zero)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DJNZ n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||13 ||B--; if B!=0 PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Decrements B then performs JR NZ.. to the given address. Used for encapsulating loops.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CALL&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ||SP-=2; SP*:=PC; PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL Z/NZ/C/NC/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ;   10 if not cc ||if cc {SP-=2; SP*:=PC; PC:=nn}&lt;br /&gt;
|}&lt;br /&gt;
:Like JP (including the ability to have conditions), but PUSHes the PC before jumping. Used for subroutine calls. &lt;br /&gt;
:* If a subroutine ends with a CALL to another subroutine immediately before the RET, it is more efficient to JP to the other subroutine and allow its RET to return from the whole combination. This might make high-level programmers queasy but your compiler already does it (tail call optimization)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RET (RETurn)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET Z/NZ/C/NC/PO/PE/P/M &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||11 ;   5 if not cc ||if cc {PC:=SP*; SP+=2}&lt;br /&gt;
|}&lt;br /&gt;
:POPs the PC from the stack, returning from a previous CALL. This can also accept the same conditions as JP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETI (RETurn from Interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from an interrupt service routine (same as RET instruction, but also does signal to I/O device that the interrupt routine is completed).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETN (RETurn from Non-maskable interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETN &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||IFF1:=IFF2; PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from a non-maskable interrupt service routine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RST (ReSTart)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RST n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||CALL n&lt;br /&gt;
|}&lt;br /&gt;
:Performs a CALL to a routine located at one of eight fixed locations ($00, $08, ..., $38) in the zero page. This is located in ROM, and on the Spectrum only a limited number of values are useful to call built-in ROM routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOP (No OPeration)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NOP &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC+=1&lt;br /&gt;
|}&lt;br /&gt;
:Does &amp;quot;nothing&amp;quot; (just usual housekeeping like refreshing memory and advancing program counter to next instruction).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;HALT&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HALT &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||waits for interrupt&lt;br /&gt;
|}&lt;br /&gt;
:Suspends the CPU until an interrupt is received (maskable interrupts must be enabled to break the wait). While CPU is waiting for interrupt, the fake NOP instruction is being executed, to keep memory refresh going on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DI (Disable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=0; IFF2:=0&lt;br /&gt;
|}&lt;br /&gt;
:Disables maskable interrupts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EI (Enable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=1; IFF2:=1&lt;br /&gt;
|}&lt;br /&gt;
:Enables maskable interrupts (after next instruction, i.e. for example &amp;quot;EI RET&amp;quot; - the interrupt may happen only after RET instruction is finished (or &amp;quot;EI DI&amp;quot; pair of instructions will not allow any maskable interrupt to happen).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IM (Interrupt Mode)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IM n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||Interrupt mode:=n&lt;br /&gt;
|}&lt;br /&gt;
:Sets interrupt handling mode. The default for Next is 1. 2 is used for user defined interrupt service routines. IM 0 is useless on Next (and pretty much everything else, to be honest)&lt;br /&gt;
&lt;br /&gt;
=== Input and Output ===&lt;br /&gt;
;IN r, (c); OUT (c), r&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN r, (c) &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||0 ||P ||0 ||S ||S ||12 ||r := in(BC)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),r &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||12 ||out(BC,r)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs a byte value from the 16-bit port number given in BC. R can be any 8-bit register. Note that the port number is given in BC even though the instruction refers only to C. Some assemblers will allow the instruction to be written with &amp;quot;(bc)&amp;quot; instead of &amp;quot;(c)&amp;quot; as a reminder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN (c); OUT (c), 0&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN (c) &amp;lt;/code&amp;gt;||Register ||- ||U ||- ||0 ||P ||0 ||S ||S ||12 ||in(BC)?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),0 &amp;lt;/code&amp;gt;||Register ||Immediate ||U ||- ||- ||- ||- ||- ||- ||12 ||out(BC,0)&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes. The IN variation performs an input, but does not store the result, only setting the flags. The OUT variation outputs 0 on the port. This is the only number that can be output to a port in immediate mode. The Next FPGA does output zero, but some Z80 chips manufactured differently from early batches output different value like 255, so it is not recommended to use OUT (C),0 if you want to reuse your code also on classic ZX Spectrum or publish it as example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN a, (n); OUT (n), a&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN A, (n) &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||- ||- ||- ||- ||- ||- ||11 ||A := in(An)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (n),A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||11 ||out(An,A)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs the byte value in A from a 16-bit port number where the lower byte is N and the upper byte is A. This is only likely to be useful in cases where the upper byte of the port number is not relevant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INI (INput and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL++; B--&lt;br /&gt;
|}&lt;br /&gt;
:Inputs a value from port BC into memory at the address stored in HL, then increments HL and decrements B. Because B is decremented and is part of the port number, the port number for future INI instructions will change unless it is reset. Z is set if B reached 0; C, S, H, and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INIR (INput and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do INI while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Loops INIR until B reaches 0, so that if INIR starts with B=0 it loops 256 times. Because B is decremented during this process and is part of the port number, this is unlikely to be useful except when the upper byte of the port number is not relevant. Interrupts are recognized during execution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IND, INDR (INput and Decrement, INput and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IND &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL--; B--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do IND while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI and INIR except that HL is decremented instead of incremented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTI (Out and Increment), OTIR (Out and Increment Repeated), OUTD (Out and Decrement), OTDR (Out and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTI while (B&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTD &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTD while (B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI, INIR, IND, INDR except that they output instead of input and B is decremented &#039;&#039;&#039;before&#039;&#039;&#039; the output instead of after. Condition check on B is performed &#039;&#039;&#039;after&#039;&#039;&#039;, so that if OTIR starts with B=0 it loops 256 times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTINB (Out and Increment with No B)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTINB &amp;lt;/code&amp;gt;||- ||- ||E ||? ||? ||? ||? ||? ||? ||16 ||out(BC,HL*); HL++&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Behaves like OUTI, but doesn&#039;t decrement B.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEXTREG&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n,n&#039; &amp;lt;/code&amp;gt;||Immediate ||Immediate ||E ||- ||- ||- ||- ||- ||- ||20 ||HwNextReg_n:=n&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n, A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||E ||- ||- ||- ||- ||- ||- ||17 ||HwNextReg_n:=A&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Directly sets the [[Board feature control|Next Feature Control Registers]] without going through ports {{PortNo|$243B}} and {{PortNo|$253B}}.&lt;br /&gt;
&lt;br /&gt;
=== A note on some Z80-N specific observations ===&lt;br /&gt;
2021-09-16: figuring out the hard way, the three Z80N instructions `ADD HL/DE/BC,A` actually do NOT preserve carry flag, but change it to undefined value (verified with core 3.1.5). There&#039;s also strong suspicion (but not verified yet), that LDIX/LDDX/LDIRX/LDDRX/LDPIRX do affects flags the same way as LDI/LDIR - to be verified.&lt;br /&gt;
&lt;br /&gt;
2025-01-25: Testing 3.02.x 1) &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt; affect the flags similarly to &amp;lt;code&amp;gt;LDI&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDD&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LDDR&amp;lt;/code&amp;gt;. 2) &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt; most probably always reset the carry flag.&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
&lt;br /&gt;
This section lists the changes of the specification of the behavior of Z80N instructions, compared to the previous content of this wiki page.&lt;br /&gt;
&lt;br /&gt;
2022-01-11: The previous versions of this page didn&#039;t match what was [http://www.z80.info/zip/z80-documented.pdf documented] for several years, that regular Z80 INI/IND/INIR/INDR/OUTI/OUTD/OTIR/OTDR instructions do modify carry flag (contrary to the official Z80 documentation and many Internet resources describing Z80 instructions).&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41127</id>
		<title>Extended Z80 instruction set</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Z80_instruction_set&amp;diff=41127"/>
		<updated>2025-10-07T11:57:55Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: rebuilt tables&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
This is a general list of Z80 and Z80N instructions with descriptions. The instructions specific to Z80N have the [[#Z80N_instructions_opcodes|encodings described first]].&lt;br /&gt;
&lt;br /&gt;
For a table of summaries without additional descriptions see the [[Z80 Instruction Table]]. There&#039;s also a [[Special:RunQuery/OpcodeQuery|special search for opcodes in the same table]] and an external [https://table.specnext.dev/ Z80N opcode value matrix on specnext.dev].&lt;br /&gt;
&lt;br /&gt;
=== Z80N instructions opcodes ===&lt;br /&gt;
&lt;br /&gt;
This is a table of the instructions and the encodings of all &#039;&#039;&#039;Next-specific&#039;&#039;&#039; Z80 instructions:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Instruction !!data-sort-type=&amp;quot;text&amp;quot;| Encoding (2-4 bytes) (hex) !! T-States !! Description !! 4 letter&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;SWAPNIB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 23&amp;lt;/code&amp;gt;  || 8 || Swap the nibbles (4-bits) of A || SWAP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;MIRROR A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 24&amp;lt;/code&amp;gt;  || 8  || Mirror bits 0..7 to 7..0 of A || MIRR&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt; &amp;lt;code&amp;gt;TEST $im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 27&amp;lt;/code&amp;gt; value  || 11 || Change flags as AND A but A stays unaffected ||style=&amp;quot;color:DarkGrey;&amp;quot;|  TEST&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSLA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 28&amp;lt;/code&amp;gt;  || 8  || Shift left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSLA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRA DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 29&amp;lt;/code&amp;gt;  || 8  || Shift right signed DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRA&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRL DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2A&amp;lt;/code&amp;gt;  || 8  || Shift right DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BSRF DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2B&amp;lt;/code&amp;gt;  || 8  || Shift right DE, filling 1 for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BSRF&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;BRLC DE,B&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 2C&amp;lt;/code&amp;gt;  || 8  || Rotate left DE for B bits ||style=&amp;quot;color:DarkGrey;&amp;quot;|  BRLC&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;MUL D,E&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 30&amp;lt;/code&amp;gt;  || 8  || Multiply D with E, result in DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  MUL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 31&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 32&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 33&amp;lt;/code&amp;gt;  || 8  || Add unsigned A to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD HL,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 34 low high&amp;lt;/code&amp;gt;   || 16  || Add a constant to HL ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD DE,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 35 low high&amp;lt;/code&amp;gt;  || 16   || Add a constant to DE ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;ADD BC,$im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 36 low high&amp;lt;/code&amp;gt;  || 16  || Add a constant to BC ||style=&amp;quot;color:DarkGrey;&amp;quot;|  ADD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 8A  high low&amp;lt;/code&amp;gt;  || 23  || Push a constant ||style=&amp;quot;color:DarkGrey;&amp;quot;|  PUSH&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;OUTINB&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 90&amp;lt;/code&amp;gt;  || 16  || OUTI, but don&#039;t change B || OTIB&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,$im8&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 91 register value&amp;lt;/code&amp;gt;  || 20  || Write v to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;NEXTREG $im8,A&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 92 register&amp;lt;/code&amp;gt; || 17  || Write A to Next register r || NREG&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELDN&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 93&amp;lt;/code&amp;gt;  || 8  || HL as a pixel address moved one line down || PXDN&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;PIXELAD&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 94&amp;lt;/code&amp;gt;  || 8  || HL := as ULA pixel address from D==Y E==X || PXAD&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;SETAE&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 95&amp;lt;/code&amp;gt;  || 8  || Get A as a mask for ULA pixel from E || STAE&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;JP (C)&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED 98&amp;lt;/code&amp;gt;  || 13  || IN (C) then jump to a 64 byte section ||style=&amp;quot;color:DarkGrey;&amp;quot;|  JP&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A4&amp;lt;/code&amp;gt;  || 16  || Extended LDI byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDIX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDWS&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED A5&amp;lt;/code&amp;gt;  || 14  || Byte copy as for Layer 2 ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDWS&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED AC&amp;lt;/code&amp;gt;  || 16  || Extended LDD byte copy ||style=&amp;quot;color:DarkGrey;&amp;quot;|  LDDX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B4&amp;lt;/code&amp;gt;  || 21/16  || Extended LDIR || LIRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDPIRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED B7&amp;lt;/code&amp;gt;  || 21/16  || Byte copy as for a pattern fill || LPRX&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;  &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt;  &amp;lt;/code&amp;gt;|| &amp;lt;code&amp;gt;ED BC&amp;lt;/code&amp;gt;  || 21/16  || Extended LDDR || LDRX&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
More details and the explanations of all Z80 instructions implemented in the Next Z80 CPU follow.&lt;br /&gt;
&lt;br /&gt;
Notes: &lt;br /&gt;
&lt;br /&gt;
* The encoding of the operand of the &amp;lt;code&amp;gt;PUSH $im16&amp;lt;/code&amp;gt; is unique: it is the only operand encoded as big-endian.&lt;br /&gt;
* The timings (T-States) are based on some limited testing and may not be accurate.&lt;br /&gt;
* The shorter aliases of the official mnemonics (the 4-letter column) are those suggested in an initiative led by Matt Davies, the author of Odin assembler, editor and debugger tool for ZX Next.&lt;br /&gt;
* A relevant early source for this table could be [https://github.com/z88dk/z88dk/issues/312#issuecomment-322659205 a Christmas 2018 edit of a comment in a discussion of an issue 312 of z88dk].&lt;br /&gt;
&lt;br /&gt;
=== Notation ===&lt;br /&gt;
* In the descriptions &#039;&#039;any 8-bit register&#039;&#039; means A, B, C, D, E, H, and L. The registers named F, I and R aren&#039;t a part of this set even if they are technically 8 bit registers. Additionally, IXH, IXL, IYH, IYL, which are the high and low byte parts of IX and IY, can be used in some of the instructions as 8-bit registers although this wasn&#039;t documented for the original Z80.&lt;br /&gt;
* IXY means IX or IY.&lt;br /&gt;
* For the status field:&lt;br /&gt;
** S means Standard. It&#039;s in the Z80 manual. Everything should support it.&lt;br /&gt;
** U means Undocumented. It works on Z80 chips, but it&#039;s not in the manual. These have been known for years and were acknowledged by Zilog, so they should work on everything, but some assemblers may vary the syntax.&lt;br /&gt;
** E means Extension. It &#039;&#039;only&#039;&#039; works on the Z80 core on the Next. It&#039;ll probably only be accepted by assemblers that have been updated specifically for the Next.&lt;br /&gt;
* Each of the flag effects is documented as follows:&lt;br /&gt;
** - means the flag is unchanged.&lt;br /&gt;
** 1 or 0 mean the flag is set or reset as appropriate.&lt;br /&gt;
** ? means we don&#039;t know what effect the instruction has on the flag.&lt;br /&gt;
** ! means the instruction has an unusual effect on the flag which is documented in the description.&lt;br /&gt;
** S means the effect on the flag is &amp;quot;standard&amp;quot;. C is set if a carry/borrow occurred beyond the MSB; Z is set if the result of the operation is zero; H is set if a carry/borrow occurred beyond bit 3.&lt;br /&gt;
** P, V, and L are used for the P/V flag which has several standard effects. P means it&#039;s parity. V means it&#039;s overflow. L means it checks BC as loop counter for some of the block copy and search instructions: P/V = (BC != 0)&lt;br /&gt;
&lt;br /&gt;
=== Register and Data manipulation ===&lt;br /&gt;
;LD (LoaD)&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, r&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||r := r&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r,n &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||7 ||r := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (HL) &amp;lt;/code&amp;gt;||Register ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||r := HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD r, (IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||S ||- ||- ||- ||- ||- ||- ||19 ||r := (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL),r &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||7 ||HL* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d),r &amp;lt;/code&amp;gt;||Indexed ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+D)* := r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (HL), n &amp;lt;/code&amp;gt;||Indirect ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||HL* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (IXY+d), n &amp;lt;/code&amp;gt;||Indexed ||Immediate ||S ||- ||- ||- ||- ||- ||- ||19 ||(IXY+d)* := n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (BC/DE) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||- ||- ||- ||- ||- ||- ||7 ||A := rr*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, (nn) &amp;lt;/code&amp;gt;||Accumulator ||Address ||S ||- ||- ||- ||- ||- ||- ||13 ||A := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (BC/DE), A &amp;lt;/code&amp;gt;||Indirect ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||7 ||rr* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), A &amp;lt;/code&amp;gt;||Address ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||13 ||(nn)* := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, I &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := I; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD A, R &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||- ||0 ||! ||0 ||S ||S ||9 ||A := R; P/V:=IFF2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD I, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||I := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD R, A &amp;lt;/code&amp;gt;||Register ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||9 ||R := A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/HL/SP, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||10 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD IXY, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||S ||- ||- ||- ||- ||- ||- ||14 ||rr := nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD HL, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||16 ||HL := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD BC/DE/SP/IXY, (nn) &amp;lt;/code&amp;gt;||Register ||Address ||S ||- ||- ||- ||- ||- ||- ||20 ||rr := (nn)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), HL &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||16 ||(nn)* := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD (nn), BC/DE/SP/IXY &amp;lt;/code&amp;gt;||Address ||Register ||S ||- ||- ||- ||- ||- ||- ||20 ||(nn)* := rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||6 ||SP := HL&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LD SP, IXY &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||10 ||SP := IXY&lt;br /&gt;
|}&lt;br /&gt;
:The basic data load/transfer instruction. Transfers data from the location specified by the second argument, to the location specified by the first. Available combinations are as follows:&lt;br /&gt;
:* Any 8-bit register can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of any other 8-bit register except I and R;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by HL;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory offset-indexed by IX or IY.&lt;br /&gt;
:* Additionally, the accumulator A (only) can be:&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by BC or DE;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address;&lt;br /&gt;
:** loaded with the contents of I or R.&lt;br /&gt;
:* Any 16-bit register pair can be:&lt;br /&gt;
:** loaded with an immediate value;&lt;br /&gt;
:** loaded with the contents of, or stored in, memory pointed to by an immediate address.&lt;br /&gt;
:* Additionally, SP (only) can be:&lt;br /&gt;
:** loaded with the contents of HL, IX, or IY.&lt;br /&gt;
:** The planned &#039;&#039;&#039;ld hl, sp&#039;&#039;&#039; didn&#039;t make it to Next yet, one possible workaround is: &#039;&#039;&#039;ld hl,0&#039;&#039;&#039;; &#039;&#039;&#039;add hl,sp&#039;&#039;&#039;;&lt;br /&gt;
:* Memory referred to by HL or through IX can be assigned immediate values.&lt;br /&gt;
:Although 16-bit register pairs cannot be directly moved between each other, they can be moved by moving the two 8-bit registers. (SP gets a special case because it can&#039;t be addressed via 8-bit registers.) Some assemblers will provide built-in macro instructions allowing, for example, &#039;&#039;&#039;ld bc, de&#039;&#039;&#039;.&lt;br /&gt;
:LD instructions do not alter any flags unless I or R are loaded into A.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EX (EXchange)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX DE, HL &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(DE,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX AF, AF&#039; &amp;lt;/code&amp;gt;||Register ||Register ||S ||! ||! ||! ||! ||! ||! ||4 ||swap(AF,AF&#039;)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), HL &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||19 ||swap(SP*,HL)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EX (SP), IXY &amp;lt;/code&amp;gt;||Indirect ||Register ||S ||- ||- ||- ||- ||- ||- ||23 ||swap(SP*,IXY)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges the contents of two sources. The only permitted combinations are&lt;br /&gt;
:* Exchanging DE and HL;&lt;br /&gt;
:* Exchanging AF and AF&#039;;&lt;br /&gt;
:* Exchanging HL, IX, or IY with the contents of memory pointed to by SP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EXX (EXchange all)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EXX &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||swap(BC,BC&#039;);swap(DE,DE&#039;);swap(HL,HL&#039;)&lt;br /&gt;
|}&lt;br /&gt;
:Exchanges BC, DE, and HL with their shadow registers. AF and AF&#039; are not exchanged. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH BC/DE/HL/AF &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||15 ||SP-=2; SP*:=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PUSH nn &amp;lt;/code&amp;gt;||Immediate ||- ||E ||- ||- ||- ||- ||- ||- ||23 ||SP-=2; SP*:=nn&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
:Pushes the given argument on the stack. This can be any 16-bit register pair except SP. SP is reduced by 2 and then the argument is written to the new location SP points to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP BC/DE/HL &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP AF &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||! ||! ||! ||! ||! ||10 ||rr:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;POP IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||rr:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Pops the given argument from the stack. This can be any 16-bit register pair except SP. The current value at SP is copied to the register pair and then SP is raised by 2.&lt;br /&gt;
:Popping into AF does set value of flag register F directly to low 8 bits of value from stack.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Block Copy ===&lt;br /&gt;
;LDI (LoaD and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE++; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Copies the byte pointed to by HL to the address pointed to by DE, then adds 1 to DE and HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIR (LoaD and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||21x+16 ||do LDI while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops LDI until BC reaches zero. Note the last iteration starts when BC=1 and ends with BC=0 (starting the LDIR with BC=0 will start 64kiB transfer, most likely overwriting vital parts of system memory and/or code itself).&lt;br /&gt;
:Flag effects are the same as LDI except that P/V will always be reset, because BC by definition reaches 0 before this instruction ends (normally - unless something overwrites LDIR opcode while BC&amp;gt;0).&lt;br /&gt;
:Interrupts may interrupt LDIR instruction while looping (after each single LDI sub-part finished) and LDIR will resume after and finish loop properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDD (LoaD and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||L ||0 ||- ||- ||16 ||DE*:=HL*; DE--; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDI, but subtracts 1 from DE and HL instead of adding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDDR (LoaD and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||0 ||0 ||- ||- ||21x+16 ||do LDD while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as LDIR but loops LDD instead of LDI.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDWS&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDWS &amp;lt;/code&amp;gt;||- ||- ||E ||- ||0 ||! ||S ||S ||S ||14 ||DE*:=HL*; INC L; INC D;&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcode. Copies the byte pointed to by HL to the address pointed to by DE and increments only L and D. This is used for vertically copying bytes to the Layer 2 display.&lt;br /&gt;
:The flags are identical to what the &#039;&#039;&#039;INC D&#039;&#039;&#039; instruction would produce.&lt;br /&gt;
:Note the source data are read only from single 256B (aligned) block of memory, because only L is incremented, not HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDIX, LDIRX, LDDX, LDDRX&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL++; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDIX while(BC&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||16 ||{if HL*!=A DE*:=HL*;} DE++; HL--; BC--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDDRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do LDDX while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Next-only extended opcodes. Behave similarly as their non-X equivalents except the byte is not copied if it is equal to A and LDDX/LDDRX advance DE by incrementing it (like LDI), while HL is decremented (like LDD).&lt;br /&gt;
:Second difference to non-X instructions (as usual with next-only opcodes due to implementation), the extended ones don&#039;t modify any flags.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;LDPIRX &lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;LDPIRX &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||21/16 ||do{t:=(HL&amp;amp;$FFF8+E&amp;amp;7)*; {if t!=A DE*:=t;} DE++; BC--}while(BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Similar to LDIRX except the source byte address is not just HL, but is obtained by using the top 13 bits of HL and the lower 3 bits of DE and HL does not increment during whole loop (HL works as base address of aligned 8 byte lookup table, DE works as destination and also wrapping index 0..7 into table). This is intended for &amp;quot;pattern fill&amp;quot; functionality.&lt;br /&gt;
&lt;br /&gt;
=== Block Search ===&lt;br /&gt;
;CPI (ComPare and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL++; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Compares the byte pointed to by HL with the contents of A and sets Z if it matches or S if the comparison goes negative. Then adds 1 to HL and subtracts 1 from BC. P/V is set to (BC!=0), i.e. set when non zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPIR (ComPare and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPIR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPI while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Automatically loops CPI until either Z is set (A is found in the byte pointed to by HL) or P/V is reset (BC reached 0).&lt;br /&gt;
:Flag effects are the same as CPI except that one of the two terminating flag conditions will always be true.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPD (ComPare and Decrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||16 ||HL*==A?; HL--; BC--&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPI, but subtracts 1 from HL instead of adding it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPDR (ComPare and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPDR &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||L ||S ||! ||S ||21x+16 ||do CPD while (!Z &amp;amp;&amp;amp; BC&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Same as CPIR but loops CPD instead of CPI. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
;ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||11 ||HL+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD IXY, BC/DE/IXY/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||- ||! ||- ||- ||15 ||IXY+=rr&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, A &amp;lt;/code&amp;gt;||Register ||Register ||E ||? ||- ||- ||- ||- ||- ||8 ||rr+=unsigned A&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADD HL/DE/BC, nn &amp;lt;/code&amp;gt;||Register ||Immediate ||E ||- ||- ||- ||- ||- ||- ||16 ||rr+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together. Legal combinations are:&lt;br /&gt;
:* When adding 8-bit values the first parameter must be A and the second may be:&lt;br /&gt;
:** The contents of an 8-bit register;&lt;br /&gt;
:** An immediate value;&lt;br /&gt;
:** The contents of memory pointed to by HL or by indexing based on IX or IY.&lt;br /&gt;
:* When adding 16-bit values the first parameter must be HL, IX or IY and the second must be another 16-bit register pair. If the first parameter is IX or IY, the second cannot be HL or the other index register. &lt;br /&gt;
:* For 16 bit additions (regular Z80), H is set if a carry occurred in bit 11 (ie, a half carry in the high byte)&lt;br /&gt;
:* On the Spectrum Next the extended opcodes also allow the first parameter to be HL, DE, or BC and the second to be A (A will be zero extended to 16 bits) or an 16bit immediate value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;ADC (ADd with Carry)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||0 ||V ||S ||S ||S ||4 ||A+=r+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=n+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||0 ||V ||S ||S ||S ||7 ||A+=HL*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||0 ||V ||S ||S ||S ||19 ||A+=(IXY+d)*+(CF?1:0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;ADC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||0 ||V ||! ||S ||S ||15 ||HL+=rr+(CF?1:0)&lt;br /&gt;
|}&lt;br /&gt;
:Adds values together, adding an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of ADC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if carry from bit 11; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
;SUB&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A -= r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A -= HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SUB (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A -= (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts a value from A. Legal combinations are the same as for ADD for 8-bit, except that A does not need to be specified as the first parameter because subtraction can only be done from A. SUB cannot be used for 16-bit numbers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SBC (SuBtract with Carry, er, borrow)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, r &amp;lt;/code&amp;gt;||Accumulator ||Register ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=(r+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, n &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(n+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (HL) &amp;lt;/code&amp;gt;||Accumulator ||Indirect ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=(HL*+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC A, (IXY+d) &amp;lt;/code&amp;gt;||Accumulator ||Indexed ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=((IXY+d)+(CF?1:0))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SBC HL, BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||Register ||S ||S ||1 ||V ||! ||S ||S ||15 ||HL-=(rr+(CF?1:0))&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts values, subtracting an additional 1 if Carry is set. Legal combinations are the same as for ADD, although there are no extended opcode versions of SBC and in 16-bit values the first parameter can only be HL. For 16-bit values the H flag is set if borrow from bit 12; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;AND, OR, XOR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||1 ||S ||S ||4 ||A := A &amp;amp; r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||1 ||S ||S ||7 ||A := A &amp;amp; HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;AND (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||1 ||S ||S ||19 ||A := A &amp;amp; (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A OR r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A OR HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A OR (IXY+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR r &amp;lt;/code&amp;gt;||Register ||- ||S ||0 ||0 ||P ||0 ||S ||S ||4 ||A := A ^ r&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ n&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||0 ||0 ||P ||0 ||S ||S ||7 ||A := A ^ HL*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;XOR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||0 ||0 ||P ||0 ||S ||S ||19 ||A := A ^ (IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Performs the appropriate bitwise operator on A. Legal combinations are the same as SUB. &lt;br /&gt;
&lt;br /&gt;
:XOR A is faster and shorter than LD A,0&lt;br /&gt;
&lt;br /&gt;
;MIRROR&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MIRROR A &amp;lt;/code&amp;gt;||Register ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A[76543210]:=A[01234567]&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Mirrors (reverses the order) of bits in the accumulator. Older core versions supported MIRROR DE, but this was removed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CP (ComPare)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP r &amp;lt;/code&amp;gt;||Register ||- ||S ||S ||1 ||V ||S ||S ||S ||4 ||A-=r?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=n?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||S ||1 ||V ||S ||S ||S ||7 ||A-=HL*?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CP (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||S ||1 ||V ||S ||S ||S ||19 ||A-=(IXY+d)?&lt;br /&gt;
|}&lt;br /&gt;
:Sets the flags as if a SUB was performed but does not perform it. Legal combinations are the same as SUB. This is commonly used to set the flags to perform an equality or greater/less test.&lt;br /&gt;
:* CP is &#039;&#039;not&#039;&#039; equivalent to &amp;quot;if&amp;quot; in high level languages. Flag based jumps can follow any instruction that sets the flags, not just CP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;TEST&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;TEST n &amp;lt;/code&amp;gt;||Immediate ||- ||E ||S ||? ||P ||S ||S ||S ||11 ||A&amp;amp;n?&lt;br /&gt;
|}&lt;br /&gt;
: Next extended opcode. Similar to CP, but performs an AND instead of a subtraction. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INC (INCrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||0 ||! ||S ||S ||S ||4 ||r++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||0 ||! ||S ||S ||S ||11 ||HL*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||0 ||! ||S ||S ||S ||23 ||(IXY+d)*++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr++&lt;br /&gt;
|}&lt;br /&gt;
:Increments the target by one. The argument can be any 8-bit register, any 16-bit register pair, or the address pointed to by HL or indexed via IX or IY. P/V is set if the target held $7F. N is reset.&lt;br /&gt;
:* INC A is faster than ADD 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DEC (DECrement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC r &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||1 ||! ||S ||S ||S ||4 ||r--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||- ||1 ||! ||S ||S ||S ||11 ||HL*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||- ||1 ||! ||S ||S ||S ||23 ||(IXY+D)*--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC BC/DE/HL/SP &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||6 ||rr--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DEC IXY &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||rr--&lt;br /&gt;
|}&lt;br /&gt;
:Decrements the target by one. Allowed arguments are the same as INC. Flag effects are the same as INC except H refers to borrow, not carry; and P/V is set if the target held $80.&lt;br /&gt;
:* DEC A is faster than SUB 1.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLC (Rotate Left Circular)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Rotates the target bitwise left by one position. The MSB is copied to bit 0, and also to Carry. Can be applied to any 8-bit register or to a location in memory pointed to by HL or indexed via IX or IY. The final alternative is undocumented, and stores the result in a register as well as performing the operation. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RL (Rotate Left)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[7]; r:=r&amp;lt;&amp;lt;1; r[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[7]; HL*:=HL*&amp;lt;&amp;lt;1; HL*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[7]; (IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1; (IXY+d)*[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RL r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[7]; (IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; (IX+d)*[0]:=CF; CF:=x; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC, except the MSB is copied to Carry only, and the previous contents of Carry are copied to bit 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRC, RR (Rotate Right Circular, Rotate Right)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRC r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=x; CF:=x; r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||x:=r[0]; r:=r&amp;gt;&amp;gt;1; r[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||x:=HL*[0]; HL*:=HL*&amp;gt;&amp;gt;1; HL*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IXY+d)*[0]; (IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1; (IXY+d)*[7]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RR r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||x:=(IX+d)*[0]; (IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1; (IX+d)*[7]:=CF; CF:=x; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLC and RL except they rotate right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLA (Shift Left Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;lt;&amp;lt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SLA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;lt;&amp;lt;1; r=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RL except bit 0 is set to zero, not the previous contents of Carry.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRA (Shift Right Arithmetic)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||S ||8 ||r:=r&amp;gt;&amp;gt;1 OR r[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=HL*&amp;gt;&amp;gt;1 OR HL*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=(IXY+d)*&amp;gt;&amp;gt;1 OR (IXY+d)*[7]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRA r,(IX+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IX+d)*:=(IX+d)*&amp;gt;&amp;gt;1 OR (IX+d)*[7]; r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as RR except the MSB is left unchanged (on the assumption that it&#039;s the sign bit), not replaced with the previous contents of Carry. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SRL (Shift Right Logical)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r &amp;lt;/code&amp;gt;||Register ||- ||S ||! ||0 ||P ||0 ||S ||0 ||8 ||r:=unsigned(r)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||S ||! ||0 ||P ||0 ||S ||0 ||15 ||HL*:=unsigned(HL*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||S ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SRL r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||0 ||23 ||(IXY+d)*:=unsigned((IXY+d)*)&amp;gt;&amp;gt;1; r:=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Same as SLA except it shifts right instead of left.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLCA, RLA, RRCA, RRA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[7]; A:=A&amp;lt;&amp;lt;1; A[0]:=CF; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRCA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=x; CF:=x&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||0 ||- ||- ||4 ||x:=A[0]; A:=A&amp;gt;&amp;gt;1; A[7]:=CF; CF:=x&lt;br /&gt;
|}&lt;br /&gt;
:Same as their matching instruction except they work only on A, are faster, and do not alter S, Z or P/V.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SLL (Shift Left Logical)&lt;br /&gt;
:This mnemonic has no associated opcode. There is no difference between a logical and arithmetic shift left, so both can use SLA, but some assemblers will allow SLL as an equivalent. Unfortunately, some will also assemble it as SL1. So it&#039;s probably worth just avoiding.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SL1 or SLI (Shift Left and Add 1) or (Shift Left and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r &amp;lt;/code&amp;gt;||Register ||- ||U ||! ||0 ||P ||0 ||S ||S ||8 ||r:=(r&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (HL) &amp;lt;/code&amp;gt;||Indirect ||- ||U ||! ||0 ||P ||0 ||S ||S ||15 ||HL*:=(HL*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 (IXY+d) &amp;lt;/code&amp;gt;||Indexed ||- ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SL1 r,(IXY+d) &amp;lt;/code&amp;gt;||Register ||Indexed ||U ||! ||0 ||P ||0 ||S ||S ||23 ||(IXY+d)*:=((IXY+d)*&amp;lt;&amp;lt;1)+1; r=(IXY+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes that behave like SLA, but set bit 0 to 1 instead of 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RLD (Rotate Left bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RLD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[0123]:=A[0123]; HL*[7654]:=x[0123]; A[0123]:=x[7654]  &lt;br /&gt;
|}&lt;br /&gt;
:Rotates the lower nibble of the byte pointed to by HL, the upper nibble of that byte, and the lower nibble of A, in that order.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RRD (Rotate Right bcd Digit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RRD &amp;lt;/code&amp;gt;||- ||- ||S ||- ||0 ||P ||0 ||S ||S ||18 ||x=HL*; HL*[7654]:=A[0123]; HL*[0123]:=x[7654]; A[0123]:=x[0123]&lt;br /&gt;
|}&lt;br /&gt;
:Same as RLD, but the order is: the lower nibble pointed to by HL, the lower nibble of the A, and the upper nibble of the byte.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;Barrel (variable amount) shift and rotate (cores v2+ only)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSLA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRA DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=signed(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRL DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=unsigned(DE)&amp;gt;&amp;gt;(B&amp;amp;31) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BSRF DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=~(unsigned(~DE)&amp;gt;&amp;gt;(B&amp;amp;31)) ||8&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BRLC DE,B &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||DE:=DE&amp;lt;&amp;lt;(B&amp;amp;15) OR DE&amp;gt;&amp;gt;(16-B&amp;amp;15) ||8&lt;br /&gt;
|}&lt;br /&gt;
:Shift instructions use only bits 4..0 of B, BSLA shifts DE left, BSRA/BSRL/BSRF shifts DE right in arithmetic/logical/fill-one way. BRLC rotates DE left by B places, uses only bits 3..0 of B (to rotate right, use B=16-places).&lt;br /&gt;
&lt;br /&gt;
If you are implementing BSRF in C (or similar), be careful with implicit variable type promotion. You will need to do something like this: DE:=~((uint16_t)~DE&amp;gt;&amp;gt;(B&amp;amp;31))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CPL (ComPLement)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CPL &amp;lt;/code&amp;gt;||- ||- ||S ||- ||1 ||- ||1 ||- ||- ||4 ||A:=~A&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the contents of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEG (NEGate)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEG &amp;lt;/code&amp;gt;||- ||- ||S ||! ||1 ||! ||S ||S ||S ||8 ||A:=0-A&lt;br /&gt;
|}&lt;br /&gt;
:Subtracts the contents of the accumulator from zero, making it negative for the purpose of two&#039;s complement. P/V is set if A previously held $80. C is set if accumulator did not previously hold $00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CCF (Complement Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CCF &amp;lt;/code&amp;gt;||- ||- ||S ||! ||0 ||- ||! ||- ||- ||4 ||CF:=!CF&lt;br /&gt;
|}&lt;br /&gt;
:Inverts the carry flag. (Does not, as might be assumed, clear it!) Also sets H to the previous value of the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SCF (Set Carry Flag)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SCF &amp;lt;/code&amp;gt;||- ||- ||S ||1 ||0 ||- ||0 ||- ||- ||4 ||CF:=1&lt;br /&gt;
|}&lt;br /&gt;
:Sets the carry flag.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;BIT (test BIT)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||0 ||? ||1 ||! ||? ||8 ||r[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Indirect ||S ||- ||0 ||? ||1 ||! ||? ||12 ||HL*[b]==1?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;BIT b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||0 ||? ||1 ||! ||? ||20 ||(IXY+d)*[b]==1?&lt;br /&gt;
|}&lt;br /&gt;
:Tests if a bit is set on target value. The first parameter states which bit. The second can be any 8-bit register, or the location in memory pointed to by HL or indexed by IX or IY. Sets Z if specified bit was 0. S and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SET (SET bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* OR (1&amp;lt;&amp;lt;b)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SET r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* OR (1&amp;lt;&amp;lt;b); r:=(IX+d)*&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SETAE &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=unsigned($80)&amp;gt;&amp;gt;(E&amp;amp;7)&lt;br /&gt;
|}&lt;br /&gt;
:Sets the numbered bit on target value. The possible targets are the same as BIT. The three parameter variant is undocumented and stores the result in a register as well as performing the SET.&lt;br /&gt;
:SETAE is a Next extended opcode which takes the bit number to set from E (only the low 3 bits) and sets whole A to value of that bit, but counted from top to bottom (E=0 will produce A:=$80, E=7 will produce A:=$01). This works as pixel mask for ULA bitmap modes, when E is 0..255 x-coordinate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RES (RESet bit)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,r &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||8 ||r:=r &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(HL) &amp;lt;/code&amp;gt;||Immediate ||Register ||S ||- ||- ||- ||- ||- ||- ||15 ||HL*:=HL* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES b,(IXY+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||S ||- ||- ||- ||- ||- ||- ||23 ||(IXY+d)*:=(IXY+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b))&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RES r,b,(IX+d) &amp;lt;/code&amp;gt;||Immediate ||Indexed ||U ||- ||- ||- ||- ||- ||- ||23 ||(IX+d)*:=(IX+d)* &amp;amp; (~(1&amp;lt;&amp;lt;b)); r:=(IX+d)*&lt;br /&gt;
|}&lt;br /&gt;
:Resets the numbered bit on target value. The possible targets are the same as BIT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DAA (Decimal Adjust Accumulator)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DAA &amp;lt;/code&amp;gt;||- ||- ||S ||! ||- ||P ||! ||S ||S ||8 ||if(A&amp;amp;$0F&amp;gt;$09 or HF) A±=$06; if(A&amp;amp;$F0&amp;gt;$90 or CF) A±=$60 (± depends on NF)&lt;br /&gt;
|}&lt;br /&gt;
:Modifies the contents of the accumulator based on the flags left by previous operation to correct for binary coded decimal (BCD).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;MUL (MULtiply)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;MUL d,e &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||DE:=D*E&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Multiplies D by E, storing 16 bit result into DE. Does not alter any flags (the opcode is not compatible with any of the R800/Z180/eZ80/... variants of MUL, it is solely Next specific).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;SWAPNIB (SWAP NIBbles)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;SWAPNIB &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||A:=A[3210]&amp;lt;&amp;lt;4 OR A[7654]&amp;gt;&amp;gt;4&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Swaps the high and low nibbles of the accumulator.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELAD (PIXEL ADdress)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELAD &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||HL:=$4000+((D&amp;amp;$C0)&amp;lt;&amp;lt;5)+((D&amp;amp;$07)&amp;lt;&amp;lt;8)+((D&amp;amp;$38)&amp;lt;&amp;lt;2)+(E&amp;gt;&amp;gt;3)&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Takes E and D as the X,Y coordinate of a point and calculates the address of the byte containing this pixel in the pixel area of standard ULA screen 0, storing it in HL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;PIXELDN (PIXEL DowN)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;PIXELDN &amp;lt;/code&amp;gt;||- ||- ||E ||- ||- ||- ||- ||- ||- ||8 ||if(HL&amp;amp;$0700!=$0700) HL+=256;&amp;lt;br&amp;gt;&lt;br /&gt;
else if(HL&amp;amp;$e0!=$e0) HL:=HL&amp;amp;$F8FF+$20;&amp;lt;br&amp;gt;&lt;br /&gt;
else HL:=HL&amp;amp;$F81F+$0800&lt;br /&gt;
|}&lt;br /&gt;
:Updates the address in HL to move down by one line of pixels.&lt;br /&gt;
&lt;br /&gt;
=== Control Flow ===&lt;br /&gt;
;JP (JumP)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (HL) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC:=HL (not PC:=HL*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (IXY) &amp;lt;/code&amp;gt;||Register ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||PC:=IXY (not PC:=IXY*)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP (C) &amp;lt;/code&amp;gt;||Register ||- ||E ||? ||? ||? ||? ||? ||? ||13 ||PC:=PC&amp;amp;$C000+IN(C)&amp;lt;&amp;lt;6&lt;br /&gt;
|}&lt;br /&gt;
:Jumps (sets the PC) to the given address. The address can be given immediately or read from HL, IX, or IY. Note that although the variants that use register pairs &#039;&#039;look&#039;&#039; like they are using indirect addressing, JP (HL) jumps to the address stored in the register HL, not the address stored at the address HL points to. The JP (C) sets bottom 14 bits of current PC&amp;lt;sup&amp;gt;*&amp;lt;/sup&amp;gt; to value read from I/O port: PC[13:0] = (IN (C) &amp;lt;&amp;lt; 6) (can be used to execute code block read from a disk stream) * &amp;quot;current PC&amp;quot; is address of next instruction after JP (C), as the PC is advanced by fetching op code from memory and is already advanced when execution happens - if the JP instruction resides at the very end of 16k memory block (..FE or ..FF address), then newly composed PC value will land into following 16k block.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JP cc (JumP conditionally)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JP Z/NZ/NC/C/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||if cc PC:=nn&lt;br /&gt;
|}&lt;br /&gt;
:Conditionally jumps (sets the PC) to the given address. The condition is set in terms of the flags: Zero (Z, NZ), Carry (C, NC), Parity (PO, PE), and Sign (P/M). The address can only be given immediately for a conditional jump.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;JR (Jump Relative)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ||PC+=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;JR C/NC/Z/NZ, nn &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||12 ;   7 if not cc ||if cc PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Jumps to an alternate address by &#039;&#039;adding&#039;&#039; the parameter to the PC - in other words the parameter is an adjustment, not an absolute address. When used in an assembler with labels the syntax should be the same as JP. The JR address can only be given immediately. Conditions are legal, but only those based on carry and zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DJNZ (Decrement reg. b and Jump if Not Zero)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DJNZ n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||13 ||B--; if B!=0 PC+=nn&lt;br /&gt;
|}&lt;br /&gt;
:Decrements B then performs JR NZ.. to the given address. Used for encapsulating loops.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;CALL&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ||SP-=2; SP*:=PC; PC:=nn&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;CALL Z/NZ/C/NC/PO/PE/P/M, nn &amp;lt;/code&amp;gt;||Address ||- ||S ||- ||- ||- ||- ||- ||- ||17 ;   10 if not cc ||if cc {SP-=2; SP*:=PC; PC:=nn}&lt;br /&gt;
|}&lt;br /&gt;
:Like JP (including the ability to have conditions), but PUSHes the PC before jumping. Used for subroutine calls. &lt;br /&gt;
:* If a subroutine ends with a CALL to another subroutine immediately before the RET, it is more efficient to JP to the other subroutine and allow its RET to return from the whole combination. This might make high-level programmers queasy but your compiler already does it (tail call optimization)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RET (RETurn)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||10 ||PC:=SP*; SP+=2&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RET Z/NZ/C/NC/PO/PE/P/M &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||11 ;   5 if not cc ||if cc {PC:=SP*; SP+=2}&lt;br /&gt;
|}&lt;br /&gt;
:POPs the PC from the stack, returning from a previous CALL. This can also accept the same conditions as JP.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETI (RETurn from Interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from an interrupt service routine (same as RET instruction, but also does signal to I/O device that the interrupt routine is completed).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RETN (RETurn from Non-maskable interrupt)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RETN &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||14 ||IFF1:=IFF2; PC:=SP*; SP+=2&lt;br /&gt;
|}&lt;br /&gt;
:Returns from a non-maskable interrupt service routine.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;RST (ReSTart)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;RST n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||11 ||CALL n&lt;br /&gt;
|}&lt;br /&gt;
:Performs a CALL to a routine located at one of eight fixed locations ($00, $08, ..., $38) in the zero page. This is located in ROM, and on the Spectrum only a limited number of values are useful to call built-in ROM routines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NOP (No OPeration)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NOP &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||PC+=1&lt;br /&gt;
|}&lt;br /&gt;
:Does &amp;quot;nothing&amp;quot; (just usual housekeeping like refreshing memory and advancing program counter to next instruction).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;HALT&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;HALT &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||waits for interrupt&lt;br /&gt;
|}&lt;br /&gt;
:Suspends the CPU until an interrupt is received (maskable interrupts must be enabled to break the wait). While CPU is waiting for interrupt, the fake NOP instruction is being executed, to keep memory refresh going on.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;DI (Disable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;DI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=0; IFF2:=0&lt;br /&gt;
|}&lt;br /&gt;
:Disables maskable interrupts.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;EI (Enable Interrupts)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;EI &amp;lt;/code&amp;gt;||- ||- ||S ||- ||- ||- ||- ||- ||- ||4 ||IFF1:=1; IFF2:=1&lt;br /&gt;
|}&lt;br /&gt;
:Enables maskable interrupts (after next instruction, i.e. for example &amp;quot;EI RET&amp;quot; - the interrupt may happen only after RET instruction is finished (or &amp;quot;EI DI&amp;quot; pair of instructions will not allow any maskable interrupt to happen).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IM (Interrupt Mode)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IM n &amp;lt;/code&amp;gt;||Immediate ||- ||S ||- ||- ||- ||- ||- ||- ||8 ||Interrupt mode:=n&lt;br /&gt;
|}&lt;br /&gt;
:Sets interrupt handling mode. The default for Next is 1. 2 is used for user defined interrupt service routines. IM 0 is useless on Next (and pretty much everything else, to be honest)&lt;br /&gt;
&lt;br /&gt;
=== Input and Output ===&lt;br /&gt;
;IN r, (c); OUT (c), r&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN r, (c) &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||0 ||P ||0 ||S ||S ||12 ||r := in(BC)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),r &amp;lt;/code&amp;gt;||Register ||Register ||S ||- ||- ||- ||- ||- ||- ||12 ||out(BC,r)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs a byte value from the 16-bit port number given in BC. R can be any 8-bit register. Note that the port number is given in BC even though the instruction refers only to C. Some assemblers will allow the instruction to be written with &amp;quot;(bc)&amp;quot; instead of &amp;quot;(c)&amp;quot; as a reminder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN (c); OUT (c), 0&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN (c) &amp;lt;/code&amp;gt;||Register ||- ||U ||- ||0 ||P ||0 ||S ||S ||12 ||in(BC)?&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (c),0 &amp;lt;/code&amp;gt;||Register ||Immediate ||U ||- ||- ||- ||- ||- ||- ||12 ||out(BC,0)&lt;br /&gt;
|}&lt;br /&gt;
:Undocumented opcodes. The IN variation performs an input, but does not store the result, only setting the flags. The OUT variation outputs 0 on the port. This is the only number that can be output to a port in immediate mode. The Next FPGA does output zero, but some Z80 chips manufactured differently from early batches output different value like 255, so it is not recommended to use OUT (C),0 if you want to reuse your code also on classic ZX Spectrum or publish it as example.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IN a, (n); OUT (n), a&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IN A, (n) &amp;lt;/code&amp;gt;||Accumulator ||Immediate ||S ||- ||- ||- ||- ||- ||- ||11 ||A := in(An)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUT (n),A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||S ||- ||- ||- ||- ||- ||- ||11 ||out(An,A)&lt;br /&gt;
|}&lt;br /&gt;
:Inputs or outputs the byte value in A from a 16-bit port number where the lower byte is N and the upper byte is A. This is only likely to be useful in cases where the upper byte of the port number is not relevant.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INI (INput and Increment)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL++; B--&lt;br /&gt;
|}&lt;br /&gt;
:Inputs a value from port BC into memory at the address stored in HL, then increments HL and decrements B. Because B is decremented and is part of the port number, the port number for future INI instructions will change unless it is reset. Z is set if B reached 0; C, S, H, and P/V are destroyed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;INIR (INput and Increment Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do INI while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Loops INIR until B reaches 0, so that if INIR starts with B=0 it loops 256 times. Because B is decremented during this process and is part of the port number, this is unlikely to be useful except when the upper byte of the port number is not relevant. Interrupts are recognized during execution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;IND, INDR (INput and Decrement, INput and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;IND &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||HL*:=in(BC); HL--; B--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;INDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do IND while(B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI and INIR except that HL is decremented instead of incremented.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTI (Out and Increment), OTIR (Out and Increment Repeated), OUTD (Out and Decrement), OTDR (Out and Decrement Repeated)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTI &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL++&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTIR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTI while (B&amp;gt;0)&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTD &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||! ||? ||16 ||B--; out(BC,HL*); HL--&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OTDR &amp;lt;/code&amp;gt;||- ||- ||S ||? ||1 ||? ||? ||1 ||? ||21x+16 ||do OUTD while (B&amp;gt;0)&lt;br /&gt;
|}&lt;br /&gt;
:Behave like INI, INIR, IND, INDR except that they output instead of input and B is decremented &#039;&#039;&#039;before&#039;&#039;&#039; the output instead of after. Condition check on B is performed &#039;&#039;&#039;after&#039;&#039;&#039;, so that if OTIR starts with B=0 it loops 256 times.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;OUTINB (Out and Increment with No B)&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;OUTINB &amp;lt;/code&amp;gt;||- ||- ||E ||? ||? ||? ||? ||? ||? ||16 ||out(BC,HL*); HL++&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Behaves like OUTI, but doesn&#039;t decrement B.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;NEXTREG&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;margin:auto&amp;quot;&lt;br /&gt;
!Mnemonic || Addressing mode 1 || Addressing mode 2 || Status || C || N || PV || H || Z || S || Tstates || Shortfx&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n,n&#039; &amp;lt;/code&amp;gt;||Immediate ||Immediate ||E ||- ||- ||- ||- ||- ||- ||20 ||HwNextReg_n:=n&#039;&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;code&amp;gt;NEXTREG n, A &amp;lt;/code&amp;gt;||Immediate ||Accumulator ||E ||- ||- ||- ||- ||- ||- ||17 ||HwNextReg_n:=A&lt;br /&gt;
|}&lt;br /&gt;
:Next extended opcode. Directly sets the [[Board feature control|Next Feature Control Registers]] without going through ports {{PortNo|$243B}} and {{PortNo|$253B}}.&lt;br /&gt;
&lt;br /&gt;
=== A note on some Z80-N specific observations ===&lt;br /&gt;
2021-09-16: figuring out the hard way, the three Z80N instructions `ADD HL/DE/BC,A` actually do NOT preserve carry flag, but change it to undefined value (verified with core 3.1.5). There&#039;s also strong suspicion (but not verified yet), that LDIX/LDDX/LDIRX/LDDRX/LDPIRX do affects flags the same way as LDI/LDIR - to be verified.&lt;br /&gt;
&lt;br /&gt;
2025-01-25: Testing 3.02.x 1) &amp;lt;code&amp;gt;LDIX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIRX&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDDRX&amp;lt;/code&amp;gt; affect the flags similarly to &amp;lt;code&amp;gt;LDI&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDD&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;LDIR&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LDDR&amp;lt;/code&amp;gt;. 2) &amp;lt;code&amp;gt;ADD HL,A&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ADD DE,A&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ADD BC,A&amp;lt;/code&amp;gt; most probably always reset the carry flag.&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
&lt;br /&gt;
This section lists the changes of the specification of the behavior of Z80N instructions, compared to the previous content of this wiki page.&lt;br /&gt;
&lt;br /&gt;
2022-01-11: The previous versions of this page didn&#039;t match what was [http://www.z80.info/zip/z80-documented.pdf documented] for several years, that regular Z80 INI/IND/INIR/INDR/OUTI/OUTD/OTIR/OTDR instructions do modify carry flag (contrary to the official Z80 documentation and many Internet resources describing Z80 instructions).&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=27605</id>
		<title>File Formats</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=File_Formats&amp;diff=27605"/>
		<updated>2025-09-08T10:05:42Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: loadable directory&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Supported File Formats in NextZXOS ==&lt;br /&gt;
&lt;br /&gt;
NextZXOS can directly read and load the following file types: `.bas`, `.tap`, `.z80`, `.sna`, `.snx`, `.dot`, `.o`, `.p`. Many other file types are supported via external dot commands.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable sortable&amp;quot;&lt;br /&gt;
! File Extension !! Description !! Notes&lt;br /&gt;
|-&lt;br /&gt;
| .z80 || Spectrum snapshot file || More suitable for emulator compatibility than real hardware. Loadable via NextZXOS browser, SPECTRUM keyword, esxDOS NMI menu, and exDOS `.snapload` command.&lt;br /&gt;
|-&lt;br /&gt;
| .sna || Spectrum snapshot file || Supports 48K and 128K. Loadable via browser, SPECTRUM keyword, esxDOS NMI, and `.snapload`. Private data appended is ignored by NextZXOS but prevents loading via esxDOS. NextZXOS reconfigures system based on file type.&lt;br /&gt;
|-&lt;br /&gt;
| .snx || Spectrum snapshot file || Identical to 128K .sna, but leaves file handle 0 open. Program must close it. May contain private data. Not supported by esxDOS.&lt;br /&gt;
|-&lt;br /&gt;
| .o || ZX80 snapshot || —&lt;br /&gt;
|-&lt;br /&gt;
| .p || ZX81 snapshot || —&lt;br /&gt;
|-&lt;br /&gt;
| [[NEX_file_format|.nex]] || Next executable file || Takes over machine. Can coexist with NextZXOS if careful. Loadable via browser and `.nexload`. CSpect emulator supports loading. Not supported by esxDOS.&lt;br /&gt;
|-&lt;br /&gt;
| .dot || Dot command format || For programs that coexist with BASIC/NextZXOS and return safely.&lt;br /&gt;
|-&lt;br /&gt;
| .tap || Tape container format || Holds many files, emulator-compatible. Browser prompts for load mode: standard, USR0, or 48K.&lt;br /&gt;
|-&lt;br /&gt;
| .bas || BASIC program || Native SD card format for BASIC programs. First 128 bytes are standard +3DOS header.&lt;br /&gt;
|-&lt;br /&gt;
| .run || Loadable Directory || If a directory ends with .run and contains run.bas, browser runs the bas when directory is selected.&lt;br /&gt;
|-&lt;br /&gt;
| .scr || Standard Spectrum screenshot || 256x192, 15 colours, 2 per cell. Headered files (7,040 bytes) or headerless (6,912 bytes). Both are supported.&lt;br /&gt;
|-&lt;br /&gt;
| .shc || Timex 8x1 Hi-colour screenshot || 256x192, 15 colours.&lt;br /&gt;
|-&lt;br /&gt;
| .shr || Timex Hi-res screenshot || 512x192, mono.&lt;br /&gt;
|-&lt;br /&gt;
| .slr || Low-res screenshot || 128x96, 256 colours.&lt;br /&gt;
|-&lt;br /&gt;
| .sl2 || Layer 2 screenshot || 256x192, 256 colours. 128-byte +3DOS header + 49,152 bytes of pixel data. No palette data.&lt;br /&gt;
|-&lt;br /&gt;
| .pal || 9-bit palette format || 256 pairs of bytes in %RRRGGGBB, %P000000B format. Priority bit (P) causes pixel layering. Loadable via Screenshots menu (M1 or F9).&lt;br /&gt;
|-&lt;br /&gt;
| .npl || Extended palette format || First 512 bytes identical to .pal. Byte 513 is transparency index or mask. Created and loaded via WASPtools.&lt;br /&gt;
|-&lt;br /&gt;
| .nxi || Layer 2 screen format || 49,152 bytes = screen data. 49,664 bytes = screen + palette. Used by PLOTIT, Dnext, zxnext_bmp_tools, and Jim Bagley’s tools.&lt;br /&gt;
|-&lt;br /&gt;
| .vid || [[VID file format|Video format]] || Played via `.playvid`. Formats supported: &lt;br /&gt;
* 320x240 @ 16.7fps, 15.6kHz &lt;br /&gt;
* 256x240 @ 16.7fps, 31.1kHz &lt;br /&gt;
* 256x192 @ 25fps, 23kHz&lt;br /&gt;
A tool for converting video files to .vid can be found here https://github.com/em00k/MakeVid-Release&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Special Notes ===&lt;br /&gt;
* The `.tzx` format is recognised by the browser, but files can only be loaded if a Raspberry Pi is installed in your Next. See the FAQ for details.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Palettes&amp;diff=12882</id>
		<title>Palettes</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Palettes&amp;diff=12882"/>
		<updated>2025-03-15T14:10:59Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: added alternative rgb values&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;To increase the number of available colours on screen, the Spectrum Next supports palletized colours. &lt;br /&gt;
&lt;br /&gt;
Colour IDs in [[Layer 2]], [[Tilemap]] and [[Sprites]] are always taken as palette indices. Colour values in the ULA are mapped to the palette as fixed indices, or can be taken as partial palette indices if Enhanced ULA mode is enabled. The palette entry numbers for standard ULA mode are: 0-7 for the standard ink colors, 8-15 for BRIGHT ink colors, 16-23 for standard paper and border colors, and 24-31 for BRIGHT paper colors.&lt;br /&gt;
&lt;br /&gt;
With Enhanced ULA mode enabled, the {{NextRegNo|$42}} defines how particular ULA attribute breaks into INK and PAPER color. The INK colors are mapped from index 0 in palette, PAPER (and BORDER) colors are mapped from index 128, except when in &amp;quot;full ink&amp;quot; mode (ink mask = 255), then PAPER and BORDER color is taken from {{NextRegNo|$4A}}.&lt;br /&gt;
&lt;br /&gt;
Palette configuration can be done through registers $40-$44 and $6B. {{NextRegNo|$43}} sets which palette is being set up. There are two palettes each for Layer 2, Sprites, Tilemap and ULA; which one of the two is used for each is selected using the lower bits of {{NextRegNo|$43}} and in {{NextRegNo|$6B}}.&lt;br /&gt;
&lt;br /&gt;
Once a palette is selected, {{NextRegNo|$40}} sets the palette entry number to set up; you can then send the color to set it to on {{NextRegNo|$41}} &#039;&#039;or&#039;&#039; {{NextRegNo|$44}} which then auto-increment. $41 is used for sending 8-bit colours in RRRGGGBB format; the &amp;quot;missing&amp;quot; third blue bit is set to an OR between the other two. $44 is used for sending 9-bit colours in two byte packets; the first byte sent should be RRRGGGBB as with $41, and the second byte&#039;s LSB fills in the third blue bit. For Layer 2 color the top bit in second byte signals &amp;quot;priority&amp;quot; colour, which makes particular Layer 2 pixel to be drawn on top of everything else, overriding current order of layers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:256-palette.png|left|thumb| Default 256 colour 8-bit indexed palette.]]&lt;br /&gt;
&amp;lt;br clear=all&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since next has 3 bit color and modern computers have 8 bit, conversion between the two always leads to either inventing or discarding information. Here&#039;s an alternative 8-bit palette that is calculated by scaling the 3 bit (0..7) values to 8 bit (0..255) linearly (res=src*255/7):&lt;br /&gt;
&lt;br /&gt;
[[File:256-palette-2.png|thumb|left|Alternate 8 bit rgb values]]&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=File:256-palette-2.png&amp;diff=12881</id>
		<title>File:256-palette-2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=File:256-palette-2.png&amp;diff=12881"/>
		<updated>2025-03-15T14:07:09Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;alternate way to calculate the default 256 color palette for desktop&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Refresh_Rates&amp;diff=12764</id>
		<title>Refresh Rates</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Refresh_Rates&amp;diff=12764"/>
		<updated>2025-02-20T12:50:58Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This depends on the model, as the video timing is driven by which Spectrum&#039;s video timing is currently used. Which one depends on either the personality chosen, or what kind of tape load you do from the NextZXOS browser.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;With VGA or RGB 50 Hz, 1T = 1/3.5MHz  &lt;br /&gt;
48K = 224T * 312 = 69888T per frame = 50.08Hz  &lt;br /&gt;
128K = 228T * 311 = 70908T per frame = 49.36Hz  &lt;br /&gt;
Pentagon = 224T * 320 = 71680T per frame = 48.83Hz&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is at VGA 0, the perfect timings where the system clock is 28MHz. As you move up through VGA 1 to VGA 6, the system clock is increased according to nextreg [https://gitlab.com/SpectrumNext/ZX_Spectrum_Next_FPGA/-/blob/master/cores/zxnext/nextreg.txt#L159 0x11]. Then the refresh rate has to be modified.&lt;br /&gt;
&lt;br /&gt;
For example, at VGA 5 the system clock is 32MHz. The spectrum runs at 32/28*3.5MHz = 4MHz in real time, and the refresh rate is 32/28*50.08 = 57.23Hz.&lt;br /&gt;
&lt;br /&gt;
The video mode chosen should always be VGA 0 or RGB at 50Hz. This option of increasing steps VGA 1-6 are for monitors that cannot sync to 50Hz only. All relative timing in the machine is kept the same but the real time speed is higher so programs run faster and sound is higher pitch.&lt;br /&gt;
&lt;br /&gt;
The 60Hz VGA timing should only be used if the monitor can&#039;t do anything under 60Hz, or if the higher 50Hz settings are too annoying due to high speed. But all the relative timing relationships are broken, and programs depending on timing will not display properly, just like with HDMI.&lt;br /&gt;
&lt;br /&gt;
If the display can only do 60Hz VGA or the higher 50Hz VGA settings is too annoying, We would honestly recommend looking for another, more capable monitor.&lt;br /&gt;
&lt;br /&gt;
The pixel resolution of the VGA signal is 704 x 568.&lt;br /&gt;
&lt;br /&gt;
See also: https://wiki.specnext.dev/Video_Timing_Register&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=AY_Info&amp;diff=12342</id>
		<title>AY Info</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=AY_Info&amp;diff=12342"/>
		<updated>2024-11-03T13:14:18Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Port&lt;br /&gt;
|Number=$BFF5&lt;br /&gt;
|NumberDec=49141&lt;br /&gt;
|PortMask=1011111111110101&lt;br /&gt;
|ShortDesc=AY information&lt;br /&gt;
|Readable=yes&lt;br /&gt;
|Writable=no&lt;br /&gt;
}}&lt;br /&gt;
  bits 7:6 = active AY chip&lt;br /&gt;
    11 = AY 0 is active&lt;br /&gt;
    10 = AY 1 is active&lt;br /&gt;
    01 = AY 2 is active&lt;br /&gt;
  bit 5 = Reserved&lt;br /&gt;
  bits 4:0 = currently selected AY register&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Turbo_Sound_Next_Control&amp;diff=12341</id>
		<title>Turbo Sound Next Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Turbo_Sound_Next_Control&amp;diff=12341"/>
		<updated>2024-11-03T13:11:50Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Port&lt;br /&gt;
|Number=$FFFD&lt;br /&gt;
|NumberDec=65533&lt;br /&gt;
|PortMask=%11-- ---- ---- --0-&lt;br /&gt;
|ShortDesc=Controls stereo channels and selects active sound chip and sound chip channel.&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|Subsystem=Turbo Sound Next&lt;br /&gt;
}}&lt;br /&gt;
There are three AY chips in the zx next whose selection is made through port 0xFFFD.  The currently active AY chip continues&lt;br /&gt;
to use port 0xFFFD for register select and port 0xBFFD for data.  All AY chips generate stereo sound unless placed in mono&lt;br /&gt;
mode per nextreg 0x08 and nextreg 0x09.  The Next adds port 0xBFF5 to read information about the currently selected AY chip&lt;br /&gt;
and its currently selected register.&lt;br /&gt;
&lt;br /&gt;
When read, returns the value stored in the selected register on the active AY chip&lt;br /&gt;
&lt;br /&gt;
When written to with the top bit set, selects the active sound chip. &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit !! Function &lt;br /&gt;
|-&lt;br /&gt;
| 7 || Must be 1&lt;br /&gt;
|-&lt;br /&gt;
| 6 || Enable left audio&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Enable right audio&lt;br /&gt;
|-&lt;br /&gt;
| 4-2 || Must be 1&lt;br /&gt;
|-&lt;br /&gt;
| 1-0 || Select active chip. 0-3: unused, AY3, AY2, AY1.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Otherwise, selects the register number to access from the active sound chip.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Pentagon_1024_paging&amp;diff=12340</id>
		<title>Pentagon 1024 paging</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Pentagon_1024_paging&amp;diff=12340"/>
		<updated>2024-11-03T13:07:00Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Port&lt;br /&gt;
|Number=$EFF7&lt;br /&gt;
|NumberDec=61431&lt;br /&gt;
|PortMask=1110111111110111&lt;br /&gt;
|ShortDesc=Paging in Pentagon 1024K mode&lt;br /&gt;
|Readable=no&lt;br /&gt;
|Writable=yes&lt;br /&gt;
}}&lt;br /&gt;
bit 3 = 1 to overlay the bottom 16K with ram from 16k bank 0&lt;br /&gt;
bit 2 = 0 to enable Pentagon 1024 mapping and disable bit 5 port 0x7ffd locking, 1 to select standard zx128 mapping **&lt;br /&gt;
* ** Applies only when pentagon 1024 mapping mode is enabled via nextreg 0x8f.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Memory_Paging_Control&amp;diff=12339</id>
		<title>Memory Paging Control</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Memory_Paging_Control&amp;diff=12339"/>
		<updated>2024-11-03T13:03:33Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Port&lt;br /&gt;
|Number=$7FFD&lt;br /&gt;
|NumberDec=32765&lt;br /&gt;
|PortMask=%01-- ---- ---- --0-&lt;br /&gt;
|ShortDesc=Selects active RAM, ROM, and displayed screen.&lt;br /&gt;
|Readable=No&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|Subsystem=Memory map&lt;br /&gt;
}}&lt;br /&gt;
Selects the active memory page in slot 4 at $C000. See [[Memory map]] (soft reset = 0).&lt;br /&gt;
&lt;br /&gt;
Any values written to this port should also be stored at $5B5C if any OS routines are in use.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit !! Effect&lt;br /&gt;
|-&lt;br /&gt;
| 6-7 || Extra two bits for 16K RAM bank if in Pentagon 512K / 1024K mode (see {{PortNo|$DFFD}}, {{NextRegNo|$8f}})&lt;br /&gt;
|-&lt;br /&gt;
| 5 || Lock memory paging (setting to 1 locks pages and cannot be unlocked until next reset (on regular ZX128))&lt;br /&gt;
|-&lt;br /&gt;
| 4 || ROM select (0 = 128k editor, 1 = 48k basic) (low bit of ROM select on +2/+3)&lt;br /&gt;
|-&lt;br /&gt;
| 3 || Shadow Screen toggle (0 = bank 5, 1 = bank 7) - this is ULA layer shadow, not related to {{NextRegNo|$13}}&lt;br /&gt;
|-&lt;br /&gt;
| 0-2 || Bank number for slot 4 ($C000)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Since core3.0 the Layer 2 can be used together with shadow ULA screen from Bank 7 (previous cores did disable Layer 2).&lt;br /&gt;
&lt;br /&gt;
When the port is locked (bit 5), the shadow screen toggle is considered part of the paging, i.e. it&#039;s not possible to flip between shadow and regular screen. Except for {{NextRegNo|$69}} which works even when port is locked, and you can unlock the port back (without reset) with {{NextRegNo|$08}}.&lt;br /&gt;
&lt;br /&gt;
ULA shadow screen from Bank 7 has higher priority than Timex modes, setting bit 3 to &amp;quot;1&amp;quot; when in one of the extended Timex graphic modes will switch to classic ZX128 ULA mode using Bank 7 data.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Keyboard&amp;diff=12338</id>
		<title>Keyboard</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Keyboard&amp;diff=12338"/>
		<updated>2024-11-03T13:00:33Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Port&lt;br /&gt;
|Number=$**FE&lt;br /&gt;
|NumberDec=254&lt;br /&gt;
|PortMask=%xxxx xxxx ---- ---0 where only one bit in x is 0&lt;br /&gt;
|ShortDesc=Series of specific ports that read keyboard key presses.&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=No&lt;br /&gt;
|Subsystem=Input&lt;br /&gt;
}}&lt;br /&gt;
  bit 6 = EAR in from the tape audio jack&lt;br /&gt;
  bits 4:0 = key column result from keyboard, active low&lt;br /&gt;
&lt;br /&gt;
* nextreg 0x08 bit 0 can be set to select issue 2 keyboard which will affect reads of bit 6&lt;br /&gt;
&lt;br /&gt;
Reads keys on the keyboard depending on the upper byte of the port number. The five keys are represented by bits 0-4 of the read byte, listed below with bit 4 first down to bit 0. A zero means that the key is pressed.&lt;br /&gt;
&lt;br /&gt;
The top eight bits of the port address are active low signals that select one or more key rows for reading.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Port upper byte !! Keys affected (row of keys)&lt;br /&gt;
|-&lt;br /&gt;
| $7F (bit 7) || B, N, M, Symbol Shift, Space&lt;br /&gt;
|-&lt;br /&gt;
| $BF (bit 6) || H, J, K, L, Enter&lt;br /&gt;
|-&lt;br /&gt;
| $DF (bit 5) || Y, U, I, O P &lt;br /&gt;
|-&lt;br /&gt;
| $EF (bit 4) || 6, 7, 8, 9, 0&lt;br /&gt;
|-&lt;br /&gt;
| $F7 (bit 3) || 5, 4, 3, 2, 1&lt;br /&gt;
|-&lt;br /&gt;
| $FB (bit 2) || T, R, E, W, Q&lt;br /&gt;
|-&lt;br /&gt;
| $FD (bit 1) || G, F, D, S, A&lt;br /&gt;
|-&lt;br /&gt;
| $FE (bit 0) || V, C, X, Z, Caps Shift&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
[[File:Speckeys.png]]&lt;br /&gt;
&lt;br /&gt;
=== Wireless Keyboards ===&lt;br /&gt;
Most ps/2 keyboards commonly seen today are wired. Two models of wireless keyboard known to work well with the Next are the &#039;&#039;&#039;Microsoft Wireless Elite Keyboard 1011&#039;&#039;&#039; and the &#039;&#039;&#039;Logitech Cordless Desktop Keyboard EX110&#039;&#039;&#039;.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=XADC_D1_Register&amp;diff=12337</id>
		<title>XADC D1 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=XADC_D1_Register&amp;diff=12337"/>
		<updated>2024-11-03T12:52:35Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$F9&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Issue 4 only&lt;br /&gt;
}}&lt;br /&gt;
   bits 7:0 = MSB data connected to XADC DRP data bus D15:8&lt;br /&gt;
DRP reads store result here, DRP writes take value from here&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=XADC_D0_Register&amp;diff=12336</id>
		<title>XADC D0 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=XADC_D0_Register&amp;diff=12336"/>
		<updated>2024-11-03T12:51:40Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$F9&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Issue 4 only&lt;br /&gt;
}}&lt;br /&gt;
   bits 7:0 = LSB data connected to XADC DRP data bus D7:0&lt;br /&gt;
* DRP reads store result here, DRP writes take value from here&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=XADC_Register&amp;diff=12335</id>
		<title>XADC Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=XADC_Register&amp;diff=12335"/>
		<updated>2024-11-03T12:50:34Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$F8&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Issue 4 only&lt;br /&gt;
}}&lt;br /&gt;
   bit 7 = 1 to write to XADC DRP port, 0 to read from XADC DRP port **&lt;br /&gt;
   bits 6:0 = XADC DRP register address DADDR&lt;br /&gt;
* An XADC register read or write is initiated by writing to this register&lt;br /&gt;
* There must be at least six 28 MHz cycles after each r/w to this register&lt;br /&gt;
* ** Reads as 0&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=XDEV_command&amp;diff=12334</id>
		<title>XDEV command</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=XDEV_command&amp;diff=12334"/>
		<updated>2024-11-03T12:49:15Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$F0&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Issue 4 only&lt;br /&gt;
}}&lt;br /&gt;
  * Select Mode&lt;br /&gt;
     (R)&lt;br /&gt;
       bit 7 = 1 if in select mode&lt;br /&gt;
       bits 1:0 indicate currently selected device&lt;br /&gt;
         00 = none&lt;br /&gt;
         01 = Xilinx DNA&lt;br /&gt;
         10 = Xilinx XADC&lt;br /&gt;
     (W)&lt;br /&gt;
       bit 7 = 1 to enter select mode, 0 to enter selected device mode (no other bits have effect)&lt;br /&gt;
       bit 6 = 1 to change selected device&lt;br /&gt;
       bits 1:0 selected device&lt;br /&gt;
         00 = none&lt;br /&gt;
         01 = Xilinx DNA&lt;br /&gt;
         10 = Xilinx XADC&lt;br /&gt;
   * Xilinx DNA Mode&lt;br /&gt;
     (R)&lt;br /&gt;
       bit 0 = dna bit (serial stream shifts left)&lt;br /&gt;
       the first eight bits read will indicate the length of the following dna bits&lt;br /&gt;
     (W)&lt;br /&gt;
       bit 7 = 1 to enter select mode (write has no other effect)&lt;br /&gt;
       otherwise causes dna string to reload, ready for fresh read&lt;br /&gt;
   * Xilinx XADC Mode (Documented in Xilinx Series 7 UG480)&lt;br /&gt;
     (R)&lt;br /&gt;
       bit 6 = 1 if XADC is busy with conversion (BUSY)&lt;br /&gt;
       bit 1 = 1 if XADC conversion completed since last read (EOC, read clears)&lt;br /&gt;
       bit 0 = 1 if XADC conversion sequence completed since last read (EOS, read clears)&lt;br /&gt;
     (W)&lt;br /&gt;
       bit 7 = 1 to enter select mode (write has no other effect)&lt;br /&gt;
       bit 6 = 1 to reset XADC (RESET)&lt;br /&gt;
       bit 0 = 1 to start conversion (CONVST)&lt;br /&gt;
* Re-enter select mode at any time by writing to the register with bit 7 set&lt;br /&gt;
* Select a device to communicate with by writing to the register with bits 6 &amp;amp; 7 set&lt;br /&gt;
* Exit select mode by writing zero to bit 7; thereafter the particular device is attached to the nextreg&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=I/O_Trap_Cause_Register&amp;diff=12333</id>
		<title>I/O Trap Cause Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=I/O_Trap_Cause_Register&amp;diff=12333"/>
		<updated>2024-11-03T12:47:44Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$DA&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=No&lt;br /&gt;
|ShortDesc=experimental&lt;br /&gt;
}}&lt;br /&gt;
   0 = none (zero at the same time nextreg 0x02 bit 4 is 0)&lt;br /&gt;
   1 = port_2ffd read&lt;br /&gt;
   2 = port_3ffd read&lt;br /&gt;
   3 = port_3ffd write&lt;br /&gt;
* If nextreg 0x02 bit 4 indicates an i/o cycle was trapped, this register indicates the cause&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=I/O_Trap_Write_Register&amp;diff=12332</id>
		<title>I/O Trap Write Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=I/O_Trap_Write_Register&amp;diff=12332"/>
		<updated>2024-11-03T12:41:37Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$D9&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=experimental&lt;br /&gt;
}}&lt;br /&gt;
Holds byte written during trapped i/o write cycle&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=I/O_Traps_Register&amp;diff=12331</id>
		<title>I/O Traps Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=I/O_Traps_Register&amp;diff=12331"/>
		<updated>2024-11-03T12:40:47Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$D8&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=experimental&lt;br /&gt;
}}&lt;br /&gt;
   bits 7:1 = Reserved must be zero&lt;br /&gt;
   bit 0 = 1 to enable +3 FDC traps on ports 0x2ffd and 0x3ffd&lt;br /&gt;
* An i/o trap generates a multiface nmi and is indicated in nextreg 0x02&lt;br /&gt;
* Traps cannot be triggered by the dma or while the multiface, divmmc or external nmi is active&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_2&amp;diff=12330</id>
		<title>DMA interrupt enable 2</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_2&amp;diff=12330"/>
		<updated>2024-11-03T12:37:16Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CE&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=UART Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = Reserved must be zero&lt;br /&gt;
  bit 6 = UART1 Tx empty&lt;br /&gt;
  bit 5 = UART1 Rx half full     \ shared&lt;br /&gt;
  bit 4 = UART1 Rx available     / interrupt&lt;br /&gt;
  bit 3 = Reserved must be zero&lt;br /&gt;
  bit 2 = UART0 Tx empty&lt;br /&gt;
  bit 1 = UART0 Rx half full     \ shared&lt;br /&gt;
  bit 0 = UART0 Rx available     / interrupt&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
Because interrupts are only sampled at the end of an instruction by the Z80, each time the dma is interrupted one instruction of progress is made in the main program.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_1&amp;diff=12329</id>
		<title>DMA interrupt enable 1</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_1&amp;diff=12329"/>
		<updated>2024-11-03T12:35:19Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CD&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=CTC Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = ctc channel 7 zc/to&lt;br /&gt;
  bit 6 = ctc channel 6 zc/to&lt;br /&gt;
  bit 5 = ctc channel 5 zc/to&lt;br /&gt;
  bit 4 = ctc channel 4 zc/to&lt;br /&gt;
  bit 3 = ctc channel 3 zc/to&lt;br /&gt;
  bit 2 = ctc channel 2 zc/to&lt;br /&gt;
  bit 1 = ctc channel 1 zc/to&lt;br /&gt;
  bit 0 = ctc channel 0 zc/to&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
Because interrupts are only sampled at the end of an instruction by the Z80, each time the dma is interrupted one instruction of progress is made in the main program.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_0&amp;diff=12328</id>
		<title>DMA interrupt enable 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_0&amp;diff=12328"/>
		<updated>2024-11-03T12:34:56Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CC&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = NMI&lt;br /&gt;
  bit 1 = Line&lt;br /&gt;
  bit 0 = ULA&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
Soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
Because interrupts are only sampled at the end of an instruction by the Z80, each time the dma is interrupted one instruction of progress is made in the main program.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_2&amp;diff=12327</id>
		<title>DMA interrupt enable 2</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_2&amp;diff=12327"/>
		<updated>2024-11-03T12:33:29Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CE&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=UART Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = Reserved must be zero&lt;br /&gt;
  bit 6 = UART1 Tx empty&lt;br /&gt;
  bit 5 = UART1 Rx half full     \ shared&lt;br /&gt;
  bit 4 = UART1 Rx available     / interrupt&lt;br /&gt;
  bit 3 = Reserved must be zero&lt;br /&gt;
  bit 2 = UART0 Tx empty&lt;br /&gt;
  bit 1 = UART0 Rx half full     \ shared&lt;br /&gt;
  bit 0 = UART0 Rx available     / interrupt&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_1&amp;diff=12326</id>
		<title>DMA interrupt enable 1</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_1&amp;diff=12326"/>
		<updated>2024-11-03T12:32:21Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CD&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=CTC Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = ctc channel 7 zc/to&lt;br /&gt;
  bit 6 = ctc channel 6 zc/to&lt;br /&gt;
  bit 5 = ctc channel 5 zc/to&lt;br /&gt;
  bit 4 = ctc channel 4 zc/to&lt;br /&gt;
  bit 3 = ctc channel 3 zc/to&lt;br /&gt;
  bit 2 = ctc channel 2 zc/to&lt;br /&gt;
  bit 1 = ctc channel 1 zc/to&lt;br /&gt;
  bit 0 = ctc channel 0 zc/to&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_0&amp;diff=12325</id>
		<title>DMA interrupt enable 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=DMA_interrupt_enable_0&amp;diff=12325"/>
		<updated>2024-11-03T12:31:10Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CC&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Interrupts that can override DMA&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = NMI&lt;br /&gt;
  bit 1 = Line&lt;br /&gt;
  bit 0 = ULA&lt;br /&gt;
* Set bits indicate the corresponding interrupt will interrupt a dma operation when in hw im2 mode&lt;br /&gt;
&lt;br /&gt;
Soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Status_2_Register&amp;diff=12324</id>
		<title>Interrupt Status 2 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Status_2_Register&amp;diff=12324"/>
		<updated>2024-11-03T12:29:37Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$CA&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Has UART interrupt happened?&lt;br /&gt;
}}&lt;br /&gt;
 bit 7 = Reserved must be zero&lt;br /&gt;
  bit 6 = UART1 Tx empty&lt;br /&gt;
  bit 5 = UART1 Rx half full    \ shared&lt;br /&gt;
  bit 4 = UART1 Rx available    / interrupt&lt;br /&gt;
  bit 3 = Reserved must be zero&lt;br /&gt;
  bit 2 = UART0 Tx empty&lt;br /&gt;
  bit 1 = UART0 Rx half full    \ shared&lt;br /&gt;
  bit 0 = UART0 Rx available    / interrupt&lt;br /&gt;
* (R) Set bits indicate the device generated an interrupt in the past or an interrupt is pending&lt;br /&gt;
* (W) Set bits clear the status.  In hw im2 mode the status will continue to read as set until the interrupt pending condition is cleared&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Status_1_Register&amp;diff=12323</id>
		<title>Interrupt Status 1 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Status_1_Register&amp;diff=12323"/>
		<updated>2024-11-03T12:28:32Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C9&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=has ctc interrupt occurred?&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = ctc channel 7 zc/to&lt;br /&gt;
  bit 6 = ctc channel 6 zc/to&lt;br /&gt;
  bit 5 = ctc channel 5 zc/to&lt;br /&gt;
  bit 4 = ctc channel 4 zc/to&lt;br /&gt;
  bit 3 = ctc channel 3 zc/to&lt;br /&gt;
  bit 2 = ctc channel 2 zc/to&lt;br /&gt;
  bit 1 = ctc channel 1 zc/to&lt;br /&gt;
  bit 0 = ctc channel 0 zc/to&lt;br /&gt;
* (R) Set bits indicate the device generated an interrupt in the past or an interrupt is pending&lt;br /&gt;
* (W) Set bits clear the status.  In hw im2 mode the status will continue to read as set until the interrupt pending condition is cleared&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Status_0_Register&amp;diff=12322</id>
		<title>Interrupt Status 0 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Status_0_Register&amp;diff=12322"/>
		<updated>2024-11-03T12:27:07Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C8&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=has interrupt occurred?&lt;br /&gt;
}}&lt;br /&gt;
  bits 7:2 = Reserved must be 0&lt;br /&gt;
  bit 1 = Line&lt;br /&gt;
  bit 0 = ULA&lt;br /&gt;
* (R) Set bits indicate the device generated an interrupt in the past or an interrupt is pending&lt;br /&gt;
* (W) Set bits clear the status.  In hw im2 mode the status will continue to read as set until the interrupt pending condition is cleared&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Enable_2_Register&amp;diff=12321</id>
		<title>Interrupt Enable 2 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Enable_2_Register&amp;diff=12321"/>
		<updated>2024-11-03T12:25:13Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C6&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=UART interrupt enable control&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = Reserved must be zero&lt;br /&gt;
  bit 6 = UART1 Tx empty&lt;br /&gt;
  bit 5 = UART1 Rx near full     \ shared&lt;br /&gt;
  bit 4 = UART1 Rx available     / interrupt&lt;br /&gt;
  bit 3 = Reserved must be zero&lt;br /&gt;
  bit 2 = UART0 Tx empty&lt;br /&gt;
  bit 1 = UART0 Rx near full     \ shared&lt;br /&gt;
  bit 0 = UART0 Rx available     / interrupt&lt;br /&gt;
* Rx near full overrides Rx available&lt;br /&gt;
* If a device interrupt is disabled, it enters a polled mode&lt;br /&gt;
&lt;br /&gt;
Soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Enable_1_Register&amp;diff=12320</id>
		<title>Interrupt Enable 1 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Enable_1_Register&amp;diff=12320"/>
		<updated>2024-11-03T12:23:47Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C5&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=ctc interrupt enable control&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = ctc channel 7 zc/to&lt;br /&gt;
  bit 6 = ctc channel 6 zc/to&lt;br /&gt;
  bit 5 = ctc channel 5 zc/to&lt;br /&gt;
  bit 4 = ctc channel 4 zc/to&lt;br /&gt;
  bit 3 = ctc channel 3 zc/to&lt;br /&gt;
  bit 2 = ctc channel 2 zc/to&lt;br /&gt;
  bit 1 = ctc channel 1 zc/to&lt;br /&gt;
  bit 0 = ctc channel 0 zc/to&lt;br /&gt;
  * If a device interrupt is disabled, it enters a polled mode&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Enable_0_Register&amp;diff=12319</id>
		<title>Interrupt Enable 0 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Enable_0_Register&amp;diff=12319"/>
		<updated>2024-11-03T12:22:23Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C4&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Interrupt type enable control&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = Expansion bus /INT (soft reset = 1)&lt;br /&gt;
  bits 6:2 = Reserved must be 0&lt;br /&gt;
  bit 1 = Line ** (soft reset = 0)&lt;br /&gt;
  bit 0 = ULA ** (soft reset = 1)&lt;br /&gt;
* * If a device interrupt is disabled, it enters a polled mode&lt;br /&gt;
* ** Aliases of interrupt enable bits in nextreg 0x22&lt;br /&gt;
&lt;br /&gt;
Soft reset = 0x81&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=NMI_Return_Address_MSB_Register&amp;diff=12318</id>
		<title>NMI Return Address MSB Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=NMI_Return_Address_MSB_Register&amp;diff=12318"/>
		<updated>2024-11-03T12:20:14Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C3&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=MSB of NMI return address&lt;br /&gt;
}}&lt;br /&gt;
Soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
The return address written during an nmi acknowledge cycle is always stored in these registers.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=NMI_Return_Address_LSB_Register&amp;diff=12317</id>
		<title>NMI Return Address LSB Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=NMI_Return_Address_LSB_Register&amp;diff=12317"/>
		<updated>2024-11-03T12:19:00Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C2&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=LSB of NMI return address&lt;br /&gt;
}}&lt;br /&gt;
Soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
The return address written during an nmi acknowledge cycle is always stored in these registers.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Interrupt_Control_Register&amp;diff=12316</id>
		<title>Interrupt Control Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Interrupt_Control_Register&amp;diff=12316"/>
		<updated>2024-11-03T12:17:22Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$C0&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
}}&lt;br /&gt;
Soft reset = 0x00&lt;br /&gt;
&lt;br /&gt;
  bits 7:5 = Programmable portion of im2 vector*&lt;br /&gt;
  bit 4 = Reserved must be 0&lt;br /&gt;
  bit 3 = Enable stackless nmi response**&lt;br /&gt;
  bits 2:1 = Current Z80 interrupt mode 0,1,2 (read only, write ignored)&lt;br /&gt;
  bit 0 = Maskable interrupt mode: pulse (0) or hw im2 mode (1)&lt;br /&gt;
&lt;br /&gt;
* * In hw im2 mode the interrupt vector generated is:&lt;br /&gt;
  bits 7:5 = nextreg 0xC0 bits 7:5&lt;br /&gt;
  bits 4:1 = 0  line interrupt (highest priority)&lt;br /&gt;
    = 1  uart0 Rx&lt;br /&gt;
    = 2  uart1 Rx&lt;br /&gt;
    = 3-10  ctc channels 0-7&lt;br /&gt;
    = 11 ula&lt;br /&gt;
    = 12 uart0 Tx&lt;br /&gt;
    = 13 uart1 Tx (lowest priority)&lt;br /&gt;
  bit 0 = 0&lt;br /&gt;
&lt;br /&gt;
* * In hw im2 mode the expansion bus is the lowest priority interrupter and if no vector is supplied externally then 0xFF is generated.&lt;br /&gt;
&lt;br /&gt;
* ** The return address pushed during an nmi acknowledge cycle will be written to nextreg instead of memory (the stack pointer will be decremented) and the first RETN after the acknowledge will take its return address from nextreg instead of memory (the stack pointer will be incremented).  If bit 3 = 0 and in other circumstances, RETN functions normally.&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_1&amp;diff=12315</id>
		<title>Divmmc Entry Points 1</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_1&amp;diff=12315"/>
		<updated>2024-11-03T12:11:20Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: Created page with &amp;quot;{{NextRegister |Number=$BB |Readable=Yes |Writable=Yes |ShortDesc=DivMMC automap control }}   bit 7 = 1 to enable automap on addresses 0x3DXX (instruction fetch, instant, ROM3...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$BB&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=DivMMC automap control&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = 1 to enable automap on addresses 0x3DXX (instruction fetch, instant, ROM3) &amp;gt; TRDOS (soft reset = 1)&lt;br /&gt;
  bit 6 = 1 to disable automap on addresses 0x1FF8-0x1FFF (instruction fetch, delayed)  (soft reset = 1)&lt;br /&gt;
  bit 5 = 1 to enable automap on address 0x056A (instruction fetch, delayed, ROM3)   \ tape traps  (soft reset = 0)&lt;br /&gt;
  bit 4 = 1 to enable automap on address 0x04D7 (instruction fetch, delayed, ROM3)   / nextzxos (better compatibility)  (soft reset = 0)&lt;br /&gt;
  bit 3 = 1 to enable automap on address 0x0562 (instruction fetch, delayed, ROM3)   \ tape traps  (soft reset = 1)&lt;br /&gt;
  bit 2 = 1 to enable automap on address 0x04C6 (instruction fetch, delayed, ROM3)   / esxdos + original divmmc  (soft reset = 1)&lt;br /&gt;
  bit 1 = 1 to enable automap on address 0x0066 (instruction fetch + button, instant) (soft reset = 0)&lt;br /&gt;
  bit 0 = 1 to enable automap on address 0x0066 (instruction fetch + button, delayed)  (soft reset = 1)&lt;br /&gt;
&lt;br /&gt;
soft reset = 0xCD&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_Timing_0&amp;diff=12314</id>
		<title>Divmmc Entry Points Timing 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_Timing_0&amp;diff=12314"/>
		<updated>2024-11-03T12:09:00Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$BA&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=Adjust delay of divmmc mapping&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = 1 for instant mapping else delayed (0x0038)&lt;br /&gt;
  bit 6 = 1 for instant mapping else delayed (0x0030)&lt;br /&gt;
  bit 5 = 1 for instant mapping else delayed (0x0028)&lt;br /&gt;
  bit 4 = 1 for instant mapping else delayed (0x0020)&lt;br /&gt;
  bit 3 = 1 for instant mapping else delayed (0x0018)&lt;br /&gt;
  bit 2 = 1 for instant mapping else delayed (0x0010)&lt;br /&gt;
  bit 1 = 1 for instant mapping else delayed (0x0008)&lt;br /&gt;
  bit 0 = 1 for instant mapping else delayed (0x0000)&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x00&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_Valid_0&amp;diff=12313</id>
		<title>Divmmc Entry Points Valid 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_Valid_0&amp;diff=12313"/>
		<updated>2024-11-03T12:07:29Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$B9&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=DivMMC entry point validity&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = 1 for always else only when rom3 is present (0x0038) (soft reset = 0)&lt;br /&gt;
  bit 6 = 1 for always else only when rom3 is present (0x0030) (soft reset = 0)&lt;br /&gt;
  bit 5 = 1 for always else only when rom3 is present (0x0028) (soft reset = 0)&lt;br /&gt;
  bit 4 = 1 for always else only when rom3 is present (0x0020) (soft reset = 0)&lt;br /&gt;
  bit 3 = 1 for always else only when rom3 is present (0x0018) (soft reset = 0)&lt;br /&gt;
  bit 2 = 1 for always else only when rom3 is present (0x0010) (soft reset = 0)&lt;br /&gt;
  bit 1 = 1 for always else only when rom3 is present (0x0008) (soft reset = 0)&lt;br /&gt;
  bit 0 = 1 for always else only when rom3 is present (0x0000) (soft reset = 1)&lt;br /&gt;
&lt;br /&gt;
soft reset = 0x01&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_0&amp;diff=12312</id>
		<title>Divmmc Entry Points 0</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Divmmc_Entry_Points_0&amp;diff=12312"/>
		<updated>2024-11-03T12:05:18Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$B8&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=Yes&lt;br /&gt;
|ShortDesc=DivMMC automap control&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = 1 to enable automap on address 0x0038 (instruction fetch) (soft reset = 1)&lt;br /&gt;
  bit 6 = 1 to enable automap on address 0x0030 (instruction fetch) (soft reset = 0)&lt;br /&gt;
  bit 5 = 1 to enable automap on address 0x0028 (instruction fetch) (soft reset = 0)&lt;br /&gt;
  bit 4 = 1 to enable automap on address 0x0020 (instruction fetch) (soft reset = 0)&lt;br /&gt;
  bit 3 = 1 to enable automap on address 0x0018 (instruction fetch) (soft reset = 0)&lt;br /&gt;
  bit 2 = 1 to enable automap on address 0x0010 (instruction fetch) (soft reset = 0)&lt;br /&gt;
  bit 1 = 1 to enable automap on address 0x0008 (instruction fetch) (soft reset = 1)&lt;br /&gt;
  bit 0 = 1 to enable automap on address 0x0000 (instruction fetch) (soft reset = 1)&lt;br /&gt;
&lt;br /&gt;
Soft reset = 0x83&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_MD_Pad_Buttons_Register&amp;diff=12311</id>
		<title>Extended MD Pad Buttons Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_MD_Pad_Buttons_Register&amp;diff=12311"/>
		<updated>2024-11-03T12:01:06Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$B2&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=No&lt;br /&gt;
|ShortDesc=Reading additional buttons on MD pads&lt;br /&gt;
}}&lt;br /&gt;
  bit 7 = 1 if Right Pad X pressed&lt;br /&gt;
  bit 6 = 1 if Right Pad Z pressed&lt;br /&gt;
  bit 5 = 1 if Right Pad Y pressed&lt;br /&gt;
  bit 4 = 1 if Right Pad MODE pressed&lt;br /&gt;
  bit 3 = 1 if Left Pad X pressed&lt;br /&gt;
  bit 2 = 1 if Left Pad Z pressed&lt;br /&gt;
  bit 1 = 1 if Left Pad Y pressed&lt;br /&gt;
  bit 0 = 1 if Left Pad MODE pressed&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Keys_1_Register&amp;diff=12310</id>
		<title>Extended Keys 1 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Keys_1_Register&amp;diff=12310"/>
		<updated>2024-11-03T11:56:50Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$B1&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=No&lt;br /&gt;
|ShortDesc=Read Next keyboard compound keys separately&lt;br /&gt;
}}&lt;br /&gt;
Available since core3.1.5.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 1 if DELETE pressed&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 1 if EDIT pressed&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 1 if BREAK pressed&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 1 if INV VIDEO pressed&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 1 if TRUE VIDEO pressed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1 if GRAPH pressed&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 if CAPS LOCK pressed&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 if EXTEND pressed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
  * Nextreg 0x68 bit 4 stops extended keys from making entries in the 8x5 matrix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{NextRegNo|$68}} (104) bit 4 stops extended keys from making entries in the 8x5 matrix&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Extended_Keys_0_Register&amp;diff=12309</id>
		<title>Extended Keys 0 Register</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Extended_Keys_0_Register&amp;diff=12309"/>
		<updated>2024-11-03T11:56:18Z</updated>

		<summary type="html">&lt;p&gt;Sol HSA: updated to 78a6ee50&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NextRegister&lt;br /&gt;
|Number=$B0&lt;br /&gt;
|Readable=Yes&lt;br /&gt;
|Writable=No&lt;br /&gt;
|ShortDesc=Read Next keyboard compound keys separately&lt;br /&gt;
}}&lt;br /&gt;
Available since core3.1.5.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Bit !! Description&lt;br /&gt;
|-&lt;br /&gt;
| 7 || 1 if ; pressed&lt;br /&gt;
|-&lt;br /&gt;
| 6 || 1 if &amp;quot; pressed&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 1 if , pressed&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 1 if . pressed&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 1 if UP pressed&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 1 if DOWN pressed&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 if LEFT pressed&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 if RIGHT pressed&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
  * Nextreg 0x68 bit 4 stops extended keys from making entries in the 8x5 matrix&lt;br /&gt;
&lt;br /&gt;
{{NextRegNo|$68}} (104) bit 4 stops extended keys from making entries in the 8x5 matrix&lt;/div&gt;</summary>
		<author><name>Sol HSA</name></author>
	</entry>
</feed>