<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-CA">
	<id>http://docs.fox-labs.io/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Inari</id>
	<title>FoxLabs Wiki - User contributions [en-ca]</title>
	<link rel="self" type="application/atom+xml" href="http://docs.fox-labs.io/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Inari"/>
	<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php/Special:Contributions/Inari"/>
	<updated>2026-07-17T01:50:42Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=615</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=615"/>
		<updated>2026-06-06T23:03:46Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
= Instructions by Opcode =&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
&lt;br /&gt;
=== Legends ===&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - CPU Control Group#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - CPU Control Group#DAA|DAA]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
&lt;br /&gt;
{{#invoke:navbox|navbox&lt;br /&gt;
| name = Zilog Z80 Instruction Set&lt;br /&gt;
| state = {{{state&amp;lt;includeonly&amp;gt;|{{{1|autocollapse}}}&amp;lt;/includeonly&amp;gt;}}}&lt;br /&gt;
| bodyclass = hlist&lt;br /&gt;
| titlestyle = {{{titlestyle|}}}&lt;br /&gt;
| title = Zilog Z80 Instruction Set&lt;br /&gt;
&lt;br /&gt;
|group1 = Load Instructions&lt;br /&gt;
|list1 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Load Group|8-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Load Group|16-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Exchange and Block Transfer|Exchange and Block Transfer Group]]&lt;br /&gt;
&lt;br /&gt;
|group2 = Arithmetic Instructions&lt;br /&gt;
|list2 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Arithmetic Group|8-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group|16-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Rotate and Shift Group|Rotate and Shift Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Bit Operations Group|Bit Set, Reset and Test Group]]&lt;br /&gt;
&lt;br /&gt;
|group3 = I/O Operations&lt;br /&gt;
|list3 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Input and Output Group|Input and Output Group]]&lt;br /&gt;
&lt;br /&gt;
|group4 = Control Group&lt;br /&gt;
|list4 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Jump Group|Jump Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Call and Return Group|Call and Return Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - CPU Control Group|CPU Control Group]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=614</id>
		<title>Zilog Z80 Instruction Set - CPU Control Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=614"/>
		<updated>2026-06-06T23:02:29Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;General-Purpose and CPU Control Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for controlling the CPU&#039;s state and miscellaneous instructions.&lt;br /&gt;
&lt;br /&gt;
== DAA ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
@&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DAA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 || 1 || 1 || 1 || 27 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This instruction conditionally adjusts the Accumulator for BCD addition and subtraction operations. For addition (ADD, ADC, INC) or subtraction (SUB, SBC, DEC, NEG), the following table indicates the operation being performed:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Operation&lt;br /&gt;
!C before DAA&lt;br /&gt;
!Hex Value In Upper Digit&lt;br /&gt;
(Bits 7–4)&lt;br /&gt;
!H Before DAA&lt;br /&gt;
!Hex Value In Lower Digit&lt;br /&gt;
(Bits 3–0)&lt;br /&gt;
!Number Added To Byte&lt;br /&gt;
!C After DAA&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|9-0&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|00&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|0-8&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|06&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|06&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|ADD&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|60&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|ADC&lt;br /&gt;
|0&lt;br /&gt;
|9-F&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|INC&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-2&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|60&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-2&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|SUB&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|00&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|SBC&lt;br /&gt;
|0&lt;br /&gt;
|0-8&lt;br /&gt;
|1&lt;br /&gt;
|6-F&lt;br /&gt;
|FA&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|DEC&lt;br /&gt;
|1&lt;br /&gt;
|7-F&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|A0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|NEG&lt;br /&gt;
|1&lt;br /&gt;
|6-7&lt;br /&gt;
|1&lt;br /&gt;
|6-F&lt;br /&gt;
|9A&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* S is set if most-significant bit of the Accumulator is 1 after an operation; otherwise, it is reset.&lt;br /&gt;
*Z is set if the Accumulator is 0 after an operation; otherwise, it is reset.&lt;br /&gt;
*H: see the DAA instruction table on the previous page.P/V is set if the Accumulator is at even parity after an operation; otherwise, it is reset.&lt;br /&gt;
*N is not affected.&lt;br /&gt;
*C: see the DAA instruction table above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An addition operation is performed between 15 (BCD) and 27 (BCD); simple decimal arithmetic provides the following result:&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|15&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|27&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|42&lt;br /&gt;
|}&lt;br /&gt;
The binary representations are added in the Accumulator according to standard binary&lt;br /&gt;
&lt;br /&gt;
arithmetic, as follows:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|0001&lt;br /&gt;
|&amp;amp;nbsp;&lt;br /&gt;
|0101&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0010&lt;br /&gt;
|&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0111&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0011&lt;br /&gt;
|&lt;br /&gt;
|1100&lt;br /&gt;
|= 3C&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The sum is ambiguous. The DAA instruction adjusts this result so that the correct BCD representation is obtained, as follows:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|0011&lt;br /&gt;
|&amp;amp;nbsp;&lt;br /&gt;
|1100&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0000&lt;br /&gt;
|&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0110&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0100&lt;br /&gt;
|&lt;br /&gt;
|0010&lt;br /&gt;
|= 42&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NOP ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=613</id>
		<title>Zilog Z80 Instruction Set - CPU Control Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=613"/>
		<updated>2026-06-06T23:01:54Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;General-Purpose and CPU Control Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for controlling the CPU&#039;s state and miscellaneous instructions.&lt;br /&gt;
&lt;br /&gt;
== DAA ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
@&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
DAA&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 || 1 || 1 || 1 || 27 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This instruction conditionally adjusts the Accumulator for BCD addition and subtraction operations. For addition (ADD, ADC, INC) or subtraction (SUB, SBC, DEC, NEG), the following table indicates the operation being performed:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+&lt;br /&gt;
!Operation&lt;br /&gt;
!C before DAA&lt;br /&gt;
!Hex Value In Upper Digit&lt;br /&gt;
(Bits 7–4)&lt;br /&gt;
!H Before DAA&lt;br /&gt;
!Hex Value In Lower Digit&lt;br /&gt;
(Bits 3–0)&lt;br /&gt;
!Number Added To Byte&lt;br /&gt;
!C After DAA&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|9-0&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|00&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|0-8&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|06&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|06&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|ADD&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|60&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|ADC&lt;br /&gt;
|0&lt;br /&gt;
|9-F&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|INC&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-2&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|60&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-2&lt;br /&gt;
|0&lt;br /&gt;
|A-F&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|1&lt;br /&gt;
|0-3&lt;br /&gt;
|66&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|SUB&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|00&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|SBC&lt;br /&gt;
|0&lt;br /&gt;
|0-8&lt;br /&gt;
|1&lt;br /&gt;
|6-F&lt;br /&gt;
|FA&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|DEC&lt;br /&gt;
|1&lt;br /&gt;
|7-F&lt;br /&gt;
|0&lt;br /&gt;
|0-9&lt;br /&gt;
|A0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;text-align: left&amp;quot;|NEG&lt;br /&gt;
|1&lt;br /&gt;
|6-7&lt;br /&gt;
|1&lt;br /&gt;
|6-F&lt;br /&gt;
|9A&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* S is set if most-significant bit of the Accumulator is 1 after an operation; otherwise, it is reset.&lt;br /&gt;
*Z is set if the Accumulator is 0 after an operation; otherwise, it is reset.&lt;br /&gt;
*H: see the DAA instruction table on the previous page.P/V is set if the Accumulator is at even parity after an operation; otherwise, it is reset.&lt;br /&gt;
*N is not affected.&lt;br /&gt;
*C: see the DAA instruction table on the previous page..&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
An addition operation is performed between 15 (BCD) and 27 (BCD); simple decimal arithmetic provides the following result:&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|15&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|27&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|42&lt;br /&gt;
|}&lt;br /&gt;
The binary representations are added in the Accumulator according to standard binary&lt;br /&gt;
&lt;br /&gt;
arithmetic, as follows:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|0001&lt;br /&gt;
|&amp;amp;nbsp;&lt;br /&gt;
|0101&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0010&lt;br /&gt;
|&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0111&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0011&lt;br /&gt;
|&lt;br /&gt;
|1100&lt;br /&gt;
|= 3C&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The sum is ambiguous. The DAA instruction adjusts this result so that the correct BCD representation is obtained, as follows:&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;text-align: right; border-collapse: collapse;&amp;quot;&lt;br /&gt;
|&lt;br /&gt;
|0011&lt;br /&gt;
|&amp;amp;nbsp;&lt;br /&gt;
|1100&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|+&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0000&lt;br /&gt;
|&lt;br /&gt;
|style=&amp;quot;border-bottom: 1px solid #000&amp;quot;|0110&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|0100&lt;br /&gt;
|&lt;br /&gt;
|0010&lt;br /&gt;
|= 42&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== NOP ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=612</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=612"/>
		<updated>2026-06-06T21:39:50Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
= Instructions by Opcode =&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
&lt;br /&gt;
=== Legends ===&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
&lt;br /&gt;
{{#invoke:navbox|navbox&lt;br /&gt;
| name = Zilog Z80 Instruction Set&lt;br /&gt;
| state = {{{state&amp;lt;includeonly&amp;gt;|{{{1|autocollapse}}}&amp;lt;/includeonly&amp;gt;}}}&lt;br /&gt;
| bodyclass = hlist&lt;br /&gt;
| titlestyle = {{{titlestyle|}}}&lt;br /&gt;
| title = Zilog Z80 Instruction Set&lt;br /&gt;
&lt;br /&gt;
|group1 = Load Instructions&lt;br /&gt;
|list1 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Load Group|8-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Load Group|16-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Exchange and Block Transfer|Exchange and Block Transfer Group]]&lt;br /&gt;
&lt;br /&gt;
|group2 = Arithmetic Instructions&lt;br /&gt;
|list2 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Arithmetic Group|8-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group|16-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Rotate and Shift Group|Rotate and Shift Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Bit Operations Group|Bit Set, Reset and Test Group]]&lt;br /&gt;
&lt;br /&gt;
|group3 = I/O Operations&lt;br /&gt;
|list3 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Input and Output Group|Input and Output Group]]&lt;br /&gt;
&lt;br /&gt;
|group4 = Control Group&lt;br /&gt;
|list4 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Jump Group|Jump Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Call and Return Group|Call and Return Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - CPU Control Group|CPU Control Group]]&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
= References =&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/styles.css&amp;diff=611</id>
		<title>Module:Citation/CS1/styles.css</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/styles.css&amp;diff=611"/>
		<updated>2026-06-06T21:34:23Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;/* Protection icon the following line controls the page-protection icon in the upper right corner it must remain within this comment 	{{sandbox other||{{pp-template}}}}  */  /* Overrides Some wikis do not override user agent default styles for HTML &amp;lt;cite&amp;gt; and &amp;lt;q&amp;gt;, unlike en.wp. On en.wp, keep these the same as MediaWiki:Common.css.  The word-wrap and :target styles were moved here from Common.css. On en.wp, keep these the same as Template:Citation/styles.css. */...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* Protection icon&lt;br /&gt;
the following line controls the page-protection icon in the upper right corner&lt;br /&gt;
it must remain within this comment&lt;br /&gt;
	{{sandbox other||{{pp-template}}}}&lt;br /&gt;
&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/* Overrides&lt;br /&gt;
Some wikis do not override user agent default styles for HTML &amp;lt;cite&amp;gt; and &amp;lt;q&amp;gt;,&lt;br /&gt;
unlike en.wp. On en.wp, keep these the same as [[MediaWiki:Common.css]].&lt;br /&gt;
&lt;br /&gt;
The word-wrap and :target styles were moved here from Common.css.&lt;br /&gt;
On en.wp, keep these the same as [[Template:Citation/styles.css]].&lt;br /&gt;
*/&lt;br /&gt;
cite.citation {&lt;br /&gt;
	font-style: inherit; /* Remove italics for &amp;lt;cite&amp;gt; */&lt;br /&gt;
	/* Break long urls, etc., rather than overflowing box */&lt;br /&gt;
	word-wrap: break-word;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.citation q {&lt;br /&gt;
	quotes: &#039;&amp;quot;&#039; &#039;&amp;quot;&#039; &amp;quot;&#039;&amp;quot; &amp;quot;&#039;&amp;quot;; /* Straight quote marks for &amp;lt;q&amp;gt; */&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Highlight linked elements (such as clicked references) in blue */&lt;br /&gt;
.citation:target {&lt;br /&gt;
	/* ignore the linter - all browsers of interest implement this */&lt;br /&gt;
	background-color: rgba(0, 127, 255, 0.133);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* ID and URL access&lt;br /&gt;
Both core and Common.css have selector .mw-parser-output a[href$=&amp;quot;.pdf&amp;quot;].external&lt;br /&gt;
for PDF pages. All TemplateStyles pages are hoisted to .mw-parser-output. We need&lt;br /&gt;
to have specificity equal to a[href$=&amp;quot;.pdf&amp;quot;].external for locks to override PDF icon.&lt;br /&gt;
That&#039;s essentially 2 classes and 1 element.&lt;br /&gt;
&lt;br /&gt;
the .id-lock-... selectors are for use by non-citation templates like&lt;br /&gt;
{{Catalog lookup link}}&lt;br /&gt;
&lt;br /&gt;
bg-size `contain` in Minerva and Timeless is too large, so we set a size for them&lt;br /&gt;
and then exclude them later&lt;br /&gt;
*/&lt;br /&gt;
.id-lock-free.id-lock-free a {&lt;br /&gt;
	/*background: url(//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg)&lt;br /&gt;
		right 0.1em center/9px no-repeat;*/&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.id-lock-limited.id-lock-limited a,&lt;br /&gt;
.id-lock-registration.id-lock-registration a {&lt;br /&gt;
	/*background: url(//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg)&lt;br /&gt;
		right 0.1em center/9px no-repeat;*/&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.id-lock-subscription.id-lock-subscription a {&lt;br /&gt;
	/*background: url(//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg)&lt;br /&gt;
		right 0.1em center/9px no-repeat;*/&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Wikisource&lt;br /&gt;
Wikisource icon when |chapter= or |title= is wikilinked to Wikisource&lt;br /&gt;
as in cite wikisource&lt;br /&gt;
*/&lt;br /&gt;
.cs1-ws-icon a {&lt;br /&gt;
	/*background: url(//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg)&lt;br /&gt;
		right 0.1em center/12px no-repeat;*/&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-free a,&lt;br /&gt;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-limited a,&lt;br /&gt;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-registration a,&lt;br /&gt;
body:not(.skin-timeless):not(.skin-minerva) .id-lock-subscription a,&lt;br /&gt;
body:not(.skin-timeless):not(.skin-minerva) .cs1-ws-icon a {&lt;br /&gt;
	background-size: contain;&lt;br /&gt;
	/* Common.css has a padding set for PDF URLs. bg-contain expands to the&lt;br /&gt;
	 * size of the padding which makes the icons very large. we &amp;quot;reset&amp;quot; the&lt;br /&gt;
	 * padding here. 1em picked out of a hat based on console having a similar&lt;br /&gt;
	 * rule from elsewhere&lt;br /&gt;
	 */&lt;br /&gt;
	padding: 0 1em 0 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* Errors and maintenance */&lt;br /&gt;
.cs1-code {&lt;br /&gt;
	/* &amp;lt;code&amp;gt;...&amp;lt;/code&amp;gt; style override: mediawiki&#039;s css definition is specified here:&lt;br /&gt;
	https://git.wikimedia.org/blob/mediawiki%2Fcore.git/&lt;br /&gt;
		69cd73811f7aadd093050dbf20ed70ef0b42a713/skins%2Fcommon%2FcommonElements.css#L199&lt;br /&gt;
	*/&lt;br /&gt;
	color: inherit;&lt;br /&gt;
	background: inherit;&lt;br /&gt;
	border: none;&lt;br /&gt;
	padding: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.cs1-hidden-error {&lt;br /&gt;
	display: none;&lt;br /&gt;
	color: var(--color-error, #bf3c2c);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.cs1-visible-error {&lt;br /&gt;
	color: var(--color-error, #bf3c2c);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.cs1-maint {&lt;br /&gt;
	display: none;&lt;br /&gt;
	color: #085;&lt;br /&gt;
	margin-left: 0.3em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* kerning */&lt;br /&gt;
.cs1-kern-left {&lt;br /&gt;
	padding-left: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
.cs1-kern-right {&lt;br /&gt;
	padding-right: 0.2em;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
/* selflinks – avoid bold font style when cs1|2 template links to the current page */&lt;br /&gt;
.citation .mw-selflink {&lt;br /&gt;
	font-weight: inherit;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen {&lt;br /&gt;
	/* Small text size&lt;br /&gt;
	Set small text size in one place. 0.95 (here) * 0.9 (from references list) is&lt;br /&gt;
	~0.85, which is the lower bound for size for accessibility. Old styling for this&lt;br /&gt;
	was just 0.85. We could write the rule so that when this template is inside&lt;br /&gt;
	references/reflist, only then does it multiply by 0.95; else multiply by 0.85 */&lt;br /&gt;
	.cs1-format {&lt;br /&gt;
		font-size: 95%;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	html.skin-theme-clientpref-night .cs1-maint {&lt;br /&gt;
		color: #18911f;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
@media screen and (prefers-color-scheme: dark) {&lt;br /&gt;
	html.skin-theme-clientpref-os .cs1-maint {&lt;br /&gt;
		color: #18911f;&lt;br /&gt;
	}&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/COinS&amp;diff=610</id>
		<title>Module:Citation/CS1/COinS</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/COinS&amp;diff=610"/>
		<updated>2026-06-06T21:32:08Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;----------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------   local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup;	-- functions in Module:Citation/CS1/Utilities  local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration   --[[--------------------------&amp;lt; M A K E _ C O I N S _ T I T L E &amp;gt;----------------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local has_accept_as_written, is_set, in_array, remove_wiki_link, strip_apostrophe_markup;	-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ C O I N S _ T I T L E &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Makes a title for COinS from Title and / or ScriptTitle (or any other name-script pairs)&lt;br /&gt;
&lt;br /&gt;
Apostrophe markup (bold, italics) is stripped from each value so that the COinS metadata isn&#039;t corrupted with strings&lt;br /&gt;
of %27%27...&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_coins_title (title, script)&lt;br /&gt;
	title = has_accept_as_written (title);&lt;br /&gt;
	if is_set (title) then&lt;br /&gt;
		title = strip_apostrophe_markup (title);								-- strip any apostrophe markup&lt;br /&gt;
	else&lt;br /&gt;
		title = &#039;&#039;;																-- if not set, make sure title is an empty string&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (script) then&lt;br /&gt;
		script = script:gsub (&#039;^%l%l%s*:%s*&#039;, &#039;&#039;);								-- remove language prefix if present (script value may now be empty string)&lt;br /&gt;
		script = strip_apostrophe_markup (script);								-- strip any apostrophe markup&lt;br /&gt;
	else&lt;br /&gt;
		script = &#039;&#039;;															-- if not set, make sure script is an empty string&lt;br /&gt;
	end&lt;br /&gt;
	if is_set (title) and is_set (script) then&lt;br /&gt;
		script = &#039; &#039; .. script;													-- add a space before we concatenate&lt;br /&gt;
	end&lt;br /&gt;
	return title .. script;														-- return the concatenation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E S C A P E _ L U A _ M A G I C _ C H A R S &amp;gt;----------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns a string where all of Lua&#039;s magic characters have been escaped.  This is important because functions like&lt;br /&gt;
string.gsub() treat their pattern and replace strings as patterns, not literal strings.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function escape_lua_magic_chars (argument)&lt;br /&gt;
	argument = argument:gsub(&amp;quot;%%&amp;quot;, &amp;quot;%%%%&amp;quot;);										-- replace % with %%&lt;br /&gt;
	argument = argument:gsub(&amp;quot;([%^%$%(%)%.%[%]%*%+%-%?])&amp;quot;, &amp;quot;%%%1&amp;quot;);				-- replace all other Lua magic pattern characters&lt;br /&gt;
	return argument;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ C O I N S _ P A G E S &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Extract page numbers from external wikilinks in any of the |page=, |pages=, or |at= parameters for use in COinS.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_coins_pages (pages)&lt;br /&gt;
	local pattern;&lt;br /&gt;
	if not is_set (pages) then return pages; end								-- if no page numbers then we&#039;re done&lt;br /&gt;
	&lt;br /&gt;
	while true do&lt;br /&gt;
		pattern = pages:match(&amp;quot;%[(%w*:?//[^ ]+%s+)[%w%d].*%]&amp;quot;);					-- pattern is the opening bracket, the URL and following space(s): &amp;quot;[url &amp;quot;&lt;br /&gt;
		if nil == pattern then break; end										-- no more URLs&lt;br /&gt;
		pattern = escape_lua_magic_chars (pattern);								-- pattern is not a literal string; escape Lua&#039;s magic pattern characters&lt;br /&gt;
		pages = pages:gsub(pattern, &amp;quot;&amp;quot;);										-- remove as many instances of pattern as possible&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	pages = pages:gsub(&amp;quot;[%[%]]&amp;quot;, &amp;quot;&amp;quot;);											-- remove the brackets&lt;br /&gt;
	pages = pages:gsub(&amp;quot;–&amp;quot;, &amp;quot;-&amp;quot; );												-- replace endashes with hyphens&lt;br /&gt;
	pages = pages:gsub(&amp;quot;&amp;amp;%w+;&amp;quot;, &amp;quot;-&amp;quot; );											-- and replace HTML entities (&amp;amp;ndash; etc.) with hyphens; do we need to replace numerical entities like &amp;amp;#32; and the like?&lt;br /&gt;
	pages = pages:gsub (&#039;%b&amp;lt;&amp;gt;&#039;, &#039;&#039;);											-- remove html-like tags; spans are added to &amp;lt;Pages&amp;gt; by utilities.hyphen_to_dash() which should not appear in COinS metadata&lt;br /&gt;
	return pages;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; C O I N S _ R E P L A C E _ M A T H _ S T R I P M A R K E R &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
There are three options for math markup rendering that depend on the editor&#039;s math preference settings.  These&lt;br /&gt;
settings are at [[Special:Preferences#mw-prefsection-rendering]] and are&lt;br /&gt;
	PNG images&lt;br /&gt;
	TeX source&lt;br /&gt;
	MathML with SVG or PNG fallback&lt;br /&gt;
&lt;br /&gt;
All three are heavy with HTML and CSS which doesn&#039;t belong in the metadata.&lt;br /&gt;
&lt;br /&gt;
Without this function, the metadata saved in the raw wikitext contained the rendering determined by the settings&lt;br /&gt;
of the last editor to save the page.&lt;br /&gt;
&lt;br /&gt;
This function gets the rendered form of an equation according to the editor&#039;s preference before the page is saved.  It&lt;br /&gt;
then searches the rendering for the text equivalent of the rendered equation and replaces the rendering with that so&lt;br /&gt;
that the page is saved without extraneous HTML/CSS markup and with a reasonably readable text form of the equation.&lt;br /&gt;
&lt;br /&gt;
When a replacement is made, this function returns true and the value with replacement; otherwise false and the initial&lt;br /&gt;
value.  To replace multipe equations it is necessary to call this function from within a loop.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function coins_replace_math_stripmarker (value)&lt;br /&gt;
	local stripmarker = cfg.stripmarkers[&#039;math&#039;];&lt;br /&gt;
	local rendering = value:match (stripmarker);								-- is there a math stripmarker&lt;br /&gt;
&lt;br /&gt;
	if not rendering then														-- when value doesn&#039;t have a math stripmarker, abandon this test&lt;br /&gt;
		return false, value;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	rendering = mw.text.unstripNoWiki (rendering);								-- convert stripmarker into rendered value (or nil? &#039;&#039;? when math render error)&lt;br /&gt;
	&lt;br /&gt;
	if rendering:match (&#039;alt=&amp;quot;[^&amp;quot;]+&amp;quot;&#039;) then										-- if PNG math option&lt;br /&gt;
		rendering = rendering:match (&#039;alt=&amp;quot;([^&amp;quot;]+)&amp;quot;&#039;);							-- extract just the math text&lt;br /&gt;
	elseif rendering:match (&#039;$%s+.+%s+%$&#039;) then									-- if TeX math option; $ is legit character that is escapes as \$&lt;br /&gt;
		rendering = rendering:match (&#039;$%s+(.+)%s+%$&#039;)							-- extract just the math text&lt;br /&gt;
	elseif rendering:match (&#039;&amp;lt;annotation[^&amp;gt;]+&amp;gt;.+&amp;lt;/annotation&amp;gt;&#039;) then			-- if MathML math option&lt;br /&gt;
		rendering = rendering:match (&#039;&amp;lt;annotation[^&amp;gt;]+&amp;gt;(.+)&amp;lt;/annotation&amp;gt;&#039;)		-- extract just the math text&lt;br /&gt;
	else&lt;br /&gt;
		return false, value;													-- had math stripmarker but not one of the three defined forms&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return true, value:gsub (stripmarker, rendering, 1);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O I N S _ C L E A N U P &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Cleanup parameter values for the metadata by removing or replacing invisible characters and certain HTML entities.&lt;br /&gt;
&lt;br /&gt;
2015-12-10: there is a bug in mw.text.unstripNoWiki ().  It replaces math stripmarkers with the appropriate content&lt;br /&gt;
when it shouldn&#039;t.  See https://phabricator.wikimedia.org/T121085 and Wikipedia_talk:Lua#stripmarkers_and_mw.text.unstripNoWiki.28.29&lt;br /&gt;
&lt;br /&gt;
TODO: move the replacement patterns and replacement values into a table in /Configuration similar to the invisible&lt;br /&gt;
characters table?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function coins_cleanup (value)&lt;br /&gt;
	local replaced = true;														-- default state to get the do loop running&lt;br /&gt;
&lt;br /&gt;
	while replaced do															-- loop until all math stripmarkers replaced&lt;br /&gt;
		replaced, value = coins_replace_math_stripmarker (value);				-- replace math stripmarker with text representation of the equation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	value = value:gsub (cfg.stripmarkers[&#039;math&#039;], &amp;quot;MATH RENDER ERROR&amp;quot;);			-- one or more couldn&#039;t be replaced; insert vague error message&lt;br /&gt;
	&lt;br /&gt;
	value = mw.text.unstripNoWiki (value);										-- replace nowiki stripmarkers with their content&lt;br /&gt;
	value = value:gsub (&#039;&amp;lt;span class=&amp;quot;nowrap&amp;quot; style=&amp;quot;padding%-left:0%.1em;&amp;quot;&amp;gt;&amp;amp;#39;(s?)&amp;lt;/span&amp;gt;&#039;, &amp;quot;&#039;%1&amp;quot;);	-- replace {{&#039;}} or {{&#039;s}} with simple apostrophe or apostrophe-s&lt;br /&gt;
	value = value:gsub (&#039;&amp;amp;nbsp;&#039;, &#039; &#039;);											-- replace &amp;amp;nbsp; entity with plain space&lt;br /&gt;
	value = value:gsub (&#039;\226\128\138&#039;, &#039; &#039;);									-- replace hair space with plain space&lt;br /&gt;
	if not mw.ustring.find (value, cfg.indic_script) then						-- don&#039;t remove zero-width joiner characters from indic script&lt;br /&gt;
		value = value:gsub (&#039;&amp;amp;zwj;&#039;, &#039;&#039;);										-- remove &amp;amp;zwj; entities&lt;br /&gt;
		value = mw.ustring.gsub (value, &#039;[\226\128\141\226\128\139\194\173]&#039;, &#039;&#039;);	-- remove zero-width joiner, zero-width space, soft hyphen&lt;br /&gt;
	end&lt;br /&gt;
	value = value:gsub (&#039;[\009\010\013 ]+&#039;, &#039; &#039;);								-- replace horizontal tab, line feed, carriage return with plain space&lt;br /&gt;
	return value;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C O I N S &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
COinS metadata (see &amp;lt;http://ocoins.info/&amp;gt;) allows automated tools to parse the citation information.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function COinS(data, class)&lt;br /&gt;
	if &#039;table&#039; ~= type(data) or nil == next(data) then&lt;br /&gt;
		return &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (data) do													-- spin through all of the metadata parameter values&lt;br /&gt;
		if &#039;ID_list&#039; ~= k and &#039;Authors&#039; ~= k then								-- except the ID_list and Author tables (author nowiki stripmarker done when Author table processed)&lt;br /&gt;
			data[k] = coins_cleanup (v);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ctx_ver = &amp;quot;Z39.88-2004&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	-- treat table strictly as an array with only set values.&lt;br /&gt;
	local OCinSoutput = setmetatable( {}, {&lt;br /&gt;
		__newindex = function(self, key, value)&lt;br /&gt;
			if is_set(value) then&lt;br /&gt;
				rawset( self, #self+1, table.concat{ key, &#039;=&#039;, mw.uri.encode( remove_wiki_link( value ) ) } );&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	});&lt;br /&gt;
	&lt;br /&gt;
	if in_array (class, {&#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;, &#039;journal&#039;, &#039;news&#039;, &#039;magazine&#039;}) or&lt;br /&gt;
		(in_array (class, {&#039;conference&#039;, &#039;interview&#039;, &#039;map&#039;, &#039;press release&#039;, &#039;web&#039;}) and is_set(data.Periodical)) or&lt;br /&gt;
		(&#039;citation&#039; == class and is_set(data.Periodical) and not is_set (data.Encyclopedia)) then&lt;br /&gt;
			OCinSoutput.rft_val_fmt = &amp;quot;info:ofi/fmt:kev:mtx:journal&amp;quot;;			-- journal metadata identifier&lt;br /&gt;
			if in_array (class, {&#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) then	-- set genre according to the type of citation template we are rendering&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;preprint&amp;quot;;							-- cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, cite ssrn&lt;br /&gt;
			elseif &#039;conference&#039; == class then&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;conference&amp;quot;;						-- cite conference (when Periodical set)&lt;br /&gt;
			elseif &#039;web&#039; == class then&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;unknown&amp;quot;;							-- cite web (when Periodical set)&lt;br /&gt;
			else&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;article&amp;quot;;							-- journal and other &#039;periodical&#039; articles&lt;br /&gt;
			end&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.jtitle&amp;quot;] = data.Periodical;						-- journal only&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.atitle&amp;quot;] = data.Title;								-- &#039;periodical&#039; article titles&lt;br /&gt;
&lt;br /&gt;
																				-- these used only for periodicals&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.ssn&amp;quot;] = data.Season;								-- keywords: winter, spring, summer, fall&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.quarter&amp;quot;] = data.Quarter;							-- single digits 1-&amp;gt;first quarter, etc.&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.chron&amp;quot;] = data.Chron;								-- free-form date components&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.volume&amp;quot;] = data.Volume;							-- does not apply to books&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.issue&amp;quot;] = data.Issue;&lt;br /&gt;
			OCinSoutput[&#039;rft.artnum&#039;] = data.ArticleNumber;						-- {{cite journal}} only&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.pages&amp;quot;] = data.Pages;								-- also used in book metadata&lt;br /&gt;
&lt;br /&gt;
	elseif &#039;thesis&#039; ~= class then												-- all others except cite thesis are treated as &#039;book&#039; metadata; genre distinguishes&lt;br /&gt;
		OCinSoutput.rft_val_fmt = &amp;quot;info:ofi/fmt:kev:mtx:book&amp;quot;;					-- book metadata identifier&lt;br /&gt;
		if &#039;report&#039; == class or &#039;techreport&#039; == class then						-- cite report and cite techreport&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;report&amp;quot;;&lt;br /&gt;
		elseif &#039;conference&#039; == class then										-- cite conference when Periodical not set&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;conference&amp;quot;;&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.atitle&amp;quot;] = data.Chapter;							-- conference paper as chapter in proceedings (book)&lt;br /&gt;
		elseif in_array (class, {&#039;book&#039;, &#039;citation&#039;, &#039;encyclopaedia&#039;, &#039;interview&#039;, &#039;map&#039;}) then&lt;br /&gt;
			if is_set (data.Chapter) then&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;bookitem&amp;quot;;&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.atitle&amp;quot;] = data.Chapter;						-- book chapter, encyclopedia article, interview in a book, or map title&lt;br /&gt;
			else&lt;br /&gt;
				if &#039;map&#039; == class or &#039;interview&#039; == class then&lt;br /&gt;
					OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &#039;unknown&#039;;						-- standalone map or interview&lt;br /&gt;
				else&lt;br /&gt;
					OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &#039;book&#039;;							-- book and encyclopedia&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else	-- {&#039;audio-visual&#039;, &#039;AV-media-notes&#039;, &#039;DVD-notes&#039;, &#039;episode&#039;, &#039;interview&#039;, &#039;mailinglist&#039;, &#039;map&#039;, &#039;newsgroup&#039;, &#039;podcast&#039;, &#039;press release&#039;, &#039;serial&#039;, &#039;sign&#039;, &#039;speech&#039;, &#039;web&#039;}&lt;br /&gt;
			OCinSoutput[&amp;quot;rft.genre&amp;quot;] = &amp;quot;unknown&amp;quot;;&lt;br /&gt;
		end&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.btitle&amp;quot;] = data.Title;									-- book only&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.place&amp;quot;] = data.PublicationPlace;						-- book only&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.series&amp;quot;] = data.Series;								-- book only&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.pages&amp;quot;] = data.Pages;									-- book, journal&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.edition&amp;quot;] = data.Edition;								-- book only&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.pub&amp;quot;] = data.PublisherName;							-- book and dissertation&lt;br /&gt;
		&lt;br /&gt;
	else																		-- cite thesis&lt;br /&gt;
		OCinSoutput.rft_val_fmt = &amp;quot;info:ofi/fmt:kev:mtx:dissertation&amp;quot;;			-- dissertation metadata identifier&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.title&amp;quot;] = data.Title;									-- dissertation (also patent but that is not yet supported)&lt;br /&gt;
		OCinSoutput[&amp;quot;rft.degree&amp;quot;] = data.Degree;								-- dissertation only&lt;br /&gt;
		OCinSoutput[&#039;rft.inst&#039;] = data.PublisherName;							-- book and dissertation&lt;br /&gt;
	end&lt;br /&gt;
	-- NB. Not currently supported are &amp;quot;info:ofi/fmt:kev:mtx:patent&amp;quot;, &amp;quot;info:ofi/fmt:kev:mtx:dc&amp;quot;, &amp;quot;info:ofi/fmt:kev:mtx:sch_svc&amp;quot;, &amp;quot;info:ofi/fmt:kev:mtx:ctx&amp;quot;&lt;br /&gt;
																				-- and now common parameters (as much as possible)&lt;br /&gt;
	OCinSoutput[&amp;quot;rft.date&amp;quot;] = data.Date;										-- book, journal, dissertation&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs( data.ID_list ) do										-- what to do about these? For now assume that they are common to all?&lt;br /&gt;
		if k == &#039;ISBN&#039; then v = v:gsub( &amp;quot;[^-0-9X]&amp;quot;, &amp;quot;&amp;quot; ); end&lt;br /&gt;
		local id = cfg.id_handlers[k].COinS;&lt;br /&gt;
		if string.sub( id or &amp;quot;&amp;quot;, 1, 4 ) == &#039;info&#039; then							-- for ids that are in the info:registry&lt;br /&gt;
			OCinSoutput[&amp;quot;rft_id&amp;quot;] = table.concat{ id, &amp;quot;/&amp;quot;, v };&lt;br /&gt;
		elseif string.sub (id or &amp;quot;&amp;quot;, 1, 3 ) == &#039;rft&#039; then						-- for isbn, issn, eissn, etc. that have defined COinS keywords&lt;br /&gt;
			OCinSoutput[ id ] = v;&lt;br /&gt;
		elseif &#039;url&#039; == id then													-- for urls that are assembled in ~/Identifiers; |asin= and |ol=&lt;br /&gt;
			OCinSoutput[&amp;quot;rft_id&amp;quot;] = table.concat ({data.ID_list[k], &amp;quot;#id-name=&amp;quot;, cfg.id_handlers[k].label});&lt;br /&gt;
		elseif id then															-- when cfg.id_handlers[k].COinS is not nil so urls created here&lt;br /&gt;
			OCinSoutput[&amp;quot;rft_id&amp;quot;] = table.concat{ cfg.id_handlers[k].prefix, v, cfg.id_handlers[k].suffix or &#039;&#039;, &amp;quot;#id-name=&amp;quot;, cfg.id_handlers[k].label };	-- others; provide a URL and indicate identifier name as #fragment (human-readable, but transparent to browsers)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local last, first;&lt;br /&gt;
	for k, v in ipairs( data.Authors ) do&lt;br /&gt;
		last, first = coins_cleanup (v.last), coins_cleanup (v.first or &#039;&#039;);	-- replace any nowiki stripmarkers, non-printing or invisible characters&lt;br /&gt;
		if k == 1 then															-- for the first author name only&lt;br /&gt;
			if is_set(last) and is_set(first) then								-- set these COinS values if |first= and |last= specify the first author name&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.aulast&amp;quot;] = last;								-- book, journal, dissertation&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.aufirst&amp;quot;] = first;								-- book, journal, dissertation&lt;br /&gt;
			elseif is_set(last) then &lt;br /&gt;
				OCinSoutput[&amp;quot;rft.au&amp;quot;] = last;									-- book, journal, dissertation -- otherwise use this form for the first name&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- for all other authors&lt;br /&gt;
			if is_set(last) and is_set(first) then&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.au&amp;quot;] = table.concat{ last, &amp;quot;, &amp;quot;, first };		-- book, journal, dissertation&lt;br /&gt;
			elseif is_set(last) then&lt;br /&gt;
				OCinSoutput[&amp;quot;rft.au&amp;quot;] = last;									-- book, journal, dissertation&lt;br /&gt;
			end&lt;br /&gt;
			-- TODO: At present we do not report &amp;quot;et al.&amp;quot;. Add anything special if this condition applies?&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	OCinSoutput.rft_id = data.URL;&lt;br /&gt;
	OCinSoutput.rfr_id = table.concat{ &amp;quot;info:sid/&amp;quot;, mw.site.server:match( &amp;quot;[^/]*$&amp;quot; ), &amp;quot;:&amp;quot;, data.RawPage };&lt;br /&gt;
&lt;br /&gt;
	-- TODO: Add optional extra info:&lt;br /&gt;
	-- rfr_dat=#REVISION&amp;lt;version&amp;gt; (referrer private data)&lt;br /&gt;
	-- ctx_id=&amp;lt;data.RawPage&amp;gt;#&amp;lt;ref&amp;gt; (identifier for the context object)&lt;br /&gt;
	-- ctx_tim=&amp;lt;ts&amp;gt; (timestamp in format yyyy-mm-ddThh:mm:ssTZD or yyyy-mm-dd)&lt;br /&gt;
	-- ctx_enc=info:ofi/enc:UTF-8 (character encoding)&lt;br /&gt;
	&lt;br /&gt;
	OCinSoutput = setmetatable( OCinSoutput, nil );&lt;br /&gt;
&lt;br /&gt;
	-- sort with version string always first, and combine.&lt;br /&gt;
	-- table.sort( OCinSoutput );&lt;br /&gt;
	table.insert( OCinSoutput, 1, &amp;quot;ctx_ver=&amp;quot; .. ctx_ver ); -- such as &amp;quot;Z39.88-2004&amp;quot;&lt;br /&gt;
	return table.concat(OCinSoutput, &amp;quot;&amp;amp;&amp;quot;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)&lt;br /&gt;
	cfg = cfg_table_ptr;&lt;br /&gt;
&lt;br /&gt;
	has_accept_as_written = utilities_page_ptr.has_accept_as_written;			-- import functions from selected Module:Citation/CS1/Utilities module&lt;br /&gt;
	is_set = utilities_page_ptr.is_set;&lt;br /&gt;
	in_array = utilities_page_ptr.in_array;&lt;br /&gt;
	remove_wiki_link = utilities_page_ptr.remove_wiki_link;&lt;br /&gt;
	strip_apostrophe_markup = utilities_page_ptr.strip_apostrophe_markup;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	make_coins_title = make_coins_title,&lt;br /&gt;
	get_coins_pages = get_coins_pages,&lt;br /&gt;
	COinS = COinS,&lt;br /&gt;
	set_selected_modules = set_selected_modules,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=609</id>
		<title>Module:Citation/CS1/Identifiers</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Identifiers&amp;diff=609"/>
		<updated>2026-06-06T21:31:20Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;----------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------   local has_accept_as_written, is_set, in_array, set_message, select_one,			-- functions in Module:Citation/CS1/Utilities 		substitute, make_wikilink;  local z;																		-- table of tables defined in Module:Citation/CS1/Utilities  local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration   --[[-...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local has_accept_as_written, is_set, in_array, set_message, select_one,			-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
		substitute, make_wikilink;&lt;br /&gt;
&lt;br /&gt;
local z;																		-- table of tables defined in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local cfg;																		-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P A G E   S C O P E   V A R I A B L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
declare variables here that have page-wide scope that are not brought in from other modules; that are created here and used here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local auto_link_urls = {};														-- holds identifier URLs for those identifiers that can auto-link |title=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; H E L P E R   F U N C T I O N S &amp;gt;&amp;gt;============================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W I K I D A T A _ A R T I C L E _ N A M E _ G E T &amp;gt;----------------------------&lt;br /&gt;
&lt;br /&gt;
as an aid to internationalizing identifier-label wikilinks, gets identifier article names from Wikidata.&lt;br /&gt;
&lt;br /&gt;
returns w:&amp;lt;lang code&amp;gt;:&amp;lt;article title&amp;gt; when &amp;lt;q&amp;gt; has an &amp;lt;article title&amp;gt; for &amp;lt;lang code&amp;gt;; nil else. &#039;w:&amp;lt;lang code&amp;gt;&#039;&lt;br /&gt;
ensures that sister project (like wiktionary) will link to the &amp;lt;lang code&amp;gt;.wikipedia article.&lt;br /&gt;
&lt;br /&gt;
for identifiers that do not have &amp;lt;q&amp;gt;, returns nil&lt;br /&gt;
&lt;br /&gt;
for wikis that do not have mw.wikibase installed, returns nil&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wikidata_article_name_get (q)&lt;br /&gt;
	if not is_set (q) or (q and not mw.wikibase) then							-- when no q number or when a q number but mw.wikibase not installed on this wiki&lt;br /&gt;
		return nil;																-- abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local wd_article;&lt;br /&gt;
	local this_wiki_code = cfg.this_wiki_code;									-- Wikipedia subdomain; &#039;en&#039; for en.wikipedia.org&lt;br /&gt;
&lt;br /&gt;
	wd_article = mw.wikibase.getSitelink (q, this_wiki_code .. &#039;wiki&#039;);			-- fetch article title from WD; nil when no title available at this wiki&lt;br /&gt;
&lt;br /&gt;
	if wd_article then&lt;br /&gt;
		wd_article = table.concat ({&#039;w:&#039;, this_wiki_code, &#039;:&#039;, wd_article});	-- interwiki-style link without brackets if taken from WD; leading &#039;w:&#039; required&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return wd_article;															-- article title from WD; nil else&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L A B E L _ L I N K _ M A K E &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
common function to create a link for an identifier label from handler table or from Wikidata&lt;br /&gt;
&lt;br /&gt;
returns the first available of:&lt;br /&gt;
	1. redirect from local wiki&#039;s handler table (if enabled)&lt;br /&gt;
	2. Wikidata sitelink to the local language wikipedia article (if there is a Wikidata entry for this identifier in the local language)&lt;br /&gt;
	3. link to wikipedia article specified in the local wiki&#039;s handler table&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function label_link_make (handler)&lt;br /&gt;
	local wd_article;&lt;br /&gt;
	&lt;br /&gt;
	if not (cfg.use_identifier_redirects and is_set (handler.redirect)) then	-- redirect has priority so if enabled and available don&#039;t fetch from Wikidata because expensive&lt;br /&gt;
		wd_article = wikidata_article_name_get (handler.q);						-- if Wikidata has an article title for this wiki, get it;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return (cfg.use_identifier_redirects and is_set (handler.redirect) and handler.redirect) or wd_article or handler.link;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T E R N A L _ L I N K _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style external link&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function external_link_id (options)&lt;br /&gt;
	local url_string = options.id;&lt;br /&gt;
	local ext_link;&lt;br /&gt;
	local this_wiki_code = cfg.this_wiki_code;									-- Wikipedia subdomain; &#039;en&#039; for en.wikipedia.org&lt;br /&gt;
	local wd_article;															-- article title from Wikidata&lt;br /&gt;
	&lt;br /&gt;
	if options.encode == true or options.encode == nil then&lt;br /&gt;
		url_string = mw.uri.encode (url_string, &#039;PATH&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if options.auto_link and is_set (options.access) then&lt;br /&gt;
		auto_link_urls[options.auto_link] = table.concat ({options.prefix, url_string, options.suffix});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	ext_link = mw.ustring.format (&#039;[%s%s%s %s]&#039;, options.prefix, url_string, options.suffix or &amp;quot;&amp;quot;, mw.text.nowiki (options.id));&lt;br /&gt;
	if is_set (options.access) then&lt;br /&gt;
		ext_link = substitute (cfg.presentation[&#039;ext-link-access-signal&#039;], {cfg.presentation[options.access].class, cfg.presentation[options.access].title, ext_link});	-- add the free-to-read / paywall lock&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat	({&lt;br /&gt;
		make_wikilink (label_link_make (options), options.label),				-- redirect, Wikidata link, or locally specified link (in that order)&lt;br /&gt;
		options.separator or &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		ext_link&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N T E R N A L _ L I N K _ I D &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a wiki-style internal link&lt;br /&gt;
&lt;br /&gt;
TODO: Does not currently need to support options.access, options.encode, auto-linking and COinS (as in external_link_id),&lt;br /&gt;
but may be needed in the future for :m:Interwiki_map custom-prefixes like :arxiv:, :bibcode:, :DOI:, :hdl:, :ISSN:,&lt;br /&gt;
:JSTOR:, :Openlibrary:, :PMID:, :RFC:.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function internal_link_id (options)&lt;br /&gt;
	local id = mw.ustring.gsub (options.id, &#039;%d&#039;, cfg.date_names.local_digits);	-- translate &#039;local&#039; digits to Western 0-9&lt;br /&gt;
&lt;br /&gt;
	return table.concat (&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (label_link_make (options), options.label),				-- wiki-link the identifier label&lt;br /&gt;
		options.separator or &#039;&amp;amp;nbsp;&#039;,											-- add the separator&lt;br /&gt;
		make_wikilink (&lt;br /&gt;
			table.concat (&lt;br /&gt;
				{&lt;br /&gt;
				options.prefix,&lt;br /&gt;
				id,																-- translated to Western digits&lt;br /&gt;
				options.suffix or &#039;&#039;&lt;br /&gt;
				}),&lt;br /&gt;
			substitute (cfg.presentation[&#039;bdi&#039;], {&#039;&#039;, mw.text.nowiki (options.id)})	-- bdi tags to prevent Latin script identifiers from being reversed at RTL language wikis&lt;br /&gt;
			);																	-- nowiki because MediaWiki still has magic links for ISBN and the like; TODO: is it really required?&lt;br /&gt;
		});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ E M B A R G O E D &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if a PMC identifier&#039;s online version is embargoed. Compares the date in |pmc-embargo-date= against&lt;br /&gt;
today&#039;s date.  If embargo date is in the future, returns the content of |pmc-embargo-date=; otherwise, returns&lt;br /&gt;
an empty string because the embargo has expired or because |pmc-embargo-date= was not set in this cite.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_embargoed (embargo)&lt;br /&gt;
	if is_set (embargo) then&lt;br /&gt;
		local lang = mw.getContentLanguage();&lt;br /&gt;
		local good1, embargo_date, todays_date;&lt;br /&gt;
		good1, embargo_date = pcall (lang.formatDate, lang, &#039;U&#039;, embargo);&lt;br /&gt;
		todays_date = lang:formatDate (&#039;U&#039;);&lt;br /&gt;
	&lt;br /&gt;
		if good1 then															-- if embargo date is a good date&lt;br /&gt;
			if tonumber (embargo_date) &amp;gt;= tonumber (todays_date) then			-- is embargo date is in the future?&lt;br /&gt;
				return embargo;													-- still embargoed&lt;br /&gt;
			else&lt;br /&gt;
				set_message (&#039;maint_pmc_embargo&#039;);								-- embargo has expired; add main cat&lt;br /&gt;
				return &#039;&#039;;														-- unset because embargo has expired&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return &#039;&#039;;																	-- |pmc-embargo-date= not set return empty string&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ V A L I D _ R X I V _ D A T E &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
for biorxiv, returns true if:&lt;br /&gt;
	2019-12-11T00:00Z &amp;lt;= biorxiv_date &amp;lt; today + 2 days&lt;br /&gt;
for medrxiv, returns true if:&lt;br /&gt;
	2020-01-01T00:00Z &amp;lt;= medrxiv_date &amp;lt; today + 2 days&lt;br /&gt;
	&lt;br /&gt;
The dated form of biorxiv identifier has a start date of 2019-12-11.  The Unix timestamp for that date is {{#time:U|2019-12-11}} = 1576022400&lt;br /&gt;
The medrxiv identifier has a start date of 2020-01-01.  The Unix timestamp for that date is {{#time:U|2020-01-01}} = 1577836800&lt;br /&gt;
&lt;br /&gt;
&amp;lt;rxiv_date&amp;gt; is the date provided in those |biorxiv= parameter values that are dated and in |medrxiv= parameter values at time 00:00:00 UTC&lt;br /&gt;
&amp;lt;today&amp;gt; is the current date at time 00:00:00 UTC plus 48 hours&lt;br /&gt;
	if today&#039;s date is 2023-01-01T00:00:00 then&lt;br /&gt;
		adding 24 hours gives 2023-01-02T00:00:00 – one second more than today&lt;br /&gt;
		adding 24 hours gives 2023-01-03T00:00:00 – one second more than tomorrow&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
	&amp;lt;y&amp;gt;, &amp;lt;m&amp;gt;, &amp;lt;d&amp;gt; – year, month, day parts of the date from the birxiv or medrxiv identifier&lt;br /&gt;
	&amp;lt;select&amp;gt; &#039;b&#039; for biorxiv, &#039;m&#039; for medrxiv; defaults to &#039;b&#039;&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_rxiv_date (y, m, d, select)&lt;br /&gt;
	if 0 == tonumber (m) and 12 &amp;lt; tonumber (m) then								-- &amp;lt;m&amp;gt; must be a number 1–12&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	if 0 == tonumber (d) and 31 &amp;lt; tonumber (d) then								-- &amp;lt;d&amp;gt; must be a number 1–31; TODO: account for month length and leap yer?&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local rxiv_date = table.concat ({y, m, d}, &#039;-&#039;);							-- make ymd date string&lt;br /&gt;
	local good1, good2;&lt;br /&gt;
	local rxiv_ts, tomorrow_ts;													-- to hold Unix timestamps representing the dates&lt;br /&gt;
	local lang_object = mw.getContentLanguage();&lt;br /&gt;
&lt;br /&gt;
	good1, rxiv_ts = pcall (lang_object.formatDate, lang_object, &#039;U&#039;, rxiv_date);		-- convert rxiv_date value to Unix timestamp &lt;br /&gt;
	good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, &#039;U&#039;, &#039;today + 2 days&#039; );	-- today midnight + 2 days is one second more than all day tomorrow&lt;br /&gt;
	&lt;br /&gt;
	if good1 and good2 then														-- lang.formatDate() returns a timestamp in the local script which tonumber() may not understand&lt;br /&gt;
		rxiv_ts = tonumber (rxiv_ts) or lang_object:parseFormattedNumber (rxiv_ts);	-- convert to numbers for the comparison;&lt;br /&gt;
		tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- one or both failed to convert to Unix timestamp&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local limit_ts = ((select and (&#039;m&#039; == select)) and 1577836800) or 1576022400;	-- choose the appropriate limit timesatmp&lt;br /&gt;
&lt;br /&gt;
	return ((limit_ts &amp;lt;= rxiv_ts) and (rxiv_ts &amp;lt; tomorrow_ts))					-- limit_ts &amp;lt;= rxiv_date &amp;lt; tomorrow&#039;s date&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-10 and ISSN validator code calculates checksum across all ISBN/ISSN digits including the check digit.&lt;br /&gt;
ISBN-13 is checked in isbn().&lt;br /&gt;
&lt;br /&gt;
If the number is valid the result will be 0. Before calling this function, ISBN/ISSN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn (isxn_str, len)&lt;br /&gt;
	local temp = 0;&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, len) };										-- make a table of byte values &#039;0&#039; → 0x30 .. &#039;9&#039; → 0x39, &#039;X&#039; → 0x58&lt;br /&gt;
	len = len + 1;																-- adjust to be a loop counter&lt;br /&gt;
	for i, v in ipairs (isxn_str) do											-- loop through all of the bytes and calculate the checksum&lt;br /&gt;
		if v == string.byte (&amp;quot;X&amp;quot; ) then											-- if checkdigit is X (compares the byte value of &#039;X&#039; which is 0x58)&lt;br /&gt;
			temp = temp + 10 * (len - i);										-- it represents 10 decimal&lt;br /&gt;
		else&lt;br /&gt;
			temp = temp + tonumber (string.char (v) )*(len-i);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 11 == 0;														-- returns true if calculation result is zero&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; IS _ V A L I D _ I S X N _ 1 3 &amp;gt;-----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
ISBN-13 and ISMN validator code calculates checksum across all 13 ISBN/ISMN digits including the check digit.&lt;br /&gt;
If the number is valid, the result will be 0. Before calling this function, ISBN-13/ISMN must be checked for length&lt;br /&gt;
and stripped of dashes, spaces and other non-ISxN-13 characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_isxn_13 (isxn_str)&lt;br /&gt;
	local temp=0;&lt;br /&gt;
	&lt;br /&gt;
	isxn_str = { isxn_str:byte(1, 13) };										-- make a table of byte values &#039;0&#039; → 0x30 .. &#039;9&#039; → 0x39&lt;br /&gt;
	for i, v in ipairs (isxn_str) do&lt;br /&gt;
		temp = temp + (3 - 2*(i % 2)) * tonumber (string.char (v) );			-- multiply odd index digits by 1, even index digits by 3 and sum; includes check digit&lt;br /&gt;
	end&lt;br /&gt;
	return temp % 10 == 0;														-- sum modulo 10 is zero when ISBN-13/ISMN is correct&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N O R M A L I Z E _ L C C N &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
LCCN normalization (https://www.loc.gov/marc/lccn-namespace.html#normalization)&lt;br /&gt;
1. Remove all blanks.&lt;br /&gt;
2. If there is a forward slash (/) in the string, remove it, and remove all characters to the right of the forward slash.&lt;br /&gt;
3. If there is a hyphen in the string:&lt;br /&gt;
	a. Remove it.&lt;br /&gt;
	b. Inspect the substring following (to the right of) the (removed) hyphen. Then (and assuming that steps 1 and 2 have been carried out):&lt;br /&gt;
		1. All these characters should be digits, and there should be six or less. (not done in this function)&lt;br /&gt;
		2. If the length of the substring is less than 6, left-fill the substring with zeroes until the length is six.&lt;br /&gt;
&lt;br /&gt;
Returns a normalized LCCN for lccn() to validate.  There is no error checking (step 3.b.1) performed in this function.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function normalize_lccn (lccn)&lt;br /&gt;
	lccn = lccn:gsub (&amp;quot;%s&amp;quot;, &amp;quot;&amp;quot;);												-- 1. strip whitespace&lt;br /&gt;
&lt;br /&gt;
	if nil ~= string.find (lccn, &#039;/&#039;) then&lt;br /&gt;
		lccn = lccn:match (&amp;quot;(.-)/&amp;quot;);											-- 2. remove forward slash and all character to the right of it&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local prefix&lt;br /&gt;
	local suffix&lt;br /&gt;
	prefix, suffix = lccn:match (&amp;quot;(.+)%-(.+)&amp;quot;);									-- 3.a remove hyphen by splitting the string into prefix and suffix&lt;br /&gt;
&lt;br /&gt;
	if nil ~= suffix then														-- if there was a hyphen&lt;br /&gt;
		suffix = string.rep(&amp;quot;0&amp;quot;, 6-string.len (suffix)) .. suffix;				-- 3.b.2 left fill the suffix with 0s if suffix length less than 6&lt;br /&gt;
		lccn = prefix..suffix;													-- reassemble the LCCN&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return lccn;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I D E N T I F I E R   F U N C T I O N S &amp;gt;&amp;gt;====================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R X I V &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
See: https://arxiv.org/help/arxiv_identifier&lt;br /&gt;
&lt;br /&gt;
format and error check arXiv identifier.  There are three valid forms of the identifier:&lt;br /&gt;
the first form, valid only between date codes 9107 and 0703, is:&lt;br /&gt;
	arXiv:&amp;lt;archive&amp;gt;.&amp;lt;class&amp;gt;/&amp;lt;date code&amp;gt;&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;archive&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation&lt;br /&gt;
	&amp;lt;class&amp;gt; is a string of alpha characters - may be hyphenated; no other punctuation; not the same as |class= parameter which is not supported in this form&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
		first digit of YY for this form can only 9 and 0&lt;br /&gt;
	&amp;lt;number&amp;gt; is a three-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces (undocumented)&lt;br /&gt;
	&lt;br /&gt;
the second form, valid from April 2007 through December 2014 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; is four digits in the form YYMM where YY is the last two digits of the four-digit year and MM is the month number January = 01&lt;br /&gt;
	&amp;lt;number&amp;gt; is a four-digit number&lt;br /&gt;
	&amp;lt;version&amp;gt; is a 1 or more digit number preceded with a lowercase v; no spaces&lt;br /&gt;
&lt;br /&gt;
the third form, valid from January 2015 is:&lt;br /&gt;
	arXiv:&amp;lt;date code&amp;gt;.&amp;lt;number&amp;gt;&amp;lt;version&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;date code&amp;gt; and &amp;lt;version&amp;gt; are as defined for 0704-1412&lt;br /&gt;
	&amp;lt;number&amp;gt; is a five-digit number&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function arxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local class = options.Class;												-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local year, month, version;&lt;br /&gt;
	local err_msg = false;														-- assume no error message&lt;br /&gt;
	local text;																	-- output text&lt;br /&gt;
	&lt;br /&gt;
	if id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%a[%a%.%-]+/[90]%d[01]%d%d%d%dv%d+$&amp;quot;) then	-- test for the 9107-0703 format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^%a[%a%.%-]+/([90]%d)([01]%d)%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((not (90 &amp;lt; year or 8 &amp;gt; year)) or (1 &amp;gt; month or 12 &amp;lt; month)) or		-- if invalid year or invalid month&lt;br /&gt;
			((91 == year and 7 &amp;gt; month) or (7 == year and 3 &amp;lt; month)) then		-- if years ok, are starting and ending months ok?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%dv%d+$&amp;quot;) then	-- test for the 0704-1412 with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((7 &amp;gt; year) or (14 &amp;lt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) or			-- is year invalid or is month invalid? (doesn&#039;t test for future years)&lt;br /&gt;
			((7 == year) and (4 &amp;gt; month)) then									-- when year is 07, is month invalid (before April)?&lt;br /&gt;
				err_msg = true;													-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%d$&amp;quot;) or id:match(&amp;quot;^%d%d[01]%d%.%d%d%d%d%dv%d+$&amp;quot;) then	-- test for the 1501- format with or without version&lt;br /&gt;
		year, month = id:match(&amp;quot;^(%d%d)([01]%d)%.%d%d%d%d%d[v%d]*$&amp;quot;);&lt;br /&gt;
		year = tonumber (year);&lt;br /&gt;
		month = tonumber (month);&lt;br /&gt;
		if ((15 &amp;gt; year) or (1 &amp;gt; month or 12 &amp;lt; month)) then						-- is year invalid or is month invalid? (doesn&#039;t test for future years)&lt;br /&gt;
			err_msg = true;														-- flag for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		err_msg = true;															-- not a recognized format; flag for error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t[&#039;ARXIV&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local err_msg_t = {};&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		set_message (&#039;err_bad_arxiv&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
&lt;br /&gt;
	if is_set (class) then&lt;br /&gt;
		if id:match (&#039;^%d+&#039;) then&lt;br /&gt;
			text = table.concat ({text, &#039; [[https://arxiv.org/archive/&#039;, class, &#039; &#039;, class, &#039;]]&#039;});	-- external link within square brackets, not wikilink&lt;br /&gt;
		else&lt;br /&gt;
			set_message (&#039;err_class_ignored&#039;);&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- class not set&lt;br /&gt;
		if id:match (&#039;^%d+&#039;) and options.CitationClass == &#039;arxiv&#039; then			-- new (post 2007) format; {{cite arxiv}} only&lt;br /&gt;
			set_message (&#039;maint_missing_class&#039;);								-- add maint cat&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I B C O D E &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validates (sort of) and formats a bibcode ID.&lt;br /&gt;
&lt;br /&gt;
Format for bibcodes is specified here: https://adsabs.harvard.edu/abs_doc/help_pages/data.html#bibcodes&lt;br /&gt;
&lt;br /&gt;
But, this: 2015arXiv151206696F is apparently valid so apparently, the only things that really matter are length, 19 characters&lt;br /&gt;
and first four digits must be a year.  This function makes these tests:&lt;br /&gt;
	length must be 19 characters&lt;br /&gt;
	characters in position&lt;br /&gt;
		1–4 must be digits and must represent a year in the range of 1000 – next year&lt;br /&gt;
		5 must be a letter&lt;br /&gt;
		6–8 must be letter, digit, ampersand, or dot (ampersand cannot directly precede a dot; &amp;amp;. )&lt;br /&gt;
		9–18 must be letter, digit, or dot&lt;br /&gt;
		19 must be a letter or dot&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function bibcode (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local err_type;&lt;br /&gt;
	local err_msg = &#039;&#039;;&lt;br /&gt;
	local year;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
	&lt;br /&gt;
	if 19 ~= id:len() then&lt;br /&gt;
		err_type = cfg.err_msg_supl.length;&lt;br /&gt;
	else&lt;br /&gt;
		year = id:match (&amp;quot;^(%d%d%d%d)[%a][%w&amp;amp;%.][%w&amp;amp;%.][%w&amp;amp;%.][%w.]+[%a%.]$&amp;quot;);&lt;br /&gt;
		if not year then														-- if nil then no pattern match&lt;br /&gt;
			err_type = cfg.err_msg_supl.value;									-- so value error&lt;br /&gt;
		else&lt;br /&gt;
			local next_year = tonumber (os.date (&#039;%Y&#039;)) + 1;					-- get the current year as a number and add one for next year&lt;br /&gt;
			year = tonumber (year);												-- convert year portion of bibcode to a number&lt;br /&gt;
			if (1000 &amp;gt; year) or (year &amp;gt; next_year) then&lt;br /&gt;
				err_type = cfg.err_msg_supl.year;								-- year out of bounds&lt;br /&gt;
			end&lt;br /&gt;
			if id:find(&#039;&amp;amp;%.&#039;) then&lt;br /&gt;
				err_type = cfg.err_msg_supl.journal;							-- journal abbreviation must not have &#039;&amp;amp;.&#039; (if it does it&#039;s missing a letter)&lt;br /&gt;
			end&lt;br /&gt;
			if id:match (&#039;.........%.tmp%.&#039;) then								-- temporary bibcodes when positions 10–14 are &#039;.tmp.&#039;&lt;br /&gt;
				set_message (&#039;maint_bibcode&#039;);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_type) and not ignore_invalid then							-- if there was an error detected and accept-as-written markup not used&lt;br /&gt;
		set_message (&#039;err_bad_bibcode&#039;, {err_type});&lt;br /&gt;
		options.coins_list_t[&#039;BIBCODE&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B I O R X I V &amp;gt;-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format bioRxiv ID and do simple error checking.  Before 2019-12-11, biorXiv IDs were 10.1101/ followed by exactly&lt;br /&gt;
6 digits.  After 2019-12-11, biorXiv IDs retained the six-digit identifier but prefixed that with a yyyy.mm.dd. &lt;br /&gt;
date and suffixed with an optional version identifier.&lt;br /&gt;
&lt;br /&gt;
From December 2025 biorxiv added a new &#039;doi&#039; prefix: 10.64898:&lt;br /&gt;
	10.64898/2025.12.10.693067&lt;br /&gt;
&lt;br /&gt;
The bioRxiv ID is the string of characters:&lt;br /&gt;
	https://doi.org/10.1101/078733 -&amp;gt; 10.1101/078733&lt;br /&gt;
or a date followed by a six-digit number followed by an optional version indicator &#039;v&#039; and one or more digits:&lt;br /&gt;
	https://www.biorxiv.org/content/10.1101/2019.12.11.123456v2 -&amp;gt; 10.1101/2019.12.11.123456v2&lt;br /&gt;
	&lt;br /&gt;
see https://www.biorxiv.org/about-biorxiv&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function biorxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_msg = true;														-- flag; assume that there will be an error&lt;br /&gt;
	&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		&#039;^10%.1101/%d%d%d%d%d%d$&#039;,												-- simple 6-digit identifier (before 2019-12-11)&lt;br /&gt;
		&#039;^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$&#039;,				-- y.m.d. date + 6-digit identifier + version (after 2019-12-11)&lt;br /&gt;
		&#039;^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$&#039;,					-- y.m.d. date + 6-digit identifier (after 2019-12-11)&lt;br /&gt;
		&#039;^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%dv%d+$&#039;,				-- y.m.d. date + 6-digit identifier + version (from December 2025)&lt;br /&gt;
		&#039;^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d$&#039;,					-- y.m.d. date + 6-digit identifier (from December 2025)&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- spin through the patterns looking for a match&lt;br /&gt;
		if id:match (pattern) then&lt;br /&gt;
			local y, m, d = id:match (pattern);									-- found a match, attempt to get year, month and date from the identifier&lt;br /&gt;
&lt;br /&gt;
			if m then															-- m is nil when id is the six-digit form&lt;br /&gt;
				if not is_valid_rxiv_date (y, m, d, &#039;b&#039;) then					-- validate the encoded date; &#039;b&#039; for biorxiv limit&lt;br /&gt;
					break;														-- date fail; break out early so we don&#039;t unset the error message&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			err_msg = nil;														-- we found a match so unset the error message&lt;br /&gt;
			break;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- err_cat remains set here when no match&lt;br /&gt;
&lt;br /&gt;
	if err_msg then&lt;br /&gt;
		options.coins_list_t[&#039;BIORXIV&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		set_message (&#039;err_bad_biorxiv&#039;);										-- and set the error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator,&lt;br /&gt;
			encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E S E E R X &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
CiteSeerX use their own notion of &amp;quot;doi&amp;quot; (not to be confused with the identifiers resolved via doi.org).&lt;br /&gt;
&lt;br /&gt;
The description of the structure of this identifier can be found at Help_talk:Citation_Style_1/Archive_26#CiteSeerX_id_structure&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citeseerx (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local matched;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = handler.access});&lt;br /&gt;
	&lt;br /&gt;
	matched = id:match (&amp;quot;^10%.1%.1%.[1-9]%d?%d?%d?%.[1-9]%d?%d?%d?$&amp;quot;);&lt;br /&gt;
	if not matched then&lt;br /&gt;
		set_message (&#039;err_bad_citeseerx&#039; );&lt;br /&gt;
		options.coins_list_t[&#039;CITESEERX&#039;] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D O I &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a DOI and checks for DOI errors.&lt;br /&gt;
&lt;br /&gt;
DOI names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: directory indicator &#039;10.&#039; followed by a registrant code&lt;br /&gt;
	Suffix: character string of any length chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a DOI name for: prefix/suffix.  If the DOI name contains spaces or endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_doi error message.&lt;br /&gt;
&lt;br /&gt;
DOI names are case-insensitive and can incorporate any printable Unicode characters so the test for spaces, endash,&lt;br /&gt;
and terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in DOI names.&lt;br /&gt;
&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html				-- 2.2 Syntax of a DOI name&lt;br /&gt;
https://www.doi.org/doi_handbook/2_Numbering.html#2.2.2			-- 2.2.2 DOI prefix&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function doi (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local inactive = options.DoiBroken&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	local function is_extended_free (registrant, suffix)						-- local function to check those few registrants that are mixed; identifiable by the doi suffix &amp;lt;incipit&amp;gt;&lt;br /&gt;
		suffix = suffix:lower();												-- ascii [a-z] same as [A-Z] in doi names; see §3.4.4 Case Insensitivity of the Doi Name&lt;br /&gt;
		if cfg.extended_registrants_t[registrant] then							-- if this registrant has known free-to-read extentions&lt;br /&gt;
			for _, incipit in ipairs (cfg.extended_registrants_t[registrant]) do	-- loop through the registrant&#039;s incipits&lt;br /&gt;
				if mw.ustring.find (suffix, &#039;^&#039; .. incipit:lower()) then		-- ascii [a-z] same as [A-Z] in doi names&lt;br /&gt;
					return true;												-- if foundm done&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text;&lt;br /&gt;
	if is_set (inactive) then&lt;br /&gt;
		local inactive_year = inactive:match(&amp;quot;%d%d%d%d&amp;quot;);						-- try to get the year portion from the inactive date&lt;br /&gt;
		local inactive_month, good;&lt;br /&gt;
&lt;br /&gt;
		if is_set (inactive_year) then&lt;br /&gt;
			if 4 &amp;lt; inactive:len() then											-- inactive date has more than just a year (could be anything)&lt;br /&gt;
				local lang_obj = mw.getContentLanguage();						-- get a language object for this wiki&lt;br /&gt;
				good, inactive_month = pcall (lang_obj.formatDate, lang_obj, &#039;F&#039;, inactive);	-- try to get the month name from the inactive date&lt;br /&gt;
				if not good then&lt;br /&gt;
					inactive_month = nil;										-- something went wrong so make sure this is unset&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end																		-- otherwise, |doi-broken-date= has something but it isn&#039;t a date&lt;br /&gt;
		&lt;br /&gt;
		if is_set (inactive_year) and is_set (inactive_month) then&lt;br /&gt;
			set_message (&#039;maint_doi_inactive_dated&#039;, {inactive_year, inactive_month, &#039; &#039;});&lt;br /&gt;
		elseif is_set (inactive_year) then&lt;br /&gt;
			set_message (&#039;maint_doi_inactive_dated&#039;, {inactive_year, &#039;&#039;, &#039;&#039;});&lt;br /&gt;
		else&lt;br /&gt;
			set_message (&#039;maint_doi_inactive&#039;);&lt;br /&gt;
		end&lt;br /&gt;
		inactive = substitute (cfg.messages[&#039;inactive&#039;], inactive );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local suffix;&lt;br /&gt;
	local registrant, suffix = mw.ustring.match (id, &#039;^10%.([^/]+)/([^%s–]-[^%.,])$&#039;);	-- registrant and suffix set when DOI has the proper basic form; both nil else&lt;br /&gt;
&lt;br /&gt;
	local registrant_err_patterns = {											-- these patterns are for code ranges that are not supported &lt;br /&gt;
		&#039;^[^1-3]%d%d%d%d%.%d+$&#039;,												-- 5 digits with subcode (reject 0xxxx, 40000+); accepts: 10000–39999&lt;br /&gt;
		&#039;^[^1-8]%d%d%d%d$&#039;,														-- 5 digits without subcode (reject 0xxxx, 90000+); accepts: 10000–89999&lt;br /&gt;
		&#039;^[^1-9]%d%d%d%.%d+$&#039;,													-- 4 digits with subcode (reject 0xxx); accepts: 1000–9999&lt;br /&gt;
		&#039;^[^1-9]%d%d%d$&#039;,														-- 4 digits without subcode (reject 0xxx); accepts: 1000–9999&lt;br /&gt;
		&#039;^%d%d%d%d%d%d+&#039;,														-- 6 or more digits&lt;br /&gt;
		&#039;^%d%d?%d?$&#039;,															-- less than 4 digits without subcode (3 digits with subcode is legitimate)&lt;br /&gt;
		&#039;^%d%d?%.[%d%.]+&#039;,														-- 1 or 2 digits with subcode&lt;br /&gt;
		&#039;^5555$&#039;,																-- test registrant will never resolve&lt;br /&gt;
		&#039;[^%d%.]&#039;,																-- any character that isn&#039;t a digit or a dot&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	if not ignore_invalid then&lt;br /&gt;
		if registrant then														-- when DOI has proper form&lt;br /&gt;
			for i, pattern in ipairs (registrant_err_patterns) do				-- spin through error patterns&lt;br /&gt;
				if registrant:match (pattern) then								-- to validate registrant codes&lt;br /&gt;
					err_flag = set_message (&#039;err_bad_doi&#039;);						-- when found, mark this DOI as bad&lt;br /&gt;
					break;														-- and done&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_doi&#039;);								-- invalid directory or malformed&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		set_message (&#039;maint_doi_ignore&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t[&#039;DOI&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- here when doi has no errors or has been wrapped in accept-as-written markup&lt;br /&gt;
		suffix = mw.ustring.match (id, &#039;^10%.[^/]+/(.+)&#039;);						-- refetch suffix because doi may have been wrapped in accept-as-written markup&lt;br /&gt;
		if not access and (cfg.known_free_doi_registrants_t[registrant] or is_extended_free (registrant, suffix)) then		-- |doi-access=free not set and &amp;lt;registrant&amp;gt; is known to be free&lt;br /&gt;
			set_message (&#039;maint_doi_unflagged_free&#039;);							-- set a maint cat&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access,&lt;br /&gt;
		auto_link = not (err_flag or is_set (inactive) or ignore_invalid) and &#039;doi&#039; or nil -- do not auto-link when |doi-broken-date= has a value or when there is a DOI error or (to play it safe, after all, auto-linking is not essential) when invalid DOIs are ignored&lt;br /&gt;
		}) .. (inactive or &#039;&#039;);&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H D L &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an HDL with minor error checking.&lt;br /&gt;
&lt;br /&gt;
HDL names contain two parts: prefix and suffix separated by a forward slash.&lt;br /&gt;
	Prefix: character string using any character in the UCS-2 character set except &#039;/&#039;&lt;br /&gt;
	Suffix: character string of any length using any character in the UCS-2 character set chosen by the registrant&lt;br /&gt;
&lt;br /&gt;
This function checks a HDL name for: prefix/suffix.  If the HDL name contains spaces, endashes, or, if it ends&lt;br /&gt;
with a period or a comma, this function will emit a bad_hdl error message.&lt;br /&gt;
&lt;br /&gt;
HDL names are case-insensitive and can incorporate any printable Unicode characters so the test for endashes and&lt;br /&gt;
terminal punctuation may not be technically correct but it appears, that in practice these characters are rarely&lt;br /&gt;
if ever used in HDLs.&lt;br /&gt;
&lt;br /&gt;
Query string parameters are named here: https://www.handle.net/proxy_servlet.html.  query strings are not displayed&lt;br /&gt;
but since &#039;?&#039; is an allowed character in an HDL, &#039;?&#039; followed by one of the query parameters is the only way we&lt;br /&gt;
have to detect the query string so that it isn&#039;t URL-encoded with the rest of the identifier.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function hdl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local query_params = {														-- list of known query parameters from https://www.handle.net/proxy_servlet.html&lt;br /&gt;
		&#039;noredirect&#039;,&lt;br /&gt;
		&#039;ignore_aliases&#039;,&lt;br /&gt;
		&#039;auth&#039;,&lt;br /&gt;
		&#039;cert&#039;,&lt;br /&gt;
		&#039;index&#039;,&lt;br /&gt;
		&#039;type&#039;,&lt;br /&gt;
		&#039;urlappend&#039;,&lt;br /&gt;
		&#039;locatt&#039;,&lt;br /&gt;
		&#039;action&#039;,&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local hdl, suffix, param = id:match (&#039;(.-)(%?(%a+).+)$&#039;);					-- look for query string&lt;br /&gt;
	local found;&lt;br /&gt;
&lt;br /&gt;
	if hdl then																	-- when there are query strings, this is the handle identifier portion&lt;br /&gt;
		for _, q in ipairs (query_params) do									-- spin through the list of query parameters&lt;br /&gt;
			if param:match (&#039;^&#039; .. q) then										-- if the query string begins with one of the parameters&lt;br /&gt;
				found = true;													-- announce a find&lt;br /&gt;
				break;															-- and stop looking&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if found then&lt;br /&gt;
		id = hdl;																-- found so replace id with the handle portion; this will be URL-encoded, suffix will not&lt;br /&gt;
	else&lt;br /&gt;
		suffix = &#039;&#039;;															-- make sure suffix is empty string for concatenation else&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, suffix = suffix, separator = handler.separator, encode = handler.encode, access = access})&lt;br /&gt;
&lt;br /&gt;
	if nil == id:match(&amp;quot;^[^%s–]-/[^%s–]-[^%.,]$&amp;quot;) then							-- HDL must contain a forward slash, must not contain spaces, endashes, and must not end with period or comma&lt;br /&gt;
		set_message (&#039;err_bad_hdl&#039; );&lt;br /&gt;
		options.coins_list_t[&#039;HDL&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S B N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISBN string is valid&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function isbn (options_t)&lt;br /&gt;
	local isbn_str = options_t.id;&lt;br /&gt;
	local ignore_invalid = options_t.accept;&lt;br /&gt;
	local handler = options_t.handler;&lt;br /&gt;
	local year = options_t.Year;												-- when set, valid anchor_year; may have a disambiguator which must be removed&lt;br /&gt;
&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local ISBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = isbn_str, separator = handler.separator});&lt;br /&gt;
		if ignore_invalid then													-- if ignoring ISBN errors&lt;br /&gt;
			set_message (&#039;maint_isbn_ignore&#039;);									-- add a maint category even when there is no error&lt;br /&gt;
		else																	-- here when not ignoring&lt;br /&gt;
			if not check then													-- and there is an error&lt;br /&gt;
				options_t.coins_list_t[&#039;ISBN&#039;] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
				set_message (&#039;err_bad_isbn&#039;, err_type);							-- set an error message&lt;br /&gt;
				return ISBN;										 			-- return id text&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return ISBN;															-- return id text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if year and not ignore_invalid then											-- &lt;br /&gt;
		year = year:match (&#039;%d%d%d%d?&#039;);										-- strip disambiguator if present&lt;br /&gt;
		if year and (1965 &amp;gt; tonumber(year)) then								-- &amp;lt;year&amp;gt; will be nil here when |year=n.d. or |year=nd&lt;br /&gt;
			set_message (&#039;err_invalid_isbn_date&#039;);								-- set an error message&lt;br /&gt;
			return internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
					prefix = handler.prefix, id = isbn_str, separator = handler.separator});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if nil ~= isbn_str:match (&#039;[^%s-0-9X]&#039;) then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if isbn_str contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local id = isbn_str:gsub (&#039;[%s-]&#039;, &#039;&#039;);										-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	local len = id:len();&lt;br /&gt;
 &lt;br /&gt;
	if len ~= 10 and len ~= 13 then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if len == 10 then&lt;br /&gt;
		if id:match (&#039;^%d*X?$&#039;) == nil then										-- fail if isbn_str has &#039;X&#039; anywhere but last position&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.form);									&lt;br /&gt;
		end&lt;br /&gt;
		if not is_valid_isxn (id, 10) then										-- test isbn-10 for numerical validity&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.check);				-- fail if isbn-10 is not numerically valid&lt;br /&gt;
		end&lt;br /&gt;
		if id:find (&#039;^63[01]&#039;) then												-- 630xxxxxxx and 631xxxxxxx are (apparently) not valid isbn group ids but are used by amazon as numeric identifiers (asin)&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- fail if isbn-10 begins with 630/1&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (true, cfg.err_msg_supl.check);					-- pass if isbn-10 is numerically valid&lt;br /&gt;
	else&lt;br /&gt;
		if id:match (&#039;^%d+$&#039;) == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.char);				-- fail if ISBN-13 is not all digits&lt;br /&gt;
		end&lt;br /&gt;
		if id:match (&#039;^97[89]%d*$&#039;) == nil then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.prefix);				-- fail when ISBN-13 does not begin with 978 or 979&lt;br /&gt;
		end&lt;br /&gt;
		if id:match (&#039;^9790&#039;) then&lt;br /&gt;
			return return_result (false, cfg.err_msg_supl.group);				-- group identifier &#039;0&#039; is reserved to ISMN&lt;br /&gt;
		end&lt;br /&gt;
		return return_result (is_valid_isxn_13 (id), cfg.err_msg_supl.check);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A S I N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a link to Amazon.  Do simple error checking: ASIN must be mix of 10 numeric or uppercase alpha&lt;br /&gt;
characters.  If a mix, first character must be uppercase alpha; if all numeric, ASINs must be 10-digit&lt;br /&gt;
ISBN. If 10-digit ISBN, add a maintenance category so a bot or AWB script can replace |asin= with |isbn=.&lt;br /&gt;
Error message if not 10 characters, if not ISBN-10, if mixed and first character is a digit.&lt;br /&gt;
&lt;br /&gt;
|asin=630....... and |asin=631....... are (apparently) not a legitimate ISBN though it checksums as one; these&lt;br /&gt;
do not cause this function to emit the maint_asin message&lt;br /&gt;
&lt;br /&gt;
This function is positioned here because it calls isbn()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function asin (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local domain = options.ASINTLD;&lt;br /&gt;
	&lt;br /&gt;
	local err_flag;&lt;br /&gt;
&lt;br /&gt;
	if not id:match(&amp;quot;^[%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u][%d%u]$&amp;quot;) then&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_asin&#039;);								-- ASIN is not a mix of 10 uppercase alpha and numeric characters&lt;br /&gt;
	else&lt;br /&gt;
		if id:match(&amp;quot;^%d%d%d%d%d%d%d%d%d[%dX]$&amp;quot;) then							-- if 10-digit numeric (or 9 digits with terminal X)&lt;br /&gt;
			if is_valid_isxn (id, 10) then										-- see if ASIN value is or validates as ISBN-10&lt;br /&gt;
				if not id:find (&#039;^63[01]&#039;) then									-- 630xxxxxxx and 631xxxxxxx are (apparently) not a valid isbn prefixes but are used by amazon as a numeric identifier&lt;br /&gt;
					err_flag = set_message (&#039;err_bad_asin&#039;);					-- ASIN has ISBN-10 form but begins with something other than 630/1 so probably an isbn &lt;br /&gt;
				end&lt;br /&gt;
			elseif not is_set (err_flag) then&lt;br /&gt;
				err_flag = set_message (&#039;err_bad_asin&#039;);						-- ASIN is not ISBN-10&lt;br /&gt;
			end&lt;br /&gt;
		elseif not id:match(&amp;quot;^%u[%d%u]+$&amp;quot;) then&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_asin&#039;);							-- asin doesn&#039;t begin with uppercase alpha&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if (not is_set (domain)) or in_array (domain, {&#039;us&#039;}) then					-- default: United States&lt;br /&gt;
		domain = &amp;quot;com&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {&#039;jp&#039;, &#039;uk&#039;}) then									-- Japan, United Kingdom&lt;br /&gt;
		domain = &amp;quot;co.&amp;quot; .. domain;&lt;br /&gt;
	elseif in_array (domain, {&#039;z.cn&#039;}) then 									-- China&lt;br /&gt;
		domain = &amp;quot;cn&amp;quot;;&lt;br /&gt;
	elseif in_array (domain, {&#039;au&#039;, &#039;br&#039;, &#039;mx&#039;, &#039;sg&#039;, &#039;tr&#039;}) then				-- Australia, Brazil, Mexico, Singapore, Turkey&lt;br /&gt;
		domain = &amp;quot;com.&amp;quot; .. domain;&lt;br /&gt;
	elseif not in_array (domain, {&#039;ae&#039;, &#039;ca&#039;, &#039;cn&#039;, &#039;de&#039;, &#039;es&#039;, &#039;fr&#039;, &#039;in&#039;, &#039;it&#039;, &#039;nl&#039;, &#039;pl&#039;, &#039;sa&#039;, &#039;se&#039;, &#039;co.jp&#039;, &#039;co.uk&#039;, &#039;com&#039;, &#039;com.au&#039;, &#039;com.br&#039;, &#039;com.mx&#039;, &#039;com.sg&#039;, &#039;com.tr&#039;}) then -- Arabic Emirates, Canada, China, Germany, Spain, France, Indonesia, Italy, Netherlands, Poland, Saudi Arabia, Sweden (as of 2021-03 Austria (.at), Liechtenstein (.li) and Switzerland (.ch) still redirect to the German site (.de) with special settings, so don&#039;t maintain local ASINs for them)&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_asin_tld&#039;);							-- unsupported asin-tld value&lt;br /&gt;
	end&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t[&#039;ASIN&#039;] = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot; .. id;	-- asin for coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t[&#039;ASIN&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. domain .. &amp;quot;/dp/&amp;quot;,&lt;br /&gt;
		id = id, encode = handler.encode, separator = handler.separator})&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S M N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether an ISMN string is valid.  Similar to ISBN-13, ISMN is 13 digits beginning 979-0-... and uses the&lt;br /&gt;
same check digit calculations.  See https://www.ismn-international.org/download/Web_ISMN_Users_Manual_2008-6.pdf&lt;br /&gt;
section 2, pages 9–12.&lt;br /&gt;
&lt;br /&gt;
ismn value not made part of COinS metadata because we don&#039;t have a url or isn&#039;t a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ismn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_ismn = true;&lt;br /&gt;
	local id_copy;&lt;br /&gt;
&lt;br /&gt;
	id_copy = id;																-- save a copy because this testing is destructive&lt;br /&gt;
	id = id:gsub (&#039;[%s-]&#039;, &#039;&#039;);													-- remove hyphens and white space&lt;br /&gt;
&lt;br /&gt;
	if 13 ~= id:len() or id:match (&amp;quot;^9790%d*$&amp;quot; ) == nil then					-- ISMN must be 13 digits and begin with 9790&lt;br /&gt;
		valid_ismn = false;&lt;br /&gt;
	else&lt;br /&gt;
		valid_ismn=is_valid_isxn_13 (id);										-- validate ISMN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--	text = internal_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,		-- use this (or external version) when there is some place to link to&lt;br /&gt;
	--		prefix = handler.prefix, id = id_copy, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	text = table.concat (														-- because no place to link to yet&lt;br /&gt;
		{&lt;br /&gt;
		make_wikilink (label_link_make (handler), handler.label),&lt;br /&gt;
		handler.separator,&lt;br /&gt;
		id_copy&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	if false == valid_ismn then&lt;br /&gt;
		options.coins_list_t[&#039;ISMN&#039;] = nil;										-- when error, unset so not included in COinS; not really necessary here because ismn not made part of COinS&lt;br /&gt;
		set_message (&#039;err_bad_ismn&#039;);											-- create an error message if the ISMN is invalid&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S S N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an ISSN.  This code fixes the case where an editor has included an ISSN in the citation but&lt;br /&gt;
has separated the two groups of four digits with a space.  When that condition occurred, the resulting link looked&lt;br /&gt;
like this:&lt;br /&gt;
&lt;br /&gt;
	|issn=0819 4327 gives: [https://www.worldcat.org/issn/0819 4327 0819 4327]	-- can&#039;t have spaces in an external link&lt;br /&gt;
	&lt;br /&gt;
This code now prevents that by inserting a hyphen at the ISSN midpoint.  It also validates the ISSN for length&lt;br /&gt;
and makes sure that the checkdigit agrees with the calculated value.  Incorrect length (8 digits), characters&lt;br /&gt;
other than 0-9 and X, or checkdigit / calculated value mismatch will all cause a check ISSN error message.  The&lt;br /&gt;
ISSN is always displayed with a hyphen, even if the ISSN was given as a single group of 8 digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function issn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
&lt;br /&gt;
	local issn_copy = id;														-- save a copy of unadulterated ISSN; use this version for display if ISSN does not validate&lt;br /&gt;
	local text;&lt;br /&gt;
	local valid_issn = true;&lt;br /&gt;
&lt;br /&gt;
	id = id:gsub (&#039;[%s-]&#039;, &#039;&#039;);													-- remove hyphens and whitespace&lt;br /&gt;
&lt;br /&gt;
	if 8 ~= id:len() or nil == id:match (&amp;quot;^%d*X?$&amp;quot; ) then						-- validate the ISSN: 8 digits long, containing only 0-9 or X in the last position&lt;br /&gt;
		valid_issn = false;														-- wrong length or improper character&lt;br /&gt;
	else&lt;br /&gt;
		valid_issn = is_valid_isxn (id, 8);										-- validate ISSN&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if true == valid_issn then&lt;br /&gt;
		id = string.sub (id, 1, 4 ) .. &amp;quot;-&amp;quot; .. string.sub (id, 5 );				-- if valid, display correctly formatted version&lt;br /&gt;
	else&lt;br /&gt;
		id = issn_copy;															-- if not valid, show the invalid ISSN with error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
&lt;br /&gt;
	if ignore_invalid then&lt;br /&gt;
		set_message (&#039;maint_issn_ignore&#039;);&lt;br /&gt;
	else&lt;br /&gt;
		if false == valid_issn then&lt;br /&gt;
			options.coins_list_t[&#039;ISSN&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
			set_message (&#039;err_bad_issn&#039;, (options.hkey == &#039;EISSN&#039;) and &#039;e&#039; or &#039;&#039;);	-- create an error message if the ISSN is invalid&lt;br /&gt;
		end &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J F M &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nn.nnnn.nn&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jfm (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match (&#039;^[Jj][Ff][Mm](.*)$&#039;);									-- identifier with jfm prefix; extract identifier&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message (&#039;maint_jfm_format&#039;);&lt;br /&gt;
	else																		-- plain number without JFM prefix&lt;br /&gt;
		id_num = id;															-- if here id does not have prefix&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id_num and id_num:match(&#039;^%d%d%.%d%d%d%d%.%d%d$&#039;) then&lt;br /&gt;
		id = id_num;															-- jfm matches pattern&lt;br /&gt;
	else&lt;br /&gt;
		set_message (&#039;err_bad_jfm&#039; );											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;JFM&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; J S T O R &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a JSTOR with some error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function jstor (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:find (&#039;[Jj][Ss][Tt][Oo][Rr]&#039;) or id:find (&#039;^https?://&#039;) or id:find (&#039;%s&#039;) then&lt;br /&gt;
		set_message (&#039;err_bad_jstor&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;JSTOR&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L C C N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format LCCN link and do simple error checking.  LCCN is a character string 8-12 characters long. The length of&lt;br /&gt;
the LCCN dictates the character type of the first 1-3 characters; the rightmost eight are always digits.&lt;br /&gt;
https://oclc-research.github.io/infoURI-Frozen/info-uri.info/info:lccn/reg.html&lt;br /&gt;
&lt;br /&gt;
length = 8 then all digits&lt;br /&gt;
length = 9 then lccn[1] is lowercase alpha&lt;br /&gt;
length = 10 then lccn[1] and lccn[2] are both lowercase alpha or both digits&lt;br /&gt;
length = 11 then lccn[1] is lower case alpha, lccn[2] and lccn[3] are both lowercase alpha or both digits&lt;br /&gt;
length = 12 then lccn[1] and lccn[2] are both lowercase alpha&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function lccn (options)&lt;br /&gt;
	local lccn = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;																-- presume that LCCN is valid&lt;br /&gt;
	local id = lccn;															-- local copy of the LCCN&lt;br /&gt;
&lt;br /&gt;
	id = normalize_lccn (id);													-- get canonical form (no whitespace, hyphens, forward slashes)&lt;br /&gt;
	local len = id:len();														-- get the length of the LCCN&lt;br /&gt;
&lt;br /&gt;
	if 8 == len then&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits)&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_lccn&#039;);							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 9 == len then														-- LCCN should be adddddddd&lt;br /&gt;
		if nil == id:match(&amp;quot;%l%d%d%d%d%d%d%d%d&amp;quot;) then							-- does it match our pattern?&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_lccn&#039;);							-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 10 == len then														-- LCCN should be aadddddddd or dddddddddd&lt;br /&gt;
		if id:match(&amp;quot;[^%d]&amp;quot;) then												-- if LCCN has anything but digits (nil if only digits) ...&lt;br /&gt;
			if nil == id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d&amp;quot;) then					-- ... see if it matches our pattern&lt;br /&gt;
				err_flag = set_message (&#039;err_bad_lccn&#039;);						-- no match, set an error message&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif 11 == len then														-- LCCN should be aaadddddddd or adddddddddd&lt;br /&gt;
		if not (id:match(&amp;quot;^%l%l%l%d%d%d%d%d%d%d%d&amp;quot;) or id:match(&amp;quot;^%l%d%d%d%d%d%d%d%d%d%d&amp;quot;)) then	-- see if it matches one of our patterns&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_lccn&#039;);							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif 12 == len then														-- LCCN should be aadddddddddd&lt;br /&gt;
		if not id:match(&amp;quot;^%l%l%d%d%d%d%d%d%d%d%d%d&amp;quot;) then						-- see if it matches our pattern&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_lccn&#039;);							-- no match, set an error message&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_lccn&#039;);								-- wrong length, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) and nil ~= lccn:find (&#039;%s&#039;) then&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_lccn&#039;);								-- lccn contains a space, set an error message&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t[&#039;LCCN&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = lccn, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M E D R X I V &amp;gt;-----------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format medRxiv ID and do simple error checking.  Similar to later bioRxiv IDs, medRxiv IDs are prefixed with a&lt;br /&gt;
yyyy.mm.dd. date and suffixed with an optional version identifier.  Ealiest date accepted is 2020.01.01&lt;br /&gt;
&lt;br /&gt;
The medRxiv ID is a date followed by an eight-digit number followed by an optional version indicator &#039;v&#039; and one or more digits:&lt;br /&gt;
	https://www.medrxiv.org/content/10.1101/2020.11.16.20232009v2 -&amp;gt; 10.1101/2020.11.16.20232009v2&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function medrxiv (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_msg_flag = true;													-- flag; assume that there will be an error&lt;br /&gt;
&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		&#039;^%d%d%d%d%d%d%d%d$&#039;,													-- simple 8-digit identifier; these should be relatively rare&lt;br /&gt;
		&#039;^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$&#039;,			-- y.m.d. date + 8-digit identifier + version (2020-01-01 and later)&lt;br /&gt;
		&#039;^10%.1101/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$&#039;,				-- y.m.d. date + 8-digit identifier (2020-01-01 and later)&lt;br /&gt;
		&#039;^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%dv%d+$&#039;,			-- y.m.d. date + 8-digit identifier + version (2025-12-01 and later)&lt;br /&gt;
		&#039;^10%.64898/(20%d%d)%.(%d%d)%.(%d%d)%.%d%d%d%d%d%d%d%d$&#039;,				-- y.m.d. date + 8-digit identifier (2025-12-01 and later)&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- spin through the patterns looking for a match&lt;br /&gt;
		if id:match (pattern) then&lt;br /&gt;
			local y, m, d = id:match (pattern);									-- found a match, attempt to get year, month and date from the identifier&lt;br /&gt;
&lt;br /&gt;
			if m then															-- m is nil when id is the 8-digit form&lt;br /&gt;
				if not is_valid_rxiv_date (y, m, d, &#039;b&#039;) then					-- validate the encoded date; &#039;b&#039; for medrxiv limit&lt;br /&gt;
					break;														-- date fail; break out early so we don&#039;t unset the error message&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			err_msg_flag = nil;													-- we found a match so unset the error message&lt;br /&gt;
			break;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- &amp;lt;err_msg_flag&amp;gt; remains set here when no match&lt;br /&gt;
&lt;br /&gt;
	if err_msg_flag then&lt;br /&gt;
		options.coins_list_t[&#039;MEDRXIV&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		set_message (&#039;err_bad_medrxiv&#039;);										-- and set the error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator,&lt;br /&gt;
			encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M R &amp;gt;--------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A seven digit number; if not seven digits, zero-fill leading digits to make seven digits.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function mr (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local id_len;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match (&#039;^[Mm][Rr](%d+)$&#039;);										-- identifier with mr prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message (&#039;maint_mr_format&#039;);										-- add maint cat&lt;br /&gt;
	else																		-- plain number without mr prefix&lt;br /&gt;
		id_num = id:match (&#039;^%d+$&#039;);											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	id_len = id_num and id_num:len() or 0;&lt;br /&gt;
	if (7 &amp;gt;= id_len) and (0 ~= id_len) then&lt;br /&gt;
		id = string.rep (&#039;0&#039;, 7-id_len) .. id_num;								-- zero-fill leading digits&lt;br /&gt;
	else&lt;br /&gt;
		set_message (&#039;err_bad_mr&#039;);												-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;MR&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O C L C &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format an OCLC ID.  https://www.oclc.org/batchload/controlnumber.en.html {{dead link}}&lt;br /&gt;
archived at: https://web.archive.org/web/20161228233804/https://www.oclc.org/batchload/controlnumber.en.html&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function oclc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local number;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&#039;^ocm%d%d%d%d%d%d%d%d$&#039;) then									-- ocm prefix and 8 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match(&#039;ocm(%d+)&#039;);											-- get the number&lt;br /&gt;
	elseif id:match(&#039;^ocn%d%d%d%d%d%d%d%d%d$&#039;) then								-- ocn prefix and 9 digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match(&#039;ocn(%d+)&#039;);											-- get the number&lt;br /&gt;
	elseif id:match(&#039;^on%d%d%d%d%d%d%d%d%d%d+$&#039;) then							-- on prefix and 10 or more digits; 001 field (12 characters)&lt;br /&gt;
		number = id:match(&#039;^on(%d%d%d%d%d%d%d%d%d%d+)$&#039;);						-- get the number&lt;br /&gt;
	elseif id:match(&#039;^%(OCoLC%)[1-9]%d*$&#039;) then									-- (OCoLC) prefix and variable number digits; no leading zeros; 035 field&lt;br /&gt;
		number = id:match(&#039;%(OCoLC%)([1-9]%d*)&#039;);								-- get the number&lt;br /&gt;
		if 9 &amp;lt; number:len() then&lt;br /&gt;
			number = nil;														-- constrain to 1 to 9 digits; change this when OCLC issues 10-digit numbers&lt;br /&gt;
		end&lt;br /&gt;
	elseif id:match(&#039;^%d+$&#039;) then												-- no prefix&lt;br /&gt;
		number = id;															-- get the number&lt;br /&gt;
		if tonumber (id) &amp;gt; handler.id_limit then&lt;br /&gt;
			number = nil;														-- unset when id value exceeds the limit&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if number then																-- proper format&lt;br /&gt;
		id = number;															-- exclude prefix, if any, from external link&lt;br /&gt;
	else&lt;br /&gt;
		set_message (&#039;err_bad_oclc&#039;)											-- add an error message if the id is malformed&lt;br /&gt;
		options.coins_list_t[&#039;OCLC&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P E N L I B R A R Y &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Formats an OpenLibrary link, and checks for associated errors.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function openlibrary (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local ident, code = id:gsub(&#039;^OL&#039;, &#039;&#039;):match(&amp;quot;^(%d+([AMW]))$&amp;quot;);				-- strip optional OL prefix followed immediately by digits followed by &#039;A&#039;, &#039;M&#039;, or &#039;W&#039;;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local prefix = {															-- these are appended to the handler.prefix according to code&lt;br /&gt;
		[&#039;A&#039;]=&#039;authors/OL&#039;,&lt;br /&gt;
		[&#039;M&#039;]=&#039;books/OL&#039;,&lt;br /&gt;
		[&#039;W&#039;]=&#039;works/OL&#039;,&lt;br /&gt;
		[&#039;X&#039;]=&#039;OL&#039;																-- not a code; spoof when &#039;code&#039; in id is invalid&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
	if not ident then&lt;br /&gt;
		code = &#039;X&#039;;																-- no code or id completely invalid&lt;br /&gt;
		ident = id;																-- copy id to ident so that we display the flawed identifier&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_ol&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not is_set (err_flag) then&lt;br /&gt;
		options.coins_list_t[&#039;OL&#039;] = handler.prefix .. prefix[code] .. ident;	-- experiment for ol coins&lt;br /&gt;
	else&lt;br /&gt;
		options.coins_list_t[&#039;OL&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix .. prefix[code],&lt;br /&gt;
		id = ident, separator = handler.separator, encode = handler.encode,&lt;br /&gt;
		access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O S T I &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format OSTI and do simple error checking. OSTIs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the OSTI to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more OSTIs are issued.&lt;br /&gt;
&lt;br /&gt;
NB. 1018 is the lowest OSTI number found in the wild (so far) and resolving OK on the OSTI site&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function osti (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if OSTI has anything but digits&lt;br /&gt;
		set_message (&#039;err_bad_osti&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;OSTI&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- OSTI is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1018 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if OSTI is outside test limit boundaries&lt;br /&gt;
			set_message (&#039;err_bad_osti&#039;);										-- set an error message&lt;br /&gt;
			options.coins_list_t[&#039;OSTI&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format a PMC, do simple error checking, and check for embargoed articles.&lt;br /&gt;
&lt;br /&gt;
The embargo parameter takes a date for a value. If the embargo date is in the future the PMC identifier will not&lt;br /&gt;
be linked to the article.  If the embargo date is today or in the past, or if it is empty or omitted, then the&lt;br /&gt;
PMC identifier is linked to the article through the link at cfg.id_handlers[&#039;PMC&#039;].prefix.&lt;br /&gt;
&lt;br /&gt;
PMC embargo date testing is done in function is_embargoed () which is called earlier because when the citation&lt;br /&gt;
has |pmc=&amp;lt;value&amp;gt; but does not have a |url= then |title= is linked with the PMC link.  Function is_embargoed ()&lt;br /&gt;
returns the embargo date if the PMC article is still embargoed, otherwise it returns an empty string.&lt;br /&gt;
&lt;br /&gt;
PMCs are sequential numbers beginning at 1 and counting up.  This code checks the PMC to see that it contains only digits and is less&lt;br /&gt;
than test_limit; the value in local variable test_limit will need to be updated periodically as more PMCs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local embargo = options.Embargo;											-- TODO: lowercase?&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local err_flag;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
&lt;br /&gt;
	id_num = id:match (&#039;^[Pp][Mm][Cc](%d+)$&#039;);									-- identifier with PMC prefix&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then&lt;br /&gt;
		set_message (&#039;maint_pmc_format&#039;);&lt;br /&gt;
	else																		-- plain number without PMC prefix&lt;br /&gt;
		id_num = id:match (&#039;^%d+$&#039;);											-- if here id is all digits&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMC is outside test limit boundaries&lt;br /&gt;
			err_flag = set_message (&#039;err_bad_pmc&#039;);								-- set an error message&lt;br /&gt;
		else&lt;br /&gt;
			id = tostring (id_num);												-- make sure id is a string&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		err_flag = set_message (&#039;err_bad_pmc&#039;);									-- set an error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if is_set (embargo) and is_set (is_embargoed (embargo)) then				-- is PMC is still embargoed?&lt;br /&gt;
		text = table.concat (													-- still embargoed so no external link&lt;br /&gt;
			{&lt;br /&gt;
			make_wikilink (label_link_make (handler), handler.label),&lt;br /&gt;
			handler.separator,&lt;br /&gt;
			id,&lt;br /&gt;
			});&lt;br /&gt;
	else&lt;br /&gt;
		text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,	-- no embargo date or embargo has expired, ok to link to article&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access,&lt;br /&gt;
			auto_link = not err_flag and &#039;pmc&#039; or nil							-- do not auto-link when PMC has error&lt;br /&gt;
			});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if err_flag then&lt;br /&gt;
		options.coins_list_t[&#039;PMC&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P M I D &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format PMID and do simple error checking.  PMIDs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the PMID to see that it contains only digits and is less than test_limit; the value in local variable&lt;br /&gt;
test_limit will need to be updated periodically as more PMIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function pmid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if PMID has anything but digits&lt;br /&gt;
		set_message (&#039;err_bad_pmid&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;PMID&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- PMID is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if PMID is outside test limit boundaries&lt;br /&gt;
			set_message (&#039;err_bad_pmid&#039;);										-- set an error message&lt;br /&gt;
			options.coins_list_t[&#039;PMID&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R F C &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format RFC and do simple error checking. RFCs are sequential numbers beginning at 1 and counting up.  This&lt;br /&gt;
code checks the RFC to see that it contains only digits and is less than test_limit specified in the configuration;&lt;br /&gt;
the value in test_limit will need to be updated periodically as more RFCs are issued.&lt;br /&gt;
&lt;br /&gt;
An index of all RFCs is here: https://tools.ietf.org/rfc/&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function rfc (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&amp;quot;[^%d]&amp;quot;) then													-- if RFC has anything but digits&lt;br /&gt;
		set_message (&#039;err_bad_rfc&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;RFC&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	else																		-- RFC is only digits&lt;br /&gt;
		local id_num = tonumber (id);											-- convert id to a number for range testing&lt;br /&gt;
		if 1 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then							-- if RFC is outside test limit boundaries&lt;br /&gt;
			set_message (&#039;err_bad_rfc&#039;);										-- set an error message&lt;br /&gt;
			options.coins_list_t[&#039;RFC&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = handler.access});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S 2 C I D &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an S2CID, do simple error checking&lt;br /&gt;
&lt;br /&gt;
S2CIDs are sequential numbers beginning at 1 and counting up.  This code checks the S2CID to see that it is only&lt;br /&gt;
digits and is less than test_limit; the value in local variable test_limit will need to be updated periodically&lt;br /&gt;
as more S2CIDs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function s2cid (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local access = options.access;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match (&#039;^[1-9]%d*$&#039;);											-- id must be all digits; must not begin with 0; no open access flag&lt;br /&gt;
&lt;br /&gt;
 	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if handler.id_limit &amp;lt; id_num then										-- if S2CID is outside test limit boundaries&lt;br /&gt;
			set_message (&#039;err_bad_s2cid&#039;);										-- set an error message&lt;br /&gt;
			options.coins_list_t[&#039;S2CID&#039;] = nil;								-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message (&#039;err_bad_s2cid&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;S2CID&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S B N &amp;gt;------------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
9-digit form of ISBN-10; uses same check-digit validation when SBN is prefixed with an additional &#039;0&#039; to make 10 digits&lt;br /&gt;
&lt;br /&gt;
sbn value not made part of COinS metadata because we don&#039;t have a url or isn&#039;t a COinS-defined identifier (rft.xxx)&lt;br /&gt;
or an identifier registered at info-uri.info (info:)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function sbn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local ignore_invalid = options.accept;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local function return_result (check, err_type)								-- local function to handle the various returns&lt;br /&gt;
		local SBN = internal_link_id ({link = handler.link, label = handler.label, redirect = handler.redirect,&lt;br /&gt;
						prefix = handler.prefix, id = id, separator = handler.separator});&lt;br /&gt;
		if not ignore_invalid then												-- if not ignoring SBN errors&lt;br /&gt;
			if not check then&lt;br /&gt;
				options.coins_list_t[&#039;SBN&#039;] = nil;								-- when error, unset so not included in COinS; not really necessary here because sbn not made part of COinS&lt;br /&gt;
				set_message (&#039;err_bad_sbn&#039;, {err_type});						-- display an error message&lt;br /&gt;
				return SBN; &lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			set_message (&#039;maint_isbn_ignore&#039;);									-- add a maint category even when there is no error (ToDo: Possibly switch to separate message for SBNs only)&lt;br /&gt;
		end&lt;br /&gt;
		return SBN;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if id:match (&#039;[^%s-0-9X]&#039;) then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.char);					-- fail if SBN contains anything but digits, hyphens, or the uppercase X&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ident = id:gsub (&#039;[%s-]&#039;, &#039;&#039;);										-- remove hyphens and whitespace; they interfere with the rest of the tests&lt;br /&gt;
&lt;br /&gt;
	if  9 ~= ident:len() then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.length);					-- fail if incorrect length&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ident:match (&#039;^%d*X?$&#039;) == nil then&lt;br /&gt;
		return return_result (false, cfg.err_msg_supl.form);					-- fail if SBN has &#039;X&#039; anywhere but last position&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return return_result (is_valid_isxn (&#039;0&#039; .. ident, 10), cfg.err_msg_supl.check);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S S R N &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an SSRN, do simple error checking&lt;br /&gt;
&lt;br /&gt;
SSRNs are sequential numbers beginning at 100? and counting up.  This code checks the SSRN to see that it is&lt;br /&gt;
only digits and is greater than 99 and less than test_limit; the value in local variable test_limit will need&lt;br /&gt;
to be updated periodically as more SSRNs are issued.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function ssrn (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
	local id_num;&lt;br /&gt;
	local text;&lt;br /&gt;
	&lt;br /&gt;
	id_num = id:match (&#039;^%d+$&#039;);												-- id must be all digits&lt;br /&gt;
&lt;br /&gt;
	if is_set (id_num) then														-- id_num has a value so test it&lt;br /&gt;
		id_num = tonumber (id_num);												-- convert id_num to a number for range testing&lt;br /&gt;
		if 100 &amp;gt; id_num or handler.id_limit &amp;lt; id_num then						-- if SSRN is outside test limit boundaries&lt;br /&gt;
			set_message (&#039;err_bad_ssrn&#039;);										-- set an error message&lt;br /&gt;
			options.coins_list_t[&#039;SSRN&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- when id format incorrect&lt;br /&gt;
		set_message (&#039;err_bad_ssrn&#039;);											-- set an error message&lt;br /&gt;
		options.coins_list_t[&#039;SSRN&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode, access = options.access});&lt;br /&gt;
&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U S E N E T _ I D &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Validate and format a usenet message id.  Simple error checking, looks for &#039;id-left@id-right&#039; not enclosed in&lt;br /&gt;
&#039;&amp;lt;&#039; and/or &#039;&amp;gt;&#039; angle brackets.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function usenet_id (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	local text = external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
		prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode})&lt;br /&gt;
 &lt;br /&gt;
	if not id:match(&#039;^.+@.+$&#039;) or not id:match(&#039;^[^&amp;lt;].*[^&amp;gt;]$&#039;) then				-- doesn&#039;t have &#039;@&#039; or has one or first or last character is &#039;&amp;lt; or &#039;&amp;gt;&#039;&lt;br /&gt;
		set_message (&#039;err_bad_usenet_id&#039;)										-- add an error message if the message id is invalid&lt;br /&gt;
		options.coins_list_t[&#039;USENETID&#039;] = nil;									-- when error, unset so not included in COinS&lt;br /&gt;
	end &lt;br /&gt;
	&lt;br /&gt;
	return text;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Z B L &amp;gt;-----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
A numerical identifier in the form nnnn.nnnnn - leading zeros in the first quartet optional&lt;br /&gt;
&lt;br /&gt;
format described here: http://emis.mi.sanu.ac.rs/ZMATH/zmath/en/help/search/&lt;br /&gt;
&lt;br /&gt;
temporary format is apparently eight digits.  Anything else is an error&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function zbl (options)&lt;br /&gt;
	local id = options.id;&lt;br /&gt;
	local handler = options.handler;&lt;br /&gt;
&lt;br /&gt;
	if id:match(&#039;^%d%d%d%d%d%d%d%d$&#039;) then										-- is this identifier using temporary format?&lt;br /&gt;
		set_message (&#039;maint_zbl&#039;);												-- yes, add maint cat&lt;br /&gt;
	elseif not id:match(&#039;^%d?%d?%d?%d%.%d%d%d%d%d$&#039;) then						-- not temporary, is it normal format?&lt;br /&gt;
		set_message (&#039;err_bad_zbl&#039;);											-- no, set an error message&lt;br /&gt;
		options.coins_list_t[&#039;ZBL&#039;] = nil;										-- when error, unset so not included in COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return external_link_id ({link = handler.link, label = handler.label, q = handler.q, redirect = handler.redirect,&lt;br /&gt;
			prefix = handler.prefix, id = id, separator = handler.separator, encode = handler.encode});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--============================&amp;lt;&amp;lt; I N T E R F A C E   F U N C T I O N S &amp;gt;&amp;gt;==========================================&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D S &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Populates ID table from arguments using configuration settings. Loops through cfg.id_handlers and searches args for&lt;br /&gt;
any of the parameters listed in each cfg.id_handlers[&#039;...&#039;].parameters.  If found, adds the parameter and value to&lt;br /&gt;
the identifier list.  Emits redundant error message if more than one alias exists in args&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_ids (args)&lt;br /&gt;
	local id_list = {};															-- list of identifiers found in args&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do										-- k is uppercase identifier name as index to cfg.id_handlers; e.g. cfg.id_handlers[&#039;ISBN&#039;], v is a table&lt;br /&gt;
		v = select_one (args, v.parameters, &#039;err_redundant_parameters&#039; );		-- v.parameters is a table of aliases for k; here we pick one from args if present&lt;br /&gt;
		if is_set (v) then id_list[k] = v; end									-- if found in args, add identifier to our list&lt;br /&gt;
	end&lt;br /&gt;
	return id_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A C T _ I D _ A C C E S S _ L E V E L S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Fetches custom id access levels from arguments using configuration settings. Parameters which have a predefined access&lt;br /&gt;
level (e.g. arxiv) do not use this function as they are directly rendered as free without using an additional parameter.&lt;br /&gt;
&lt;br /&gt;
returns a table of k/v pairs where k is same as the identifier&#039;s key in cfg.id_handlers and v is the assigned (valid) keyword&lt;br /&gt;
&lt;br /&gt;
access-level values must match the case used in cfg.keywords_lists[&#039;id-access&#039;] (lowercase unless there is some special reason for something else)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_id_access_levels (args, id_list)&lt;br /&gt;
	local id_accesses_list = {};&lt;br /&gt;
	for k, v in pairs (cfg.id_handlers) do&lt;br /&gt;
		local access_param = v.custom_access;									-- name of identifier&#039;s access-level parameter&lt;br /&gt;
		if is_set (access_param) then&lt;br /&gt;
			local access_level = args[access_param];							-- get the assigned value if there is one&lt;br /&gt;
			if is_set (access_level) then&lt;br /&gt;
				if not in_array (access_level, cfg.keywords_lists[&#039;id-access&#039;]) then	-- exact match required&lt;br /&gt;
					set_message (&#039;err_invalid_param_val&#039;, {access_param, access_level});	&lt;br /&gt;
					access_level = nil;											-- invalid so unset&lt;br /&gt;
				end&lt;br /&gt;
				if not is_set (id_list[k]) then									-- identifier access-level must have a matching identifier&lt;br /&gt;
					set_message (&#039;err_param_access_requires_param&#039;, {k:lower()});	-- parameter name is uppercase in cfg.id_handlers (k); lowercase for error message&lt;br /&gt;
				end&lt;br /&gt;
				id_accesses_list[k] = cfg.keywords_xlate[access_level];			-- get translated keyword&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return id_accesses_list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B U I L D _ I D _ L I S T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
render the identifiers into a sorted sequence table&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;options_t&amp;gt; is a table of various k/v option pairs provided in the call to new_build_id_list();&lt;br /&gt;
	modified by	this function and passed to all identifier rendering functions&lt;br /&gt;
&amp;lt;access_levels_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value (if valid)&lt;br /&gt;
&lt;br /&gt;
returns a sequence table of sorted (by hkey - &#039;handler&#039; key) rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function build_id_list (ID_list_coins_t, options_t, access_levels_t)&lt;br /&gt;
	local ID_list_t = {};&lt;br /&gt;
	local accept;&lt;br /&gt;
	local func_map = {															--function map points to functions associated with hkey identifier&lt;br /&gt;
		[&#039;ARXIV&#039;] = arxiv,&lt;br /&gt;
		[&#039;ASIN&#039;] = asin,&lt;br /&gt;
		[&#039;BIBCODE&#039;] = bibcode,&lt;br /&gt;
		[&#039;BIORXIV&#039;] = biorxiv,&lt;br /&gt;
		[&#039;CITESEERX&#039;] = citeseerx,&lt;br /&gt;
		[&#039;DOI&#039;] = doi,&lt;br /&gt;
		[&#039;EISSN&#039;] = issn,&lt;br /&gt;
		[&#039;HDL&#039;] = hdl,&lt;br /&gt;
		[&#039;ISBN&#039;] = isbn,&lt;br /&gt;
		[&#039;ISMN&#039;] = ismn,&lt;br /&gt;
		[&#039;ISSN&#039;] = issn,&lt;br /&gt;
		[&#039;JFM&#039;] = jfm,&lt;br /&gt;
		[&#039;JSTOR&#039;] = jstor,&lt;br /&gt;
		[&#039;LCCN&#039;] = lccn,&lt;br /&gt;
		[&#039;MEDRXIV&#039;] = medrxiv,&lt;br /&gt;
		[&#039;MR&#039;] = mr,&lt;br /&gt;
		[&#039;OCLC&#039;] = oclc,&lt;br /&gt;
		[&#039;OL&#039;] = openlibrary,&lt;br /&gt;
		[&#039;OSTI&#039;] = osti,&lt;br /&gt;
		[&#039;PMC&#039;] = pmc,&lt;br /&gt;
		[&#039;PMID&#039;] = pmid,&lt;br /&gt;
		[&#039;RFC&#039;]  = rfc,&lt;br /&gt;
		[&#039;S2CID&#039;] = s2cid,&lt;br /&gt;
		[&#039;SBN&#039;] = sbn,&lt;br /&gt;
		[&#039;SSRN&#039;] = ssrn,&lt;br /&gt;
		[&#039;USENETID&#039;] = usenet_id,&lt;br /&gt;
		[&#039;ZBL&#039;] = zbl,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for hkey, v in pairs (ID_list_coins_t) do&lt;br /&gt;
		v, accept = has_accept_as_written (v);									-- remove accept-as-written markup if present; accept is boolean true when markup removed; false else&lt;br /&gt;
																				-- every function gets the options table with value v and accept boolean&lt;br /&gt;
		options_t.hkey = hkey;													-- ~/Configuration handler key&lt;br /&gt;
		options_t.id = v;														-- add that identifier value to the options table&lt;br /&gt;
		options_t.accept = accept;												-- add the accept boolean flag&lt;br /&gt;
		options_t.access = access_levels_t[hkey];								-- add the access level for those that have an |&amp;lt;identifier-access= parameter&lt;br /&gt;
		options_t.handler = cfg.id_handlers[hkey];&lt;br /&gt;
		options_t.coins_list_t = ID_list_coins_t;								-- pointer to ID_list_coins_t; for |asin= and |ol=; also to keep erroneous values out of the citation&#039;s metadata&lt;br /&gt;
		options_t.coins_list_t[hkey] = v;										-- id value without accept-as-written markup for metadata&lt;br /&gt;
		&lt;br /&gt;
		if options_t.handler.access and not in_array (options_t.handler.access, cfg.keywords_lists[&#039;id-access&#039;]) then&lt;br /&gt;
			error (cfg.messages[&#039;unknown_ID_access&#039;] .. options_t.handler.access);	-- here when handler access key set to a value not listed in list of allowed id access keywords&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if func_map[hkey] then&lt;br /&gt;
			local id_text = func_map[hkey] (options_t);							-- call the function to get identifier text and any error message&lt;br /&gt;
			table.insert (ID_list_t, {hkey, id_text});							-- add identifier text to the output sequence table&lt;br /&gt;
		else&lt;br /&gt;
			error (cfg.messages[&#039;unknown_ID_key&#039;] .. hkey);						-- here when func_map doesn&#039;t have a function for hkey&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local function comp (a, b)													-- used by following table.sort()&lt;br /&gt;
		return a[1]:lower() &amp;lt; b[1]:lower();										-- sort by hkey&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	table.sort (ID_list_t, comp);												-- sequence table of tables sort	&lt;br /&gt;
	for k, v in ipairs (ID_list_t) do											-- convert sequence table of tables to simple sequence table of strings&lt;br /&gt;
		ID_list_t[k] = v[2];													-- v[2] is the identifier rendering from the call to the various functions in func_map{}&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return ID_list_t;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; O P T I O N S _ C H E C K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check that certain option parameters have their associated identifier parameters with values&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ID_list_coins_t&amp;gt; is a table of k/v pairs where k is same as key in cfg.id_handlers and v is the assigned value&lt;br /&gt;
&amp;lt;ID_support_t&amp;gt; is a sequence table of tables created in citation0() where each subtable has four elements:&lt;br /&gt;
	[1] is the support parameter&#039;s assigned value; empty string if not set&lt;br /&gt;
	[2] is a text string same as key in cfg.id_handlers&lt;br /&gt;
	[3] is cfg.error_conditions key used to create error message&lt;br /&gt;
	[4] is original ID support parameter name used to create error message&lt;br /&gt;
	&lt;br /&gt;
returns nothing; on error emits an appropriate error message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function options_check (ID_list_coins_t, ID_support_t)&lt;br /&gt;
	for _, v in ipairs (ID_support_t) do&lt;br /&gt;
		if is_set (v[1]) and not ID_list_coins_t[v[2]] then						-- when support parameter has a value but matching identifier parameter is missing or empty&lt;br /&gt;
			set_message (v[3], (v[4]));											-- emit the appropriate error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I D E N T I F I E R _ L I S T S _ G E T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Creates two identifier lists: a k/v table of identifiers and their values to be used locally and for use in the&lt;br /&gt;
COinS metadata, and a sequence table of the rendered identifier strings that will be included in the rendered&lt;br /&gt;
citation.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function identifier_lists_get (args_t, options_t, ID_support_t)&lt;br /&gt;
	local ID_list_coins_t = extract_ids (args_t);										-- get a table of identifiers and their values for use locally and for use in COinS&lt;br /&gt;
	options_check (ID_list_coins_t, ID_support_t);										-- ID support parameters must have matching identifier parameters &lt;br /&gt;
	local ID_access_levels_t = extract_id_access_levels (args_t, ID_list_coins_t);		-- get a table of identifier access levels&lt;br /&gt;
	local ID_list_t = build_id_list (ID_list_coins_t, options_t, ID_access_levels_t);	-- get a sequence table of rendered identifier strings&lt;br /&gt;
&lt;br /&gt;
	return ID_list_t, ID_list_coins_t;											-- return the tables&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local cfg table and imported functions table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)&lt;br /&gt;
	cfg = cfg_table_ptr;&lt;br /&gt;
&lt;br /&gt;
	has_accept_as_written = utilities_page_ptr.has_accept_as_written;			-- import functions from select Module:Citation/CS1/Utilities module&lt;br /&gt;
	is_set = utilities_page_ptr.is_set;								&lt;br /&gt;
	in_array = utilities_page_ptr.in_array;&lt;br /&gt;
	set_message = utilities_page_ptr.set_message;&lt;br /&gt;
	select_one = utilities_page_ptr.select_one;&lt;br /&gt;
	substitute = utilities_page_ptr.substitute;&lt;br /&gt;
	make_wikilink = utilities_page_ptr.make_wikilink;&lt;br /&gt;
&lt;br /&gt;
	z = utilities_page_ptr.z;													-- table of tables in Module:Citation/CS1/Utilities&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	auto_link_urls = auto_link_urls,											-- table of identifier URLs to be used when auto-linking |title=&lt;br /&gt;
	&lt;br /&gt;
	identifier_lists_get = identifier_lists_get,								-- experiment to replace individual calls to build_id_list(), extract_ids, extract_id_access_levels&lt;br /&gt;
	is_embargoed = is_embargoed;&lt;br /&gt;
	set_selected_modules = set_selected_modules;&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Date_validation&amp;diff=608</id>
		<title>Module:Citation/CS1/Date validation</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Date_validation&amp;diff=608"/>
		<updated>2026-06-06T21:30:49Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;----------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------   local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style;		-- imported functions from selected Module:Citation/CS1/Utilities local cfg;																		-- table of tables imported from selected Module:Citation/CS1/Configuration   --[[--------------------------&amp;lt; F I L E - S C O P E   D E C L A R A T I O N S &amp;gt;--------------------------------...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local add_prop_cat, is_set, in_array, set_message, substitute, wrap_style;		-- imported functions from selected Module:Citation/CS1/Utilities&lt;br /&gt;
local cfg;																		-- table of tables imported from selected Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F I L E - S C O P E   D E C L A R A T I O N S &amp;gt;--------------------------------&lt;br /&gt;
&lt;br /&gt;
File-scope variables are declared here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local lang_object = mw.getContentLanguage();									-- used by is_valid_accessdate(), is_valid_year(), date_name_xlate(); TODO: move to ~/Configuration?&lt;br /&gt;
local year_limit;																-- used by is_valid_year()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ V A L I D _ A C C E S S D A T E &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if:&lt;br /&gt;
	Wikipedia start date &amp;lt;= accessdate &amp;lt; today + 2 days&lt;br /&gt;
&lt;br /&gt;
Wikipedia start date is 2001-01-15T00:00:00 UTC which is 979516800 seconds after 1970-01-01T00:00:00 UTC (the start of Unix time)&lt;br /&gt;
accessdate is the date provided in |access-date= at time 00:00:00 UTC&lt;br /&gt;
today is the current date at time 00:00:00 UTC plus 48 hours&lt;br /&gt;
	if today is 2015-01-01T00:00:00 then&lt;br /&gt;
		adding 24 hours gives 2015-01-02T00:00:00 – one second more than today&lt;br /&gt;
		adding 24 hours gives 2015-01-03T00:00:00 – one second more than tomorrow&lt;br /&gt;
&lt;br /&gt;
This function does not work if it is fed month names for languages other than English.  Wikimedia #time: parser&lt;br /&gt;
apparently doesn&#039;t understand non-English date month names. This function will always return false when the date&lt;br /&gt;
contains a non-English month name because good1 is false after the call to lang.formatDate().  To get around that&lt;br /&gt;
call this function with YYYY-MM-DD format dates.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_accessdate (accessdate)&lt;br /&gt;
	local good1, good2;&lt;br /&gt;
	local access_ts, tomorrow_ts;												-- to hold Unix time stamps representing the dates&lt;br /&gt;
&lt;br /&gt;
	good1, access_ts = pcall (lang_object.formatDate, lang_object, &#039;U&#039;, accessdate );			-- convert accessdate value to Unix timestamp &lt;br /&gt;
	good2, tomorrow_ts = pcall (lang_object.formatDate, lang_object, &#039;U&#039;, &#039;today + 2 days&#039; );	-- today midnight + 2 days is one second more than all day tomorrow&lt;br /&gt;
	&lt;br /&gt;
	if good1 and good2 then														-- lang.formatDate() returns a timestamp in the local script which which tonumber() may not understand&lt;br /&gt;
		access_ts = tonumber (access_ts) or lang_object:parseFormattedNumber (access_ts);		-- convert to numbers for the comparison;&lt;br /&gt;
		tomorrow_ts = tonumber (tomorrow_ts) or lang_object:parseFormattedNumber (tomorrow_ts);&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- one or both failed to convert to Unix time stamp&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 979516800 &amp;lt;= access_ts and access_ts &amp;lt; tomorrow_ts then					-- Wikipedia start date &amp;lt;= accessdate &amp;lt; tomorrow&#039;s date&lt;br /&gt;
		return true;&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- accessdate out of range&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ M O N T H _ N U M B E R &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns a number according to the month in a date: 1 for January, etc.  Capitalization and spelling must be correct.&lt;br /&gt;
If not a valid month, returns 0&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_month_number (month)&lt;br /&gt;
	return cfg.date_names[&#039;local&#039;].long[month] or cfg.date_names[&#039;local&#039;].short[month] or	-- look for local names first&lt;br /&gt;
			cfg.date_names[&#039;en&#039;].long[month] or	cfg.date_names[&#039;en&#039;].short[month] or		-- failing that, look for English names&lt;br /&gt;
			0;																				-- not a recognized month name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ S E A S O N _ N U M B E R &amp;gt;--------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns a number according to the sequence of seasons in a year: 21 for Spring, etc.  Capitalization and spelling&lt;br /&gt;
must be correct. If not a valid season, returns 0.&lt;br /&gt;
	21-24 = Spring, Summer, Autumn, Winter, independent of “Hemisphere”&lt;br /&gt;
&lt;br /&gt;
returns 0 when &amp;lt;param&amp;gt; is not |date=&lt;br /&gt;
&lt;br /&gt;
Season numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)&lt;br /&gt;
which became part of ISO 8601 in 2019.  See &#039;§Sub-year groupings&#039;.  The standard defines various divisions using&lt;br /&gt;
numbers 21-41.  cs1|2 only supports generic seasons.  EDTF does support the distinction between north and south&lt;br /&gt;
hemisphere seasons but cs1|2 has no way to make that distinction.&lt;br /&gt;
&lt;br /&gt;
These additional divisions not currently supported:&lt;br /&gt;
	25-28 = Spring - Northern Hemisphere, Summer- Northern Hemisphere, Autumn - Northern Hemisphere, Winter - Northern Hemisphere&lt;br /&gt;
	29-32 = Spring – Southern Hemisphere, Summer– Southern Hemisphere, Autumn – Southern Hemisphere, Winter - Southern Hemisphere&lt;br /&gt;
	33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)&lt;br /&gt;
	37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)&lt;br /&gt;
	40-41 = Semestral 1, Semestral-2 (6 months each)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_season_number (season, param)&lt;br /&gt;
	if &#039;date&#039; ~= param then&lt;br /&gt;
		return 0;																-- season dates only supported by |date=&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.date_names[&#039;local&#039;].season[season] or							-- look for local names first&lt;br /&gt;
			cfg.date_names[&#039;en&#039;].season[season] or								-- failing that, look for English names&lt;br /&gt;
			0;																	-- not a recognized season name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ Q U A R T E R _ N U M B E R &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns a number according to the sequence of quarters in a year: 33 for first quarter, etc.  Capitalization and spelling&lt;br /&gt;
must be correct. If not a valid quarter, returns 0.&lt;br /&gt;
	33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)&lt;br /&gt;
&lt;br /&gt;
returns 0 when &amp;lt;param&amp;gt; is not |date=&lt;br /&gt;
&lt;br /&gt;
Quarter numbering is defined by Extended Date/Time Format (EDTF) specification (https://www.loc.gov/standards/datetime/)&lt;br /&gt;
which became part of ISO 8601 in 2019.  See &#039;§Sub-year groupings&#039;.  The standard defines various divisions using&lt;br /&gt;
numbers 21-41.  cs1|2 only supports generic seasons and quarters.&lt;br /&gt;
&lt;br /&gt;
These additional divisions not currently supported:&lt;br /&gt;
	37-39 = Quadrimester 1, Quadrimester 2, Quadrimester 3 (4 months each)&lt;br /&gt;
	40-41 = Semestral 1, Semestral-2 (6 months each)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_quarter_number (quarter, param)&lt;br /&gt;
	if &#039;date&#039; ~= param then&lt;br /&gt;
		return 0;																-- quarter dates only supported by |date=&lt;br /&gt;
	end&lt;br /&gt;
	quarter = mw.ustring.gsub (quarter, &#039; +&#039;, &#039; &#039;);								-- special case replace multiple space chars with a single space char&lt;br /&gt;
	return cfg.date_names[&#039;local&#039;].quarter[quarter] or							-- look for local names first&lt;br /&gt;
			cfg.date_names[&#039;en&#039;].quarter[quarter] or							-- failing that, look for English names&lt;br /&gt;
			0;																	-- not a recognized quarter name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ P R O P E R _ N A M E _ N U M B E R &amp;gt;----------------------------------&lt;br /&gt;
&lt;br /&gt;
returns a non-zero number if date contains a recognized proper-name.  Capitalization and spelling must be correct.&lt;br /&gt;
&lt;br /&gt;
returns 0 when &amp;lt;param&amp;gt; is not |date=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_proper_name_number (name, param)&lt;br /&gt;
	if &#039;date&#039; ~= param then&lt;br /&gt;
		return 0;																-- proper-name dates only supported by |date=&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.date_names[&#039;local&#039;].named[name] or								-- look for local names dates first&lt;br /&gt;
			cfg.date_names[&#039;en&#039;].named[name] or									-- failing that, look for English names&lt;br /&gt;
			0;																	-- not a recognized named date&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; G E T _ E L E M E N T _ N U M B E R &amp;lt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if month or season or quarter or proper name is valid (properly spelled, capitalized, abbreviated)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_element_number (element, param)&lt;br /&gt;
	local num;&lt;br /&gt;
	&lt;br /&gt;
	local funcs = {get_month_number, get_season_number, get_quarter_number, get_proper_name_number};	-- list of functions to execute in order&lt;br /&gt;
	&lt;br /&gt;
	for _, func in ipairs (funcs) do											-- spin through the function list&lt;br /&gt;
		num = func (element, param);											-- call the function and get the returned number&lt;br /&gt;
		if 0 ~= num then														-- non-zero when valid month season quarter &lt;br /&gt;
			return num;															-- return that number&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return nil;																	-- not valid&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ Y E A R &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Function gets current year from the server and compares it to year from a citation parameter.  Years more than one&lt;br /&gt;
year in the future are not acceptable.&lt;br /&gt;
&lt;br /&gt;
Special case for |pmc-embargo-date=: years more than two years in the future are not acceptable&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_year (year, param)&lt;br /&gt;
	if not is_set (year_limit) then&lt;br /&gt;
		year_limit = tonumber(os.date(&amp;quot;%Y&amp;quot;))+1;									-- global variable so we only have to fetch it once&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	year = tonumber (year) or lang_object:parseFormattedNumber (year);			-- convert to number for the comparison&lt;br /&gt;
	if year and (100 &amp;gt; year) then												-- years less than 100 not supported&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;pmc-embargo-date&#039; == param then											-- special case for |pmc-embargo-date=&lt;br /&gt;
		return year and (year &amp;lt;= tonumber(os.date(&amp;quot;%Y&amp;quot;))+2) or false;			-- years more than two years in the future are not accepted&lt;br /&gt;
	end	&lt;br /&gt;
	return year and (year &amp;lt;= year_limit) or false;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ D A T E &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns true if day is less than or equal to the number of days in month and year is no farther into the future&lt;br /&gt;
than next year; else returns false.&lt;br /&gt;
&lt;br /&gt;
Assumes Julian calendar prior to year 1582 and Gregorian calendar thereafter. Accounts for Julian calendar leap&lt;br /&gt;
years before 1582 and Gregorian leap years after 1582. Where the two calendars overlap (1582 to approximately&lt;br /&gt;
1923) dates are assumed to be Gregorian.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_date (year, month, day, param)&lt;br /&gt;
local days_in_month = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};&lt;br /&gt;
local month_length;&lt;br /&gt;
	if not is_valid_year (year, param) then										-- no farther into the future than next year except |pmc-embargo-date= no more than two years in the future&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	month = tonumber (month);													-- required for YYYY-MM-DD dates&lt;br /&gt;
	&lt;br /&gt;
	if (2 == month) then														-- if February&lt;br /&gt;
		month_length = 28;														-- then 28 days unless&lt;br /&gt;
		if 1582 &amp;gt; tonumber(year) then											-- Julian calendar&lt;br /&gt;
			if 0 == (year%4) then												-- is a leap year?&lt;br /&gt;
				month_length = 29;												-- if leap year then 29 days in February&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- Gregorian calendar&lt;br /&gt;
			if (0 == (year%4) and (0 ~= (year%100) or 0 == (year%400))) then	-- is a leap year?&lt;br /&gt;
				month_length = 29;												-- if leap year then 29 days in February&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		month_length = days_in_month[month] or 0;								-- invalid month number is nil so default &amp;lt;month_length&amp;gt; to 0&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if tonumber (day) &amp;gt; month_length then&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ M O N T H _ R A N G E _ S T Y L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Months in a range are expected to have the same style: Jan–Mar or October–December but not February–Mar or Jul–August. &lt;br /&gt;
This function looks in cfg.date_names{} to see if both month names are listed in the long subtable or both are&lt;br /&gt;
listed in the short subtable.  When both have the same style (both are listed in the same table), returns true; false else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_month_range_style (month1, month2)&lt;br /&gt;
	if (cfg.date_names.en.long[month1] and cfg.date_names.en.long[month2]) or					-- are both English names listed in the long subtable?&lt;br /&gt;
		(cfg.date_names.en.short[month1] and cfg.date_names.en.short[month2]) or				-- are both English names listed in the short subtable?&lt;br /&gt;
		(cfg.date_names[&#039;local&#039;].long[month1] and cfg.date_names[&#039;local&#039;].long[month2]) or		-- are both local names listed in the long subtable?&lt;br /&gt;
		(cfg.date_names[&#039;local&#039;].short[month1] and cfg.date_names[&#039;local&#039;].short[month2]) then	-- are both local names listed in the short subtable?&lt;br /&gt;
			return true;&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- names are mixed&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ M O N T H _ S E A S O N _ R A N G E &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Check a pair of months or seasons to see if both are valid members of a month or season pair.&lt;br /&gt;
&lt;br /&gt;
Month pairs are expected to be left to right, earliest to latest in time.&lt;br /&gt;
&lt;br /&gt;
All season ranges are accepted as valid because there are publishers out there who have published a Summer–Spring YYYY issue, hence treat as ok&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_month_season_range(range_start, range_end, param)&lt;br /&gt;
	local range_start_number = get_month_number (range_start);&lt;br /&gt;
	local range_end_number;&lt;br /&gt;
&lt;br /&gt;
	if 0 == range_start_number then												-- is this a month range?&lt;br /&gt;
		range_start_number = get_season_number (range_start, param);			-- not a month; is it a season? get start season number&lt;br /&gt;
		range_end_number = get_season_number (range_end, param);				-- get end season number&lt;br /&gt;
&lt;br /&gt;
		if (0 ~= range_start_number) and (0 ~= range_end_number) and (range_start_number ~= range_end_number) then&lt;br /&gt;
			return true;														-- any season pairing is accepted except when both are the same&lt;br /&gt;
		end&lt;br /&gt;
		return false;															-- range_start and/or range_end is not a season&lt;br /&gt;
	end&lt;br /&gt;
																				-- here when range_start is a month&lt;br /&gt;
	range_end_number = get_month_number (range_end);							-- get end month number&lt;br /&gt;
	if range_start_number &amp;lt; range_end_number and								-- range_start is a month; does range_start precede range_end?&lt;br /&gt;
		is_valid_month_range_style (range_start, range_end) then				-- do months have the same style?&lt;br /&gt;
			return true;														-- proper order and same style&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- range_start month number is greater than or equal to range end number; or range end isn&#039;t a month&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ C O I N S _ D A T E &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function receives a table of date parts for one or two dates and an empty table reference declared in&lt;br /&gt;
Module:Citation/CS1.  The function is called only for |date= parameters and only if the |date=&amp;lt;value&amp;gt; is &lt;br /&gt;
determined to be a valid date format.  The question of what to do with invalid date formats is not answered here.&lt;br /&gt;
&lt;br /&gt;
The date parts in the input table are converted to an ISO 8601 conforming date string:&lt;br /&gt;
	single whole dates:		yyyy-mm-dd&lt;br /&gt;
	month and year dates:	yyyy-mm&lt;br /&gt;
	year dates:				yyyy&lt;br /&gt;
	ranges:					yyyy-mm-dd/yyyy-mm-dd&lt;br /&gt;
							yyyy-mm/yyyy-mm&lt;br /&gt;
							yyyy/yyyy&lt;br /&gt;
&lt;br /&gt;
Dates in the Julian calendar are reduced to year or year/year so that we don&#039;t have to do calendar conversion from&lt;br /&gt;
Julian to Proleptic Gregorian.&lt;br /&gt;
&lt;br /&gt;
The input table has:&lt;br /&gt;
	year, year2 – always present; if before 1582, ignore months and days if present&lt;br /&gt;
	month, month2 – 0 if not provided, 1-12 for months, 21-24 for seasons; 99 Christmas&lt;br /&gt;
	day, day2 –  0 if not provided, 1-31 for days&lt;br /&gt;
	&lt;br /&gt;
the output table receives:&lt;br /&gt;
	rftdate:	an ISO 8601 formatted date&lt;br /&gt;
	rftchron:	a free-form version of the date, usually without year which is in rftdate (season ranges and proper-name dates)&lt;br /&gt;
	rftssn:		one of four season keywords: winter, spring, summer, fall (lowercase)&lt;br /&gt;
	rftquarter:	one of four values: 1, 2, 3, 4&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_COinS_date (input, tCOinS_date)&lt;br /&gt;
	local date;																	-- one date or first date in a range&lt;br /&gt;
	local date2 = &#039;&#039;;															-- end of range date&lt;br /&gt;
	input.year = tonumber (input.year) or lang_object:parseFormattedNumber (input.year);	-- language-aware tonumber()&lt;br /&gt;
	input.year2 = tonumber (input.year2) or lang_object:parseFormattedNumber (input.year2);	-- COinS dates are pseudo-ISO 8601 so convert to Arabic numerals&lt;br /&gt;
&lt;br /&gt;
	if ((1582 == input.year) and (10 &amp;gt; tonumber(input.month))) or (1582 &amp;gt; input.year) then	-- if a Julian calendar date&lt;br /&gt;
		tCOinS_date.rftdate = tostring (input.year);							-- &amp;amp;rft.date gets year only&lt;br /&gt;
		return;																	-- done&lt;br /&gt;
	end&lt;br /&gt;
																				-- here for all forms of Gregorian dates&lt;br /&gt;
	if 20 &amp;lt; tonumber (input.month) then											-- if season, quarter, or proper-name date&lt;br /&gt;
		date = input.year;														-- &amp;amp;rft.date gets year only&lt;br /&gt;
		if 0 ~= input.year2 and input.year ~= input.year2 then					-- if a range, only the second year portion when not the same as range start year&lt;br /&gt;
			date = string.format (&#039;%.4d/%.4d&#039;, input.year, input.year2)			-- assemble the date range&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local season = {[24] = &#039;winter&#039;, [21] = &#039;spring&#039;, [22] = &#039;summer&#039;, [23] = &#039;fall&#039;, [33] = &#039;1&#039;, [34] = &#039;2&#039;, [35] = &#039;3&#039;, [36] = &#039;4&#039;, [98] = &#039;Easter&#039;, [99] = &#039;Christmas&#039;};	-- seasons lowercase, no autumn; proper-names use title case&lt;br /&gt;
		if 0 == input.month2 then												-- single season, quarter, or proper-name date&lt;br /&gt;
			if 40 &amp;lt; tonumber(input.month) then&lt;br /&gt;
				tCOinS_date.rftchron = season[input.month];						-- proper-name date; used in journal metadata only&lt;br /&gt;
			elseif 30 &amp;lt; tonumber(input.month) then&lt;br /&gt;
				tCOinS_date.rftquarter = season[input.month];					-- quarter date; used in journal metadata only&lt;br /&gt;
			else&lt;br /&gt;
				tCOinS_date.rftssn = season[input.month];						-- season date; used in journal metadata only&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- season ranges are lumped into &amp;amp;rft.chron; &amp;amp;rft.ssn and &amp;amp;rft.quarter are left blank&lt;br /&gt;
			if input.year ~= input.year2 then									-- season year – season year range or season year–year&lt;br /&gt;
				if 0 ~= input.month2 then&lt;br /&gt;
					tCOinS_date.rftchron = string.format (&#039;%s %s – %s %s&#039;, season[input.month], input.year, season[input.month2], input.year2);	-- used in journal metadata only&lt;br /&gt;
				end&lt;br /&gt;
			else																-- season–season year range&lt;br /&gt;
				tCOinS_date.rftchron = season[input.month] .. &#039;–&#039; .. season[input.month2];	-- season–season year range; used in journal metadata only&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		tCOinS_date.rftdate = tostring (date);&lt;br /&gt;
		return;																	-- done&lt;br /&gt;
	end&lt;br /&gt;
																				-- here for gregorian calendar dates&lt;br /&gt;
	if 0 ~= input.day then&lt;br /&gt;
		date = string.format (&#039;%s-%.2d-%.2d&#039;, input.year, tonumber(input.month), tonumber(input.day));	-- whole date&lt;br /&gt;
	elseif 0 ~= input.month then&lt;br /&gt;
		date = string.format (&#039;%s-%.2d&#039;, input.year, tonumber(input.month));	-- year and month&lt;br /&gt;
	else&lt;br /&gt;
		date = string.format (&#039;%s&#039;, input.year);								-- just year&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= input.year2 then&lt;br /&gt;
		if 0 ~= input.day2 then&lt;br /&gt;
			date2 = string.format (&#039;/%s-%.2d-%.2d&#039;, input.year2, tonumber(input.month2), tonumber(input.day2));		-- whole date&lt;br /&gt;
		elseif 0 ~= input.month2 then&lt;br /&gt;
			date2 = string.format (&#039;/%s-%.2d&#039;, input.year2, tonumber(input.month2));	-- year and month&lt;br /&gt;
		else&lt;br /&gt;
			date2 = string.format (&#039;/%s&#039;, input.year2);							-- just year&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	tCOinS_date.rftdate = date .. date2;										-- date2 has the &#039;/&#039; separator&lt;br /&gt;
	return;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P A T T E R N S _ T &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
this is the list of patterns for date formats that this module recognizes.  Approximately the first half of these&lt;br /&gt;
patterns represent formats that might be reformatted into another format.  Those that might be reformatted have&lt;br /&gt;
&#039;indicator&#039; letters that identify the content of the matching capture: &#039;d&#039; (day), &#039;m&#039; (month), &#039;a&#039; (anchor year),&lt;br /&gt;
&#039;y&#039; (year); second day, month, year have a &#039;2&#039; suffix.&lt;br /&gt;
&lt;br /&gt;
These patterns are used for both date validation and for reformatting.  This table should not be moved to ~/Configuration&lt;br /&gt;
because changes to this table require changes to check_date() and to reformatter() and reformat_date()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local patterns_t = {&lt;br /&gt;
	 																			-- year-initial numerical year-month-day&lt;br /&gt;
	[&#039;ymd&#039;] = {&#039;^([1-9]%d%d%d)%-(%d%d)%-(%d%d)$&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},					&lt;br /&gt;
																				-- month-initial: month day, year&lt;br /&gt;
	[&#039;Mdy&#039;] = {&#039;^(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;d&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- month-initial day range: month day–day, year; days are separated by endash&lt;br /&gt;
	[&#039;Md-dy&#039;] = {&#039;^(%D-) +([1-9]%d?)[%-–]([1-9]%d?), +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- day-initial: day month year&lt;br /&gt;
	[&#039;dMy&#039;] = {&#039;^([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;d&#039;, &#039;m&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed; not supported at en.wiki&lt;br /&gt;
	--	[&#039;yMd&#039;] = {&#039;^(([1-9]%d%d%d?)%a?) +(%D-) +(%d%d?)$&#039;, &#039;a&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},&lt;br /&gt;
																				-- day-range-initial: day–day month year; days are separated by endash&lt;br /&gt;
	[&#039;d-dMy&#039;] = {&#039;^([1-9]%d?)[%-–]([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;m&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- day initial month-day-range: day month - day month year; uses spaced endash&lt;br /&gt;
	[&#039;dM-dMy&#039;] = {&#039;^([1-9]%d?) +(%D-) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;d&#039;, &#039;m&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- month initial month-day-range: month day – month day, year;  uses spaced endash&lt;br /&gt;
	[&#039;Md-Mdy&#039;] = {&#039;^(%D-) +([1-9]%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%a?)$&#039;,&#039;m&#039;, &#039;d&#039;, &#039;m2&#039;, &#039;d2&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- day initial month-day-year-range: day month year - day month year; uses spaced endash&lt;br /&gt;
	[&#039;dMy-dMy&#039;] = {&#039;^([1-9]%d?) +(%D-) +([1-9]%d%d%d?) +[%-–] +([1-9]%d?) +(%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;a&#039;, &#039;y2&#039;},&lt;br /&gt;
																				-- month initial month-day-year-range: month day, year – month day, year;  uses spaced endash&lt;br /&gt;
	[&#039;Mdy-Mdy&#039;] = {&#039;^(%D-) +([1-9]%d?), +([1-9]%d%d%d?) +[%-–] +(%D-) +([1-9]%d?), +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;, &#039;m2&#039;, &#039;d2&#039;, &#039;a&#039;, &#039;y2&#039;},&lt;br /&gt;
&lt;br /&gt;
																				-- these date formats cannot be converted, per se, but month name can be rendered short or long&lt;br /&gt;
																				-- month/season year - month/season year; separated by spaced endash&lt;br /&gt;
	[&#039;My-My&#039;] = {&#039;^(%D-) +([1-9]%d%d%d?) +[%-–] +(%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;y&#039;, &#039;m2&#039;, &#039;a&#039;, &#039;y2&#039;},&lt;br /&gt;
																				-- month/season range year; months separated by endash&lt;br /&gt;
	[&#039;M-My&#039;] = {&#039;^(%D-)[%-–](%D-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;m2&#039;, &#039;a&#039;, &#039;y&#039;},&lt;br /&gt;
																				-- month/season year or proper-name year; quarter year when First Quarter YYYY etc.&lt;br /&gt;
	[&#039;My&#039;] = {&#039;^([^%d–]-) +(([1-9]%d%d%d?)%a?)$&#039;, &#039;m&#039;, &#039;a&#039;, &#039;y&#039;},					-- this way because endash is a member of %D; %D- will match January–March 2019 when it shouldn&#039;t&lt;br /&gt;
&lt;br /&gt;
																				-- these date formats cannot be converted&lt;br /&gt;
	[&#039;Sy4-y2&#039;] = {&#039;^(%D-) +(([1-9]%d)%d%d)[%-–]((%d%d)%a?)$&#039;},						-- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash&lt;br /&gt;
	[&#039;Sy-y&#039;] = {&#039;^(%D-) +([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%a?)$&#039;},					-- special case Winter/Summer year-year; year separated with unspaced endash&lt;br /&gt;
	[&#039;y-y&#039;] = {&#039;^([1-9]%d%d%d?)[%-–](([1-9]%d%d%d?)%a?)$&#039;},							-- year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999&lt;br /&gt;
	[&#039;y4-y2&#039;] = {&#039;^(([1-9]%d)%d%d)[%-–]((%d%d)%a?)$&#039;},								-- year range: YYYY–YY; separated by unspaced endash&lt;br /&gt;
	[&#039;y&#039;] = {&#039;^(([1-9]%d%d%d?)%a?)$&#039;},												-- year; here accept either YYY or YYYY&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ E M B A R G O _ D A T E &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true and date value if that value has proper dmy, mdy, ymd format.&lt;br /&gt;
&lt;br /&gt;
returns false and 9999 (embargoed forever) when date value is not proper format; assumes that when |pmc-embargo-date= is&lt;br /&gt;
set, the editor intended to embargo a PMC but |pmc-embargo-date= does not hold a single date.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_embargo_date (v)&lt;br /&gt;
	if v:match (patterns_t[&#039;ymd&#039;][1]) or										-- ymd&lt;br /&gt;
		v:match (patterns_t[&#039;Mdy&#039;][1]) or										-- dmy&lt;br /&gt;
		v:match (patterns_t[&#039;dMy&#039;][1]) then										-- mdy&lt;br /&gt;
			return true, v;&lt;br /&gt;
	end&lt;br /&gt;
	return false, &#039;9999&#039;;														-- if here not good date so return false and set embargo date to long time in future&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ D A T E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Check date format to see that it is one of the formats approved by WP:DATESNO or WP:DATERANGE. Exception: only&lt;br /&gt;
allowed range separator is endash.  Additionally, check the date to see that it is a real date: no 31 in 30-day&lt;br /&gt;
months; no 29 February when not a leap year.  Months, both long-form and three character abbreviations, and seasons&lt;br /&gt;
must be spelled correctly.  Future years beyond next year are not allowed.&lt;br /&gt;
&lt;br /&gt;
If the date fails the format tests, this function returns false and does not return values for anchor_year and&lt;br /&gt;
COinS_date.  When this happens, the date parameter is (DEBUG: not?) used in the COinS metadata and the CITEREF identifier gets&lt;br /&gt;
its year from the year parameter if present otherwise CITEREF does not get a date value.&lt;br /&gt;
&lt;br /&gt;
Inputs:&lt;br /&gt;
	date_string - date string from date-holding parameters (date, year, publication-date, access-date, pmc-embargo-date, archive-date, lay-date)&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
	false if date string is not a real date; else&lt;br /&gt;
	true, anchor_year, COinS_date&lt;br /&gt;
		anchor_year can be used in CITEREF anchors&lt;br /&gt;
		COinS_date is ISO 8601 format date; see make_COInS_date()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_date (date_string, param, tCOinS_date)&lt;br /&gt;
	local year;																	-- assume that year2, months, and days are not used;&lt;br /&gt;
	local year2 = 0;															-- second year in a year range&lt;br /&gt;
	local month = 0;&lt;br /&gt;
	local month2 = 0;															-- second month in a month range&lt;br /&gt;
	local day = 0;&lt;br /&gt;
	local day2 = 0;																-- second day in a day range&lt;br /&gt;
	local anchor_year;&lt;br /&gt;
	local coins_date;&lt;br /&gt;
&lt;br /&gt;
	if date_string:match (patterns_t[&#039;ymd&#039;][1]) then							-- year-initial numerical year month day format&lt;br /&gt;
		year, month, day = date_string:match (patterns_t[&#039;ymd&#039;][1]);&lt;br /&gt;
		if 12 &amp;lt; tonumber(month) or 1 &amp;gt; tonumber(month) or 1582 &amp;gt; tonumber(year) or 0 == tonumber(day) then return false; end	-- month or day number not valid or not Gregorian calendar&lt;br /&gt;
		anchor_year = year;&lt;br /&gt;
	&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Mdy&#039;][1]) then				-- month-initial: month day, year&lt;br /&gt;
		month, day, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;Mdy&#039;][1]);&lt;br /&gt;
		month = get_month_number (month);&lt;br /&gt;
		if 0 == month then return false; end									-- return false if month text isn&#039;t one of the twelve months&lt;br /&gt;
				&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Md-dy&#039;][1]) then			-- month-initial day range: month day–day, year; days are separated by endash&lt;br /&gt;
		month, day, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;Md-dy&#039;][1]);&lt;br /&gt;
		if tonumber(day) &amp;gt;= tonumber(day2) then return false; end				-- date range order is left to right: earlier to later; dates may not be the same;&lt;br /&gt;
		month = get_month_number (month);&lt;br /&gt;
		if 0 == month then return false; end									-- return false if month text isn&#039;t one of the twelve months&lt;br /&gt;
		month2=month;															-- for metadata&lt;br /&gt;
		year2 = year;&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;dMy&#039;][1]) then				-- day-initial: day month year&lt;br /&gt;
		day, month, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;dMy&#039;][1]);&lt;br /&gt;
		month = get_month_number (month);&lt;br /&gt;
		if 0 == month then return false; end									-- return false if month text isn&#039;t one of the twelve months&lt;br /&gt;
&lt;br /&gt;
--[[ NOT supported at en.wiki&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;yMd&#039;][1]) then				-- year-initial: year month day; day: 1 or 2 two digits, leading zero allowed&lt;br /&gt;
		anchor_year, year, month, day = mw.ustring.match(date_string, patterns_t[&#039;yMd&#039;][1]);&lt;br /&gt;
		month = get_month_number (month);&lt;br /&gt;
		if 0 == month then return false; end									-- return false if month text isn&#039;t one of the twelve months&lt;br /&gt;
-- end NOT supported at en.wiki ]]&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;d-dMy&#039;][1]) then			-- day-range-initial: day–day month year; days are separated by endash&lt;br /&gt;
		day, day2, month, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;d-dMy&#039;][1]);&lt;br /&gt;
		if tonumber(day) &amp;gt;= tonumber(day2) then return false; end				-- date range order is left to right: earlier to later; dates may not be the same;&lt;br /&gt;
		month = get_month_number (month);&lt;br /&gt;
		if 0 == month then return false; end									-- return false if month text isn&#039;t one of the twelve months&lt;br /&gt;
		month2 = month;															-- for metadata&lt;br /&gt;
		year2 = year;&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;dM-dMy&#039;][1]) then			-- day initial month-day-range: day month - day month year; uses spaced endash&lt;br /&gt;
		day, month, day2, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;dM-dMy&#039;][1]);&lt;br /&gt;
		if (not is_valid_month_season_range(month, month2)) or not is_valid_year(year) then return false; end	-- date range order is left to right: earlier to later;&lt;br /&gt;
		month = get_month_number (month);										-- for metadata&lt;br /&gt;
		month2 = get_month_number (month2);&lt;br /&gt;
		year2 = year;&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Md-Mdy&#039;][1]) then			-- month initial month-day-range: month day – month day, year; uses spaced endash&lt;br /&gt;
		month, day, month2, day2, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;Md-Mdy&#039;][1]);&lt;br /&gt;
		if (not is_valid_month_season_range(month, month2, param)) or not is_valid_year(year) then return false; end&lt;br /&gt;
		month = get_month_number (month);										-- for metadata&lt;br /&gt;
		month2 = get_month_number (month2);&lt;br /&gt;
		year2 = year;&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;dMy-dMy&#039;][1]) then			-- day initial month-day-year-range: day month year - day month year; uses spaced endash&lt;br /&gt;
		day, month, year, day2, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;dMy-dMy&#039;][1]);&lt;br /&gt;
		if tonumber(year2) &amp;lt;= tonumber(year) then return false; end				-- must be sequential years, left to right, earlier to later&lt;br /&gt;
		if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end		-- year2 no more than one year in the future; months same style&lt;br /&gt;
		month = get_month_number (month);										-- for metadata&lt;br /&gt;
		month2 = get_month_number (month2);&lt;br /&gt;
		if 0 == month or 0 == month2 then return false; end						-- both must be valid&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Mdy-Mdy&#039;][1]) then			-- month initial month-day-year-range: month day, year – month day, year; uses spaced endash&lt;br /&gt;
		month, day, year, month2, day2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;Mdy-Mdy&#039;][1]);&lt;br /&gt;
		if tonumber(year2) &amp;lt;= tonumber(year) then return false; end				-- must be sequential years, left to right, earlier to later&lt;br /&gt;
		if not is_valid_year(year2) or not is_valid_month_range_style(month, month2) then return false; end		-- year2 no more than one year in the future; months same style&lt;br /&gt;
		month = get_month_number (month);										-- for metadata&lt;br /&gt;
		month2 = get_month_number(month2);&lt;br /&gt;
		if 0 == month or 0 == month2 then return false; end						-- both must be valid&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Sy4-y2&#039;][1]) then			-- special case Winter/Summer year-year (YYYY-YY); year separated with unspaced endash&lt;br /&gt;
		local century;&lt;br /&gt;
		month, year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;Sy4-y2&#039;][1]);&lt;br /&gt;
		if &#039;Winter&#039; ~= month and &#039;Summer&#039; ~= month then return false end;		-- &#039;month&#039; can only be Winter or Summer&lt;br /&gt;
		anchor_year = year .. &#039;–&#039; .. anchor_year;								-- assemble anchor_year from both years&lt;br /&gt;
		year2 = century..year2;													-- add the century to year2 for comparisons&lt;br /&gt;
		if 1 ~= tonumber(year2) - tonumber(year) then return false; end			-- must be sequential years, left to right, earlier to later&lt;br /&gt;
		if not is_valid_year(year2) then return false; end						-- no year farther in the future than next year&lt;br /&gt;
		month = get_season_number(month, param);&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;Sy-y&#039;][1]) then			-- special case Winter/Summer year-year; year separated with unspaced endash&lt;br /&gt;
		month, year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;Sy-y&#039;][1]);&lt;br /&gt;
		month = get_season_number (month, param);								-- &amp;lt;month&amp;gt; can only be winter or summer; also for metadata&lt;br /&gt;
		if (month ~= cfg.date_names[&#039;en&#039;].season[&#039;Winter&#039;]) and (month ~= cfg.date_names[&#039;en&#039;].season[&#039;Summer&#039;]) then&lt;br /&gt;
			return false;														-- not Summer or Winter; abandon&lt;br /&gt;
		end&lt;br /&gt;
		anchor_year = year .. &#039;–&#039; .. anchor_year;								-- assemble anchor_year from both years&lt;br /&gt;
		if 1 ~= tonumber(year2) - tonumber(year) then return false; end			-- must be sequential years, left to right, earlier to later&lt;br /&gt;
		if not is_valid_year(year2) then return false; end						-- no year farther in the future than next year&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;My-My&#039;][1]) then			-- month/season year - month/season year; separated by spaced endash&lt;br /&gt;
		month, year, month2, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;My-My&#039;][1]);&lt;br /&gt;
		anchor_year = year .. &#039;–&#039; .. anchor_year;								-- assemble anchor_year from both years&lt;br /&gt;
		if tonumber(year) &amp;gt;= tonumber(year2) then return false; end				-- left to right, earlier to later, not the same&lt;br /&gt;
		if not is_valid_year(year2) then return false; end						-- no year farther in the future than next year&lt;br /&gt;
		if 0 ~= get_month_number(month) and 0 ~= get_month_number(month2) and is_valid_month_range_style(month, month2) then 	-- both must be month year, same month style&lt;br /&gt;
			month = get_month_number(month);&lt;br /&gt;
			month2 = get_month_number(month2);&lt;br /&gt;
		elseif 0 ~= get_season_number(month, param) and 0 ~= get_season_number(month2, param) then	-- both must be season year, not mixed&lt;br /&gt;
			month = get_season_number(month, param);&lt;br /&gt;
			month2 = get_season_number(month2, param);&lt;br /&gt;
		else&lt;br /&gt;
			 return false;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;M-My&#039;][1]) then			-- month/season range year; months separated by endash &lt;br /&gt;
		month, month2, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;M-My&#039;][1]);&lt;br /&gt;
		if (not is_valid_month_season_range(month, month2, param)) or (not is_valid_year(year)) then return false; end&lt;br /&gt;
		if 0 ~= get_month_number(month) then									-- determined to be a valid range so just check this one to know if month or season&lt;br /&gt;
			month = get_month_number(month);&lt;br /&gt;
			month2 = get_month_number(month2);&lt;br /&gt;
			if 0 == month or 0 == month2 then return false; end&lt;br /&gt;
		else&lt;br /&gt;
			month = get_season_number(month, param);&lt;br /&gt;
			month2 = get_season_number(month2, param);&lt;br /&gt;
		end&lt;br /&gt;
		year2 = year;&lt;br /&gt;
		&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;My&#039;][1]) then				-- month/season/quarter/proper-name year&lt;br /&gt;
		month, anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;My&#039;][1]);&lt;br /&gt;
		if not is_valid_year(year) then return false; end&lt;br /&gt;
		month = get_element_number(month, param);								-- get month season quarter proper-name number or nil&lt;br /&gt;
		if not month then return false; end										-- not valid whatever it is&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;y-y&#039;][1]) then				-- Year range: YYY-YYY or YYY-YYYY or YYYY–YYYY; separated by unspaced endash; 100-9999&lt;br /&gt;
		year, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;y-y&#039;][1]);&lt;br /&gt;
		anchor_year = year .. &#039;–&#039; .. anchor_year;								-- assemble anchor year from both years&lt;br /&gt;
		if tonumber(year) &amp;gt;= tonumber(year2) then return false; end				-- left to right, earlier to later, not the same&lt;br /&gt;
		if not is_valid_year(year2) then return false; end						-- no year farther in the future than next year&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;y4-y2&#039;][1]) then			-- Year range: YYYY–YY; separated by unspaced endash&lt;br /&gt;
		local century;&lt;br /&gt;
		year, century, anchor_year, year2 = mw.ustring.match(date_string, patterns_t[&#039;y4-y2&#039;][1]);&lt;br /&gt;
		anchor_year = year .. &#039;–&#039; .. anchor_year;								-- assemble anchor year from both years&lt;br /&gt;
&lt;br /&gt;
		if 13 &amp;gt; tonumber(year2) then return false; end							-- don&#039;t allow 2003-05 which might be May 2003&lt;br /&gt;
		year2 = century .. year2;												-- add the century to year2 for comparisons&lt;br /&gt;
		if tonumber(year) &amp;gt;= tonumber(year2) then return false; end				-- left to right, earlier to later, not the same&lt;br /&gt;
		if not is_valid_year(year2) then return false; end						-- no year farther in the future than next year&lt;br /&gt;
&lt;br /&gt;
		if in_array (param, {&#039;date&#039;, &#039;publication-date&#039;, &#039;year&#039;}) then			-- here when &#039;valid&#039; abbreviated year range; if one of these parameters&lt;br /&gt;
			add_prop_cat (&#039;year-range-abbreviated&#039;);							-- add properties cat&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, patterns_t[&#039;y&#039;][1]) then				-- year; here accept either YYY or YYYY&lt;br /&gt;
		anchor_year, year = mw.ustring.match(date_string, patterns_t[&#039;y&#039;][1]);&lt;br /&gt;
		if false == is_valid_year(year) then&lt;br /&gt;
			return false;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- date format not one of the MOS:DATE approved formats&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if param ~= &#039;date&#039; then														-- CITEREF disambiguation only allowed in |date=; |year= &amp;amp; |publication-date= promote to date&lt;br /&gt;
		if anchor_year:match (&#039;%l$&#039;) then&lt;br /&gt;
			return false;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;access-date&#039; == param then												-- test access-date here because we have numerical date parts&lt;br /&gt;
		if 0 ~= year and 0 ~= month and 0 ~= day and 							-- all parts of a single date required&lt;br /&gt;
			0 == year2 and 0 == month2 and 0 == day2 then						-- none of these; access-date must not be a range&lt;br /&gt;
				if not is_valid_accessdate(year .. &#039;-&#039; .. month .. &#039;-&#039; .. day) then	&lt;br /&gt;
					return false;												-- return false when access-date out of bounds&lt;br /&gt;
				end&lt;br /&gt;
		else&lt;br /&gt;
			return false;														-- return false when access-date is a range of two dates&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;archive-date&#039; == param then												-- test archive-date here because we have numerical date parts&lt;br /&gt;
		if not (0 ~= year and 0 ~= month and 0 ~= day and						-- all parts of a single date required&lt;br /&gt;
			0 == year2 and 0 == month2 and 0 == day2) then						-- none of these; archive-date must not be a range&lt;br /&gt;
				return false;													-- return false when archive-date is a range of two dates&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result=true;															-- check whole dates for validity; assume true because not all dates will go through this test&lt;br /&gt;
	if 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 == day2 then		-- YMD (simple whole date)&lt;br /&gt;
		result = is_valid_date (year, month, day, param);						-- &amp;lt;param&amp;gt; for |pmc-embargo-date=&lt;br /&gt;
&lt;br /&gt;
	elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 == month2 and 0 ~= day2 then	-- YMD-d (day range)&lt;br /&gt;
		result = is_valid_date (year, month, day);&lt;br /&gt;
		result = result and is_valid_date (year, month, day2);&lt;br /&gt;
&lt;br /&gt;
	elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 == year2 and 0 ~= month2 and 0 ~= day2 then	-- YMD-md (day month range)&lt;br /&gt;
		result = is_valid_date (year, month, day);&lt;br /&gt;
		result = result and is_valid_date (year, month2, day2);&lt;br /&gt;
&lt;br /&gt;
	elseif 0 ~= year and 0 ~= month and 0 ~= day and 0 ~= year2 and 0 ~= month2 and 0 ~= day2 then	-- YMD-ymd (day month year range)&lt;br /&gt;
		result = is_valid_date(year, month, day);&lt;br /&gt;
		result = result and is_valid_date(year2, month2, day2);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if false == result then return false; end&lt;br /&gt;
&lt;br /&gt;
	if nil ~= tCOinS_date then													-- this table only passed into this function when testing |date= parameter values&lt;br /&gt;
		make_COinS_date ({year = year, month = month, day = day, year2 = year2, month2 = month2, day2 = day2}, tCOinS_date);	-- make an ISO 8601 date string for COinS&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return true, anchor_year;													-- format is good and date string represents a real date&lt;br /&gt;
end	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D A T E S &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Cycle the date-holding parameters in passed table date_parameters_list through check_date() to check compliance with MOS:DATE. For all valid dates, check_date() returns&lt;br /&gt;
true. The |date= parameter test is unique, it is the only date holding parameter from which values for anchor_year (used in CITEREF identifiers) and COinS_date (used in&lt;br /&gt;
the COinS metadata) are derived.  The |date= parameter is the only date-holding parameter that is allowed to contain the no-date keywords &amp;quot;n.d.&amp;quot; or &amp;quot;nd&amp;quot; (without quotes).&lt;br /&gt;
&lt;br /&gt;
Unlike most error messages created in this module, only one error message is created by this function. Because all of the date holding parameters are processed serially,&lt;br /&gt;
parameters with errors are added to the &amp;lt;error_list&amp;gt; sequence table as the dates are tested.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function dates(date_parameters_list, tCOinS_date, error_list)&lt;br /&gt;
	local anchor_year;															-- will return as nil if the date being tested is not |date=&lt;br /&gt;
	local COinS_date;															-- will return as nil if the date being tested is not |date=&lt;br /&gt;
	local embargo_date;															-- if embargo date is a good dmy, mdy, ymd date then holds original value else reset to 9999&lt;br /&gt;
	local good_date = false;&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs(date_parameters_list) do									-- for each date-holding parameter in the list&lt;br /&gt;
		if is_set(v.val) then													-- if the parameter has a value&lt;br /&gt;
			v.val = mw.ustring.gsub(v.val, &#039;%d&#039;, cfg.date_names.local_digits);	-- translate &#039;local&#039; digits to Western 0-9&lt;br /&gt;
			if v.val:match(&amp;quot;^c%. [1-9]%d%d%d?%a?$&amp;quot;) then						-- special case for c. year or with or without CITEREF disambiguator - only |date= and |year=&lt;br /&gt;
				local year = v.val:match(&amp;quot;c%. ([1-9]%d%d%d?)%a?&amp;quot;);				-- get the year portion so it can be tested&lt;br /&gt;
				if &#039;date&#039; == k then&lt;br /&gt;
					anchor_year, COinS_date = v.val:match(&amp;quot;((c%. [1-9]%d%d%d?)%a?)&amp;quot;);	-- anchor year and COinS_date only from |date= parameter&lt;br /&gt;
					good_date = is_valid_year(year);&lt;br /&gt;
				elseif &#039;year&#039; == k then&lt;br /&gt;
					good_date = is_valid_year(year);&lt;br /&gt;
				else&lt;br /&gt;
					good_date = false;&lt;br /&gt;
				end&lt;br /&gt;
			elseif &#039;date&#039; == k then												-- if the parameter is |date=&lt;br /&gt;
				if v.val:match(&amp;quot;^n%.d%.%a?$&amp;quot;) then -- ToDo: I18N								-- if |date=n.d. with or without a CITEREF disambiguator&lt;br /&gt;
					good_date, anchor_year, COinS_date = true, v.val:match(&amp;quot;((n%.d%.)%a?)&amp;quot;); -- ToDo: I18N	-- &amp;quot;n.d.&amp;quot;; no error when date parameter is set to no date&lt;br /&gt;
				elseif v.val:match(&amp;quot;^nd%a?$&amp;quot;) then -- ToDo: I18N								-- if |date=nd with or without a CITEREF disambiguator&lt;br /&gt;
					good_date, anchor_year, COinS_date = true, v.val:match(&amp;quot;((nd)%a?)&amp;quot;); -- ToDo: I18N	-- &amp;quot;nd&amp;quot;;	no error when date parameter is set to no date&lt;br /&gt;
				else&lt;br /&gt;
					good_date, anchor_year, COinS_date = check_date (v.val, k, tCOinS_date);	-- go test the date&lt;br /&gt;
				end&lt;br /&gt;
			elseif &#039;year&#039; == k then												-- if the parameter is |year= it should hold only a year value&lt;br /&gt;
				if v.val:match(&amp;quot;^[1-9]%d%d%d?%a?$&amp;quot;) then						-- if |year = 3 or 4 digits only with or without a CITEREF disambiguator&lt;br /&gt;
					good_date, anchor_year, COinS_date = true, v.val:match(&amp;quot;((%d+)%a?)&amp;quot;);&lt;br /&gt;
				else&lt;br /&gt;
					good_date = false;&lt;br /&gt;
				end&lt;br /&gt;
			elseif &#039;pmc-embargo-date&#039; == k then									-- if the parameter is |pmc-embargo-date=&lt;br /&gt;
				good_date = check_date (v.val, k);								-- go test the date&lt;br /&gt;
				if true == good_date then										-- if the date is a valid date&lt;br /&gt;
					good_date, embargo_date = is_valid_embargo_date (v.val);	-- is |pmc-embargo-date= date a single dmy, mdy, or ymd formatted date? yes: returns embargo date; no: returns 9999&lt;br /&gt;
				end&lt;br /&gt;
			else																-- any other date-holding parameter&lt;br /&gt;
				good_date = check_date (v.val, k);								-- go test the date&lt;br /&gt;
			end&lt;br /&gt;
			if false == good_date then											-- assemble one error message so we don&#039;t add the tracking category multiple times&lt;br /&gt;
				table.insert (error_list, wrap_style (&#039;parameter&#039;, v.name));	-- make parameter name suitable for error message list&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return anchor_year, embargo_date;											-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Y E A R _ C H E C K &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Temporary function to test |year= for acceptable values:&lt;br /&gt;
	YYY, YYYY, year-only ranges, their circa forms, with or without CITEREF disambiguators.&lt;br /&gt;
&lt;br /&gt;
When |year= holds some form of date that is not one of these year-only dates, emit a maintenance message.&lt;br /&gt;
&lt;br /&gt;
This function necessary because many non-cs1|2 templates have a |year= parameter so cirrus searches are more-or-&lt;br /&gt;
less useless&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function year_check (year)&lt;br /&gt;
	year = year:gsub (&#039;c%. *&#039;, &#039;&#039;);												-- remove circa annotation (if present) before testing &amp;lt;year&amp;gt;&lt;br /&gt;
	&lt;br /&gt;
	for _, index in ipairs ({&#039;y-y&#039;, &#039;y4-y2&#039;, &#039;y&#039;}) do							-- spin through these indexes into patterns_t&lt;br /&gt;
		if mw.ustring.match (year, patterns_t[index][1]) then&lt;br /&gt;
			return;																-- if a match then |year= holds a valid &#039;year&#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	set_message (&#039;maint_year&#039;);													-- if here, |year= value is not an accepted value; add a maint cat&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Y E A R _ D A T E _ C H E C K &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Compare the value provided in |year= with the year value(s) provided in |date=.  This function sets a local numeric value:&lt;br /&gt;
	0 - year value does not match the year value in date&lt;br /&gt;
	1 - (default) year value matches the year value in date or one of the year values when date contains two years&lt;br /&gt;
	2 - year value matches the year value in date when date is in the form YYYY-MM-DD and year is disambiguated (|year=YYYYx)&lt;br /&gt;
&lt;br /&gt;
the numeric value in &amp;lt;result&amp;gt; determines the &#039;output&#039; if any from this function:&lt;br /&gt;
	0 – adds error message to error_list sequence table&lt;br /&gt;
	1 – adds maint cat&lt;br /&gt;
	2 – does nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function year_date_check (year_string, year_origin, date_string, date_origin, error_list)&lt;br /&gt;
	local year;&lt;br /&gt;
	local date1;&lt;br /&gt;
	local date2;&lt;br /&gt;
	local result = 1;															-- result of the test; assume that the test passes&lt;br /&gt;
&lt;br /&gt;
	year = year_string:match (&#039;(%d%d%d%d?)&#039;);&lt;br /&gt;
&lt;br /&gt;
	if date_string:match (&#039;%d%d%d%d%-%d%d%-%d%d&#039;) then							--special case where both date and year are required YYYY-MM-DD and YYYYx&lt;br /&gt;
		date1 = date_string:match (&#039;(%d%d%d%d)&#039;);&lt;br /&gt;
		year = year_string:match (&#039;(%d%d%d%d)&#039;);&lt;br /&gt;
		if year ~= date1 then&lt;br /&gt;
			result = 0;															-- years don&#039;t match&lt;br /&gt;
		elseif year_string:match (&#039;%d%d%d%d%a&#039;) then&lt;br /&gt;
			result = 2;															-- years match; but because disambiguated, don&#039;t add to maint cat&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	elseif date_string:match (&amp;quot;%d%d%d%d?.-%d%d%d%d?&amp;quot;) then						-- any of the standard range formats of date with two three- or four-digit years&lt;br /&gt;
		date1, date2 = date_string:match (&amp;quot;(%d%d%d%d?).-(%d%d%d%d?)&amp;quot;);&lt;br /&gt;
		if year ~= date1 and year ~= date2 then&lt;br /&gt;
			result = 0;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif mw.ustring.match(date_string, &amp;quot;%d%d%d%d[%-–]%d%d&amp;quot;) then				-- YYYY-YY date ranges&lt;br /&gt;
		local century;&lt;br /&gt;
		date1, century, date2 = mw.ustring.match(date_string, &amp;quot;((%d%d)%d%d)[%-–]+(%d%d)&amp;quot;);&lt;br /&gt;
		date2 = century..date2;													-- convert YY to YYYY&lt;br /&gt;
		if year ~= date1 and year ~= date2 then&lt;br /&gt;
			result = 0;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif date_string:match (&amp;quot;%d%d%d%d?&amp;quot;) then									-- any of the standard formats of date with one year&lt;br /&gt;
		date1 = date_string:match (&amp;quot;(%d%d%d%d?)&amp;quot;);&lt;br /&gt;
		if year ~= date1 then&lt;br /&gt;
			result = 0;&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- should never get here; this function called only when no other date errors&lt;br /&gt;
		result = 0;																-- no recognizable year in date&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 == result then															-- year / date mismatch&lt;br /&gt;
		table.insert (error_list, substitute (cfg.messages[&#039;mismatch&#039;], {year_origin, date_origin}));	-- add error message to error_list sequence table&lt;br /&gt;
	elseif 1 == result then														-- redundant year / date&lt;br /&gt;
		set_message (&#039;maint_date_year&#039;);										-- add a maint cat&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E F O R M A T T E R &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
reformat &#039;date&#039; into new format specified by format_param if pattern_idx (the current format of &#039;date&#039;) can be&lt;br /&gt;
reformatted.  Does the grunt work for reformat_dates().&lt;br /&gt;
&lt;br /&gt;
The table re_formats maps pattern_idx (current format) and format_param (desired format) to a table that holds:&lt;br /&gt;
	format string used by string.format()&lt;br /&gt;
	identifier letters (&#039;d&#039;, &#039;m&#039;, &#039;y&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;y2&#039;) that serve as indexes into a table t{} that holds captures&lt;br /&gt;
		from mw.ustring.match() for the various date parts specified by  patterns_t[pattern_idx][1]&lt;br /&gt;
&lt;br /&gt;
Items in patterns_t{} have the general form:&lt;br /&gt;
	[&#039;ymd&#039;] = {&#039;^(%d%d%d%d)%-(%d%d)%-(%d%d)$&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;}, where:&lt;br /&gt;
		[&#039;ymd&#039;] is pattern_idx&lt;br /&gt;
		patterns_t[&#039;ymd&#039;][1] is the match pattern with captures for mw.ustring.match()&lt;br /&gt;
		patterns_t[&#039;ymd&#039;][2] is an indicator letter identifying the content of the first capture&lt;br /&gt;
		patterns_t[&#039;ymd&#039;][3] ... the second capture etc.&lt;br /&gt;
&lt;br /&gt;
when a pattern matches a date, the captures are loaded into table t{} in capture order using the idemtifier&lt;br /&gt;
characters as indexes into t{}  For the above, a ymd date is in t{} as:&lt;br /&gt;
	t.y = first capture (year), t.m = second capture (month), t.d = third capture (day)&lt;br /&gt;
&lt;br /&gt;
To reformat, this function is called with the pattern_idx that matches the current format of the date and with&lt;br /&gt;
format_param set to the desired format.  This function loads table t{} as described and then calls string.format()&lt;br /&gt;
with the format string specified by re_format[pattern_idx][format_param][1] using values taken from t{} according&lt;br /&gt;
to the capture identifier letters specified by patterns_t[pattern_idx][format_param][n] where n is 2..&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local re_formats = {&lt;br /&gt;
	[&#039;ymd&#039;] = {																	-- date format is ymd; reformat to:&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;},									-- |df=mdy&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;},									-- |df=dmy&lt;br /&gt;
	--		[&#039;yMd&#039;] = {&#039;%s %s %s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},								-- |df=yMd; not supported at en.wiki&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;Mdy&#039;] = {																	-- date format is Mdy; reformat to:&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;},									-- for long/short reformatting&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;},									-- |df=dmy&lt;br /&gt;
		[&#039;ymd&#039;] = {&#039;%s-%s-%s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},									-- |df=ymd&lt;br /&gt;
	--		[&#039;yMd&#039;] = {&#039;%s %s %s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},								-- |df=yMd; not supported at en.wiki&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;dMy&#039;] = {																	-- date format is dMy; reformat to:&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;},									-- for long/short reformatting&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;},									-- |df=mdy&lt;br /&gt;
		[&#039;ymd&#039;] = {&#039;%s-%s-%s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},									-- |df=ymd&lt;br /&gt;
	--		[&#039;yMd&#039;] = {&#039;%s %s %s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},								-- |df=yMd; not supported at en.wiki&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;Md-dy&#039;] = {																-- date format is Md-dy; reformat to:&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s–%s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;y&#039;},						-- for long/short reformatting&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s–%s %s %s&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;m&#039;, &#039;y&#039;},							-- |df=dmy -&amp;gt; d-dMy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;d-dMy&#039;] = {																-- date format is d-d&amp;gt;y; reformat to:&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s–%s %s %s&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;m&#039;, &#039;y&#039;},							-- for long/short reformatting&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s–%s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;d2&#039;, &#039;y&#039;},						-- |df=mdy -&amp;gt; Md-dy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;dM-dMy&#039;] = {																-- date format is dM-dMy; reformat to:&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s – %s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;y&#039;},				-- for long/short reformatting&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s – %s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;m2&#039;, &#039;d2&#039;, &#039;y&#039;},				-- |df=mdy -&amp;gt; Md-Mdy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;Md-Mdy&#039;] = {																-- date format is Md-Mdy; reformat to:&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s – %s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;,  &#039;m2&#039;, &#039;d2&#039;, &#039;y&#039;},			-- for long/short reformatting&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s – %s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;y&#039;},				-- |df=dmy -&amp;gt; dM-dMy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;dMy-dMy&#039;] = {																-- date format is dMy-dMy; reformat to:&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s %s – %s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;y2&#039;},		-- for long/short reformatting&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s, %s – %s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;, &#039;m2&#039;, &#039;d2&#039;, &#039;y2&#039;},	-- |df=mdy -&amp;gt; Mdy-Mdy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;Mdy-Mdy&#039;] = {																-- date format is Mdy-Mdy; reformat to:&lt;br /&gt;
		[&#039;mdy&#039;] = {&#039;%s %s, %s – %s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;, &#039;m2&#039;, &#039;d2&#039;, &#039;y2&#039;},	-- for long/short reformatting&lt;br /&gt;
		[&#039;dmy&#039;] = {&#039;%s %s %s – %s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;, &#039;d2&#039;, &#039;m2&#039;, &#039;y2&#039;},		-- |df=dmy -&amp;gt; dMy-dMy &lt;br /&gt;
		},&lt;br /&gt;
	[&#039;My-My&#039;] = {																-- these for long/short reformatting&lt;br /&gt;
		[&#039;any&#039;] = {&#039;%s %s – %s %s&#039;, &#039;m&#039;, &#039;y&#039;, &#039;m2&#039;, &#039;y2&#039;},						-- dmy/mdy agnostic&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;M-My&#039;] = {																-- these for long/short reformatting&lt;br /&gt;
		[&#039;any&#039;] = {&#039;%s–%s %s&#039;, &#039;m&#039;, &#039;m2&#039;, &#039;y&#039;},									-- dmy/mdy agnostic&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;My&#039;] = {																	-- these for long/short reformatting&lt;br /&gt;
		[&#039;any&#039;] = {&#039;%s %s&#039;, &#039;m&#039;, &#039;y&#039;},											-- dmy/mdy agnostic&lt;br /&gt;
		},&lt;br /&gt;
	--	[&#039;yMd&#039;] = {																-- not supported at en.wiki&lt;br /&gt;
	--		[&#039;mdy&#039;] = {&#039;%s %s, %s&#039;, &#039;m&#039;, &#039;d&#039;, &#039;y&#039;},								-- |df=mdy&lt;br /&gt;
	--		[&#039;dmy&#039;] = {&#039;%s %s %s&#039;, &#039;d&#039;, &#039;m&#039;, &#039;y&#039;},								-- |df=dmy&lt;br /&gt;
	--		[&#039;ymd&#039;] = {&#039;%s-%s-%s&#039;, &#039;y&#039;, &#039;m&#039;, &#039;d&#039;},								-- |df=ymd&lt;br /&gt;
	--		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
local function reformatter (date, pattern_idx, format_param, mon_len)&lt;br /&gt;
	if not in_array (pattern_idx, {&#039;ymd&#039;, &#039;Mdy&#039;, &#039;Md-dy&#039;, &#039;dMy&#039;, &#039;yMd&#039;, &#039;d-dMy&#039;, &#039;dM-dMy&#039;, &#039;Md-Mdy&#039;, &#039;dMy-dMy&#039;, &#039;Mdy-Mdy&#039;, &#039;My-My&#039;, &#039;M-My&#039;, &#039;My&#039;}) then&lt;br /&gt;
		return;																	-- not in this set of date format patterns_t then not a reformattable date&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;ymd&#039; == format_param and in_array (pattern_idx, {&#039;ymd&#039;, &#039;Md-dy&#039;, &#039;d-dMy&#039;, &#039;dM-dMy&#039;, &#039;Md-Mdy&#039;, &#039;dMy-dMy&#039;, &#039;Mdy-Mdy&#039;, &#039;My-My&#039;, &#039;M-My&#039;, &#039;My&#039;}) then&lt;br /&gt;
		return;																	-- ymd date ranges not supported at en.wiki; no point in reformatting ymd to ymd&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if in_array (pattern_idx, {&#039;My&#039;, &#039;M-My&#039;, &#039;My-My&#039;}) then						-- these are not dmy/mdy so can&#039;t be &#039;reformatted&#039; into either&lt;br /&gt;
		format_param = &#039;any&#039;;													-- so format-agnostic &lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
																				-- yMd is not supported at en.wiki; when yMd is supported at your wiki, uncomment the next line&lt;br /&gt;
	--	if &#039;yMd&#039; == format_param and in_array (pattern_idx, {&#039;yMd&#039;, &#039;Md-dy&#039;, &#039;d-dMy&#039;, &#039;dM-dMy&#039;, &#039;Md-Mdy&#039;, &#039;dMy-dMy&#039;, &#039;Mdy-Mdy&#039;}) then	-- these formats not convertable; yMd not supported at en.wiki&lt;br /&gt;
	if &#039;yMd&#039; == format_param then												-- yMd not supported at en.wiki; when yMd is supported at your wiki, remove or comment-out this line&lt;br /&gt;
		return;																	-- not a reformattable date&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local c1, c2, c3, c4, c5, c6, c7;											-- these hold the captures specified in patterns_t[pattern_idx][1]&lt;br /&gt;
	c1, c2, c3, c4, c5, c6, c7 = mw.ustring.match (date, patterns_t[pattern_idx][1]);	-- get the captures&lt;br /&gt;
&lt;br /&gt;
	local t = {																	-- table that holds k/v pairs of date parts from the captures and patterns_t[pattern_idx][2..]&lt;br /&gt;
		[patterns_t[pattern_idx][2]] = c1;										-- at minimum there is always one capture with a matching indicator letter&lt;br /&gt;
		[patterns_t[pattern_idx][3] or &#039;x&#039;] = c2;								-- patterns_t can have a variable number of captures; each capture requires an indicator letter;&lt;br /&gt;
		[patterns_t[pattern_idx][4] or &#039;x&#039;] = c3;								-- where there is no capture, there is no indicator letter so n in patterns_t[pattern_idx][n] will be nil;&lt;br /&gt;
		[patterns_t[pattern_idx][5] or &#039;x&#039;] = c4;								-- the &#039;x&#039; here spoofs an indicator letter to prevent &#039;table index is nil&#039; error&lt;br /&gt;
		[patterns_t[pattern_idx][6] or &#039;x&#039;] = c5;&lt;br /&gt;
		[patterns_t[pattern_idx][7] or &#039;x&#039;] = c6;&lt;br /&gt;
		[patterns_t[pattern_idx][8] or &#039;x&#039;] = c7;&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
	if t.a then																	-- if this date has an anchor year capture (all convertable date formats except ymd)&lt;br /&gt;
		if t.y2 then															-- for year range date formats														&lt;br /&gt;
			t.y2 = t.a;															-- use the anchor year capture when reassembling the date&lt;br /&gt;
		else																	-- here for single date formats (except ymd)&lt;br /&gt;
			t.y = t.a;															-- use the anchor year capture when reassembling the date&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if tonumber(t.m) then														-- if raw month is a number (converting from ymd)&lt;br /&gt;
		if &#039;s&#039; == mon_len then													-- if we are to use abbreviated month names&lt;br /&gt;
			t.m = cfg.date_names[&#039;inv_local_short&#039;][tonumber(t.m)];					-- convert it to a month name&lt;br /&gt;
		else&lt;br /&gt;
			t.m = cfg.date_names[&#039;inv_local_long&#039;][tonumber(t.m)];					-- convert it to a month name&lt;br /&gt;
		end&lt;br /&gt;
		t.d = t.d:gsub (&#039;0(%d)&#039;, &#039;%1&#039;);											-- strip leading &#039;0&#039; from day if present&lt;br /&gt;
	elseif &#039;ymd&#039; == format_param then											-- when converting to ymd&lt;br /&gt;
		t.y = t.y:gsub (&#039;%a&#039;, &#039;&#039;);												-- strip CITREF disambiguator if present; anchor year already known so process can proceed; TODO: maint message?&lt;br /&gt;
		if 1582 &amp;gt; tonumber (t.y) then											-- ymd format dates not allowed before 1582&lt;br /&gt;
			return;&lt;br /&gt;
		end&lt;br /&gt;
		t.m = string.format (&#039;%02d&#039;, get_month_number (t.m));					-- make sure that month and day are two digits&lt;br /&gt;
		t.d = string.format (&#039;%02d&#039;, t.d);&lt;br /&gt;
	elseif mon_len then															-- if mon_len is set to either &#039;short&#039; or &#039;long&#039;&lt;br /&gt;
		for _, mon in ipairs ({&#039;m&#039;, &#039;m2&#039;}) do									-- because there can be two month names, check both &lt;br /&gt;
			if t[mon] then&lt;br /&gt;
				t[mon] = get_month_number (t[mon]);								-- get the month number for this month (is length agnostic)&lt;br /&gt;
				if 0 == t[mon] then return; end									-- seasons and named dates can&#039;t be converted&lt;br /&gt;
				t[mon] = ((&#039;s&#039; == mon_len) and cfg.date_names[&#039;inv_local_short&#039;][t[mon]]) or cfg.date_names[&#039;inv_local_long&#039;][t[mon]];	-- fetch month name according to length&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local new_date = string.format (re_formats[pattern_idx][format_param][1],	-- format string&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][2]],							-- named captures from t{}&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][3]],&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][4]],&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][5]],&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][6]],&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][7]],&lt;br /&gt;
		t[re_formats[pattern_idx][format_param][8]]&lt;br /&gt;
		);&lt;br /&gt;
&lt;br /&gt;
	return new_date;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; R E F O R M A T _ D A T E S &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Reformats existing dates into the format specified by format.&lt;br /&gt;
&lt;br /&gt;
format is one of several manual keywords: dmy, dmy-all, mdy, mdy-all, ymd, ymd-all.  The -all version includes&lt;br /&gt;
access- and archive-dates; otherwise these dates are not reformatted.&lt;br /&gt;
&lt;br /&gt;
This function allows automatic date formatting.  In ~/Configuration, the article source is searched for one of&lt;br /&gt;
the {{use xxx dates}} templates.  If found, xxx becomes the global date format as xxx-all.  If |cs1-dates= in&lt;br /&gt;
{{use xxx dates}} has legitimate value then that value determines how cs1|2 dates will be rendered.  Legitimate&lt;br /&gt;
values for |cs1-dates= are:&lt;br /&gt;
	l - all dates are rendered with long month names&lt;br /&gt;
	ls - publication dates use long month names; access-/archive-dates use abbreviated month names&lt;br /&gt;
	ly - publication dates use long month names; access-/archive-dates rendered in ymd format&lt;br /&gt;
	s - all dates are rendered with abbreviated (short) month names&lt;br /&gt;
	sy - publication dates use abbreviated month names; access-/archive-dates rendered in ymd format&lt;br /&gt;
	y - all dates are rendered in ymd format&lt;br /&gt;
&lt;br /&gt;
the format argument for automatic date formatting will be the format specified by {{use xxx dates}} with the&lt;br /&gt;
value supplied by |cs1-dates so one of: xxx-l, xxx-ls, xxx-ly, xxx-s, xxx-sy, xxx-y, or simply xxx (|cs1-dates=&lt;br /&gt;
empty, omitted, or invalid) where xxx shall be either of dmy or mdy.&lt;br /&gt;
&lt;br /&gt;
dates are extracted from date_parameters_list, reformatted (if appropriate), and then written back into the&lt;br /&gt;
list in the new format.  Dates in date_parameters_list are presumed here to be valid (no errors).  This function&lt;br /&gt;
returns true when a date has been reformatted, false else.  Actual reformatting is done by reformatter().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function reformat_dates (date_parameters_list, format)&lt;br /&gt;
	local all = false;															-- set to false to skip access- and archive-dates&lt;br /&gt;
	local len_p = &#039;l&#039;;															-- default publication date length shall be long&lt;br /&gt;
	local len_a = &#039;l&#039;;															-- default access-/archive-date length shall be long&lt;br /&gt;
	local result = false;&lt;br /&gt;
	local new_date;																&lt;br /&gt;
	&lt;br /&gt;
	if format:match(&#039;%a+%-all&#039;) then											-- manual df keyword; auto df keyword when length not specified in {{use xxx dates}}; &lt;br /&gt;
		format = format:match(&#039;(%a+)%-all&#039;);									-- extract the format&lt;br /&gt;
		all = true;																-- all dates are long format dates because this keyword doesn&#039;t specify length&lt;br /&gt;
	elseif format:match(&#039;%a+%-[lsy][sy]?&#039;) then									-- auto df keywords; internal only&lt;br /&gt;
		all = true;																-- auto df applies to all dates; use length specified by capture len_p for all dates&lt;br /&gt;
		format, len_p, len_a = format:match(&#039;(%a+)%-([lsy])([sy]?)&#039;);			-- extract the format and length keywords&lt;br /&gt;
		if &#039;y&#039; == len_p then													-- because allowed by MOS:DATEUNIFY (sort of) range dates and My dates not reformatted&lt;br /&gt;
			format = &#039;ymd&#039;;														-- override {{use xxx dates}}&lt;br /&gt;
		elseif (not is_set(len_a)) or (len_p == len_a) then						-- no access-/archive-date length specified or same length as publication dates then&lt;br /&gt;
			len_a = len_p;														-- in case len_a not set&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- else only publication dates and they are long&lt;br /&gt;
&lt;br /&gt;
	for param_name, param_val in pairs (date_parameters_list) do				-- for each date-holding parameter in the list&lt;br /&gt;
		if is_set (param_val.val) then											-- if the parameter has a value&lt;br /&gt;
			if not (not all and in_array (param_name, {&#039;access-date&#039;, &#039;archive-date&#039;})) then	-- skip access- or archive-date unless format is xxx-all; yeah, ugly; TODO: find a better way&lt;br /&gt;
				for pattern_idx, pattern in pairs (patterns_t) do&lt;br /&gt;
					if mw.ustring.match (param_val.val, pattern[1]) then&lt;br /&gt;
						if all and in_array (param_name, {&#039;access-date&#039;, &#039;archive-date&#039;}) then	-- if this date is an access- or archive-date&lt;br /&gt;
							new_date = reformatter (param_val.val, pattern_idx, ((&#039;y&#039; == len_a) and &#039;ymd&#039;) or format, len_a);	-- choose ymd or dmy/mdy according to len_a setting&lt;br /&gt;
						else													-- all other dates&lt;br /&gt;
							new_date = reformatter (param_val.val, pattern_idx, format, len_p);&lt;br /&gt;
						end&lt;br /&gt;
						&lt;br /&gt;
						if new_date then										-- set when date was reformatted&lt;br /&gt;
							date_parameters_list[param_name].val = new_date;	-- update date in date list&lt;br /&gt;
							result = true;										-- and announce that changes have been made&lt;br /&gt;
							break;&lt;br /&gt;
						end&lt;br /&gt;
					end	-- if&lt;br /&gt;
				end		-- for&lt;br /&gt;
			end			-- if&lt;br /&gt;
		end				-- if&lt;br /&gt;
	end					-- for&lt;br /&gt;
	return result;																-- declare boolean result and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D A T E _ H Y P H E N _ T O _ D A S H &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
Loops through the list of date-holding parameters and converts any hyphen to an ndash.  Not called if the cs1|2&lt;br /&gt;
template has any date errors.&lt;br /&gt;
&lt;br /&gt;
Modifies the date_parameters_list and returns true if hyphens are replaced, else returns false.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function date_hyphen_to_dash (date_parameters_list)&lt;br /&gt;
	local result = false;&lt;br /&gt;
	local n;&lt;br /&gt;
	for param_name, param_val in pairs(date_parameters_list) do					-- for each date-holding parameter in the list&lt;br /&gt;
		if is_set (param_val.val) and&lt;br /&gt;
			not mw.ustring.match (param_val.val, patterns_t.ymd[1]) then		-- for those that are not ymd dates (ustring because here digits may not be Western)&lt;br /&gt;
				param_val.val, n = param_val.val:gsub (&#039;%-&#039;, &#039;–&#039;);				-- replace any hyphen with ndash&lt;br /&gt;
				if 0 ~= n then&lt;br /&gt;
					date_parameters_list[param_name].val = param_val.val;		-- update the list&lt;br /&gt;
					result = true;&lt;br /&gt;
				end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return result;																-- so we know if any hyphens were replaced&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; D A T E _ N A M E _ X L A T E &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Attempts to translate English date names to local-language date names using names supplied by MediaWiki&#039;s&lt;br /&gt;
date parser function.  This is simple name-for-name replacement and may not work for all languages.&lt;br /&gt;
&lt;br /&gt;
if xlat_dig is true, this function will also translate Western (English) digits to the local language&#039;s digits.&lt;br /&gt;
This will also translate ymd dates.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function date_name_xlate (date_parameters_list, xlt_dig)&lt;br /&gt;
	local xlate;&lt;br /&gt;
	local mode;																	-- long or short month names&lt;br /&gt;
	local modified = false;&lt;br /&gt;
	local date;&lt;br /&gt;
	&lt;br /&gt;
	local sources_t = {&lt;br /&gt;
		{cfg.date_names.en.long, cfg.date_names.inv_local_long},				-- for translating long English month names to long local month names&lt;br /&gt;
		{cfg.date_names.en.short, cfg.date_names.inv_local_short},				-- short month names&lt;br /&gt;
		{cfg.date_names.en.quarter, cfg.date_names.inv_local_quarter},			-- quarter date names&lt;br /&gt;
		{cfg.date_names.en.season, cfg.date_names.inv_local_season},			-- season date nam&lt;br /&gt;
		{cfg.date_names.en.named, cfg.date_names.inv_local_named},				-- named dates&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local function is_xlateable (month)											-- local function to get local date name that replaces existing English-language date name&lt;br /&gt;
		for _, date_names_t in ipairs (sources_t) do							-- for each sequence table in date_names_t&lt;br /&gt;
			if date_names_t[1][month] then										-- if date name is English month (long or short), quarter, season or named and&lt;br /&gt;
				if date_names_t[2][date_names_t[1][month]] then					-- if there is a matching local date name&lt;br /&gt;
					return date_names_t[2][date_names_t[1][month]];				-- return the local date name&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for param_name, param_val in pairs(date_parameters_list) do					-- for each date-holding parameter in the list&lt;br /&gt;
		if is_set(param_val.val) then											-- if the parameter has a value&lt;br /&gt;
			date = param_val.val;&lt;br /&gt;
			for month in mw.ustring.gmatch (date, &#039;[%a ]+&#039;) do					-- iterate through all date names in the date (single date or date range)&lt;br /&gt;
				month = mw.text.trim (month);									-- this because quarterly dates contain whitespace&lt;br /&gt;
				xlate = is_xlateable (month);									-- get translate &amp;lt;month&amp;gt;; returns translation or nil&lt;br /&gt;
				&lt;br /&gt;
				if xlate then		&lt;br /&gt;
					date = mw.ustring.gsub (date, month, xlate);				-- replace the English with the translation&lt;br /&gt;
					date_parameters_list[param_name].val = date;				-- save the translated date&lt;br /&gt;
					modified = true;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if xlt_dig then														-- shall we also translate digits?&lt;br /&gt;
				date = date:gsub (&#039;%d&#039;, cfg.date_names.xlate_digits);			-- translate digits from Western to &#039;local digits&#039;&lt;br /&gt;
				date_parameters_list[param_name].val = date;					-- save the translated date&lt;br /&gt;
				modified = true;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return modified;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local imported functions table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr, utilities_page_ptr)&lt;br /&gt;
	add_prop_cat = utilities_page_ptr.add_prop_cat ;							-- import functions from selected Module:Citation/CS1/Utilities module&lt;br /&gt;
	is_set = utilities_page_ptr.is_set;&lt;br /&gt;
	in_array = utilities_page_ptr.in_array;&lt;br /&gt;
	set_message = utilities_page_ptr.set_message;&lt;br /&gt;
	substitute = utilities_page_ptr.substitute;&lt;br /&gt;
	wrap_style = utilities_page_ptr.wrap_style;&lt;br /&gt;
&lt;br /&gt;
	cfg = cfg_table_ptr;														-- import tables from selected Module:Citation/CS1/Configuration&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A R C H I V E _ D A T E _ C H E C K &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Compare value in |archive-date= with the timestamp in Wayback machine urls.  Emits an error message with suggested&lt;br /&gt;
date from the |archive-url= timestamp in an appropriate format when the value in |archive-date= does not match&lt;br /&gt;
the timestamp.&lt;br /&gt;
&lt;br /&gt;
this function never called when any date in a cs1|2 template has errors&lt;br /&gt;
&lt;br /&gt;
error message suggests new |archive-date= value in an appropriate format specified by &amp;lt;df&amp;gt;.  &amp;lt;df&amp;gt; is either &lt;br /&gt;
|df= or cfg.global_df in that order.  If &amp;lt;df&amp;gt; is nil, suggested date has format from |archive-date=.  There is&lt;br /&gt;
a caveat: when |df=dmy or |df=mdy, the reformatter leaves |access-date= and |archive-date= formats as they are.&lt;br /&gt;
The error message suggested date is passed to the formatter as YYYY-MM-DD so when |df=dmy or |df=mdy, the format&lt;br /&gt;
is not changed.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function archive_date_check (archive_date, archive_url_timestamp, df)&lt;br /&gt;
	local archive_date_format = &#039;dmy-y&#039;;										-- holds the date format of date in |archive-date; default to ymd; &#039;dmy&#039; used here to spoof reformat_dates() &lt;br /&gt;
	&lt;br /&gt;
	for _, v_t in ipairs ({{&#039;dMy&#039;, &#039;dmy-all&#039;}, {&#039;Mdy&#039;, &#039;mdy-all&#039;}}) do			-- is |archive-date= format dmy or mdy?&lt;br /&gt;
		if archive_date:match (patterns_t[v_t[1]][1]) then						-- does the pattern match?&lt;br /&gt;
			archive_date_format = cfg.keywords_xlate[v_t[2]];					-- get appropriate |df= supported keyword from the i18n translator table&lt;br /&gt;
			break;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local dates_t = {};&lt;br /&gt;
	dates_t[&#039;archive-date&#039;] = {val=archive_date, name=&#039;&#039;};						-- setup to call reformat_dates(); never called when errors so &amp;lt;name&amp;gt; unset as not needed&lt;br /&gt;
	reformat_dates (dates_t, &#039;dmy-y&#039;);											-- reformat |archive-date= to ymd; &#039;dmy&#039; used here to spoof reformat_dates()&lt;br /&gt;
	local archive_url_date = archive_url_timestamp:gsub (&#039;(%d%d%d%d)(%d%d)(%d%d)%d*&#039;, &#039;%1-%2-%3&#039;);	-- make ymd format date from timestamp&lt;br /&gt;
&lt;br /&gt;
	if dates_t[&#039;archive-date&#039;].val == archive_url_date then						-- are the two dates the same&lt;br /&gt;
		return;																	-- yes, done&lt;br /&gt;
	else&lt;br /&gt;
		dates_t[&#039;archive-date&#039;] = {val=archive_url_date, name=&#039;&#039;};				-- setup to call reformat_dates() with the timestamp date&lt;br /&gt;
		reformat_dates (dates_t, df or archive_date_format);					-- reformat timestamp to format specified by &amp;lt;df&amp;gt; or format used in |archive-date= &lt;br /&gt;
		archive_url_date = dates_t[&#039;archive-date&#039;].val;&lt;br /&gt;
		set_message (&#039;err_archive_date_url_ts_mismatch&#039;, archive_url_date);		-- emit an error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {																		-- return exported functions&lt;br /&gt;
	archive_date_check = archive_date_check,&lt;br /&gt;
	date_hyphen_to_dash = date_hyphen_to_dash,&lt;br /&gt;
	date_name_xlate = date_name_xlate,&lt;br /&gt;
	dates = dates,&lt;br /&gt;
	is_valid_date = is_valid_date,&lt;br /&gt;
	reformat_dates = reformat_dates,&lt;br /&gt;
	set_selected_modules = set_selected_modules,&lt;br /&gt;
	year_check = year_check,&lt;br /&gt;
	year_date_check = year_date_check,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Utilities&amp;diff=607</id>
		<title>Module:Citation/CS1/Utilities</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Utilities&amp;diff=607"/>
		<updated>2026-06-06T21:30:12Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;local z = { 	error_cats_t = {};															-- for categorizing citations that contain errors 	error_ids_t = {};															-- list of error identifiers; used to prevent duplication of certain errors; local to this module 	error_msgs_t = {};															-- sequence table of error messages 	maint_cats_t = {};															-- for categorizing citations that aren&amp;#039;t erroneous per se, but could use a little work 	prop_cats_t = {};															-- for categorizing cit...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local z = {&lt;br /&gt;
	error_cats_t = {};															-- for categorizing citations that contain errors&lt;br /&gt;
	error_ids_t = {};															-- list of error identifiers; used to prevent duplication of certain errors; local to this module&lt;br /&gt;
	error_msgs_t = {};															-- sequence table of error messages&lt;br /&gt;
	maint_cats_t = {};															-- for categorizing citations that aren&#039;t erroneous per se, but could use a little work&lt;br /&gt;
	prop_cats_t = {};															-- for categorizing citations based on certain properties, language of source for instance&lt;br /&gt;
	prop_keys_t = {};															-- for adding classes to the citation&#039;s &amp;lt;cite&amp;gt; tag&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local cfg;																		-- table of tables imported from selected Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S E T &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Returns true if argument is set; false otherwise. Argument is &#039;set&#039; when it exists (not nil) or when it is not an empty string.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_set (var)&lt;br /&gt;
	return not (var == nil or var == &#039;&#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N _ A R R A Y &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Whether needle is in haystack&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function in_array (needle, haystack)&lt;br /&gt;
	if needle == nil then&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	for n, v in ipairs (haystack) do&lt;br /&gt;
		if v == needle then&lt;br /&gt;
			return n;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ A C C E P T _ A S _ W R I T T E N &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
When &amp;lt;str&amp;gt; is wholly wrapped in accept-as-written markup, return &amp;lt;str&amp;gt; without markup and true; return &amp;lt;str&amp;gt; and false else&lt;br /&gt;
&lt;br /&gt;
with allow_empty = false, &amp;lt;str&amp;gt; must have at least one character inside the markup&lt;br /&gt;
with allow_empty = true, &amp;lt;str&amp;gt; the markup frame can be empty like (()) to distinguish an empty template parameter from the specific condition &amp;quot;has no applicable value&amp;quot; in citation-context.&lt;br /&gt;
&lt;br /&gt;
After further evaluation the two cases might be merged at a later stage, but should be kept separated for now.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_accept_as_written (str, allow_empty)&lt;br /&gt;
	if not is_set (str) then&lt;br /&gt;
		return str, false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local count;&lt;br /&gt;
&lt;br /&gt;
	if true == allow_empty then&lt;br /&gt;
		str, count = str:gsub (&#039;^%(%((.*)%)%)$&#039;, &#039;%1&#039;); 						-- allows (()) to be an empty set&lt;br /&gt;
	else&lt;br /&gt;
		str, count = str:gsub (&#039;^%(%((.+)%)%)$&#039;, &#039;%1&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	return str, 0 ~= count;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S U B S T I T U T E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Populates numbered arguments in a message string using an argument table. &amp;lt;args&amp;gt; may be a single string or a&lt;br /&gt;
sequence table of multiple strings.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function substitute (msg, args)&lt;br /&gt;
	return args and mw.message.newRawMessage (msg, args):plain() or msg;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E R R O R _ C O M M E N T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Wraps error messages with CSS markup according to the state of hidden. &amp;lt;content&amp;gt; may be a single string or a&lt;br /&gt;
sequence table of multiple strings.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function error_comment (content, hidden)&lt;br /&gt;
	return substitute (hidden and cfg.presentation[&#039;hidden-error&#039;] or cfg.presentation[&#039;visible-error&#039;], content);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H Y P H E N _ T O _ D A S H &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Converts a hyphen, endash, emdash to endash under certain conditions.  The hyphen/en/em must separate&lt;br /&gt;
like items; unlike items are returned unmodified.  These forms are modified:&lt;br /&gt;
	letter - letter (A-B)&lt;br /&gt;
	digit - digit (4-5)&lt;br /&gt;
	digit separator digit - digit separator digit (4.1-4.5 or 4-1-4-5)&lt;br /&gt;
	letterdigit - letterdigit (A1-A5) (an optional separator between letter and&lt;br /&gt;
		digit is supported – a.1-a.5 or a-1-a-5)&lt;br /&gt;
	digitletter - digitletter (5a-5d) (an optional separator between letter and&lt;br /&gt;
		digit is supported – 5.a-5.d or 5-a-5-d)&lt;br /&gt;
&lt;br /&gt;
any other forms are returned unmodified.&lt;br /&gt;
&lt;br /&gt;
str may be a comma- or semicolon-separated list of page ranges with/without single pages&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function hyphen_to_dash (str)&lt;br /&gt;
	if not is_set (str) then&lt;br /&gt;
		return str;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	str = str:gsub (&amp;quot;(%(%(.-%)%))&amp;quot;, function(m) return m:gsub(&amp;quot;,&amp;quot;, &amp;quot;，&amp;quot;):gsub(&amp;quot;;&amp;quot;, &amp;quot;；&amp;quot;) end) -- replace commas and semicolons in accept-as-written markup with similar unicode characters so they&#039;ll be ignored during the split	&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;[nm]dash;&#039;, {[&#039;&amp;amp;ndash;&#039;] = &#039;–&#039;, [&#039;&amp;amp;mdash;&#039;] = &#039;—&#039;});		-- replace &amp;amp;mdash; and &amp;amp;ndash; entities with their characters; semicolon mucks up the text.split&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;#45;&#039;, &#039;-&#039;);												-- replace HTML numeric entity with hyphen character&lt;br /&gt;
	str = str:gsub (&#039;&amp;amp;nbsp;&#039;, &#039; &#039;);												-- replace &amp;amp;nbsp; entity with generic keyboard space character&lt;br /&gt;
	&lt;br /&gt;
	local out = {};&lt;br /&gt;
	local list = mw.text.split (str, &#039;%s*[,;]%s*&#039;);								-- split str at comma or semicolon separators if there are any&lt;br /&gt;
&lt;br /&gt;
	local accept;																-- boolean&lt;br /&gt;
&lt;br /&gt;
	for _, item in ipairs (list) do												-- for each item in the list&lt;br /&gt;
		item, accept = has_accept_as_written (item);							-- remove accept-this-as-written markup when it wraps all of item&lt;br /&gt;
		if not accept and mw.ustring.match (item, &#039;^%w*[%.%-]?%w+%s*[—–-]%s*%w*[%.%-]?%w+$&#039;) then	-- if pagination uses &amp;lt;hyphen|dot&amp;gt; separators with hyphen/endash/emdash &amp;lt;range separator&amp;gt;&lt;br /&gt;
			if mw.ustring.match (item, &#039;^%a+[%.%-]%d+%s*[—–-]%s*%a+[%.%-]%d+$&#039;) or		-- letter&amp;lt;hyphen|dot&amp;gt;digit &amp;lt;range separator&amp;gt; letter&amp;lt;hyphen|dot&amp;gt;digit (requires &amp;lt;hyphen|dot&amp;gt; separator between letter and digit)&lt;br /&gt;
				mw.ustring.match (item, &#039;^%d+[%.%-]%a+%s*[—–-]%s*%d+[%.%-]%a+$&#039;) or		-- digit&amp;lt;hyphen|dot&amp;gt;letter &amp;lt;range separator&amp;gt; digit&amp;lt;hyphen|dot&amp;gt;letter (requires &amp;lt;hyphen|dot&amp;gt; separator between digit and letter)&lt;br /&gt;
				mw.ustring.match (item, &#039;^%d+[%.%-]%d+%s*[—–-]%s*%d+[%.%-]%d+$&#039;) then	-- digit&amp;lt;hyphen|dot&amp;gt;digit &amp;lt;range separator&amp;gt; digit&amp;lt;hyphen|dot&amp;gt;digit (requires &amp;lt;hyphen|dot&amp;gt; separator between digit and digit)&lt;br /&gt;
					item = mw.ustring.gsub (item, &#039;(%w*[%.%-]%w+)%s*[—–-]%s*(%w*[%.%-]%w+)&#039;, &#039;&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;%1 –&amp;lt;/span&amp;gt; &amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;%2&amp;lt;/span&amp;gt;&#039;);	-- replace &amp;lt;range separator&amp;gt;, with spaced endash&lt;br /&gt;
&lt;br /&gt;
			elseif mw.ustring.match (item, &#039;^%d+%a+%s*[—–-]%s*%d+%a+$&#039;) or		-- digitletter &amp;lt;range separator&amp;gt; digitletter&lt;br /&gt;
				mw.ustring.match (item, &#039;^%a+%d+%s*[—–-]%s*%a+%d+$&#039;) or			-- letterdigit &amp;lt;range separator&amp;gt; letterdigit&lt;br /&gt;
				mw.ustring.match (item, &#039;^%d+%s*[—–-]%s*%d+$&#039;) or				-- digit &amp;lt;range separator&amp;gt; digit&lt;br /&gt;
				mw.ustring.match (item, &#039;^%a+%s*[—–-]%s*%a+$&#039;) then				-- letter&amp;lt;range separator&amp;gt; letter&lt;br /&gt;
					item = mw.ustring.gsub (item, &#039;(%w+)%s*[—–-]%s*(%w+)&#039;, &#039;&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;%1–&amp;lt;/span&amp;gt;%2&#039;);	-- replace &amp;lt;range separator&amp;gt; with endash, remove extraneous space characters&lt;br /&gt;
&lt;br /&gt;
			else&lt;br /&gt;
	--			item = mw.ustring.gsub (item, &#039;%s*[—–-]%s*&#039;, &#039;–&#039;);				-- disabled; here when &#039;unlike&#039; items so return &amp;lt;item&amp;gt; as is&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (out, item);												-- add the (possibly modified) item to the output table&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local temp_str = &#039;&#039;;														-- concatenate the output table into a comma separated string&lt;br /&gt;
	temp_str, accept = has_accept_as_written (table.concat (out, &#039;, &#039;));		-- remove accept-this-as-written markup when it wraps all of concatenated out&lt;br /&gt;
	if accept then&lt;br /&gt;
		temp_str = has_accept_as_written (str);									-- when global markup removed, return original str; do it this way to suppress boolean second return value&lt;br /&gt;
		return temp_str:gsub(&amp;quot;，&amp;quot;, &amp;quot;,&amp;quot;):gsub(&amp;quot;；&amp;quot;, &amp;quot;;&amp;quot;);&lt;br /&gt;
	else&lt;br /&gt;
		return temp_str:gsub(&amp;quot;，&amp;quot;, &amp;quot;,&amp;quot;):gsub(&amp;quot;；&amp;quot;, &amp;quot;;&amp;quot;);						-- else, return assembled temp_str&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; M A K E _ W I K I L I N K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Makes a wikilink; when both link and display text is provided, returns a wikilink in the form [[L|D]]; if only&lt;br /&gt;
link is provided (or link and display are the same), returns a wikilink in the form [[L]]; if neither are&lt;br /&gt;
provided or link is omitted, returns an empty string.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function make_wikilink (link, display)&lt;br /&gt;
	if not is_set (link) then return &#039;&#039; end&lt;br /&gt;
&lt;br /&gt;
	if is_set (display) and link ~= display then			&lt;br /&gt;
		return table.concat ({&#039;[[&#039;, link, &#039;|&#039;, display, &#039;]]&#039;});			&lt;br /&gt;
	else&lt;br /&gt;
		return table.concat ({&#039;[[&#039;, link, &#039;]]&#039;});&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ M E S S A G E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets an error message using the ~/Configuration error_conditions{} table along with arguments supplied in the function&lt;br /&gt;
call, inserts the resulting message in z.error_msgs_t{} sequence table, and returns the error message.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;error_id&amp;gt; – key value for appropriate error handler in ~/Configuration error_conditions{} table &lt;br /&gt;
&amp;lt;arguments&amp;gt; – may be a single string or a sequence table of multiple strings to be subsititued into error_conditions[error_id].message&lt;br /&gt;
&amp;lt;raw&amp;gt; – boolean&lt;br /&gt;
	true –	causes this function to return the error message not wrapped in visible-error, hidden-error span tag;&lt;br /&gt;
			returns error_conditions[error_id].hidden as a second return value&lt;br /&gt;
			does not add message to z.error_msgs_t sequence table&lt;br /&gt;
	false, nil – adds message wrapped in visible-error, hidden-error span tag to z.error_msgs_t&lt;br /&gt;
			returns the error message wrapped in visible-error, hidden-error span tag; there is no second return value&lt;br /&gt;
&amp;lt;prefix&amp;gt; – string to be prepended to &amp;lt;message&amp;gt;									-- TODO: remove support for these unused(?) arguments?&lt;br /&gt;
&amp;lt;suffix&amp;gt; – string to be appended to &amp;lt;message&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TODO: change z.error_cats_t and z.maint_cats_t to have the form cat_name = true?  this to avoid dups without having to have an extra table&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local added_maint_cats = {}														-- list of maintenance categories that have been added to z.maint_cats_t; TODO: figure out how to delete this table&lt;br /&gt;
&lt;br /&gt;
local function set_message (error_id, arguments, raw, prefix, suffix)&lt;br /&gt;
	local error_state = cfg.error_conditions[error_id];&lt;br /&gt;
	&lt;br /&gt;
	prefix = prefix or &#039;&#039;;&lt;br /&gt;
	suffix = suffix or &#039;&#039;;&lt;br /&gt;
	&lt;br /&gt;
	if error_state == nil then&lt;br /&gt;
		error (cfg.messages[&#039;undefined_error&#039;] .. &#039;: &#039; .. error_id);			-- because missing error handler in Module:Citation/CS1/Configuration&lt;br /&gt;
&lt;br /&gt;
	elseif is_set (error_state.category) then&lt;br /&gt;
		if error_state.message then												-- when error_state.message defined, this is an error message&lt;br /&gt;
			table.insert (z.error_cats_t, error_state.category);&lt;br /&gt;
		else&lt;br /&gt;
			if not added_maint_cats[error_id] then&lt;br /&gt;
				added_maint_cats[error_id] = true;								-- note that we&#039;ve added this category&lt;br /&gt;
				table.insert (z.maint_cats_t, substitute (error_state.category, arguments));	-- make cat name then add to table&lt;br /&gt;
			end&lt;br /&gt;
			return;																-- because no message, nothing more to do&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local message = substitute (error_state.message, arguments);&lt;br /&gt;
&lt;br /&gt;
	message = table.concat (&lt;br /&gt;
		{&lt;br /&gt;
		message,&lt;br /&gt;
		&#039; (&#039;,&lt;br /&gt;
		make_wikilink (&lt;br /&gt;
			table.concat (&lt;br /&gt;
				{&lt;br /&gt;
				cfg.messages[&#039;help page link&#039;],&lt;br /&gt;
				&#039;#&#039;,&lt;br /&gt;
				error_state.anchor&lt;br /&gt;
				}),&lt;br /&gt;
			cfg.messages[&#039;help page label&#039;]),&lt;br /&gt;
		&#039;)&#039;&lt;br /&gt;
		});&lt;br /&gt;
&lt;br /&gt;
	z.error_ids_t[error_id] = true;&lt;br /&gt;
	if z.error_ids_t[&#039;err_citation_missing_title&#039;] and							-- if missing-title error already noted&lt;br /&gt;
		in_array (error_id, {&#039;err_bare_url_missing_title&#039;, &#039;err_trans_missing_title&#039;}) then		-- and this error is one of these&lt;br /&gt;
			return &#039;&#039;, false;													-- don&#039;t bother because one flavor of missing title is sufficient&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	message = table.concat ({prefix, message, suffix});&lt;br /&gt;
&lt;br /&gt;
	if true == raw then&lt;br /&gt;
		return message, error_state.hidden;										-- return message not wrapped in visible-error, hidden-error span tag&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	message = error_comment (message, error_state.hidden);						-- wrap message in visible-error, hidden-error span tag&lt;br /&gt;
	table.insert (z.error_msgs_t, message);										-- add it to the messages sequence table&lt;br /&gt;
	return message;																-- and done; return value generally not used but is used as a flag in various functions of ~/Identifiers&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; I S _ A L I A S _ U S E D &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function is used by select_one() to determine if one of a list of alias parameters is in the argument list&lt;br /&gt;
provided by the template.&lt;br /&gt;
&lt;br /&gt;
Input:&lt;br /&gt;
	args – pointer to the arguments table from calling template&lt;br /&gt;
	alias – one of the list of possible aliases in the aliases lists from Module:Citation/CS1/Configuration&lt;br /&gt;
	index – for enumerated parameters, identifies which one&lt;br /&gt;
	enumerated – true/false flag used to choose how enumerated aliases are examined&lt;br /&gt;
	value – value associated with an alias that has previously been selected; nil if not yet selected&lt;br /&gt;
	selected – the alias that has previously been selected; nil if not yet selected&lt;br /&gt;
	error_list – list of aliases that are duplicates of the alias already selected&lt;br /&gt;
&lt;br /&gt;
Returns:&lt;br /&gt;
	value – value associated with alias we selected or that was previously selected or nil if an alias not yet selected&lt;br /&gt;
	selected – the alias we selected or the alias that was previously selected or nil if an alias not yet selected&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_alias_used (args, alias, index, enumerated, value, selected, error_list)&lt;br /&gt;
	if enumerated then															-- is this a test for an enumerated parameters?&lt;br /&gt;
		alias = alias:gsub (&#039;#&#039;, index);										-- replace &#039;#&#039; with the value in index&lt;br /&gt;
	else&lt;br /&gt;
		alias = alias:gsub (&#039;#&#039;, &#039;&#039;);											-- remove &#039;#&#039; if it exists&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_set (args[alias]) then												-- alias is in the template&#039;s argument list&lt;br /&gt;
		if value ~= nil and selected ~= alias then								-- if we have already selected one of the aliases&lt;br /&gt;
			local skip;&lt;br /&gt;
			for _, v in ipairs (error_list) do									-- spin through the error list to see if we&#039;ve added this alias&lt;br /&gt;
				if v == alias then&lt;br /&gt;
					skip = true;&lt;br /&gt;
					break;														-- has been added so stop looking &lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if not skip then													-- has not been added so&lt;br /&gt;
				table.insert (error_list, alias);								-- add error alias to the error list&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			value = args[alias];												-- not yet selected an alias, so select this one&lt;br /&gt;
			selected = alias;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return value, selected;														-- return newly selected alias, or previously selected alias&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A D D _ M A I N T _ C A T &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Adds a category to z.maint_cats_t using names from the configuration file with additional text if any.&lt;br /&gt;
To prevent duplication, the added_maint_cats table lists the categories by key that have been added to z.maint_cats_t.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function add_maint_cat (key, arguments)&lt;br /&gt;
	if not added_maint_cats [key] then&lt;br /&gt;
		added_maint_cats [key] = true;											-- note that we&#039;ve added this category&lt;br /&gt;
		table.insert (z.maint_cats_t, substitute (cfg.maint_cats [key], arguments));	-- make name then add to table&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A D D _ P R O P _ C A T &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Adds a category to z.prop_cats_t using names from the configuration file with additional text if any.&lt;br /&gt;
&lt;br /&gt;
foreign_lang_source and foreign_lang_source_2 keys have a language code appended to them so that multiple languages&lt;br /&gt;
may be categorized but multiples of the same language are not categorized.&lt;br /&gt;
&lt;br /&gt;
added_prop_cats is a table declared in page scope variables above&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local added_prop_cats = {};														-- list of property categories that have been added to z.prop_cats_t&lt;br /&gt;
&lt;br /&gt;
local function add_prop_cat (key, arguments, key_modifier)&lt;br /&gt;
	local key_modified = key .. ((key_modifier and key_modifier) or &#039;&#039;);		-- modify &amp;lt;key&amp;gt; with &amp;lt;key_modifier&amp;gt; if present and not nil&lt;br /&gt;
	&lt;br /&gt;
	if not added_prop_cats [key_modified] then&lt;br /&gt;
		added_prop_cats [key_modified] = true;									-- note that we&#039;ve added this category&lt;br /&gt;
		table.insert (z.prop_cats_t, substitute (cfg.prop_cats [key], arguments));	-- make name then add to table&lt;br /&gt;
		table.insert (z.prop_keys_t, &#039;cs1-prop-&#039; .. key);						-- convert key to class for use in the citation&#039;s &amp;lt;cite&amp;gt; tag&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S A F E _ F O R _ I T A L I C S &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Protects a string that will be wrapped in wiki italic markup &#039;&#039; ... &#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Note: We cannot use &amp;lt;i&amp;gt; for italics, as the expected behavior for italics specified by &#039;&#039;...&#039;&#039; in the title is that&lt;br /&gt;
they will be inverted (i.e. unitalicized) in the resulting references.  In addition, &amp;lt;i&amp;gt; and &#039;&#039; tend to interact&lt;br /&gt;
poorly under Mediawiki&#039;s HTML tidy.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function safe_for_italics (str)&lt;br /&gt;
	if not is_set (str) then return str end&lt;br /&gt;
&lt;br /&gt;
	if str:sub (1, 1) == &amp;quot;&#039;&amp;quot; then str = &amp;quot;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot; .. str; end&lt;br /&gt;
	if str:sub (-1, -1) == &amp;quot;&#039;&amp;quot; then str = str .. &amp;quot;&amp;lt;span&amp;gt;&amp;lt;/span&amp;gt;&amp;quot;; end&lt;br /&gt;
	&lt;br /&gt;
	return str:gsub (&#039;\n&#039;, &#039; &#039;);												-- Remove newlines as they break italics.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W R A P _ S T Y L E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Applies styling to various parameters.  Supplied string is wrapped using a message_list configuration taking one&lt;br /&gt;
argument; protects italic styled parameters.  Additional text taken from citation_config.presentation - the reason&lt;br /&gt;
this function is similar to but separate from wrap_msg().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wrap_style (key, str)&lt;br /&gt;
	if not is_set (str) then&lt;br /&gt;
		return &amp;quot;&amp;quot;;&lt;br /&gt;
	elseif in_array (key, {&#039;italic-title&#039;, &#039;trans-italic-title&#039;}) then&lt;br /&gt;
		str = safe_for_italics (str);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return substitute (cfg.presentation[key], {str});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A K E _ S E P _ L I S T &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
make a separated list of items using provided separators.&lt;br /&gt;
	&amp;lt;sep_list&amp;gt; - typically &#039;&amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;&#039;&lt;br /&gt;
	&amp;lt;sep_list_pair&amp;gt; - typically &#039;&amp;lt;space&amp;gt;and&amp;lt;space&amp;gt;&#039;&lt;br /&gt;
	&amp;lt;sep_list_end&amp;gt; - typically &#039;&amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;and&amp;lt;space&amp;gt;&#039; or &#039;&amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;&amp;amp;&amp;lt;space&amp;gt;&#039;&lt;br /&gt;
&lt;br /&gt;
defaults to cfg.presentation[&#039;sep_list&#039;], cfg.presentation[&#039;sep_list_pair&#039;], and cfg.presentation[&#039;sep_list_end&#039;]&lt;br /&gt;
if &amp;lt;sep_list_end&amp;gt; is specified, &amp;lt;sep_list&amp;gt; and &amp;lt;sep_list_pair&amp;gt; must also be supplied&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_sep_list (count, list_seq, sep_list, sep_list_pair, sep_list_end)&lt;br /&gt;
	local list = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
	if not sep_list then														-- set the defaults&lt;br /&gt;
		sep_list = cfg.presentation[&#039;sep_list&#039;];&lt;br /&gt;
		sep_list_pair = cfg.presentation[&#039;sep_list_pair&#039;];&lt;br /&gt;
		sep_list_end = cfg.presentation[&#039;sep_list_end&#039;];&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if 2 &amp;gt;= count then&lt;br /&gt;
		list = table.concat (list_seq, sep_list_pair);							-- insert separator between two items; returns list_seq[1] then only one item&lt;br /&gt;
	elseif 2 &amp;lt; count then&lt;br /&gt;
		list = table.concat (list_seq, sep_list, 1, count - 1);					-- concatenate all but last item with plain list separator&lt;br /&gt;
		list = table.concat ({list, list_seq[count]}, sep_list_end);			-- concatenate last item onto end of &amp;lt;list&amp;gt; with final separator&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return list;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E L E C T _ O N E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Chooses one matching parameter from a list of parameters to consider.  The list of parameters to consider is just&lt;br /&gt;
names.  For parameters that may be enumerated, the position of the numerator in the parameter name is identified&lt;br /&gt;
by the &#039;#&#039; so |author-last1= and |author1-last= are represented as &#039;author-last#&#039; and &#039;author#-last&#039;.&lt;br /&gt;
&lt;br /&gt;
Because enumerated parameter |&amp;lt;param&amp;gt;1= is an alias of |&amp;lt;param&amp;gt;= we must test for both possibilities.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Generates an error if more than one match is present.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function select_one (args, aliases_list, error_condition, index)&lt;br /&gt;
	local value = nil;															-- the value assigned to the selected parameter&lt;br /&gt;
	local selected = &#039;&#039;;														-- the name of the parameter we have chosen&lt;br /&gt;
	local error_list = {};&lt;br /&gt;
&lt;br /&gt;
	if index ~= nil then index = tostring(index); end&lt;br /&gt;
&lt;br /&gt;
	for _, alias in ipairs (aliases_list) do									-- for each alias in the aliases list&lt;br /&gt;
		if alias:match (&#039;#&#039;) then												-- if this alias can be enumerated&lt;br /&gt;
			if &#039;1&#039; == index then												-- when index is 1 test for enumerated and non-enumerated aliases&lt;br /&gt;
				value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);	-- first test for non-enumerated alias&lt;br /&gt;
			end&lt;br /&gt;
			value, selected = is_alias_used (args, alias, index, true, value, selected, error_list);	-- test for enumerated alias&lt;br /&gt;
		else&lt;br /&gt;
			value, selected = is_alias_used (args, alias, index, false, value, selected, error_list);	-- test for non-enumerated alias&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if #error_list &amp;gt; 0 and &#039;none&#039; ~= error_condition then						-- for cases where this code is used outside of extract_names()&lt;br /&gt;
		for i, v in ipairs (error_list) do&lt;br /&gt;
			error_list[i] = wrap_style (&#039;parameter&#039;, v);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (error_list, wrap_style (&#039;parameter&#039;, selected));&lt;br /&gt;
		set_message (error_condition, {make_sep_list (#error_list, error_list)});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return value, selected;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; R E M O V E _ W I K I _ L I N K &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Gets the display text from a wikilink like [[A|B]] or [[B]] gives B&lt;br /&gt;
&lt;br /&gt;
The str:gsub() returns either A|B froma [[A|B]] or B from [[B]] or B from B (no wikilink markup).&lt;br /&gt;
&lt;br /&gt;
In l(), l:gsub() removes the link and pipe (if they exist); the second :gsub() trims whitespace from the label&lt;br /&gt;
if str was wrapped in wikilink markup.  Presumably, this is because without wikimarkup in str, there is no match&lt;br /&gt;
in the initial gsub, the replacement function l() doesn&#039;t get called.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function remove_wiki_link (str)&lt;br /&gt;
	return (str:gsub (&amp;quot;%[%[([^%[%]]*)%]%]&amp;quot;, function(l)&lt;br /&gt;
		return l:gsub (&amp;quot;^[^|]*|(.*)$&amp;quot;, &amp;quot;%1&amp;quot; ):gsub (&amp;quot;^%s*(.-)%s*$&amp;quot;, &amp;quot;%1&amp;quot;);&lt;br /&gt;
	end));&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ W I K I L I N K &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if str is a wikilink, extracts, and returns the wikilink type, link text, and display text parts.&lt;br /&gt;
If str is a complex wikilink ([[L|D]]):&lt;br /&gt;
	returns wl_type 2 and D and L from [[L|D]];&lt;br /&gt;
if str is a simple wikilink ([[D]])&lt;br /&gt;
	returns wl_type 1 and D from [[D]] and L as empty string;&lt;br /&gt;
if not a wikilink:&lt;br /&gt;
	returns wl_type 0, str as D, and L as empty string.&lt;br /&gt;
&lt;br /&gt;
trims leading and trailing whitespace and pipes from L and D ([[L|]] and [[|D]] are accepted by MediaWiki and&lt;br /&gt;
treated like [[D]]; while [[|D|]] is not accepted by MediaWiki, here, we accept it and return D without the pipes).&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_wikilink (str)&lt;br /&gt;
	local D, L&lt;br /&gt;
	local wl_type = 2;															-- assume that str is a complex wikilink [[L|D]]&lt;br /&gt;
&lt;br /&gt;
	if not str:match (&#039;^%[%[[^%]]+%]%]$&#039;) then									-- is str some sort of a wikilink (must have some sort of content)&lt;br /&gt;
		return 0, str, &#039;&#039;;														-- not a wikilink; return wl_type as 0, str as D, and empty string as L&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	L, D = str:match (&#039;^%[%[([^|]+)|([^%]]+)%]%]$&#039;);							-- get L and D from [[L|D]] &lt;br /&gt;
&lt;br /&gt;
	if not is_set (D) then														-- if no separate display&lt;br /&gt;
		D = str:match (&#039;^%[%[([^%]]*)|*%]%]$&#039;);									-- get D from [[D]] or [[D|]]&lt;br /&gt;
		wl_type = 1; &lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	D = mw.text.trim (D, &#039;%s|&#039;);												-- trim white space and pipe characters &lt;br /&gt;
	return wl_type, D, L or &#039;&#039;;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S T R I P _ A P O S T R O P H E _ M A R K U P &amp;gt;--------------------------------&lt;br /&gt;
&lt;br /&gt;
Strip wiki italic and bold markup from argument so that it doesn&#039;t contaminate COinS metadata.&lt;br /&gt;
This function strips common patterns of apostrophe markup.  We presume that editors who have taken the time to&lt;br /&gt;
markup a title have, as a result, provided valid markup. When they don&#039;t, some single apostrophes are left behind.&lt;br /&gt;
&lt;br /&gt;
Returns the argument without wiki markup and a number; the number is more-or-less meaningless except as a flag&lt;br /&gt;
to indicate that markup was replaced; do not rely on it as an indicator of how many of any kind of markup was&lt;br /&gt;
removed; returns the argument and nil when no markup removed&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function strip_apostrophe_markup (argument)&lt;br /&gt;
	if not is_set (argument) then&lt;br /&gt;
		return argument, nil;													-- no argument, nothing to do&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if nil == argument:find ( &amp;quot;&#039;&#039;&amp;quot;, 1, true ) then								-- Is there at least one double apostrophe?  If not, exit.&lt;br /&gt;
		return argument, nil;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local flag;&lt;br /&gt;
	while true do&lt;br /&gt;
		if argument:find (&amp;quot;&#039;&#039;&#039;&#039;&#039;&amp;quot;, 1, true) then								-- bold italic (5)&lt;br /&gt;
			argument, flag = argument:gsub (&amp;quot;%&#039;%&#039;%&#039;%&#039;%&#039;&amp;quot;, &amp;quot;&amp;quot;);					-- remove all instances of it&lt;br /&gt;
		elseif argument:find (&amp;quot;&#039;&#039;&#039;&#039;&amp;quot;, 1, true) then								-- italic start and end without content (4)&lt;br /&gt;
			argument, flag=argument:gsub (&amp;quot;%&#039;%&#039;%&#039;%&#039;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		elseif argument:find (&amp;quot;&#039;&#039;&#039;&amp;quot;, 1, true) then								-- bold (3)&lt;br /&gt;
			argument, flag=argument:gsub (&amp;quot;%&#039;%&#039;%&#039;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		elseif argument:find (&amp;quot;&#039;&#039;&amp;quot;, 1, true) then								-- italic (2)&lt;br /&gt;
			argument, flag = argument:gsub (&amp;quot;%&#039;%&#039;&amp;quot;, &amp;quot;&amp;quot;);&lt;br /&gt;
		else&lt;br /&gt;
			break;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return argument, flag;														-- done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S E L E C T E D _ M O D U L E S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Sets local cfg table to same (live or sandbox) as that used by the other modules.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_selected_modules (cfg_table_ptr)&lt;br /&gt;
	cfg = cfg_table_ptr;&lt;br /&gt;
	&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T S &amp;gt;----------------------------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	add_maint_cat = add_maint_cat,												-- exported functions&lt;br /&gt;
	add_prop_cat = add_prop_cat,&lt;br /&gt;
	error_comment = error_comment,&lt;br /&gt;
	has_accept_as_written = has_accept_as_written,&lt;br /&gt;
	hyphen_to_dash = hyphen_to_dash,&lt;br /&gt;
	in_array = in_array,&lt;br /&gt;
	is_set = is_set,&lt;br /&gt;
	is_wikilink = is_wikilink,&lt;br /&gt;
	make_sep_list = make_sep_list,&lt;br /&gt;
	make_wikilink = make_wikilink,&lt;br /&gt;
	remove_wiki_link = remove_wiki_link,&lt;br /&gt;
	safe_for_italics = safe_for_italics,&lt;br /&gt;
	select_one = select_one,&lt;br /&gt;
	set_message = set_message,&lt;br /&gt;
	set_selected_modules = set_selected_modules,&lt;br /&gt;
	strip_apostrophe_markup = strip_apostrophe_markup,&lt;br /&gt;
	substitute = substitute,&lt;br /&gt;
	wrap_style = wrap_style,&lt;br /&gt;
&lt;br /&gt;
	z = z,																		-- exported table&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Whitelist&amp;diff=606</id>
		<title>Module:Citation/CS1/Whitelist</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Whitelist&amp;diff=606"/>
		<updated>2026-06-06T21:29:22Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;--[[--------------------------&amp;lt; S U P P O R T E D   P A R A M E T E R S &amp;gt;--------------------------------------  Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values: 	true - these parameters are valid and supported parameters 	false - these parameters are deprecated but still supported 	tracked - these parameters are valid and supported parameters tracked in an eponymous properties category 	nil - thes...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;--[[--------------------------&amp;lt; S U P P O R T E D   P A R A M E T E R S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Because a steady-state signal conveys no useful information, whitelist.basic_arguments[] list items can have three values:&lt;br /&gt;
	true - these parameters are valid and supported parameters&lt;br /&gt;
	false - these parameters are deprecated but still supported&lt;br /&gt;
	tracked - these parameters are valid and supported parameters tracked in an eponymous properties category&lt;br /&gt;
	nil - these parameters are no longer supported. remove entirely&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local basic_arguments_t = {&lt;br /&gt;
	[&#039;accessdate&#039;] = true,&lt;br /&gt;
	[&#039;access-date&#039;] = true,&lt;br /&gt;
	[&#039;agency&#039;] = true,&lt;br /&gt;
	[&#039;archivedate&#039;] = true,&lt;br /&gt;
	[&#039;archive-date&#039;] = true,&lt;br /&gt;
	[&#039;archive-format&#039;] = true,&lt;br /&gt;
	[&#039;archiveurl&#039;] = true,&lt;br /&gt;
	[&#039;archive-url&#039;] = true,&lt;br /&gt;
	[&#039;article&#039;] = true,&lt;br /&gt;
	[&#039;article-format&#039;] = true,&lt;br /&gt;
	[&#039;article-number&#039;] = true,													-- {{cite journal}}, {{cite conference}}; {{citation}} when |journal= has a value&lt;br /&gt;
	[&#039;article-url&#039;] = true,&lt;br /&gt;
	[&#039;article-url-access&#039;] = true,&lt;br /&gt;
	[&#039;arxiv&#039;] = true,															-- cite arxiv; here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;asin&#039;] = true,&lt;br /&gt;
	[&#039;ASIN&#039;] = true,&lt;br /&gt;
	[&#039;asin-tld&#039;] = true,&lt;br /&gt;
	[&#039;at&#039;] = true,&lt;br /&gt;
	[&#039;author&#039;] = true,&lt;br /&gt;
	[&#039;author-first&#039;] = true,&lt;br /&gt;
	[&#039;author-given&#039;] = true,&lt;br /&gt;
	[&#039;author-last&#039;] = true,&lt;br /&gt;
	[&#039;author-surname&#039;] = true,&lt;br /&gt;
	[&#039;authorlink&#039;] = true,&lt;br /&gt;
	[&#039;author-link&#039;] = true,&lt;br /&gt;
	[&#039;author-mask&#039;] = true,&lt;br /&gt;
	[&#039;bibcode&#039;] = true,&lt;br /&gt;
	[&#039;bibcode-access&#039;] = true,&lt;br /&gt;
	[&#039;biorxiv&#039;] = true,															-- cite biorxiv; here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;chapter&#039;] = true,&lt;br /&gt;
	[&#039;chapter-format&#039;] = true,&lt;br /&gt;
	[&#039;chapter-url&#039;] = true,&lt;br /&gt;
	[&#039;chapter-url-access&#039;] = true,&lt;br /&gt;
	[&#039;citeseerx&#039;] = true,														-- cite citeseerx; here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;collaboration&#039;] = true,&lt;br /&gt;
	[&#039;contribution&#039;] = true,&lt;br /&gt;
	[&#039;contribution-format&#039;] = true,&lt;br /&gt;
	[&#039;contribution-url&#039;] = true,&lt;br /&gt;
	[&#039;contribution-url-access&#039;] = true,&lt;br /&gt;
	[&#039;contributor&#039;] = true,&lt;br /&gt;
	[&#039;contributor-first&#039;] = true,&lt;br /&gt;
	[&#039;contributor-given&#039;] = true,&lt;br /&gt;
	[&#039;contributor-last&#039;] = true,&lt;br /&gt;
	[&#039;contributor-surname&#039;] = true,&lt;br /&gt;
	[&#039;contributor-link&#039;] = true,&lt;br /&gt;
	[&#039;contributor-mask&#039;] = true,&lt;br /&gt;
	[&#039;date&#039;] = true,&lt;br /&gt;
	[&#039;department&#039;] = true,&lt;br /&gt;
	[&#039;df&#039;] = true,&lt;br /&gt;
	[&#039;dictionary&#039;] = true,&lt;br /&gt;
	[&#039;display-authors&#039;] = true,&lt;br /&gt;
	[&#039;display-contributors&#039;] = true,&lt;br /&gt;
	[&#039;display-editors&#039;] = true,&lt;br /&gt;
	[&#039;display-interviewers&#039;] = true,&lt;br /&gt;
	[&#039;display-subjects&#039;] = true,&lt;br /&gt;
	[&#039;display-translators&#039;] = true,&lt;br /&gt;
	[&#039;doi&#039;] = true,&lt;br /&gt;
	[&#039;DOI&#039;] = true,&lt;br /&gt;
	[&#039;doi-access&#039;] = true,&lt;br /&gt;
	[&#039;doi-broken-date&#039;] = true,&lt;br /&gt;
	[&#039;edition&#039;] = true,&lt;br /&gt;
	[&#039;editor&#039;] = true,&lt;br /&gt;
	[&#039;editor-first&#039;] = true,&lt;br /&gt;
	[&#039;editor-given&#039;] = true,&lt;br /&gt;
	[&#039;editor-last&#039;] = true,&lt;br /&gt;
	[&#039;editor-surname&#039;] = true,&lt;br /&gt;
	[&#039;editor-link&#039;] = true,&lt;br /&gt;
	[&#039;editor-mask&#039;] = true,&lt;br /&gt;
	[&#039;eissn&#039;] = true,&lt;br /&gt;
	[&#039;EISSN&#039;] = true,&lt;br /&gt;
	[&#039;encyclopaedia&#039;] = true,&lt;br /&gt;
	[&#039;encyclopedia&#039;] = true,&lt;br /&gt;
	[&#039;entry&#039;] = true,&lt;br /&gt;
	[&#039;entry-format&#039;] = true,&lt;br /&gt;
	[&#039;entry-url&#039;] = true,&lt;br /&gt;
	[&#039;entry-url-access&#039;] = true,&lt;br /&gt;
	[&#039;eprint&#039;] = true,															-- cite arxiv; here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;first&#039;] = true,&lt;br /&gt;
	[&#039;format&#039;] = true,&lt;br /&gt;
	[&#039;given&#039;] = true,&lt;br /&gt;
	[&#039;hdl&#039;] = true,&lt;br /&gt;
	[&#039;HDL&#039;] = true,&lt;br /&gt;
	[&#039;hdl-access&#039;] = true,&lt;br /&gt;
	[&#039;host&#039;] = true,															-- unique to certain templates?&lt;br /&gt;
	[&#039;id&#039;] = true,&lt;br /&gt;
	[&#039;ID&#039;] = true,&lt;br /&gt;
	[&#039;institution&#039;] = true,														-- constrain to cite thesis?&lt;br /&gt;
	[&#039;interviewer&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-first&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-given&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-last&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-surname&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-link&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-mask&#039;] = true,&lt;br /&gt;
	[&#039;isbn&#039;] = true,&lt;br /&gt;
	[&#039;ISBN&#039;] = true,&lt;br /&gt;
	[&#039;ismn&#039;] = true,&lt;br /&gt;
	[&#039;ISMN&#039;] = true,&lt;br /&gt;
	[&#039;issn&#039;] = true,&lt;br /&gt;
	[&#039;ISSN&#039;] = true,&lt;br /&gt;
	[&#039;issue&#039;] = true,&lt;br /&gt;
	[&#039;jfm&#039;] = true,&lt;br /&gt;
	[&#039;JFM&#039;] = true,&lt;br /&gt;
	[&#039;journal&#039;] = true,&lt;br /&gt;
	[&#039;jstor&#039;] = true,&lt;br /&gt;
	[&#039;JSTOR&#039;] = true,&lt;br /&gt;
	[&#039;jstor-access&#039;] = true,&lt;br /&gt;
	[&#039;lang&#039;] = true,&lt;br /&gt;
	[&#039;language&#039;] = true,&lt;br /&gt;
	[&#039;last&#039;] = true,&lt;br /&gt;
	[&#039;lccn&#039;] = true,&lt;br /&gt;
	[&#039;LCCN&#039;] = true,&lt;br /&gt;
	[&#039;location&#039;] = true,&lt;br /&gt;
	[&#039;magazine&#039;] = true,&lt;br /&gt;
	[&#039;medium&#039;] = true,&lt;br /&gt;
	[&#039;medrxiv&#039;] = true,															-- cite medrxiv; here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;minutes&#039;] = true,															-- constrain to cite AV media and podcast?&lt;br /&gt;
	[&#039;mode&#039;] = true,&lt;br /&gt;
	[&#039;mr&#039;] = true,&lt;br /&gt;
	[&#039;MR&#039;] = true,&lt;br /&gt;
	[&#039;name-list-style&#039;] = true,&lt;br /&gt;
	[&#039;newspaper&#039;] = true,&lt;br /&gt;
	[&#039;no-pp&#039;] = true,&lt;br /&gt;
	[&#039;no-tracking&#039;] = true,&lt;br /&gt;
	[&#039;number&#039;] = true,&lt;br /&gt;
	[&#039;oclc&#039;] = true,&lt;br /&gt;
	[&#039;OCLC&#039;] = true,&lt;br /&gt;
	[&#039;ol&#039;] = true,&lt;br /&gt;
	[&#039;OL&#039;] = true,&lt;br /&gt;
	[&#039;ol-access&#039;] = true,&lt;br /&gt;
	[&#039;orig-date&#039;] = true,&lt;br /&gt;
	[&#039;origyear&#039;] = true,&lt;br /&gt;
	[&#039;orig-year&#039;] = true,&lt;br /&gt;
	[&#039;osti&#039;] = true,&lt;br /&gt;
	[&#039;OSTI&#039;] = true,&lt;br /&gt;
	[&#039;osti-access&#039;] = true,&lt;br /&gt;
	[&#039;others&#039;] = true,&lt;br /&gt;
	[&#039;p&#039;] = true,&lt;br /&gt;
	[&#039;page&#039;] = true,&lt;br /&gt;
	[&#039;pages&#039;] = true,&lt;br /&gt;
	[&#039;periodical&#039;] = true,&lt;br /&gt;
	[&#039;place&#039;] = true,&lt;br /&gt;
	[&#039;pmc&#039;] = true,&lt;br /&gt;
	[&#039;PMC&#039;] = true,&lt;br /&gt;
	[&#039;pmc-embargo-date&#039;] = true,&lt;br /&gt;
	[&#039;pmid&#039;] = true,&lt;br /&gt;
	[&#039;PMID&#039;] = true,&lt;br /&gt;
	[&#039;postscript&#039;] = true,&lt;br /&gt;
	[&#039;pp&#039;] = true,&lt;br /&gt;
	[&#039;publication-date&#039;] = true,&lt;br /&gt;
	[&#039;publication-place&#039;] = true,&lt;br /&gt;
	[&#039;publisher&#039;] = true,&lt;br /&gt;
	[&#039;quotation&#039;] = true,&lt;br /&gt;
	[&#039;quote&#039;] = true,&lt;br /&gt;
	[&#039;quote-page&#039;] = true,&lt;br /&gt;
	[&#039;quote-pages&#039;] = true,&lt;br /&gt;
	[&#039;ref&#039;] = true,&lt;br /&gt;
	[&#039;rfc&#039;] = true,&lt;br /&gt;
	[&#039;RFC&#039;] = true,&lt;br /&gt;
	[&#039;sbn&#039;] = true,&lt;br /&gt;
	[&#039;SBN&#039;] = true,&lt;br /&gt;
	[&#039;scale&#039;] = true,&lt;br /&gt;
	[&#039;script-article&#039;] = true,&lt;br /&gt;
	[&#039;script-chapter&#039;] = true,&lt;br /&gt;
	[&#039;script-contribution&#039;] = true,&lt;br /&gt;
	[&#039;script-encyclopaedia&#039;] = true,&lt;br /&gt;
	[&#039;script-encyclopedia&#039;] = true,&lt;br /&gt;
	[&#039;script-entry&#039;] = true,&lt;br /&gt;
	[&#039;script-journal&#039;] = true,&lt;br /&gt;
	[&#039;script-magazine&#039;] = true,&lt;br /&gt;
	[&#039;script-newspaper&#039;] = true,&lt;br /&gt;
	[&#039;script-periodical&#039;] = true,&lt;br /&gt;
	[&#039;script-quote&#039;] = true,&lt;br /&gt;
	[&#039;script-section&#039;] = true,&lt;br /&gt;
	[&#039;script-title&#039;] = true,&lt;br /&gt;
	[&#039;script-website&#039;] = true,&lt;br /&gt;
	[&#039;script-work&#039;] = true,&lt;br /&gt;
	[&#039;section&#039;] = true,&lt;br /&gt;
	[&#039;section-format&#039;] = true,&lt;br /&gt;
	[&#039;section-url&#039;] = true,&lt;br /&gt;
	[&#039;section-url-access&#039;] = true,&lt;br /&gt;
	[&#039;series&#039;] = true,&lt;br /&gt;
	[&#039;ssrn&#039;] = true,															-- cite ssrn; these three here because allowed in cite ... as identifier&lt;br /&gt;
	[&#039;SSRN&#039;] = true,&lt;br /&gt;
	[&#039;ssrn-access&#039;] = true,&lt;br /&gt;
	[&#039;subject&#039;] = true,&lt;br /&gt;
	[&#039;subject-first&#039;] = true,&lt;br /&gt;
	[&#039;subject-given&#039;] = true,&lt;br /&gt;
	[&#039;subject-last&#039;] = true,&lt;br /&gt;
	[&#039;subject-link&#039;] = true,&lt;br /&gt;
	[&#039;subject-mask&#039;] = true,&lt;br /&gt;
	[&#039;subject-surname&#039;] = true,&lt;br /&gt;
	[&#039;surname&#039;] = true,&lt;br /&gt;
	[&#039;s2cid&#039;] = true,&lt;br /&gt;
	[&#039;S2CID&#039;] = true,&lt;br /&gt;
	[&#039;s2cid-access&#039;] = true,&lt;br /&gt;
	[&#039;template-doc-demo&#039;] = true,&lt;br /&gt;
	[&#039;time&#039;] = true,															-- constrain to cite av media and podcast?&lt;br /&gt;
	[&#039;time-caption&#039;] = true,													-- constrain to cite av media and podcast?&lt;br /&gt;
	[&#039;title&#039;] = true,&lt;br /&gt;
	[&#039;title-link&#039;] = true,&lt;br /&gt;
	[&#039;title-note&#039;] = true,&lt;br /&gt;
	[&#039;translator&#039;] = true,&lt;br /&gt;
	[&#039;translator-first&#039;] = true,&lt;br /&gt;
	[&#039;translator-given&#039;] = true,&lt;br /&gt;
	[&#039;translator-last&#039;] = true,	&lt;br /&gt;
	[&#039;translator-surname&#039;] = true,&lt;br /&gt;
	[&#039;translator-link&#039;] = true,&lt;br /&gt;
	[&#039;translator-mask&#039;] = true,&lt;br /&gt;
	[&#039;trans-article&#039;] = true,&lt;br /&gt;
	[&#039;trans-chapter&#039;] = true,&lt;br /&gt;
	[&#039;trans-contribution&#039;] = true,&lt;br /&gt;
	[&#039;trans-encyclopaedia&#039;] = true,&lt;br /&gt;
	[&#039;trans-encyclopedia&#039;] = true,&lt;br /&gt;
	[&#039;trans-entry&#039;] = true,&lt;br /&gt;
	[&#039;trans-journal&#039;] = true,&lt;br /&gt;
	[&#039;trans-magazine&#039;] = true,&lt;br /&gt;
	[&#039;trans-newspaper&#039;] = true,&lt;br /&gt;
	[&#039;trans-periodical&#039;] = true,&lt;br /&gt;
	[&#039;trans-quote&#039;] = true,&lt;br /&gt;
	[&#039;trans-section&#039;] = true,&lt;br /&gt;
	[&#039;trans-title&#039;] = true,&lt;br /&gt;
	[&#039;trans-website&#039;] = true,&lt;br /&gt;
	[&#039;trans-work&#039;] = true,&lt;br /&gt;
	[&#039;type&#039;] = true,&lt;br /&gt;
	[&#039;url&#039;] = true,&lt;br /&gt;
	[&#039;URL&#039;] = true,&lt;br /&gt;
	[&#039;url-access&#039;] = true,&lt;br /&gt;
	[&#039;url-status&#039;] = true,&lt;br /&gt;
	[&#039;vauthors&#039;] = true,&lt;br /&gt;
	[&#039;veditors&#039;] = true,&lt;br /&gt;
	[&#039;version&#039;] = true,&lt;br /&gt;
	[&#039;via&#039;] = true,&lt;br /&gt;
	[&#039;volume&#039;] = true,&lt;br /&gt;
	[&#039;website&#039;] = true,&lt;br /&gt;
	[&#039;work&#039;] = true,&lt;br /&gt;
	[&#039;year&#039;] = true,&lt;br /&gt;
	[&#039;zbl&#039;] = true,&lt;br /&gt;
	[&#039;ZBL&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local numbered_arguments_t = {&lt;br /&gt;
	[&#039;author#&#039;] = true,&lt;br /&gt;
	[&#039;author-first#&#039;] = true,&lt;br /&gt;
	[&#039;author#-first&#039;] = true,&lt;br /&gt;
	[&#039;author-given#&#039;] = true,&lt;br /&gt;
	[&#039;author#-given&#039;] = true,&lt;br /&gt;
	[&#039;author-last#&#039;] = true,&lt;br /&gt;
	[&#039;author#-last&#039;] = true,&lt;br /&gt;
	[&#039;author-surname#&#039;] = true,&lt;br /&gt;
	[&#039;author#-surname&#039;] = true,&lt;br /&gt;
	[&#039;author-link#&#039;] = true,&lt;br /&gt;
	[&#039;author#-link&#039;] = true,&lt;br /&gt;
	[&#039;authorlink#&#039;] = true,&lt;br /&gt;
	[&#039;author#link&#039;] = true,&lt;br /&gt;
	[&#039;author-mask#&#039;] = true,&lt;br /&gt;
	[&#039;author#-mask&#039;] = true,&lt;br /&gt;
	[&#039;contributor#&#039;] = true,&lt;br /&gt;
	[&#039;contributor-first#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-first&#039;] = true,&lt;br /&gt;
	[&#039;contributor-given#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-given&#039;] = true,&lt;br /&gt;
	[&#039;contributor-last#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-last&#039;] = true,&lt;br /&gt;
	[&#039;contributor-surname#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-surname&#039;] = true,&lt;br /&gt;
	[&#039;contributor-link#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-link&#039;] = true,&lt;br /&gt;
	[&#039;contributor-mask#&#039;] = true,&lt;br /&gt;
	[&#039;contributor#-mask&#039;] = true,&lt;br /&gt;
	[&#039;editor#&#039;] = true,&lt;br /&gt;
	[&#039;editor-first#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-first&#039;] = true,&lt;br /&gt;
	[&#039;editor-given#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-given&#039;] = true,&lt;br /&gt;
	[&#039;editor-last#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-last&#039;] = true,&lt;br /&gt;
	[&#039;editor-surname#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-surname&#039;] = true,&lt;br /&gt;
	[&#039;editor-link#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-link&#039;] = true,&lt;br /&gt;
	[&#039;editor-mask#&#039;] = true,&lt;br /&gt;
	[&#039;editor#-mask&#039;] = true,&lt;br /&gt;
	[&#039;first#&#039;] = true,&lt;br /&gt;
	[&#039;given#&#039;] = true,&lt;br /&gt;
	[&#039;host#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-first#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-first&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-given#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-given&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-last#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-last&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-surname#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-surname&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-link#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-link&#039;] = true,&lt;br /&gt;
	[&#039;interviewer-mask#&#039;] = true,&lt;br /&gt;
	[&#039;interviewer#-mask&#039;] = true,&lt;br /&gt;
	[&#039;last#&#039;] = true,&lt;br /&gt;
	[&#039;subject#&#039;] = true,&lt;br /&gt;
	[&#039;subject-first#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-first&#039;] = true,&lt;br /&gt;
	[&#039;subject-given#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-given&#039;] = true,&lt;br /&gt;
	[&#039;subject-last#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-last&#039;] = true,&lt;br /&gt;
	[&#039;subject-link#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-link&#039;] = true,&lt;br /&gt;
	[&#039;subject-mask#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-mask&#039;] = true,&lt;br /&gt;
	[&#039;subject-surname#&#039;] = true,&lt;br /&gt;
	[&#039;subject#-surname&#039;] = true,&lt;br /&gt;
	[&#039;surname#&#039;] = true,&lt;br /&gt;
	[&#039;translator#&#039;] = true,&lt;br /&gt;
	[&#039;translator-first#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-first&#039;] = true,&lt;br /&gt;
	[&#039;translator-given#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-given&#039;] = true,&lt;br /&gt;
	[&#039;translator-last#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-last&#039;] = true,&lt;br /&gt;
	[&#039;translator-surname#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-surname&#039;] = true,&lt;br /&gt;
	[&#039;translator-link#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-link&#039;] = true,&lt;br /&gt;
	[&#039;translator-mask#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-mask&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P R E P R I N T   S U P P O R T E D   P A R A M E T E R S &amp;gt;--------------------&lt;br /&gt;
&lt;br /&gt;
Cite arXiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn are preprint templates that use the limited&lt;br /&gt;
set of parameters defined in the limited_basic_arguments and limited_numbered_arguments tables.  Those lists are&lt;br /&gt;
supplemented with a template-specific list of parameters that are required by the particular template and may be&lt;br /&gt;
exclusive to one of the preprint templates.  Some of these parameters may also be available to the general cs1|2&lt;br /&gt;
templates.&lt;br /&gt;
&lt;br /&gt;
Same conventions for true/false/tracked/nil as above.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local preprint_arguments_t = {&lt;br /&gt;
	arxiv = {&lt;br /&gt;
		[&#039;arxiv&#039;] = true,														-- cite arxiv and arxiv identifiers&lt;br /&gt;
		[&#039;class&#039;] = true,&lt;br /&gt;
		[&#039;eprint&#039;] = true,														-- cite arxiv and arxiv identifiers&lt;br /&gt;
		},&lt;br /&gt;
	biorxiv = {&lt;br /&gt;
		[&#039;biorxiv&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	citeseerx = {&lt;br /&gt;
		[&#039;citeseerx&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	medrxiv = {&lt;br /&gt;
		[&#039;medrxiv&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	ssrn = {&lt;br /&gt;
		[&#039;ssrn&#039;] = true,&lt;br /&gt;
		[&#039;SSRN&#039;] = true,&lt;br /&gt;
		[&#039;ssrn-access&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I M I T E D   S U P P O R T E D   P A R A M E T E R S &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
cite arxiv, cite biorxiv, cite citeseerx, cite medrxiv, and cite ssrn templates are preprint templates so are&lt;br /&gt;
allowed only a limited subset of parameters allowed to all other cs1|2 templates.  The limited subset is defined&lt;br /&gt;
here.&lt;br /&gt;
&lt;br /&gt;
This list of parameters also used by {{cite document}}&lt;br /&gt;
&lt;br /&gt;
Same conventions for true/false/tracked/nil as above.&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local limited_basic_arguments_t = {&lt;br /&gt;
	[&#039;at&#039;] = true,&lt;br /&gt;
	[&#039;author&#039;] = true,&lt;br /&gt;
	[&#039;author-first&#039;] = true,&lt;br /&gt;
	[&#039;author-given&#039;] = true,&lt;br /&gt;
	[&#039;author-last&#039;] = true,&lt;br /&gt;
	[&#039;author-surname&#039;] = true,&lt;br /&gt;
	[&#039;author-link&#039;] = true,&lt;br /&gt;
	[&#039;authorlink&#039;] = true,&lt;br /&gt;
	[&#039;author-mask&#039;] = true,&lt;br /&gt;
	[&#039;collaboration&#039;] = true,&lt;br /&gt;
	[&#039;date&#039;] = true,&lt;br /&gt;
	[&#039;df&#039;] = true,&lt;br /&gt;
	[&#039;display-authors&#039;] = true,&lt;br /&gt;
	[&#039;first&#039;] = true,&lt;br /&gt;
	[&#039;given&#039;] = true,&lt;br /&gt;
	[&#039;language&#039;] = true,&lt;br /&gt;
	[&#039;last&#039;] = true,&lt;br /&gt;
	[&#039;mode&#039;] = true,&lt;br /&gt;
	[&#039;name-list-style&#039;] = true,&lt;br /&gt;
	[&#039;no-tracking&#039;] = true,&lt;br /&gt;
	[&#039;p&#039;] = true,&lt;br /&gt;
	[&#039;page&#039;] = true,&lt;br /&gt;
	[&#039;pages&#039;] = true,&lt;br /&gt;
	[&#039;postscript&#039;] = true,&lt;br /&gt;
	[&#039;pp&#039;] = true,&lt;br /&gt;
	[&#039;quotation&#039;] = true,&lt;br /&gt;
	[&#039;quote&#039;] = true,&lt;br /&gt;
	[&#039;ref&#039;] = true,&lt;br /&gt;
	[&#039;surname&#039;] = true,&lt;br /&gt;
	[&#039;template-doc-demo&#039;] = true,&lt;br /&gt;
	[&#039;title&#039;] = true,&lt;br /&gt;
	[&#039;trans-title&#039;] = true,&lt;br /&gt;
	[&#039;vauthors&#039;] = true,&lt;br /&gt;
	[&#039;year&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local limited_numbered_arguments_t = {&lt;br /&gt;
	[&#039;author#&#039;] = true,&lt;br /&gt;
	[&#039;author-first#&#039;] = true,&lt;br /&gt;
	[&#039;author#-first&#039;] = true,&lt;br /&gt;
	[&#039;author-given#&#039;] = true,&lt;br /&gt;
	[&#039;author#-given&#039;] = true,&lt;br /&gt;
	[&#039;author-last#&#039;] = true,&lt;br /&gt;
	[&#039;author#-last&#039;] = true,&lt;br /&gt;
	[&#039;author-surname#&#039;] = true,&lt;br /&gt;
	[&#039;author#-surname&#039;] = true,&lt;br /&gt;
	[&#039;author-link#&#039;] = true,&lt;br /&gt;
	[&#039;author#-link&#039;] = true,&lt;br /&gt;
	[&#039;authorlink#&#039;] = true,&lt;br /&gt;
	[&#039;author#link&#039;] = true,&lt;br /&gt;
	[&#039;author-mask#&#039;] = true,&lt;br /&gt;
	[&#039;author#-mask&#039;] = true,&lt;br /&gt;
	[&#039;first#&#039;] = true,&lt;br /&gt;
	[&#039;given#&#039;] = true,&lt;br /&gt;
	[&#039;last#&#039;] = true,&lt;br /&gt;
	[&#039;surname#&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U N I Q U E _ A R G U M E N T S &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Some templates have unique parameters.  Those templates and their unique parameters are listed here. Keys in this&lt;br /&gt;
table are the template&#039;s CitationClass parameter value&lt;br /&gt;
&lt;br /&gt;
Same conventions for true/false/tracked/nil as above.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local unique_arguments_t = {&lt;br /&gt;
	[&#039;audio-visual&#039;] = {&lt;br /&gt;
		[&#039;people&#039;] = true,&lt;br /&gt;
		[&#039;transcript&#039;] = true,&lt;br /&gt;
		[&#039;transcript-format&#039;] = true,&lt;br /&gt;
		[&#039;transcript-url&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	conference = {&lt;br /&gt;
		[&#039;book-title&#039;] = true,&lt;br /&gt;
		[&#039;conference&#039;] = true,&lt;br /&gt;
		[&#039;conference-format&#039;] = true,&lt;br /&gt;
		[&#039;conference-url&#039;] = true,&lt;br /&gt;
		[&#039;event&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	episode = {&lt;br /&gt;
		[&#039;airdate&#039;] = true,&lt;br /&gt;
		[&#039;air-date&#039;] = true,&lt;br /&gt;
		[&#039;credits&#039;] = true,&lt;br /&gt;
		[&#039;episode-link&#039;] = true,												-- alias of |title-link=&lt;br /&gt;
		[&#039;network&#039;] = true,&lt;br /&gt;
		[&#039;people&#039;] = true,&lt;br /&gt;
		[&#039;season&#039;] = true,&lt;br /&gt;
		[&#039;series-link&#039;] = true,&lt;br /&gt;
		[&#039;series-no&#039;] = true,&lt;br /&gt;
		[&#039;series-number&#039;] = true,&lt;br /&gt;
		[&#039;station&#039;] = true,&lt;br /&gt;
		[&#039;transcript&#039;] = true,&lt;br /&gt;
		[&#039;transcript-format&#039;] = true,&lt;br /&gt;
		[&#039;transcript-url&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	mailinglist = {&lt;br /&gt;
		[&#039;mailing-list&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	map = {&lt;br /&gt;
		[&#039;cartography&#039;] = true,&lt;br /&gt;
		[&#039;inset&#039;] = true,&lt;br /&gt;
		[&#039;map&#039;] = true,&lt;br /&gt;
		[&#039;map-format&#039;] = true,&lt;br /&gt;
		[&#039;map-url&#039;] = true,&lt;br /&gt;
		[&#039;map-url-access&#039;] = true,&lt;br /&gt;
		[&#039;script-map&#039;] = true,&lt;br /&gt;
		[&#039;sections&#039;] = true,&lt;br /&gt;
		[&#039;sheet&#039;] = true,&lt;br /&gt;
		[&#039;sheets&#039;] = true,&lt;br /&gt;
		[&#039;trans-map&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	newsgroup = {&lt;br /&gt;
		[&#039;message-id&#039;] = true,&lt;br /&gt;
		[&#039;newsgroup&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	report = {&lt;br /&gt;
		[&#039;docket&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	serial = {&lt;br /&gt;
		[&#039;airdate&#039;] = true,&lt;br /&gt;
		[&#039;air-date&#039;] = true,&lt;br /&gt;
		[&#039;credits&#039;] = true,&lt;br /&gt;
		[&#039;episode&#039;] = true,														-- cite serial only TODO: make available to cite episode?&lt;br /&gt;
		[&#039;episode-link&#039;] = true,												-- alias of |title-link=&lt;br /&gt;
		[&#039;network&#039;] = true,&lt;br /&gt;
		[&#039;people&#039;] = true,&lt;br /&gt;
		[&#039;series-link&#039;] = true,&lt;br /&gt;
		[&#039;station&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	speech = {&lt;br /&gt;
		[&#039;conference&#039;] = true,&lt;br /&gt;
		[&#039;conference-format&#039;] = true,&lt;br /&gt;
		[&#039;conference-url&#039;] = true,&lt;br /&gt;
		[&#039;event&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	thesis = {&lt;br /&gt;
		[&#039;degree&#039;] = true,&lt;br /&gt;
		[&#039;docket&#039;] = true,&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E _ D O C U M E N T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Special case for cite document.  This template takes the limited basic and limited enumerated parameters plus&lt;br /&gt;
others that are apply only to standalone published sources that cannot be cited any other way; no url, book,&lt;br /&gt;
periodical, etc parameters; limited support for name lists and named identifiers.&lt;br /&gt;
&lt;br /&gt;
when validating parameters in {{cite document}} templates, the basic and &lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local document_arguments_t = {&lt;br /&gt;
	[&#039;bibcode&#039;] = true,&lt;br /&gt;
	[&#039;bibcode-access&#039;] = true,&lt;br /&gt;
	[&#039;doi&#039;] = true,&lt;br /&gt;
	[&#039;DOI&#039;] = true,&lt;br /&gt;
	[&#039;doi-access&#039;] = true,&lt;br /&gt;
	[&#039;doi-broken-date&#039;] = true,&lt;br /&gt;
	[&#039;hdl&#039;] = true,&lt;br /&gt;
	[&#039;HDL&#039;] = true,&lt;br /&gt;
	[&#039;hdl-access&#039;] = true,&lt;br /&gt;
	[&#039;id&#039;] = true,&lt;br /&gt;
	[&#039;ID&#039;] = true,&lt;br /&gt;
	[&#039;jfm&#039;] = true,&lt;br /&gt;
	[&#039;JFM&#039;] = true,&lt;br /&gt;
	[&#039;lang&#039;] = true,&lt;br /&gt;
	[&#039;location&#039;] = true,&lt;br /&gt;
	[&#039;mr&#039;] = true,&lt;br /&gt;
	[&#039;MR&#039;] = true,&lt;br /&gt;
	[&#039;no-pp&#039;] = true,&lt;br /&gt;
	[&#039;orig-date&#039;] = true,&lt;br /&gt;
	[&#039;origyear&#039;] = true,&lt;br /&gt;
	[&#039;orig-year&#039;] = true,&lt;br /&gt;
	[&#039;osti&#039;] = true,&lt;br /&gt;
	[&#039;OSTI&#039;] = true,&lt;br /&gt;
	[&#039;osti-access&#039;] = true,&lt;br /&gt;
	[&#039;place&#039;] = true,&lt;br /&gt;
	[&#039;publisher&#039;] = true,&lt;br /&gt;
	[&#039;quote-page&#039;] = true,&lt;br /&gt;
	[&#039;quote-pages&#039;] = true,&lt;br /&gt;
	[&#039;script-quote&#039;] = true,&lt;br /&gt;
	[&#039;script-title&#039;] = true,&lt;br /&gt;
	[&#039;title-link&#039;] = true,&lt;br /&gt;
	[&#039;translator&#039;] = true,&lt;br /&gt;
	[&#039;translator-first&#039;] = true,&lt;br /&gt;
	[&#039;translator-given&#039;] = true,&lt;br /&gt;
	[&#039;translator-last&#039;] = true,&lt;br /&gt;
	[&#039;translator-surname&#039;] = true,&lt;br /&gt;
	[&#039;translator-link&#039;] = true,&lt;br /&gt;
	[&#039;translator-mask&#039;] = true,&lt;br /&gt;
	[&#039;trans-quote&#039;] = true,&lt;br /&gt;
	[&#039;type&#039;] = true,&lt;br /&gt;
	[&#039;zbl&#039;] = true,&lt;br /&gt;
	[&#039;ZBL&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local document_numbered_arguments_t = {&lt;br /&gt;
	[&#039;translator#&#039;] = true,&lt;br /&gt;
	[&#039;translator-first#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-first&#039;] = true,&lt;br /&gt;
	[&#039;translator-given#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-given&#039;] = true,&lt;br /&gt;
	[&#039;translator-last#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-last&#039;] = true,&lt;br /&gt;
	[&#039;translator-surname#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-surname&#039;] = true,&lt;br /&gt;
	[&#039;translator-link#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-link&#039;] = true,&lt;br /&gt;
	[&#039;translator-mask#&#039;] = true,&lt;br /&gt;
	[&#039;translator#-mask&#039;] = true,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I S T _ C O M B I N E &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
makes one table from a list of tables.  &amp;lt;lists_t&amp;gt; is a sequence of tables to be combined&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function list_combine (lists_t)&lt;br /&gt;
	local out_t = {};&lt;br /&gt;
&lt;br /&gt;
	for _, list_t in ipairs (lists_t) do										-- for each list in &amp;lt;lists_t&amp;gt;&lt;br /&gt;
		for k, v in pairs (list_t) do											-- extract each k/v pair&lt;br /&gt;
			out_t[k] = v;														-- add to &amp;lt;out_t&amp;gt;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return out_t;																-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T E M P L A T E _ L I S T _ G E T &amp;gt;--------------------------------------------&lt;br /&gt;
&lt;br /&gt;
gets a list of the templates from table t&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function template_list_get (t)&lt;br /&gt;
	local out_t = {};															-- a table for output&lt;br /&gt;
	for k, _ in pairs (t) do													-- spin through the table and collect the keys&lt;br /&gt;
		table.insert (out_t, k)													-- add each key to the output table&lt;br /&gt;
	end&lt;br /&gt;
	return out_t;																-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   T A B L E S &amp;gt;------------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	preprint_arguments_t = preprint_arguments_t,&lt;br /&gt;
	preprint_template_list_t = template_list_get (preprint_arguments_t),		-- make a template list from preprint_arguments{} table&lt;br /&gt;
	unique_arguments_t = unique_arguments_t,&lt;br /&gt;
	unique_param_template_list_t = template_list_get (unique_arguments_t),		-- make a template list from unique_arguments{} table&lt;br /&gt;
	&lt;br /&gt;
	document_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t, document_arguments_t, document_numbered_arguments_t});&lt;br /&gt;
	common_parameters_t = list_combine ({basic_arguments_t, numbered_arguments_t});&lt;br /&gt;
	limited_parameters_t = list_combine ({limited_basic_arguments_t, limited_numbered_arguments_t});&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Configuration&amp;diff=604</id>
		<title>Module:Citation/CS1/Configuration</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1/Configuration&amp;diff=604"/>
		<updated>2026-06-06T21:28:24Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;local lang_obj = mw.language.getContentLanguage();								-- make a language object for the local language; used here for languages and dates    ----------------------------&amp;lt; S E T T I N G S &amp;gt;--------------------------------------------------------------  boolean settings used to control various things.  these setting located here to make them easy to find   																				-- these settings local to this module only local local_digits_from_mediawiki = false;...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local lang_obj = mw.language.getContentLanguage();								-- make a language object for the local language; used here for languages and dates &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T T I N G S &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
boolean settings used to control various things.  these setting located here to make them easy to find&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
																				-- these settings local to this module only&lt;br /&gt;
local local_digits_from_mediawiki = false;										-- for i18n; when true, module fills date_names[&#039;local_digits&#039;] from MediaWiki; manual fill required else; always false at en.wiki&lt;br /&gt;
local local_date_names_from_mediawiki = false;									-- for i18n; when true, module fills date_names[&#039;local&#039;][&#039;long&#039;] and date_names[&#039;local&#039;][&#039;short&#039;] from MediaWiki;&lt;br /&gt;
																				-- manual translation required else; ; always false at en.wiki&lt;br /&gt;
&lt;br /&gt;
																				-- these settings exported to other modules&lt;br /&gt;
local use_identifier_redirects = true;											-- when true use redirect name for identifier label links; always true at en.wiki&lt;br /&gt;
local local_lang_cat_enable = false;											-- when true categorizes pages where |language=&amp;lt;local wiki&#039;s language&amp;gt;; always false at en.wiki&lt;br /&gt;
local date_name_auto_xlate_enable = false;										-- when true translates English month-names to the local-wiki&#039;s language month names; always false at en.wiki&lt;br /&gt;
local date_digit_auto_xlate_enable = false;										-- when true translates Western date digit to the local-wiki&#039;s language digits (date_names[&#039;local_digits&#039;]); always false at en.wiki&lt;br /&gt;
local enable_sort_keys = true;													-- when true module adds namespace sort keys to error and maintenance category links&lt;br /&gt;
&lt;br /&gt;
local suppress_archive_today_urls = true;										-- when true module suppresses all parameters with an archive.today url and any deprendent parameters&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U N C A T E G O R I Z E D _ N A M E S P A C E S &amp;gt;------------------------------&lt;br /&gt;
&lt;br /&gt;
List of namespaces identifiers for namespaces that will not be included in citation error categories.&lt;br /&gt;
Same as setting notracking = true by default.&lt;br /&gt;
&lt;br /&gt;
For wikis that have a current version of Module:cs1 documentation support, this #invoke will return an unordered&lt;br /&gt;
list of namespace names and their associated identifiers:&lt;br /&gt;
	{{#invoke:cs1 documentation support|uncategorized_namespace_lister|all=&amp;lt;anything&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local uncategorized_namespaces_t = {[2]=true};										-- init with user namespace id&lt;br /&gt;
for k, _ in pairs (mw.site.talkNamespaces) do									-- add all talk namespace ids&lt;br /&gt;
	uncategorized_namespaces_t[k] = true;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local uncategorized_subpages = {&#039;/[Ss]andbox&#039;, &#039;/[Tt]estcases&#039;, &#039;/[^/]*[Ll]og&#039;, &#039;/[Aa]rchive&#039;};		-- list of Lua patterns found in page names of pages we should not categorize&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
at en.wiki Greek characters are used as sort keys for certain items in a category so that those items are&lt;br /&gt;
placed at the end of a category page.  See Wikipedia:Categorization#Sort_keys.  That works well for en.wiki&lt;br /&gt;
because English is written using the Latn script.  This may not work well for other languages.  At en.wiki it&lt;br /&gt;
is desireable to place content from certain namespaces at the end of a category listing so the module adds sort&lt;br /&gt;
keys to error and maintenance category links when rendering a cs1|2 template on a page in that namespace.&lt;br /&gt;
&lt;br /&gt;
i18n: if this does not work well for your language, set &amp;lt;enable_sort_keys&amp;gt; to false.&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local name_space_sort_keys = {													-- sort keys to be used with these namespaces:&lt;br /&gt;
	[4] = &#039;ω&#039;,																	-- wikipedia; omega&lt;br /&gt;
	[10] = &#039;τ&#039;,																	-- template; tau&lt;br /&gt;
	[118] = &#039;Δ&#039;, 																-- draft; delta&lt;br /&gt;
	[&#039;other&#039;] = &#039;ο&#039;,															-- all other non-talk namespaces except main (article); omicron&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M E S S A G E S &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Translation table&lt;br /&gt;
&lt;br /&gt;
The following contains fixed text that may be output as part of a citation.&lt;br /&gt;
This is separated from the main body to aid in future translations of this&lt;br /&gt;
module.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local messages = {&lt;br /&gt;
	[&#039;agency&#039;] = &#039;$1 $2&#039;,														-- $1 is sepc, $2 is agency&lt;br /&gt;
	[&#039;archived-dead&#039;] = &#039;Archived from $1 on $2&#039;,&lt;br /&gt;
	[&#039;archived-live&#039;] = &#039;$1 from the original on $2&#039;,&lt;br /&gt;
	[&#039;archived-unfit&#039;] = &#039;Archived from the original on $1&#039;,&lt;br /&gt;
	[&#039;archived&#039;] = &#039;Archived&#039;,&lt;br /&gt;
	[&#039;by&#039;] = &#039;By&#039;,																-- contributions to authored works: introduction, foreword, afterword&lt;br /&gt;
	[&#039;cartography&#039;] = &#039;Cartography by $1&#039;,&lt;br /&gt;
	[&#039;editor&#039;] = &#039;ed.&#039;,&lt;br /&gt;
	[&#039;editors&#039;] = &#039;eds.&#039;,&lt;br /&gt;
	[&#039;edition&#039;] = &#039;($1&amp;amp;nbsp;ed.)&#039;,&lt;br /&gt;
	[&#039;episode&#039;] = &#039;Episode $1&#039;,&lt;br /&gt;
	[&#039;et al&#039;] = &#039;et&amp;amp;nbsp;al.&#039;,&lt;br /&gt;
	[&#039;in&#039;] = &#039;In&#039;,																-- edited works&lt;br /&gt;
	[&#039;inactive&#039;] = &#039; (inactive $1)&#039;,											-- $1 is date which the doi was found to be broken in &lt;br /&gt;
	[&#039;inset&#039;] = &#039;$1 inset&#039;,&lt;br /&gt;
	[&#039;interview&#039;] = &#039;Interviewed by $1&#039;,&lt;br /&gt;
	invisible_1 = &#039;$1 $2&#039;,														-- $1 stripmarker name; $2 is text from &amp;lt;invisible_chars[1]&amp;gt;&lt;br /&gt;
	invisible_2 = &#039;$1 character&#039;,												-- $1 character name from &amp;lt;invisible_chars[1]&amp;gt;&lt;br /&gt;
	[&#039;mismatch&#039;] = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; / &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt; mismatch&#039;,	-- $1 is year param name; $2 is date param name&lt;br /&gt;
	[&#039;newsgroup&#039;] = &#039;[[Usenet newsgroup|Newsgroup]]:&amp;amp;nbsp;$1&#039;,&lt;br /&gt;
	[&#039;notitle&#039;] = &#039;No title&#039;,													-- for |title=(()) and (in the future) |title=none&lt;br /&gt;
	[&#039;original&#039;] = &#039;the original&#039;,&lt;br /&gt;
	[&#039;origdate&#039;] = &#039; [$1]&#039;,&lt;br /&gt;
	[&#039;published&#039;] = &#039; (published $1)&#039;,&lt;br /&gt;
	[&#039;retrieved&#039;] = &#039;Retrieved $1&#039;,&lt;br /&gt;
	[&#039;season&#039;] = &#039;Season $1&#039;,&lt;br /&gt;
	[&#039;section&#039;] = &#039;§&amp;amp;nbsp;$1&#039;,&lt;br /&gt;
	[&#039;sections&#039;] = &#039;§§&amp;amp;nbsp;$1&#039;,&lt;br /&gt;
	[&#039;series&#039;] = &#039;$1 $2&#039;,														-- $1 is sepc, $2 is series&lt;br /&gt;
	[&#039;seriesnum&#039;] = &#039;Series $1&#039;,&lt;br /&gt;
	[&#039;translated&#039;] = &#039;Translated by $1&#039;,&lt;br /&gt;
	[&#039;type&#039;] = &#039; ($1)&#039;,															-- for titletype&lt;br /&gt;
&lt;br /&gt;
	wikidata = &#039;Wikidata&#039;,														-- these used for interwikilinked author/editor/... names&lt;br /&gt;
	wikipedia = &#039;Wikipedia&#039;,&lt;br /&gt;
	wikisource = &#039;Wikisource&#039;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;written&#039;] = &#039;Written at $1&#039;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;vol&#039;] = &#039;$1 Vol.&amp;amp;nbsp;$2&#039;,												-- $1 is sepc; bold journal style volume is in presentation{}&lt;br /&gt;
	[&#039;vol-no&#039;] = &#039;$1 Vol.&amp;amp;nbsp;$2, no.&amp;amp;nbsp;$3&#039;,								-- sepc, volume, issue (alternatively insert $1 after $2, but then we&#039;d also have to change capitalization)&lt;br /&gt;
	[&#039;issue&#039;] = &#039;$1 No.&amp;amp;nbsp;$2&#039;,												-- $1 is sepc&lt;br /&gt;
&lt;br /&gt;
	[&#039;art&#039;] = &#039;$1 Art.&amp;amp;nbsp;$2&#039;,												-- $1 is sepc; for {{cite conference}} only&lt;br /&gt;
	[&#039;vol-art&#039;] = &#039;$1 Vol.&amp;amp;nbsp;$2, art.&amp;amp;nbsp;$3&#039;,								-- sepc, volume, article-number; for {{cite conference}} only&lt;br /&gt;
&lt;br /&gt;
	[&#039;j-vol&#039;] = &#039;$1 $2&#039;,														-- sepc, volume; bold journal volume is in presentation{}&lt;br /&gt;
	[&#039;j-issue&#039;] = &#039; ($1)&#039;,&lt;br /&gt;
	[&#039;j-article-num&#039;] = &#039; $1&#039;,													-- TODO: any punctuation here? static text?&lt;br /&gt;
&lt;br /&gt;
	[&#039;nopp&#039;] = &#039;$1 $2&#039;;															-- page(s) without prefix; $1 is sepc&lt;br /&gt;
&lt;br /&gt;
	[&#039;p-prefix&#039;] = &amp;quot;$1 p.&amp;amp;nbsp;$2&amp;quot;,												-- $1 is sepc&lt;br /&gt;
	[&#039;pp-prefix&#039;] = &amp;quot;$1 pp.&amp;amp;nbsp;$2&amp;quot;,											-- $1 is sepc&lt;br /&gt;
	[&#039;j-page(s)&#039;] = &#039;: $1&#039;,														-- same for page and pages&lt;br /&gt;
&lt;br /&gt;
	[&#039;sheet&#039;] = &#039;$1 Sheet&amp;amp;nbsp;$2&#039;,												-- $1 is sepc&lt;br /&gt;
	[&#039;sheets&#039;] = &#039;$1 Sheets&amp;amp;nbsp;$2&#039;,											-- $1 is sepc&lt;br /&gt;
	[&#039;j-sheet&#039;] = &#039;: Sheet&amp;amp;nbsp;$1&#039;,&lt;br /&gt;
	[&#039;j-sheets&#039;] = &#039;: Sheets&amp;amp;nbsp;$1&#039;,&lt;br /&gt;
	&lt;br /&gt;
	[&#039;language&#039;] = &#039;(in $1)&#039;,&lt;br /&gt;
	[&#039;via&#039;] = &amp;quot; &amp;amp;ndash; via $1&amp;quot;,&lt;br /&gt;
	[&#039;event&#039;] = &#039;Event occurs at&#039;,&lt;br /&gt;
	[&#039;minutes&#039;] = &#039; $1 minutes in&#039;,												-- $1 is the number of minutes&lt;br /&gt;
	&lt;br /&gt;
	-- Determines the location of the help page&lt;br /&gt;
	[&#039;help page link&#039;] = &#039;Help:CS1 errors&#039;,&lt;br /&gt;
	[&#039;help page label&#039;] = &#039;help&#039;,&lt;br /&gt;
	&lt;br /&gt;
	-- categories&lt;br /&gt;
	[&#039;cat wikilink&#039;] = &#039;[[Category:$1]]&#039;,										-- $1 is the category name&lt;br /&gt;
	[&#039;cat wikilink sk&#039;] = &#039;[[Category:$1|$2]]&#039;,									-- $1 is the category name; $2 is namespace sort key&lt;br /&gt;
	[&#039;:cat wikilink&#039;] = &#039;[[:Category:$1|link]]&#039;,								-- category name as maintenance message wikilink; $1 is the category name&lt;br /&gt;
&lt;br /&gt;
	-- Internal errors (should only occur if configuration is bad)&lt;br /&gt;
	[&#039;undefined_error&#039;] = &#039;Called with an undefined error condition&#039;,&lt;br /&gt;
	[&#039;unknown_ID_key&#039;] = &#039;Unrecognized ID key: &#039;,								-- an ID key in id_handlers not found in ~/Identifiers func_map{}&lt;br /&gt;
	[&#039;unknown_ID_access&#039;] = &#039;Unrecognized ID access keyword: &#039;,					-- an ID access keyword in id_handlers not found in keywords_lists[&#039;id-access&#039;]{}&lt;br /&gt;
	[&#039;unknown_argument_map&#039;] = &#039;Argument map not defined for this variable&#039;,&lt;br /&gt;
	[&#039;bare_url_no_origin&#039;] = &#039;Bare URL found but origin indicator is nil or empty&#039;,&lt;br /&gt;
	&lt;br /&gt;
	[&#039;warning_msg_e&#039;] = &#039;&amp;lt;span style=&amp;quot;color:#d33&amp;quot;&amp;gt;&amp;lt;code style=&amp;quot;color: inherit; background: inherit; border: none; padding: inherit;&amp;quot;&amp;gt;&amp;amp;#123;{$1}}&amp;lt;/code&amp;gt;: this [[#$2|reference]] has errors&amp;lt;/span&amp;gt;; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).&#039;;	-- $1 is template link; $2 is anchor ID&lt;br /&gt;
	[&#039;warning_msg_m&#039;] = &#039;&amp;lt;span style=&amp;quot;color:#085&amp;quot;&amp;gt;&amp;lt;code style=&amp;quot;color: inherit; background: inherit; border: none; padding: inherit;&amp;quot;&amp;gt;&amp;amp;#123;{$1}}&amp;lt;/code&amp;gt;: this [[#$2|reference]] has maintenance messages&amp;lt;/span&amp;gt;; messages may be hidden ([[Help:CS1_errors#Controlling_error_message_display|help]]).&#039;;	-- $1 is template link; $2 is anchor ID&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T A T I O N _ C L A S S _ M A P &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
this table maps the value assigned to |CitationClass= in the cs1|2 templates to the canonical template name when&lt;br /&gt;
the value assigned to |CitationClass= is different from the canonical template name.  |CitationClass= values are&lt;br /&gt;
used as class attributes in the &amp;lt;cite&amp;gt; tag that encloses the citation so these names may not contain spaces while&lt;br /&gt;
the canonical template name may.  These names are used in warning_msg_e and warning_msg_m to create links to the&lt;br /&gt;
template&#039;s documentation when an article is displayed in preview mode.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
	local citation_class_map_t = {												-- TODO: in Module:Cite/config write a function to use this table &lt;br /&gt;
		arxiv = &#039;cite arXiv&#039;,													-- as the source for known_templates_t and citation_classes_t&lt;br /&gt;
		[&#039;audio-visual&#039;] = &#039;cite AV media&#039;,&lt;br /&gt;
		[&#039;AV-media-notes&#039;] = &#039;cite AV media notes&#039;,&lt;br /&gt;
		biorxiv = &#039;cite bioRxiv&#039;,&lt;br /&gt;
		book = &#039;cite book&#039;,&lt;br /&gt;
		citation = &#039;citation&#039;,&lt;br /&gt;
		citeseerx = &#039;cite CiteSeerX&#039;,&lt;br /&gt;
		conference = &#039;cite conference&#039;,&lt;br /&gt;
		document = &#039;cite document&#039;,&lt;br /&gt;
		encyclopaedia = &#039;cite encyclopedia&#039;,&lt;br /&gt;
		episode = &#039;cite episode&#039;,&lt;br /&gt;
		interview = &#039;cite interview&#039;,&lt;br /&gt;
		journal = &#039;cite journal&#039;,&lt;br /&gt;
		magazine = &#039;cite magazine&#039;,&lt;br /&gt;
		mailinglist = &#039;cite mailing list&#039;,&lt;br /&gt;
		map = &#039;cite map&#039;,&lt;br /&gt;
		medrxiv = &#039;cite medRxiv&#039;,&lt;br /&gt;
		news = &#039;cite news&#039;,&lt;br /&gt;
		newsgroup = &#039;cite newsgroup&#039;,&lt;br /&gt;
		podcast = &#039;cite podcast&#039;,&lt;br /&gt;
		pressrelease = &#039;cite press release&#039;,&lt;br /&gt;
		report = &#039;cite report&#039;,&lt;br /&gt;
		serial = &#039;cite serial&#039;,&lt;br /&gt;
		sign = &#039;cite sign&#039;,&lt;br /&gt;
		speech = &#039;cite speech&#039;,&lt;br /&gt;
		ssrn = &#039;cite SSRN&#039;,&lt;br /&gt;
		techreport = &#039;cite tech report&#039;,&lt;br /&gt;
		thesis = &#039;cite thesis&#039;,&lt;br /&gt;
		web = &#039;cite web&#039;,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; E T _ A L _ P A T T E R N S &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This table provides Lua patterns for the phrase &amp;quot;et al&amp;quot; and variants in name text&lt;br /&gt;
(author, editor, etc.). The main module uses these to identify and emit the &#039;etal&#039; message.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local et_al_patterns = {&lt;br /&gt;
	&amp;quot;[;,]? *[\&amp;quot;&#039;]*%f[%a][Ee][Tt]%.? *[Aa][Ll][%.;,\&amp;quot;&#039;]*$&amp;quot;,						-- variations on the &#039;et al&#039; theme&lt;br /&gt;
	&amp;quot;[;,]? *[\&amp;quot;&#039;]*%f[%a][Ee][Tt]%.? *[Aa][Ll][Ii][AaIi][Ee]?[%.;,\&amp;quot;&#039;]*$&amp;quot;,		-- variations on the &#039;et alia&#039;, &#039;et alii&#039; and &#039;et aliae&#039; themes (false positive &#039;et aliie&#039; unlikely to match)&lt;br /&gt;
	&amp;quot;[;,]? *%f[%a]and [Oo]thers&amp;quot;,												-- an alternative to et al.&lt;br /&gt;
	&amp;quot;%[%[ *[Ee][Tt]%.? *[Aa][Ll]%.? *%]%]&amp;quot;,										-- a wikilinked form&lt;br /&gt;
	&amp;quot;%(%( *[Ee][Tt]%.? *[Aa][Ll]%.? *%)%)&amp;quot;,										-- a double-bracketed form (to counter partial removal of ((...)) syntax)&lt;br /&gt;
	&amp;quot;[%(%[] *[Ee][Tt]%.? *[Aa][Ll]%.? *[%)%]]&amp;quot;,									-- a bracketed form&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P R E S E N T A T I O N &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Fixed presentation markup.  Originally part of citation_config.messages it has&lt;br /&gt;
been moved into its own, more semantically correct place.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local presentation = &lt;br /&gt;
	{&lt;br /&gt;
	-- .citation-comment class is specified at Help:CS1_errors#Controlling_error_message_display&lt;br /&gt;
	[&#039;hidden-error&#039;] = &#039;&amp;lt;span class=&amp;quot;cs1-hidden-error citation-comment&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt;&#039;,&lt;br /&gt;
	[&#039;visible-error&#039;] = &#039;&amp;lt;span class=&amp;quot;cs1-visible-error citation-comment&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt;&#039;,&lt;br /&gt;
	[&#039;hidden-maint&#039;] = &#039;&amp;lt;span class=&amp;quot;cs1-maint citation-comment&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt;&#039;,&lt;br /&gt;
	&lt;br /&gt;
	[&#039;accessdate&#039;] = &#039;&amp;lt;span class=&amp;quot;reference-accessdate&amp;quot;&amp;gt;$1$2&amp;lt;/span&amp;gt;&#039;,			-- to allow editors to hide accessdate using personal CSS&lt;br /&gt;
&lt;br /&gt;
	[&#039;bdi&#039;] = &#039;&amp;lt;bdi$1&amp;gt;$2&amp;lt;/bdi&amp;gt;&#039;,												-- bidirectional isolation used with |script-title= and the like&lt;br /&gt;
&lt;br /&gt;
	[&#039;cite&#039;] = &#039;&amp;lt;cite class=&amp;quot;$1&amp;quot;&amp;gt;$2&amp;lt;/cite&amp;gt;&#039;;									-- for use when citation does not have a namelist and |ref= not set so no id=&amp;quot;...&amp;quot; attribute&lt;br /&gt;
	[&#039;cite-id&#039;] = &#039;&amp;lt;cite id=&amp;quot;$1&amp;quot; class=&amp;quot;$2&amp;quot;&amp;gt;$3&amp;lt;/cite&amp;gt;&#039;;							-- for use when when |ref= is set or when citation has a namelist&lt;br /&gt;
&lt;br /&gt;
	[&#039;format&#039;] = &#039; &amp;lt;span class=&amp;quot;cs1-format&amp;quot;&amp;gt;($1)&amp;lt;/span&amp;gt;&#039;,						-- for |format=, |chapter-format=, etc.&lt;br /&gt;
	[&#039;interwiki&#039;] = &#039; &amp;lt;span class=&amp;quot;cs1-format&amp;quot;&amp;gt;[in $1]&amp;lt;/span&amp;gt;&#039;,					-- for interwiki-language-linked author, editor, etc&lt;br /&gt;
	[&#039;interproj&#039;] = &#039; &amp;lt;span class=&amp;quot;cs1-format&amp;quot;&amp;gt;[at $1]&amp;lt;/span&amp;gt;&#039;,					-- for interwiki-project-linked author, editor, etc (:d: and :s: supported; :w: ignored)&lt;br /&gt;
&lt;br /&gt;
	-- various access levels, for |access=, |doi-access=, |arxiv=, ...&lt;br /&gt;
	-- narrow no-break space &amp;amp;#8239; may work better than nowrap CSS. Or not? Browser support?&lt;br /&gt;
&lt;br /&gt;
	[&#039;ext-link-access-signal&#039;] = &#039;&amp;lt;span class=&amp;quot;$1&amp;quot; title=&amp;quot;$2&amp;quot;&amp;gt;$3&amp;lt;/span&amp;gt;&#039;,		-- external link with appropriate lock icon&lt;br /&gt;
		[&#039;free&#039;] = {class=&#039;id-lock-free&#039;, title=&#039;Freely accessible&#039;},			-- classes defined in Module:Citation/CS1/styles.css&lt;br /&gt;
		[&#039;registration&#039;] = {class=&#039;id-lock-registration&#039;, title=&#039;Free registration required&#039;},&lt;br /&gt;
		[&#039;limited&#039;] = {class=&#039;id-lock-limited&#039;, title=&#039;Free access subject to limited trial, subscription normally required&#039;},&lt;br /&gt;
		[&#039;subscription&#039;] = {class=&#039;id-lock-subscription&#039;, title=&#039;Paid subscription required&#039;},&lt;br /&gt;
&lt;br /&gt;
	[&#039;interwiki-icon&#039;] = &#039;&amp;lt;span class=&amp;quot;$1&amp;quot; title=&amp;quot;$2&amp;quot;&amp;gt;$3&amp;lt;/span&amp;gt;&#039;,&lt;br /&gt;
		[&#039;class-wikisource&#039;] = &#039;cs1-ws-icon&#039;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;italic-title&#039;] = &amp;quot;&#039;&#039;$1&#039;&#039;&amp;quot;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;kern-left&#039;] = &#039;&amp;lt;span class=&amp;quot;cs1-kern-left&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;$1&#039;,					-- spacing to use when title contains leading single or double quote mark&lt;br /&gt;
	[&#039;kern-right&#039;] = &#039;$1&amp;lt;span class=&amp;quot;cs1-kern-right&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&#039;,					-- spacing to use when title contains trailing single or double quote mark&lt;br /&gt;
&lt;br /&gt;
	[&#039;nowrap1&#039;] = &#039;&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt;&#039;,								-- for nowrapping an item: &amp;lt;span ...&amp;gt;yyyy-mm-dd&amp;lt;/span&amp;gt;&lt;br /&gt;
	[&#039;nowrap2&#039;] = &#039;&amp;lt;span class=&amp;quot;nowrap&amp;quot;&amp;gt;$1&amp;lt;/span&amp;gt; $2&#039;,							-- for nowrapping portions of an item: &amp;lt;span ...&amp;gt;dd mmmm&amp;lt;/span&amp;gt; yyyy (note white space)&lt;br /&gt;
&lt;br /&gt;
	[&#039;ocins&#039;] = &#039;&amp;lt;span title=&amp;quot;$1&amp;quot; class=&amp;quot;Z3988&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&#039;,&lt;br /&gt;
	&lt;br /&gt;
	[&#039;parameter&#039;] = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
	&lt;br /&gt;
	[&#039;ps_cs1&#039;] = &#039;.&#039;;															-- CS1 style postscript (terminal) character&lt;br /&gt;
	[&#039;ps_cs2&#039;] = &#039;&#039;;															-- CS2 style postscript (terminal) character (empty string)&lt;br /&gt;
&lt;br /&gt;
	[&#039;quoted-text&#039;] = &#039;&amp;lt;q&amp;gt;$1&amp;lt;/q&amp;gt;&#039;,												-- for wrapping |quote= content&lt;br /&gt;
	[&#039;quoted-title&#039;] = &#039;&amp;quot;$1&amp;quot;&#039;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;sep_cs1&#039;] = &#039;.&#039;,															-- CS1 element separator&lt;br /&gt;
	[&#039;sep_cs2&#039;] = &#039;,&#039;,															-- CS2 separator&lt;br /&gt;
	[&#039;sep_nl&#039;] = &#039;;&#039;,															-- CS1|2 style name-list separator between names is a semicolon&lt;br /&gt;
	[&#039;sep_nl_and&#039;] = &#039; and &#039;,													-- used as last nl sep when |name-list-style=and and list has 2 items&lt;br /&gt;
	[&#039;sep_nl_end&#039;] = &#039;; and &#039;,													-- used as last nl sep when |name-list-style=and and list has 3+ names&lt;br /&gt;
	[&#039;sep_name&#039;] = &#039;, &#039;,														-- CS1|2 style last/first separator is &amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;&lt;br /&gt;
	[&#039;sep_nl_vanc&#039;] = &#039;,&#039;,														-- Vancouver style name-list separator between authors is a comma&lt;br /&gt;
	[&#039;sep_name_vanc&#039;] = &#039; &#039;,													-- Vancouver style last/first separator is a space&lt;br /&gt;
&lt;br /&gt;
	[&#039;sep_list&#039;] = &#039;, &#039;,														-- used for |language= when list has 3+ items except for last sep which uses sep_list_end&lt;br /&gt;
	[&#039;sep_list_pair&#039;] = &#039; and &#039;,												-- used for |language= when list has 2 items&lt;br /&gt;
	[&#039;sep_list_end&#039;] = &#039;, and &#039;,												-- used as last list sep for |language= when list has 3+ items&lt;br /&gt;
	&lt;br /&gt;
	[&#039;trans-italic-title&#039;] = &amp;quot;&amp;amp;#91;&#039;&#039;$1&#039;&#039;&amp;amp;#93;&amp;quot;,&lt;br /&gt;
	[&#039;trans-quoted-title&#039;] = &amp;quot;&amp;amp;#91;$1&amp;amp;#93;&amp;quot;,									-- for |trans-title= and |trans-quote=&lt;br /&gt;
	[&#039;vol-bold&#039;] = &#039;$1 &amp;lt;b&amp;gt;$2&amp;lt;/b&amp;gt;&#039;,												-- sepc, volume; for bold journal cites; for other cites [&#039;vol&#039;] in messages{}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
--[[--------------------------&amp;lt; A L I A S E S &amp;gt;---------------------------------&lt;br /&gt;
&lt;br /&gt;
Aliases table for commonly passed parameters.&lt;br /&gt;
&lt;br /&gt;
Parameter names on the right side in the assignments in this table must have been&lt;br /&gt;
defined in the Whitelist before they will be recognized as valid parameter names&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local aliases = {&lt;br /&gt;
	[&#039;AccessDate&#039;] = {&#039;access-date&#039;, &#039;accessdate&#039;},								-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Agency&#039;] = &#039;agency&#039;,&lt;br /&gt;
	[&#039;ArchiveDate&#039;] = {&#039;archive-date&#039;, &#039;archivedate&#039;},							-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;ArchiveFormat&#039;] = &#039;archive-format&#039;,&lt;br /&gt;
	[&#039;ArchiveURL&#039;] = {&#039;archive-url&#039;, &#039;archiveurl&#039;},								-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;ArticleNumber&#039;] = &#039;article-number&#039;,&lt;br /&gt;
	[&#039;ASINTLD&#039;] = &#039;asin-tld&#039;,&lt;br /&gt;
	[&#039;At&#039;] = &#039;at&#039;,																-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Authors&#039;] = {&#039;people&#039;, &#039;credits&#039;},&lt;br /&gt;
	[&#039;BookTitle&#039;] = {&#039;book-title&#039;, &#039;booktitle&#039;},&lt;br /&gt;
	[&#039;Cartography&#039;] = &#039;cartography&#039;,&lt;br /&gt;
	[&#039;Chapter&#039;] = {&#039;chapter&#039;, &#039;contribution&#039;, &#039;entry&#039;, &#039;article&#039;, &#039;section&#039;},&lt;br /&gt;
	[&#039;ChapterFormat&#039;] = {&#039;chapter-format&#039;, &#039;contribution-format&#039;, &#039;entry-format&#039;,&lt;br /&gt;
		&#039;article-format&#039;, &#039;section-format&#039;};&lt;br /&gt;
	[&#039;ChapterURL&#039;] = {&#039;chapter-url&#039;, &#039;contribution-url&#039;, &#039;entry-url&#039;, &#039;article-url&#039;, &#039;section-url&#039;},	-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;ChapterUrlAccess&#039;] = {&#039;chapter-url-access&#039;, &#039;contribution-url-access&#039;,&lt;br /&gt;
		&#039;entry-url-access&#039;, &#039;article-url-access&#039;, &#039;section-url-access&#039;},		-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Class&#039;] = &#039;class&#039;,														-- cite arxiv and arxiv identifier&lt;br /&gt;
	[&#039;Collaboration&#039;] = &#039;collaboration&#039;,&lt;br /&gt;
	[&#039;Conference&#039;] = {&#039;conference&#039;, &#039;event&#039;},&lt;br /&gt;
	[&#039;ConferenceFormat&#039;] = &#039;conference-format&#039;,&lt;br /&gt;
	[&#039;ConferenceURL&#039;] = &#039;conference-url&#039;,										-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Date&#039;] = {&#039;date&#039;, &#039;air-date&#039;, &#039;airdate&#039;},									-- air-date and airdate for cite episode and cite serial only&lt;br /&gt;
	[&#039;Degree&#039;] = &#039;degree&#039;,&lt;br /&gt;
	[&#039;DF&#039;] = &#039;df&#039;,&lt;br /&gt;
	[&#039;DisplayAuthors&#039;] = {&#039;display-authors&#039;, &#039;display-subjects&#039;},&lt;br /&gt;
	[&#039;DisplayContributors&#039;] = &#039;display-contributors&#039;,&lt;br /&gt;
	[&#039;DisplayEditors&#039;] = &#039;display-editors&#039;,&lt;br /&gt;
	[&#039;DisplayInterviewers&#039;] = &#039;display-interviewers&#039;,&lt;br /&gt;
	[&#039;DisplayTranslators&#039;] = &#039;display-translators&#039;,&lt;br /&gt;
	[&#039;Docket&#039;] = &#039;docket&#039;,&lt;br /&gt;
	[&#039;DoiBroken&#039;] = &#039;doi-broken-date&#039;,&lt;br /&gt;
	[&#039;Edition&#039;] = &#039;edition&#039;,&lt;br /&gt;
	[&#039;Embargo&#039;] = &#039;pmc-embargo-date&#039;,&lt;br /&gt;
	[&#039;Encyclopedia&#039;] = {&#039;encyclopedia&#039;, &#039;encyclopaedia&#039;, &#039;dictionary&#039;},			-- cite encyclopedia only&lt;br /&gt;
	[&#039;Episode&#039;] = &#039;episode&#039;,													-- cite serial only TODO: make available to cite episode?&lt;br /&gt;
	[&#039;Format&#039;] = &#039;format&#039;,&lt;br /&gt;
	[&#039;ID&#039;] = {&#039;id&#039;, &#039;ID&#039;},&lt;br /&gt;
	[&#039;Inset&#039;] = &#039;inset&#039;,&lt;br /&gt;
	[&#039;Issue&#039;] = {&#039;issue&#039;, &#039;number&#039;},&lt;br /&gt;
	[&#039;Language&#039;] = {&#039;language&#039;, &#039;lang&#039;},&lt;br /&gt;
	[&#039;MailingList&#039;] = {&#039;mailing-list&#039;, &#039;mailinglist&#039;},							-- cite mailing list only&lt;br /&gt;
	[&#039;Map&#039;] = &#039;map&#039;,															-- cite map only&lt;br /&gt;
	[&#039;MapFormat&#039;] = &#039;map-format&#039;,												-- cite map only&lt;br /&gt;
	[&#039;MapURL&#039;] = {&#039;map-url&#039;, &#039;mapurl&#039;},											-- cite map only -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;MapUrlAccess&#039;] = &#039;map-url-access&#039;,										-- cite map only -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Minutes&#039;] = &#039;minutes&#039;,&lt;br /&gt;
	[&#039;Mode&#039;] = &#039;mode&#039;,&lt;br /&gt;
	[&#039;NameListStyle&#039;] = &#039;name-list-style&#039;,&lt;br /&gt;
	[&#039;Network&#039;] = &#039;network&#039;,&lt;br /&gt;
	[&#039;Newsgroup&#039;] = &#039;newsgroup&#039;,												-- cite newsgroup only&lt;br /&gt;
	[&#039;NoPP&#039;] = {&#039;no-pp&#039;, &#039;nopp&#039;},&lt;br /&gt;
	[&#039;NoTracking&#039;] = {&#039;no-tracking&#039;, &#039;template-doc-demo&#039;},&lt;br /&gt;
	[&#039;Number&#039;] = &#039;number&#039;,														-- this case only for cite techreport&lt;br /&gt;
	[&#039;OrigDate&#039;] = {&#039;orig-date&#039;, &#039;orig-year&#039;, &#039;origyear&#039;},&lt;br /&gt;
	[&#039;Others&#039;] = &#039;others&#039;,&lt;br /&gt;
	[&#039;Page&#039;] = {&#039;page&#039;, &#039;p&#039;},													-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Pages&#039;] = {&#039;pages&#039;, &#039;pp&#039;},												-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Periodical&#039;] = {&#039;journal&#039;, &#039;magazine&#039;, &#039;newspaper&#039;, &#039;periodical&#039;, &#039;website&#039;, &#039;work&#039;},&lt;br /&gt;
	[&#039;Place&#039;] = {&#039;place&#039;, &#039;location&#039;},&lt;br /&gt;
	[&#039;PostScript&#039;] = &#039;postscript&#039;,&lt;br /&gt;
	[&#039;PublicationDate&#039;] = {&#039;publication-date&#039;, &#039;publicationdate&#039;},&lt;br /&gt;
	[&#039;PublicationPlace&#039;] = {&#039;publication-place&#039;, &#039;publicationplace&#039;},&lt;br /&gt;
	[&#039;PublisherName&#039;] = {&#039;publisher&#039;, &#039;institution&#039;},&lt;br /&gt;
	[&#039;Quote&#039;] = {&#039;quote&#039;, &#039;quotation&#039;},&lt;br /&gt;
	[&#039;QuotePage&#039;] = &#039;quote-page&#039;,&lt;br /&gt;
	[&#039;QuotePages&#039;] = &#039;quote-pages&#039;,&lt;br /&gt;
	[&#039;Ref&#039;] = &#039;ref&#039;,&lt;br /&gt;
	[&#039;Scale&#039;] = &#039;scale&#039;,&lt;br /&gt;
	[&#039;ScriptChapter&#039;] = {&#039;script-chapter&#039;, &#039;script-contribution&#039;, &#039;script-entry&#039;,&lt;br /&gt;
		&#039;script-article&#039;, &#039;script-section&#039;},&lt;br /&gt;
	[&#039;ScriptEncyclopedia&#039;] = {&#039;script-encyclopedia&#039;, &#039;script-encyclopaedia&#039;},	-- cite encyclopedia only&lt;br /&gt;
	[&#039;ScriptMap&#039;] = &#039;script-map&#039;,&lt;br /&gt;
	[&#039;ScriptPeriodical&#039;] = {&#039;script-journal&#039;, &#039;script-magazine&#039;, &#039;script-newspaper&#039;,&lt;br /&gt;
		&#039;script-periodical&#039;, &#039;script-website&#039;, &#039;script-work&#039;},&lt;br /&gt;
	[&#039;ScriptQuote&#039;] = &#039;script-quote&#039;,&lt;br /&gt;
	[&#039;ScriptTitle&#039;] = &#039;script-title&#039;,											-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Season&#039;] = &#039;season&#039;,&lt;br /&gt;
	[&#039;Sections&#039;] = &#039;sections&#039;,													-- cite map only&lt;br /&gt;
	[&#039;Series&#039;] = {&#039;series&#039;, &#039;version&#039;},&lt;br /&gt;
	[&#039;SeriesLink&#039;] = {&#039;series-link&#039;, &#039;serieslink&#039;},&lt;br /&gt;
	[&#039;SeriesNumber&#039;] = {&#039;series-number&#039;, &#039;series-no&#039;},&lt;br /&gt;
	[&#039;Sheet&#039;] = &#039;sheet&#039;,														-- cite map only&lt;br /&gt;
	[&#039;Sheets&#039;] = &#039;sheets&#039;,														-- cite map only&lt;br /&gt;
	[&#039;Station&#039;] = &#039;station&#039;,&lt;br /&gt;
	[&#039;Time&#039;] = &#039;time&#039;,&lt;br /&gt;
	[&#039;TimeCaption&#039;] = &#039;time-caption&#039;,&lt;br /&gt;
	[&#039;Title&#039;] = &#039;title&#039;,														-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;TitleLink&#039;] = {&#039;title-link&#039;, &#039;episode-link&#039;, &#039;episodelink&#039;},				-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;TitleNote&#039;] = {&#039;title-note&#039;, &#039;department&#039;},&lt;br /&gt;
	[&#039;TitleType&#039;] = {&#039;type&#039;, &#039;medium&#039;},&lt;br /&gt;
	[&#039;TransChapter&#039;] = {&#039;trans-article&#039;, &#039;trans-chapter&#039;, &#039;trans-contribution&#039;,&lt;br /&gt;
		&#039;trans-entry&#039;, &#039;trans-section&#039;},&lt;br /&gt;
	[&#039;Transcript&#039;] = &#039;transcript&#039;,&lt;br /&gt;
	[&#039;TranscriptFormat&#039;] = &#039;transcript-format&#039;,	&lt;br /&gt;
	[&#039;TranscriptURL&#039;] = &#039;transcript-url&#039;,										-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;TransEncyclopedia&#039;] = {&#039;trans-encyclopedia&#039;, &#039;trans-encyclopaedia&#039;},		-- cite encyclopedia only&lt;br /&gt;
	[&#039;TransMap&#039;] = &#039;trans-map&#039;,													-- cite map only&lt;br /&gt;
	[&#039;TransPeriodical&#039;] = {&#039;trans-journal&#039;, &#039;trans-magazine&#039;, &#039;trans-newspaper&#039;,&lt;br /&gt;
		&#039;trans-periodical&#039;, &#039;trans-website&#039;, &#039;trans-work&#039;},&lt;br /&gt;
	[&#039;TransQuote&#039;] = &#039;trans-quote&#039;,&lt;br /&gt;
	[&#039;TransTitle&#039;] = &#039;trans-title&#039;,												-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;URL&#039;] = {&#039;url&#039;, &#039;URL&#039;},													-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;UrlAccess&#039;] = &#039;url-access&#039;,												-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;UrlStatus&#039;] = &#039;url-status&#039;,												-- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;Vauthors&#039;] = &#039;vauthors&#039;,&lt;br /&gt;
	[&#039;Veditors&#039;] = &#039;veditors&#039;,&lt;br /&gt;
	[&#039;Via&#039;] = &#039;via&#039;,&lt;br /&gt;
	[&#039;Volume&#039;] = &#039;volume&#039;,&lt;br /&gt;
	[&#039;Year&#039;] = &#039;year&#039;,&lt;br /&gt;
&lt;br /&gt;
	[&#039;AuthorList-First&#039;] = {&amp;quot;first#&amp;quot;, &amp;quot;author-first#&amp;quot;, &amp;quot;author#-first&amp;quot;, &amp;quot;author-given#&amp;quot;, &amp;quot;author#-given&amp;quot;,&lt;br /&gt;
		&amp;quot;subject-first#&amp;quot;, &amp;quot;subject#-first&amp;quot;, &amp;quot;subject-given#&amp;quot;, &amp;quot;subject#-given&amp;quot;,&lt;br /&gt;
		&amp;quot;given#&amp;quot;},&lt;br /&gt;
	[&#039;AuthorList-Last&#039;] = {&amp;quot;last#&amp;quot;, &amp;quot;author-last#&amp;quot;, &amp;quot;author#-last&amp;quot;, &amp;quot;author-surname#&amp;quot;, &amp;quot;author#-surname&amp;quot;,&lt;br /&gt;
		&amp;quot;subject-last#&amp;quot;, &amp;quot;subject#-last&amp;quot;, &amp;quot;subject-surname#&amp;quot;, &amp;quot;subject#-surname&amp;quot;,&lt;br /&gt;
		&amp;quot;author#&amp;quot;, &#039;host#&#039;, &amp;quot;subject#&amp;quot;, &amp;quot;surname#&amp;quot;},&lt;br /&gt;
	[&#039;AuthorList-Link&#039;] = {&amp;quot;author-link#&amp;quot;, &amp;quot;author#-link&amp;quot;, &amp;quot;subject-link#&amp;quot;,&lt;br /&gt;
		&amp;quot;subject#-link&amp;quot;, &amp;quot;authorlink#&amp;quot;, &amp;quot;author#link&amp;quot;},&lt;br /&gt;
	[&#039;AuthorList-Mask&#039;] = {&amp;quot;author-mask#&amp;quot;, &amp;quot;author#-mask&amp;quot;, &amp;quot;subject-mask#&amp;quot;, &amp;quot;subject#-mask&amp;quot;},&lt;br /&gt;
&lt;br /&gt;
	[&#039;ContributorList-First&#039;] = {&#039;contributor-first#&#039;, &#039;contributor#-first&#039;,&lt;br /&gt;
		&#039;contributor-given#&#039;, &#039;contributor#-given&#039;},&lt;br /&gt;
	[&#039;ContributorList-Last&#039;] = {&#039;contributor-last#&#039;, &#039;contributor#-last&#039;,&lt;br /&gt;
		&#039;contributor-surname#&#039;, &#039;contributor#-surname&#039;, &#039;contributor#&#039;},&lt;br /&gt;
	[&#039;ContributorList-Link&#039;] = {&#039;contributor-link#&#039;, &#039;contributor#-link&#039;},&lt;br /&gt;
	[&#039;ContributorList-Mask&#039;] = {&#039;contributor-mask#&#039;, &#039;contributor#-mask&#039;},&lt;br /&gt;
&lt;br /&gt;
	[&#039;EditorList-First&#039;] = {&amp;quot;editor-first#&amp;quot;, &amp;quot;editor#-first&amp;quot;, &amp;quot;editor-given#&amp;quot;, &amp;quot;editor#-given&amp;quot;},&lt;br /&gt;
	[&#039;EditorList-Last&#039;] = {&amp;quot;editor-last#&amp;quot;, &amp;quot;editor#-last&amp;quot;, &amp;quot;editor-surname#&amp;quot;,&lt;br /&gt;
		&amp;quot;editor#-surname&amp;quot;, &amp;quot;editor#&amp;quot;},&lt;br /&gt;
	[&#039;EditorList-Link&#039;] = {&amp;quot;editor-link#&amp;quot;, &amp;quot;editor#-link&amp;quot;},&lt;br /&gt;
	[&#039;EditorList-Mask&#039;] = {&amp;quot;editor-mask#&amp;quot;, &amp;quot;editor#-mask&amp;quot;},&lt;br /&gt;
	&lt;br /&gt;
	[&#039;InterviewerList-First&#039;] = {&#039;interviewer-first#&#039;, &#039;interviewer#-first&#039;,&lt;br /&gt;
		&#039;interviewer-given#&#039;, &#039;interviewer#-given&#039;},&lt;br /&gt;
	[&#039;InterviewerList-Last&#039;] = {&#039;interviewer-last#&#039;, &#039;interviewer#-last&#039;,&lt;br /&gt;
		&#039;interviewer-surname#&#039;, &#039;interviewer#-surname&#039;, &#039;interviewer#&#039;},&lt;br /&gt;
	[&#039;InterviewerList-Link&#039;] = {&#039;interviewer-link#&#039;, &#039;interviewer#-link&#039;},&lt;br /&gt;
	[&#039;InterviewerList-Mask&#039;] = {&#039;interviewer-mask#&#039;, &#039;interviewer#-mask&#039;},&lt;br /&gt;
&lt;br /&gt;
	[&#039;TranslatorList-First&#039;] = {&#039;translator-first#&#039;, &#039;translator#-first&#039;,&lt;br /&gt;
		&#039;translator-given#&#039;, &#039;translator#-given&#039;},&lt;br /&gt;
	[&#039;TranslatorList-Last&#039;] = {&#039;translator-last#&#039;, &#039;translator#-last&#039;,&lt;br /&gt;
		&#039;translator-surname#&#039;, &#039;translator#-surname&#039;, &#039;translator#&#039;},&lt;br /&gt;
	[&#039;TranslatorList-Link&#039;] = {&#039;translator-link#&#039;, &#039;translator#-link&#039;},&lt;br /&gt;
	[&#039;TranslatorList-Mask&#039;] = {&#039;translator-mask#&#039;, &#039;translator#-mask&#039;},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D E P E N D E N C I E S _ T &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
a table of url-holding parameters upon which other parameters are dependent.&lt;br /&gt;
&lt;br /&gt;
this table is used by has_archive_today_url() to suppress parameters that are dependant upon a url-holding parameter&lt;br /&gt;
that has as a value an archive.today (or alternate tld) url.&lt;br /&gt;
&lt;br /&gt;
archive.today is deprecated at en.wiki; see Wikipedia:Requests_for_comment/Archive.is_RFC_5&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local url_dependency_map_t = {													-- table of url-holding parameters and the meta-parameters that are dependent on them&lt;br /&gt;
	[&#039;url&#039;] = {&#039;AccessDate&#039;, &#039;ArchiveURL&#039;, &#039;Format&#039;, &#039;UrlAccess&#039;},&lt;br /&gt;
	[&#039;archive-url&#039;] = {&#039;ArchiveDate&#039;, &#039;ArchiveFormat&#039;, &#039;UrlStatus&#039;},&lt;br /&gt;
	[&#039;archiveurl&#039;] = {&#039;ArchiveDate&#039;, &#039;ArchiveFormat&#039;, &#039;UrlStatus&#039;},&lt;br /&gt;
	[&#039;article-url&#039;] = {&#039;ChapterFormat&#039;, &#039;ChapterUrlAccess&#039;},&lt;br /&gt;
	[&#039;chapter-url&#039;] = {&#039;ChapterFormat&#039;, &#039;ChapterUrlAccess&#039;},&lt;br /&gt;
	[&#039;conference-url&#039;] = {&#039;ConferenceFormat&#039;},&lt;br /&gt;
	[&#039;contribution-url&#039;] = {&#039;ChapterFormat&#039;, &#039;ChapterUrlAccess&#039;},&lt;br /&gt;
	[&#039;entry-url&#039;] = {&#039;ChapterFormat&#039;, &#039;ChapterUrlAccess&#039;},&lt;br /&gt;
	[&#039;map-url&#039;] = {&#039;MapFormat&#039;, &#039;MapUrlAccess&#039;},&lt;br /&gt;
	[&#039;section-url&#039;] = {&#039;ChapterFormat&#039;, &#039;ChapterUrlAccess&#039;},&lt;br /&gt;
	[&#039;transcript-url&#039;] = {&#039;TranscriptFormat&#039;},&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
local dependencies_t = {};														-- the table of url-holding parameters and their dependent parameters&lt;br /&gt;
&lt;br /&gt;
for url_param, meta_parameters_t in pairs (url_dependency_map_t) do				-- sequence of meta-parameters (indexes) into &amp;lt;aliases&amp;gt; table&lt;br /&gt;
	local dependant_params_t = {};												-- collection of parameters that are dependent on this &amp;lt;url_param&amp;gt;&lt;br /&gt;
	for _, meta_parameter in ipairs (meta_parameters_t) do						-- for each &amp;lt;aliases&amp;gt; meta-parameter (index)&lt;br /&gt;
		if &#039;string&#039; == type (aliases[meta_parameter]) then						-- for single parameter names (no aliases), &amp;lt;aliases[meta_parameter]&amp;gt; will be a string&lt;br /&gt;
			table.insert (dependant_params_t, aliases[meta_parameter]);			-- add to this &amp;lt;url_param&amp;gt;&#039;s dependency sequence&lt;br /&gt;
		else&lt;br /&gt;
			for _, alias in ipairs (aliases[meta_parameter]) do					-- for each alias in aliases[meta_parameter] (aliases[&#039;AccessDate&#039;] for example)&lt;br /&gt;
				table.insert (dependant_params_t, alias);						-- add to this &amp;lt;url_param&amp;gt;&#039;s dependency sequence&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	dependencies_t[url_param] = dependant_params_t;								-- add the &amp;lt;url_param&amp;gt; and its dependent parameters&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P U N C T _ S K I P &amp;gt;---------------------------&lt;br /&gt;
&lt;br /&gt;
builds a table of parameter names that the extraneous terminal punctuation check should not check.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local punct_meta_params = {														-- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value&lt;br /&gt;
	&#039;BookTitle&#039;, &#039;Chapter&#039;, &#039;ScriptChapter&#039;, &#039;ScriptTitle&#039;, &#039;Title&#039;, &#039;TransChapter&#039;, &#039;Transcript&#039;, &#039;TransMap&#039;,	&#039;TransTitle&#039;,	-- title-holding parameters&lt;br /&gt;
	&#039;AuthorList-Mask&#039;, &#039;ContributorList-Mask&#039;, &#039;EditorList-Mask&#039;, &#039;InterviewerList-Mask&#039;, &#039;TranslatorList-Mask&#039;,	-- name-list mask may have name separators&lt;br /&gt;
	&#039;PostScript&#039;, &#039;Quote&#039;, &#039;ScriptQuote&#039;, &#039;TransQuote&#039;, &#039;Ref&#039;,						-- miscellaneous&lt;br /&gt;
	&#039;ArchiveURL&#039;, &#039;ChapterURL&#039;, &#039;ConferenceURL&#039;, &#039;MapURL&#039;, &#039;TranscriptURL&#039;, &#039;URL&#039;,	-- URL-holding parameters&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local url_meta_params = {														-- table of aliases[] keys (meta parameters); each key has a table of parameter names for a value&lt;br /&gt;
	&#039;ArchiveURL&#039;, &#039;ChapterURL&#039;, &#039;ConferenceURL&#039;, &#039;ID&#039;, &#039;MapURL&#039;, &#039;TranscriptURL&#039;, &#039;URL&#039;,		-- parameters allowed to hold urls&lt;br /&gt;
	&#039;Page&#039;, &#039;Pages&#039;, &#039;At&#039;, &#039;QuotePage&#039;, &#039;QuotePages&#039;,							-- insource locators allowed to hold urls&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local function build_skip_table (skip_t, meta_params)&lt;br /&gt;
	for _, meta_param in ipairs (meta_params) do								-- for each meta parameter key&lt;br /&gt;
		local params = aliases[meta_param];										-- get the parameter or the table of parameters associated with the meta parameter name&lt;br /&gt;
		if &#039;string&#039; == type (params) then&lt;br /&gt;
			skip_t[params] = 1;													-- just a single parameter&lt;br /&gt;
		else&lt;br /&gt;
			for _, param in ipairs (params) do									-- get the parameter name&lt;br /&gt;
				skip_t[param] = 1;												-- add the parameter name to the skip table&lt;br /&gt;
				local count;&lt;br /&gt;
				param, count = param:gsub (&#039;#&#039;, &#039;&#039;);							-- remove enumerator marker from enumerated parameters&lt;br /&gt;
				if 0 ~= count then												-- if removed&lt;br /&gt;
					skip_t[param] = 1;											-- add param name without enumerator marker&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return skip_t;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local punct_skip = {};&lt;br /&gt;
local url_skip = {};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; U R L _ A C C E S S _ M A P &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
this table used by the wikipedia library url test, has_twl_url(), which automatically sets a url-access parameter&lt;br /&gt;
to &#039;subscription&#039; when it discovers a wikipedia library url in any of the url-holding paramters used as keys in&lt;br /&gt;
this table.&lt;br /&gt;
&lt;br /&gt;
translators:  if your wiki uses parameter names for these url-holding parameters and their matching -access parameters,&lt;br /&gt;
add your wiki&#039;s parameters to this list.  Leave the English parameters in place.&lt;br /&gt;
&lt;br /&gt;
TODO: is there a better way to do this?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local url_access_map_t = {&lt;br /&gt;
	[&#039;chapter-url&#039;] = &#039;chapter-url-access&#039;,&lt;br /&gt;
	[&#039;contribution-url&#039;] = &#039;contribution-url-access&#039;,&lt;br /&gt;
	[&#039;entry-url&#039;] = &#039;entry-url-access&#039;,&lt;br /&gt;
	[&#039;article-url&#039;] = &#039;article-url-access&#039;,&lt;br /&gt;
	[&#039;section-url&#039;] = &#039;section-url-access&#039;,&lt;br /&gt;
	[&#039;map-url&#039;] = &#039;map-url-access&#039;,&lt;br /&gt;
	[&#039;mapurl&#039;] = &#039;map-url-access&#039;,&lt;br /&gt;
	[&#039;url&#039;] = &#039;url-access&#039;,&lt;br /&gt;
	[&#039;URL&#039;] = &#039;url-access&#039;&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S I N G L E - L E T T E R   S E C O N D - L E V E L   D O M A I N S &amp;gt;----------&lt;br /&gt;
&lt;br /&gt;
this is a list of tlds that are known to have single-letter second-level domain names.  This list does not include&lt;br /&gt;
ccTLDs which are accepted in is_domain_name().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local single_letter_2nd_lvl_domains_t = {&#039;cash&#039;, &#039;company&#039;, &#039;foundation&#039;, &#039;media&#039;, &#039;org&#039;, &#039;today&#039;};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------&amp;lt; S P E C I A L   C A S E   T R A N S L A T I O N S &amp;gt;------------&lt;br /&gt;
&lt;br /&gt;
This table is primarily here to support internationalization.  Translations in&lt;br /&gt;
this table are used, for example, when an error message, category name, etc.,&lt;br /&gt;
is extracted from the English alias key.  There may be other cases where&lt;br /&gt;
this translation table may be useful.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
local is_Latn = &#039;A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191&#039;;&lt;br /&gt;
local special_case_translation = {&lt;br /&gt;
	author = &#039;author&#039;,&lt;br /&gt;
	editor = &#039;editor&#039;,&lt;br /&gt;
	name_list_params = &#039;$1-name-list parameters&#039;,								-- $1 is &#039;author&#039; or &#039;editor&#039;; used with err_redundant_parameters&lt;br /&gt;
&lt;br /&gt;
	[&#039;AuthorList&#039;] = &#039;authors list&#039;,											-- used to assemble maintenance category names&lt;br /&gt;
	[&#039;ContributorList&#039;] = &#039;contributors list&#039;,									-- translation of these names plus translation of the base maintenance category names in maint_cats{} table below&lt;br /&gt;
	[&#039;EditorList&#039;] = &#039;editors list&#039;,											-- must match the names of the actual categories&lt;br /&gt;
	[&#039;InterviewerList&#039;] = &#039;interviewers list&#039;,									-- this group or translations used by name_has_ed_markup() and name_has_mult_names()&lt;br /&gt;
	[&#039;TranslatorList&#039;] = &#039;translators list&#039;,&lt;br /&gt;
	&lt;br /&gt;
																				-- Lua patterns to match pseudo-titles used by InternetArchiveBot and others as placeholder for unknown |title= value&lt;br /&gt;
	[&#039;archived_copy&#039;] = {														-- used with CS1 maint: Archive[d] copy as title&lt;br /&gt;
		[&#039;en&#039;] = &#039;^archived?%s+copy$&#039;,											-- for English; translators: keep this because templates imported from en.wiki&lt;br /&gt;
		[&#039;local&#039;] = nil,														-- translators: replace [&#039;local&#039;] = nil with lowercase translation only when bots or tools create generic titles in your language&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
																				-- Lua patterns to match generic titles; usually created by bots or reference filling tools&lt;br /&gt;
																				-- translators: replace [&#039;local&#039;] = nil with lowercase translation only when bots or tools create generic titles in your language&lt;br /&gt;
		-- generic titles and patterns in this table should be lowercase only&lt;br /&gt;
		-- leave [&#039;local&#039;] nil except when there is a matching generic title in your language&lt;br /&gt;
		-- boolean &#039;true&#039; for plain-text searches; &#039;false&#039; for pattern searches&lt;br /&gt;
&lt;br /&gt;
	[&#039;generic_titles&#039;] = {&lt;br /&gt;
		[&#039;accept&#039;] = {&lt;br /&gt;
			},&lt;br /&gt;
		[&#039;reject&#039;] = {&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^wayback%s+machine$&#039;, false},				[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;are you a robot&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;hugedomains&#039;, true},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[%(%[{&amp;lt;]?no +title[&amp;gt;}%]%)]?$&#039;, false},		[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;page not found&#039;, true},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;subscribe to read&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[%(%[{&amp;lt;]?unknown[&amp;gt;}%]%)]?$&#039;, false},		[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;website is for sale&#039;, true},				[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^404&#039;, false},								[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;error[ %-]404&#039;, false},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;internet archive wayback machine&#039;, true},	[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;log into facebook&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;login • instagram&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;redirecting...&#039;, true},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;usurped title&#039;, true},						[&#039;local&#039;] = nil},	-- added by a GreenC bot&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;wayback machine&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;webcite query result&#039;, true},				[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;wikiwix\&#039;s cache&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;bot verification&#039;, true},					[&#039;local&#039;] = nil},&lt;br /&gt;
			}&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
		-- boolean &#039;true&#039; for plain-text searches, search string must be lowercase only&lt;br /&gt;
		-- boolean &#039;false&#039; for pattern searches&lt;br /&gt;
		-- leave [&#039;local&#039;] nil except when there is a matching generic name in your language&lt;br /&gt;
&lt;br /&gt;
	[&#039;generic_names&#039;] = {&lt;br /&gt;
		[&#039;accept&#039;] = {&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%[%[[^|]*%(author%) *|[^%]]*%]%]&#039;, false},				[&#039;local&#039;] = nil},&lt;br /&gt;
			},&lt;br /&gt;
		[&#039;reject&#039;] = {&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;about us&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%a][Aa]dvisor%f[%A]&#039;, false},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;allmusic&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%a][Aa]uthor%f[%A]&#039;, false},							[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Bb]ureau$&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;business&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;cnn&#039;, true},											[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;collaborator&#039;, true},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Cc]ompany$&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;contributor&#039;, true},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;contact us&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;correspondent&#039;, true},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Dd]esk$&#039;, false},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;directory&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%(%[][%(%[]%s*eds?%.?%s*[%)%]]?$&#039;, false},			[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;[,%.%s]%f[e]eds?%.?$&#039;, false},							[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^eds?[%.,;]&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[%(%[]%s*[Ee][Dd][Ss]?%.?%s*[%)%]]&#039;, false},			[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%a][Ee]dited%f[%A]&#039;, false},							[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%a][Ee]ditors?%f[%A]&#039;, false},						[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[%a][Ee]mail%f[%A]&#039;, false},							[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;facebook&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;google&#039;, true},											[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Gg]roup$&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;home page&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Ii]nc%.?$&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;instagram&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;interviewer&#039;, true},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Ll]imited$&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;linkedIn&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;^[Nn]ews$&#039;, false},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;[Nn]ews[ %-]?[Rr]oom&#039;, false},							[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;pinterest&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;policy&#039;, true},											[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;privacy&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;reuters&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;translator&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;tumblr&#039;, true},											[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;twitter&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;site name&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;statement&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;submitted&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;super.?user&#039;, false},									[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;%f[&#039;..is_Latn..&#039;][Uu]ser%f[^&#039;..is_Latn..&#039;]&#039;, false},	[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;updated&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			{[&#039;en&#039;] = {&#039;verfasser&#039;, true},										[&#039;local&#039;] = nil},&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D A T E _ N A M E S &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This table of tables lists local language date names and fallback English date names.&lt;br /&gt;
The code in Date_validation will look first in the local table for valid date names.&lt;br /&gt;
If date names are not found in the local table, the code will look in the English table.&lt;br /&gt;
&lt;br /&gt;
Because citations can be copied to the local wiki from en.wiki, the English is&lt;br /&gt;
required when the date-name translation function date_name_xlate() is used.&lt;br /&gt;
&lt;br /&gt;
In these tables, season numbering is defined by&lt;br /&gt;
Extended Date/Time Format (EDTF) Specification (https://www.loc.gov/standards/datetime/)&lt;br /&gt;
which became part of ISO 8601 in 2019.  See &#039;§Sub-year groupings&#039;. The standard&lt;br /&gt;
defines various divisions using numbers 21-41. CS1|2 only supports generic seasons.&lt;br /&gt;
EDTF does support the distinction between north and south hemisphere seasons&lt;br /&gt;
but CS1|2 has no way to make that distinction.&lt;br /&gt;
&lt;br /&gt;
33-36 = Quarter 1, Quarter 2, Quarter 3, Quarter 4 (3 months each)&lt;br /&gt;
&lt;br /&gt;
The standard does not address &#039;named&#039; dates so, for the purposes of CS1|2,&lt;br /&gt;
Easter and Christmas are defined here as 98 and 99, which should be out of the&lt;br /&gt;
ISO 8601 (EDTF) range of uses for a while.&lt;br /&gt;
&lt;br /&gt;
local_date_names_from_mediawiki is a boolean.  When set to:&lt;br /&gt;
	true – module will fetch local month names from MediaWiki for both date_names[&#039;local&#039;][&#039;long&#039;] and date_names[&#039;local&#039;][&#039;short&#039;]; this will unconditionally overwrite manual translations&lt;br /&gt;
	false – module will *not* fetch local month names from MediaWiki&lt;br /&gt;
&lt;br /&gt;
Caveat lector:  There is no guarantee that MediaWiki will provide short month names.  At your wiki you can test&lt;br /&gt;
the results of the MediaWiki fetch in the debug console with this command (the result is alpha sorted):&lt;br /&gt;
	=mw.dumpObject (p.date_names[&#039;local&#039;])&lt;br /&gt;
&lt;br /&gt;
While the module can fetch month names from MediaWiki, it cannot fetch the quarter, season, and named date names&lt;br /&gt;
from MediaWiki.  Those must be translated manually.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local local_date_names_from_mediawiki = true;									-- when false, manual translation required for date_names[&#039;local&#039;][&#039;long&#039;] and date_names[&#039;local&#039;][&#039;short&#039;]; overwrites manual translations&lt;br /&gt;
																				-- when true, module fetches long and short month names from MediaWiki&lt;br /&gt;
local date_names = {&lt;br /&gt;
	[&#039;en&#039;] = {																	-- English&lt;br /&gt;
		[&#039;long&#039;]	= {[&#039;January&#039;] = 1, [&#039;February&#039;] = 2, [&#039;March&#039;] = 3, [&#039;April&#039;] = 4, [&#039;May&#039;] = 5, [&#039;June&#039;] = 6, [&#039;July&#039;] = 7, [&#039;August&#039;] = 8, [&#039;September&#039;] = 9, [&#039;October&#039;] = 10, [&#039;November&#039;] = 11, [&#039;December&#039;] = 12},&lt;br /&gt;
		[&#039;short&#039;]	= {[&#039;Jan&#039;] = 1, [&#039;Feb&#039;] = 2, [&#039;Mar&#039;] = 3, [&#039;Apr&#039;] = 4, [&#039;May&#039;] = 5, [&#039;Jun&#039;] = 6, [&#039;Jul&#039;] = 7, [&#039;Aug&#039;] = 8, [&#039;Sep&#039;] = 9, [&#039;Oct&#039;] = 10, [&#039;Nov&#039;] = 11, [&#039;Dec&#039;] = 12},&lt;br /&gt;
		[&#039;quarter&#039;] = {[&#039;First Quarter&#039;] = 33, [&#039;Second Quarter&#039;] = 34, [&#039;Third Quarter&#039;] = 35, [&#039;Fourth Quarter&#039;] = 36},&lt;br /&gt;
		[&#039;season&#039;]	= {[&#039;Winter&#039;] = 24, [&#039;Spring&#039;] = 21, [&#039;Summer&#039;] = 22, [&#039;Fall&#039;] = 23, [&#039;Autumn&#039;] = 23},&lt;br /&gt;
		[&#039;named&#039;]	= {[&#039;Easter&#039;] = 98, [&#039;Christmas&#039;] = 99},&lt;br /&gt;
		},&lt;br /&gt;
																				-- when local_date_names_from_mediawiki = false&lt;br /&gt;
	[&#039;local&#039;] = {																-- replace these English date names with the local language equivalents&lt;br /&gt;
		[&#039;long&#039;]	= {[&#039;January&#039;] = 1, [&#039;February&#039;] = 2, [&#039;March&#039;] = 3, [&#039;April&#039;] = 4, [&#039;May&#039;] = 5, [&#039;June&#039;] = 6, [&#039;July&#039;] = 7, [&#039;August&#039;] = 8, [&#039;September&#039;] = 9, [&#039;October&#039;] = 10, [&#039;November&#039;] = 11, [&#039;December&#039;] = 12},&lt;br /&gt;
		[&#039;short&#039;]	= {[&#039;Jan&#039;] = 1, [&#039;Feb&#039;] = 2, [&#039;Mar&#039;] = 3, [&#039;Apr&#039;] = 4, [&#039;May&#039;] = 5, [&#039;Jun&#039;] = 6, [&#039;Jul&#039;] = 7, [&#039;Aug&#039;] = 8, [&#039;Sep&#039;] = 9, [&#039;Oct&#039;] = 10, [&#039;Nov&#039;] = 11, [&#039;Dec&#039;] = 12},&lt;br /&gt;
		[&#039;quarter&#039;] = {[&#039;First Quarter&#039;] = 33, [&#039;Second Quarter&#039;] = 34, [&#039;Third Quarter&#039;] = 35, [&#039;Fourth Quarter&#039;] = 36},&lt;br /&gt;
		[&#039;season&#039;]	= {[&#039;Winter&#039;] = 24, [&#039;Spring&#039;] = 21, [&#039;Summer&#039;] = 22, [&#039;Fall&#039;] = 23, [&#039;Autumn&#039;] = 23},&lt;br /&gt;
		[&#039;named&#039;]	= {[&#039;Easter&#039;] = 98, [&#039;Christmas&#039;] = 99},&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;inv_local_long&#039;] = {},													-- used in date reformatting &amp;amp; translation; copy of date_names[&#039;local&#039;].long where k/v are inverted: [1]=&#039;&amp;lt;local name&amp;gt;&#039; etc.&lt;br /&gt;
	[&#039;inv_local_short&#039;] = {},													-- used in date reformatting &amp;amp; translation; copy of date_names[&#039;local&#039;].short where k/v are inverted: [1]=&#039;&amp;lt;local name&amp;gt;&#039; etc.&lt;br /&gt;
	[&#039;inv_local_quarter&#039;] = {},													-- used in date translation; copy of date_names[&#039;local&#039;].quarter where k/v are inverted: [1]=&#039;&amp;lt;local name&amp;gt;&#039; etc.&lt;br /&gt;
	[&#039;inv_local_season&#039;] = {},													-- used in date translation; copy of date_names[&#039;local&#039;].season where k/v are inverted: [1]=&#039;&amp;lt;local name&amp;gt;&#039; etc.&lt;br /&gt;
	[&#039;inv_local_named&#039;] = {},													-- used in date translation; copy of date_names[&#039;local&#039;].named where k/v are inverted: [1]=&#039;&amp;lt;local name&amp;gt;&#039; etc.&lt;br /&gt;
	[&#039;local_digits&#039;] = {[&#039;0&#039;] = &#039;0&#039;, [&#039;1&#039;] = &#039;1&#039;, [&#039;2&#039;] = &#039;2&#039;, [&#039;3&#039;] = &#039;3&#039;, [&#039;4&#039;] = &#039;4&#039;, [&#039;5&#039;] = &#039;5&#039;, [&#039;6&#039;] = &#039;6&#039;, [&#039;7&#039;] = &#039;7&#039;, [&#039;8&#039;] = &#039;8&#039;, [&#039;9&#039;] = &#039;9&#039;},	-- used to convert local language digits to Western 0-9&lt;br /&gt;
	[&#039;xlate_digits&#039;] = {},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
if local_date_names_from_mediawiki then											-- if fetching local month names from MediaWiki is enabled&lt;br /&gt;
	local long_t = {};&lt;br /&gt;
	local short_t = {};&lt;br /&gt;
	for i=1, 12 do																-- loop 12x and &lt;br /&gt;
		local name = lang_obj:formatDate(&#039;F&#039;, &#039;2022-&#039; .. i .. &#039;-1&#039;);			-- get long month name for each i&lt;br /&gt;
		long_t[name] = i;														-- save it&lt;br /&gt;
		name = lang_obj:formatDate(&#039;M&#039;, &#039;2022-&#039; .. i .. &#039;-1&#039;);					-- get short month name for each i&lt;br /&gt;
		short_t[name] = i;														-- save it&lt;br /&gt;
	end&lt;br /&gt;
	date_names[&#039;local&#039;][&#039;long&#039;] = long_t;										-- write the long table – overwrites manual translation&lt;br /&gt;
	date_names[&#039;local&#039;][&#039;short&#039;] = short_t;										-- write the short table – overwrites manual translation&lt;br /&gt;
end&lt;br /&gt;
																				-- create inverted date-name tables for reformatting and/or translation&lt;br /&gt;
for _, invert_t in pairs {{&#039;long&#039;, &#039;inv_local_long&#039;}, {&#039;short&#039;, &#039;inv_local_short&#039;}, {&#039;quarter&#039;, &#039;inv_local_quarter&#039;}, {&#039;season&#039;, &#039;inv_local_season&#039;}, {&#039;named&#039;, &#039;inv_local_named&#039;}} do&lt;br /&gt;
	for name, i in pairs (date_names[&#039;local&#039;][invert_t[1]]) do					-- this table is [&#039;name&#039;] = i&lt;br /&gt;
		date_names[invert_t[2]][i] = name;										-- invert to get [i] = &#039;name&#039; for conversions from ymd&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
if local_digits_from_mediawiki then												-- if fetching local digits from MediaWiki is enabled&lt;br /&gt;
	local digits_t = {};&lt;br /&gt;
	for i=0, 9 do																-- loop 10x and &lt;br /&gt;
		digits_t [lang_obj:formatNum (i)] = tostring (i);						-- format the loop indexer as local lang table index and assign loop indexer (a string) as the value&lt;br /&gt;
	end&lt;br /&gt;
	date_names[&#039;local_digits&#039;] = digits_t;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
for ld, ed in pairs (date_names.local_digits) do								-- make a digit translation table for simple date translation from en to local language using local_digits table&lt;br /&gt;
	date_names.xlate_digits [ed] = ld;											-- en digit becomes index with local digit as the value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local df_template_patterns = {													-- table of redirects to {{Use dmy dates}} and {{Use mdy dates}}&lt;br /&gt;
	&#039;{{ *[Uu]se +(dmy) +dates *[|}]&#039;,	-- 1159k								-- sorted by approximate transclusion count&lt;br /&gt;
	&#039;{{ *[Uu]se +(mdy) +dates *[|}]&#039;,	-- 212k&lt;br /&gt;
	&#039;{{ *[Uu]se +(MDY) +dates *[|}]&#039;,	-- 788&lt;br /&gt;
	&#039;{{ *[Uu]se +(DMY) +dates *[|}]&#039;,	-- 343&lt;br /&gt;
	&#039;{{ *([Mm]dy) *[|}]&#039;,				-- 176&lt;br /&gt;
	&#039;{{ *[Uu]se *(dmy) *[|}]&#039;,			-- 156 + 18&lt;br /&gt;
	&#039;{{ *[Uu]se *(mdy) *[|}]&#039;,			-- 149 + 11&lt;br /&gt;
	&#039;{{ *([Dd]my) *[|}]&#039;,				-- 56&lt;br /&gt;
	&#039;{{ *[Uu]se +(MDY) *[|}]&#039;,			-- 5&lt;br /&gt;
	&#039;{{ *([Dd]MY) *[|}]&#039;,				-- 3&lt;br /&gt;
	&#039;{{ *[Uu]se(mdy)dates *[|}]&#039;,		-- 1&lt;br /&gt;
	&#039;{{ *[Uu]se +(DMY) *[|}]&#039;,			-- 0&lt;br /&gt;
	&#039;{{ *([Mm]DY) *[|}]&#039;,				-- 0&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local title_object = mw.title.getCurrentTitle();&lt;br /&gt;
local content;																	-- done this way  so that unused templates appear in unused-template-reports; self-transcluded makes them look like they are used&lt;br /&gt;
if 10 ~= title_object.namespace then											-- all namespaces except Template&lt;br /&gt;
	content = title_object:getContent() or &#039;&#039;;									-- get the content of the article or &#039;&#039;; new pages edited w/ve do not have &#039;content&#039; until saved; ve does not preview; phab:T221625&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function get_date_format ()&lt;br /&gt;
	if not content then															-- nil content when we&#039;re in template&lt;br /&gt;
		return nil;																-- auto-formatting does not work in Template space so don&#039;t set global_df&lt;br /&gt;
	end&lt;br /&gt;
	for _, pattern in ipairs (df_template_patterns) do							-- loop through the patterns looking for {{Use dmy dates}} or {{Use mdy dates}} or any of their redirects&lt;br /&gt;
		local start, _, match = content:find(pattern);							-- match is the three letters indicating desired date format&lt;br /&gt;
		if match then&lt;br /&gt;
			local use_dates_template = content:match (&#039;%b{}&#039;, start);			-- get the whole template&lt;br /&gt;
			if use_dates_template:match (&#039;| *cs1%-dates *= *[lsy][sy]?&#039;) then	-- look for |cs1-dates=publication date length access-/archive-date length&lt;br /&gt;
				return match:lower() .. &#039;-&#039; .. use_dates_template:match (&#039;| *cs1%-dates *= *([lsy][sy]?)&#039;);&lt;br /&gt;
			else&lt;br /&gt;
				return match:lower() .. &#039;-all&#039;;									-- no |cs1-dates= k/v pair; return value appropriate for use in |df=&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local global_df;																-- TODO: add this to &amp;lt;global_cs1_config_t&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------------&amp;lt; V O L U M E ,  I S S U E ,  P A G E S &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
These tables hold cite class values (from the template invocation) and identify those templates that support&lt;br /&gt;
|volume=, |issue=, and |page(s)= parameters.  Cite conference and cite map require further qualification which&lt;br /&gt;
is handled in the main module.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local templates_using_volume = {&#039;citation&#039;, &#039;audio-visual&#039;, &#039;book&#039;, &#039;conference&#039;, &#039;encyclopaedia&#039;, &#039;interview&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;map&#039;, &#039;news&#039;, &#039;report&#039;, &#039;techreport&#039;, &#039;thesis&#039;}&lt;br /&gt;
local templates_using_issue = {&#039;citation&#039;, &#039;conference&#039;, &#039;episode&#039;, &#039;interview&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;map&#039;, &#039;news&#039;, &#039;podcast&#039;}&lt;br /&gt;
local templates_not_using_page = {&#039;audio-visual&#039;, &#039;episode&#039;, &#039;mailinglist&#039;, &#039;newsgroup&#039;, &#039;podcast&#039;, &#039;serial&#039;, &#039;sign&#039;, &#039;speech&#039;}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
&lt;br /&gt;
These tables control when it is appropriate for {{citation}} to render |volume= and/or |issue=.  The parameter&lt;br /&gt;
names in the tables constrain {{citation}} so that its renderings match the renderings of the equivalent cs1&lt;br /&gt;
templates.  For example, {{cite web}} does not support |volume= so the equivalent {{citation |website=...}} must&lt;br /&gt;
not support |volume=.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local citation_no_volume_t = {													-- {{citation}} does not render |volume= when these parameters are used&lt;br /&gt;
	&#039;website&#039;, &#039;mailinglist&#039;, &#039;script-website&#039;,&lt;br /&gt;
	}&lt;br /&gt;
local citation_issue_t = {														-- {{citation}} may render |issue= when these parameters are used&lt;br /&gt;
	&#039;journal&#039;, &#039;magazine&#039;, &#039;newspaper&#039;, &#039;periodical&#039;, &#039;work&#039;,&lt;br /&gt;
	&#039;script-journal&#039;, &#039;script-magazine&#039;, &#039;script-newspaper&#039;, &#039;script-periodical&#039;, &#039;script-work&#039;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
&lt;br /&gt;
Patterns for finding extra text in |volume=, |issue=, |page=, |pages=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local vol_iss_pg_patterns = {&lt;br /&gt;
	good_ppattern = &#039;^P[^%.PpGg]&#039;,												-- OK to begin with uppercase P: P7 (page 7 of section P), but not p123 (page 123); TODO: this allows &#039;Pages&#039; which it should not&lt;br /&gt;
	bad_ppatterns = {															-- patterns for |page= and |pages=&lt;br /&gt;
		&#039;^[Pp][PpGg]?%.?[ %d]&#039;,&lt;br /&gt;
		&#039;^[Pp][Pp]?%.&amp;amp;nbsp;&#039;,													-- from {{p.}} and {{pp.}} templates&lt;br /&gt;
		&#039;^[Pp]ages?&#039;,&lt;br /&gt;
		&#039;^[Pp]gs.?&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	vi_patterns_t = {															-- combined to catch volume-like text in |issue= and issue-like text in |volume=&lt;br /&gt;
		&#039;^volumes?&#039;,															-- volume-like text&lt;br /&gt;
		&#039;^vols?[%.:=]?&#039;,&lt;br /&gt;
&lt;br /&gt;
		&#039;^issues?&#039;,																--issue-like text&lt;br /&gt;
		&#039;^iss[%.:=]?&#039;,&lt;br /&gt;
		&#039;^numbers?&#039;,&lt;br /&gt;
		&#039;^nos?%A&#039;,																-- don&#039;t match &#039;november&#039; or &#039;nostradamus&#039;&lt;br /&gt;
		&#039;^nr[%.:=]?&#039;,&lt;br /&gt;
		&#039;^n[%.:= ]&#039;,															-- might be a valid issue without separator (space char is sep char here)&lt;br /&gt;
		&#039;^n°&#039;,																	-- &#039;n&#039; with degree sign (U+00B0)&lt;br /&gt;
		&#039;^№&#039;,																	-- precomposed unicode numero character (U+2116)&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; K E Y W O R D S &amp;gt;-------------------------------&lt;br /&gt;
&lt;br /&gt;
These tables hold keywords for those parameters that have defined sets of acceptable keywords.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; K E Y W O R D S   T A B L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
this is a list of keywords; each key in the list is associated with a table of&lt;br /&gt;
synonymous keywords possibly from different languages.&lt;br /&gt;
&lt;br /&gt;
for I18N: add local-language keywords to value table; do not change the key.&lt;br /&gt;
For example, adding the German keyword &#039;ja&#039;:&lt;br /&gt;
	[&#039;affirmative&#039;] = {&#039;yes&#039;, &#039;true&#039;, &#039;y&#039;, &#039;ja&#039;},&lt;br /&gt;
&lt;br /&gt;
Because CS1|2 templates from en.wiki articles are often copied to other local wikis,&lt;br /&gt;
it is recommended that the English keywords remain in these tables.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local keywords = {&lt;br /&gt;
	[&#039;amp&#039;] = {&#039;&amp;amp;&#039;, &#039;amp&#039;, &#039;ampersand&#039;}, 										-- |name-list-style=&lt;br /&gt;
	[&#039;and&#039;] = {&#039;and&#039;, &#039;serial&#039;},												-- |name-list-style=&lt;br /&gt;
	[&#039;affirmative&#039;] = {&#039;yes&#039;, &#039;true&#039;, &#039;y&#039;},										-- |no-tracking=, |no-pp= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;afterword&#039;] = {&#039;afterword&#039;},												-- |contribution=&lt;br /&gt;
	[&#039;bot: unknown&#039;] = {&#039;bot: unknown&#039;},										-- |url-status= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;cs1&#039;] = {&#039;cs1&#039;},															-- |mode=&lt;br /&gt;
	[&#039;cs2&#039;] = {&#039;cs2&#039;},															-- |mode=&lt;br /&gt;
	[&#039;dead&#039;] = {&#039;dead&#039;, &#039;deviated&#039;},											-- |url-status= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;dmy&#039;] = {&#039;dmy&#039;},															-- |df=&lt;br /&gt;
	[&#039;dmy-all&#039;] = {&#039;dmy-all&#039;},													-- |df=&lt;br /&gt;
	[&#039;foreword&#039;] = {&#039;foreword&#039;},												-- |contribution=&lt;br /&gt;
	[&#039;free&#039;] = {&#039;free&#039;},														-- |&amp;lt;id&amp;gt;-access= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;harv&#039;] = {&#039;harv&#039;},														-- |ref=; this no longer supported; is_valid_parameter_value() called with &amp;lt;invert&amp;gt; = true&lt;br /&gt;
	[&#039;introduction&#039;] = {&#039;introduction&#039;},										-- |contribution=&lt;br /&gt;
	[&#039;limited&#039;] = {&#039;limited&#039;},													-- |url-access= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;live&#039;] = {&#039;live&#039;},														-- |url-status= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;mdy&#039;] = {&#039;mdy&#039;},															-- |df=&lt;br /&gt;
	[&#039;mdy-all&#039;] = {&#039;mdy-all&#039;},													-- |df=&lt;br /&gt;
	[&#039;none&#039;] = {&#039;none&#039;},														-- |postscript=, |ref=, |title=, |type= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;off&#039;] = {&#039;off&#039;},															-- |title= (potentially also: |title-link=, |postscript=, |ref=, |type=)&lt;br /&gt;
	[&#039;preface&#039;] = {&#039;preface&#039;},													-- |contribution=&lt;br /&gt;
	[&#039;registration&#039;] = {&#039;registration&#039;},										-- |url-access= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;subscription&#039;] = {&#039;subscription&#039;},										-- |url-access= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;unfit&#039;] = {&#039;unfit&#039;},														-- |url-status= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;usurped&#039;] = {&#039;usurped&#039;},													-- |url-status= -- Used by InternetArchiveBot&lt;br /&gt;
	[&#039;vanc&#039;] = {&#039;vanc&#039;},														-- |name-list-style=&lt;br /&gt;
	[&#039;ymd&#039;] = {&#039;ymd&#039;},															-- |df=&lt;br /&gt;
	[&#039;ymd-all&#039;] = {&#039;ymd-all&#039;},													-- |df=&lt;br /&gt;
	--	[&#039;yMd&#039;] = {&#039;yMd&#039;},														-- |df=; not supported at en.wiki&lt;br /&gt;
	--	[&#039;yMd-all&#039;] = {&#039;yMd-all&#039;},												-- |df=; not supported at en.wiki&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------------------&amp;lt; X L A T E _ K E Y W O R D S &amp;gt;---------------------&lt;br /&gt;
&lt;br /&gt;
this function builds a list, keywords_xlate{}, of the keywords found in keywords{} where the values from keywords{}&lt;br /&gt;
become the keys in keywords_xlate{} and the keys from keywords{} become the values in keywords_xlate{}:&lt;br /&gt;
	[&#039;affirmative&#039;] = {&#039;yes&#039;, &#039;true&#039;, &#039;y&#039;},		-- in keywords{}&lt;br /&gt;
becomes&lt;br /&gt;
	[&#039;yes&#039;] = &#039;affirmative&#039;,					-- in keywords_xlate{}&lt;br /&gt;
	[&#039;true&#039;] = &#039;affirmative&#039;,&lt;br /&gt;
	[&#039;y&#039;] = &#039;affirmative&#039;,&lt;br /&gt;
&lt;br /&gt;
the purpose of this function is to act as a translator between a non-English keyword and its English equivalent&lt;br /&gt;
that may be used in other modules of this suite&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function xlate_keywords ()&lt;br /&gt;
	local out_table = {};														-- output goes here&lt;br /&gt;
	for k, keywords_t in pairs (keywords) do									-- spin through the keywords table&lt;br /&gt;
		for _, keyword in ipairs (keywords_t) do								-- for each keyword&lt;br /&gt;
			out_table[keyword] = k;												-- create an entry in the output table where keyword is the key&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return out_table;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local keywords_xlate = xlate_keywords ();										-- the list of translated keywords&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; M A K E _ K E Y W O R D S _ L I S T &amp;gt;---------------------&lt;br /&gt;
&lt;br /&gt;
this function assembles, for parameter-value validation, the list of keywords appropriate to that parameter.&lt;br /&gt;
&lt;br /&gt;
keywords_lists{}, is a table of tables from keywords{}&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_keywords_list (keywords_lists)&lt;br /&gt;
	local out_table = {};														-- output goes here&lt;br /&gt;
	&lt;br /&gt;
	for _, keyword_list in ipairs (keywords_lists) do							-- spin through keywords_lists{} and get a table of keywords&lt;br /&gt;
		for _, keyword in ipairs (keyword_list) do								-- spin through keyword_list{} and add each keyword, ...&lt;br /&gt;
			table.insert (out_table, keyword);									-- ... as plain text, to the output list&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return out_table;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; K E Y W O R D S _ L I S T S &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
this is a list of lists of valid keywords for the various parameters in [key].&lt;br /&gt;
Generally the keys in this table are the canonical en.wiki parameter names though&lt;br /&gt;
some are contrived because of use in multiple differently named parameters:&lt;br /&gt;
[&#039;yes_true_y&#039;], [&#039;id-access&#039;].&lt;br /&gt;
&lt;br /&gt;
The function make_keywords_list() extracts the individual keywords from the&lt;br /&gt;
appropriate list in keywords{}.&lt;br /&gt;
&lt;br /&gt;
The lists in this table are used to validate the keyword assignment for the&lt;br /&gt;
parameters named in this table&#039;s keys.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local keywords_lists = {&lt;br /&gt;
	[&#039;yes_true_y&#039;] = make_keywords_list ({keywords.affirmative}),&lt;br /&gt;
	[&#039;contribution&#039;] = make_keywords_list ({keywords.afterword, keywords.foreword, keywords.introduction, keywords.preface}),&lt;br /&gt;
	[&#039;df&#039;] = make_keywords_list ({keywords.dmy, keywords[&#039;dmy-all&#039;], keywords.mdy, keywords[&#039;mdy-all&#039;], keywords.ymd, keywords[&#039;ymd-all&#039;]}),&lt;br /&gt;
	--	[&#039;df&#039;] = make_keywords_list ({keywords.dmy, keywords[&#039;dmy-all&#039;], keywords.mdy, keywords[&#039;mdy-all&#039;], keywords.ymd, keywords[&#039;ymd-all&#039;], keywords.yMd, keywords[&#039;yMd-all&#039;]}),	-- not supported at en.wiki&lt;br /&gt;
	[&#039;mode&#039;] = make_keywords_list ({keywords.cs1, keywords.cs2}),&lt;br /&gt;
	[&#039;name-list-style&#039;] = make_keywords_list ({keywords.amp, keywords[&#039;and&#039;], keywords.vanc}),&lt;br /&gt;
	[&#039;ref&#039;] = make_keywords_list ({keywords.harv}),								-- inverted check; |ref=harv no longer supported&lt;br /&gt;
	[&#039;url-access&#039;] = make_keywords_list ({keywords.subscription, keywords.limited, keywords.registration}),&lt;br /&gt;
	[&#039;url-status&#039;] = make_keywords_list ({keywords.dead, keywords.live, keywords.unfit, keywords.usurped, keywords[&#039;bot: unknown&#039;]}),&lt;br /&gt;
	[&#039;id-access&#039;] = make_keywords_list ({keywords.free}),&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C S 1 _ C O N F I G _ G E T &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fetch and validate values from {{cs1 config}} template to fill &amp;lt;global_cs1_config_t&amp;gt;&lt;br /&gt;
&lt;br /&gt;
no error messages; when errors are detected, the parameter value from {{cs1 config}} is blanked.&lt;br /&gt;
&lt;br /&gt;
Supports all parameters and aliases associated with the metaparameters: DisplayAuthors, DisplayContributors,&lt;br /&gt;
DisplayEditors, DisplayInterviewers, DisplayTranslators, NameListStyle, and Mode.  The DisplayWhatever metaparameters&lt;br /&gt;
accept numeric values only (|display-authors=etal and the like is not supported).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local global_cs1_config_t = {};													-- TODO: add value returned from get_date_format() to this table?&lt;br /&gt;
&lt;br /&gt;
local function get_cs1_config ()&lt;br /&gt;
	if not content then															-- nil content when we&#039;re in template&lt;br /&gt;
		return nil;																-- auto-formatting does not work in Template space so don&#039;t set global_df&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local start = content:find(&#039;{{ *[Cc][Ss]1 config *[|}]&#039;);					-- &amp;lt;start&amp;gt; is offset into &amp;lt;content&amp;gt; when {{cs1 config}} found; nil else&lt;br /&gt;
	if start then&lt;br /&gt;
		local cs1_config_template = content:match (&#039;%b{}&#039;, start);				-- get the whole template&lt;br /&gt;
&lt;br /&gt;
		if not cs1_config_template then&lt;br /&gt;
			return nil;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local params_t = mw.text.split (cs1_config_template:gsub (&#039;^{{%s*&#039;, &#039;&#039;):gsub (&#039;%s*}}$&#039;, &#039;&#039;), &#039;%s*|%s*&#039;);	-- remove &#039;{{&#039; and &#039;}}&#039;; make a sequence of parameter/value pairs (split on the pipe)&lt;br /&gt;
		table.remove (params_t, 1);												-- remove the template name because it isn&#039;t a parameter/value pair&lt;br /&gt;
&lt;br /&gt;
		local config_meta_params_t = {&#039;DisplayAuthors&#039;, &#039;DisplayContributors&#039;, &#039;DisplayEditors&#039;, &#039;DisplayInterviewers&#039;, &#039;DisplayTranslators&#039;, &#039;NameListStyle&#039;, &#039;Mode&#039;};&lt;br /&gt;
		local meta_param_map_t = {};											-- list of accepted parameter names usable in {{cs1 config}} goes here&lt;br /&gt;
		&lt;br /&gt;
		for _, meta_param in ipairs (config_meta_params_t) do					-- for i18n using &amp;lt;config_meta_params_t&amp;gt;, map template parameter names to their metaparameter equivalents&lt;br /&gt;
			if &#039;table&#039; == type (aliases[meta_param]) then						-- if &amp;lt;meta_param&amp;gt; is a sequence, &lt;br /&gt;
				for _, param in ipairs (aliases[meta_param]) do					-- extract its contents&lt;br /&gt;
					meta_param_map_t[param] = meta_param;						-- and add to &amp;lt;meta_param_map_t&amp;gt;&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				meta_param_map_t[aliases[meta_param]] = meta_param;				-- not a sequence so just add the parameter to &amp;lt;meta_param_map_t&amp;gt;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		local keywords_t = {};													-- map valid keywords to their associate metaparameter; reverse form of &amp;lt;keyword_lists[key] for these metaparameters&lt;br /&gt;
		for _, metaparam_t in ipairs ({{&#039;NameListStyle&#039;, &#039;name-list-style&#039;}, {&#039;Mode&#039;, &#039;mode&#039;}}) do	-- only these metaparameter / keywords_lists key pairs&lt;br /&gt;
			for _, keyword in ipairs (keywords_lists[metaparam_t[2]]) do		-- spin through the list of keywords&lt;br /&gt;
				keywords_t[keyword] = metaparam_t[1];							-- add [keyword] = metaparameter to the map&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		for _, param in ipairs (params_t) do									-- spin through the {{cs1 config}} parameters and fill &amp;lt;global_cs1_config_t&amp;gt;&lt;br /&gt;
			local k, v = param:match (&#039;([^=]-)%s*=%s*(.+)&#039;);					-- &amp;lt;k&amp;gt; is the parameter name; &amp;lt;v&amp;gt; is parameter&#039;s assigned value&lt;br /&gt;
			if k then&lt;br /&gt;
				if k:find (&#039;^display&#039;) then										-- if &amp;lt;k&amp;gt; is one of the |display-&amp;lt;namelist&amp;gt;= parameters&lt;br /&gt;
					if v:match (&#039;%d+&#039;) then										-- the assigned value must be digits; doesn&#039;t accept &#039;etal&#039;&lt;br /&gt;
						global_cs1_config_t[meta_param_map_t[k]]=v;				-- add the display param and its value to globals table&lt;br /&gt;
					end&lt;br /&gt;
				else&lt;br /&gt;
					if keywords_t[v] == meta_param_map_t[k] then				-- keywords_t[v] returns nil or the metaparam name; these must be the same&lt;br /&gt;
						global_cs1_config_t[meta_param_map_t[k]]=v;				-- add the parameter and its value to globals table&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
get_cs1_config ();																-- fill &amp;lt;global_cs1_config_t&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; S T R I P M A R K E R S &amp;gt;----------------------------&lt;br /&gt;
&lt;br /&gt;
Common pattern definition location for stripmarkers so that we don&#039;t have to go&lt;br /&gt;
hunting for them if (when) MediaWiki changes their form.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local stripmarkers = {&lt;br /&gt;
	[&#039;any&#039;] = &#039;\127[^\127]*UNIQ%-%-(%a+)%-[%a%d]+%-QINU[^\127]*\127&#039;,			-- capture returns name of stripmarker&lt;br /&gt;
	[&#039;math&#039;] = &#039;\127[^\127]*UNIQ%-%-math%-[%a%d]+%-QINU[^\127]*\127&#039;			-- math stripmarkers used in coins_cleanup() and coins_replace_math_stripmarker()&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------&amp;lt; I N V I S I B L E _ C H A R A C T E R S &amp;gt;---------------------&lt;br /&gt;
&lt;br /&gt;
This table holds non-printing or invisible characters indexed either by name or&lt;br /&gt;
by Unicode group. Values are decimal representations of UTF-8 codes.  The table&lt;br /&gt;
is organized as a table of tables because the Lua pairs keyword returns table&lt;br /&gt;
data in an arbitrary order.  Here, we want to process the table from top to bottom&lt;br /&gt;
because the entries at the top of the table are also found in the ranges specified&lt;br /&gt;
by the entries at the bottom of the table.&lt;br /&gt;
&lt;br /&gt;
Also here is a pattern that recognizes stripmarkers that begin and end with the&lt;br /&gt;
delete characters.  The nowiki stripmarker is not an error but some others are&lt;br /&gt;
because the parameter values that include them become part of the template&#039;s&lt;br /&gt;
metadata before stripmarker replacement.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local invisible_defs = {&lt;br /&gt;
	del = &#039;\127&#039;,																-- used to distinguish between stripmarker and del char&lt;br /&gt;
	zwj = &#039;\226\128\141&#039;,														-- used with capture because zwj may be allowed&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local invisible_chars = {&lt;br /&gt;
	{&#039;replacement&#039;, &#039;\239\191\189&#039;},											-- U+FFFD, EF BF BD&lt;br /&gt;
	{&#039;zero width joiner&#039;, &#039;(&#039;.. invisible_defs.zwj .. &#039;)&#039;},						-- U+200D, E2 80 8D; capture because zwj may be allowed&lt;br /&gt;
	{&#039;zero width space&#039;, &#039;\226\128\139&#039;},										-- U+200B, E2 80 8B&lt;br /&gt;
	{&#039;hair space&#039;, &#039;\226\128\138&#039;},												-- U+200A, E2 80 8A&lt;br /&gt;
	{&#039;soft hyphen&#039;, &#039;\194\173&#039;},												-- U+00AD, C2 AD&lt;br /&gt;
	{&#039;horizontal tab&#039;, &#039;\009&#039;},													-- U+0009 (HT), 09&lt;br /&gt;
	{&#039;line feed&#039;, &#039;\010&#039;},														-- U+000A (LF), 0A&lt;br /&gt;
	{&#039;no-break space&#039;, &#039;\194\160&#039;},												-- U+00A0 (NBSP), C2 A0&lt;br /&gt;
	{&#039;carriage return&#039;, &#039;\013&#039;},												-- U+000D (CR), 0D&lt;br /&gt;
	{&#039;stripmarker&#039;, stripmarkers.any},											-- stripmarker; may or may not be an error; capture returns the stripmaker type&lt;br /&gt;
	{&#039;delete&#039;, &#039;(&#039;.. invisible_defs.del .. &#039;)&#039;},								-- U+007F (DEL), 7F; must be done after stripmarker test; capture to distinguish isolated del chars not part of stripmarker&lt;br /&gt;
	{&#039;C0 control&#039;, &#039;[\000-\008\011\012\014-\031]&#039;},								-- U+0000–U+001F (NULL–US), 00–1F (except HT, LF, CR (09, 0A, 0D))&lt;br /&gt;
	{&#039;C1 control&#039;, &#039;[\194\128-\194\159]&#039;},										-- U+0080–U+009F (XXX–APC), C2 80 – C2 9F&lt;br /&gt;
	--	{&#039;Specials&#039;, &#039;[\239\191\185-\239\191\191]&#039;},								-- U+FFF9-U+FFFF, EF BF B9 – EF BF BF&lt;br /&gt;
	--	{&#039;Private use area&#039;, &#039;[\238\128\128-\239\163\191]&#039;},						-- U+E000–U+F8FF, EE 80 80 – EF A3 BF&lt;br /&gt;
	--	{&#039;Supplementary Private Use Area-A&#039;, &#039;[\243\176\128\128-\243\191\191\189]&#039;},	-- U+F0000–U+FFFFD, F3 B0 80 80 – F3 BF BF BD&lt;br /&gt;
	--	{&#039;Supplementary Private Use Area-B&#039;, &#039;[\244\128\128\128-\244\143\191\189]&#039;},	-- U+100000–U+10FFFD, F4 80 80 80 – F4 8F BF BD&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
--[[&lt;br /&gt;
&lt;br /&gt;
Indic script makes use of zero width joiner as a character modifier so zwj&lt;br /&gt;
characters must be left in.  This pattern covers all of the unicode characters&lt;br /&gt;
for these languages:&lt;br /&gt;
	Devanagari					0900–097F – https://unicode.org/charts/PDF/U0900.pdf&lt;br /&gt;
		Devanagari extended		A8E0–A8FF – https://unicode.org/charts/PDF/UA8E0.pdf&lt;br /&gt;
	Bengali						0980–09FF – https://unicode.org/charts/PDF/U0980.pdf&lt;br /&gt;
	Gurmukhi					0A00–0A7F – https://unicode.org/charts/PDF/U0A00.pdf&lt;br /&gt;
	Gujarati					0A80–0AFF – https://unicode.org/charts/PDF/U0A80.pdf&lt;br /&gt;
	Oriya						0B00–0B7F – https://unicode.org/charts/PDF/U0B00.pdf&lt;br /&gt;
	Tamil						0B80–0BFF – https://unicode.org/charts/PDF/U0B80.pdf&lt;br /&gt;
	Telugu						0C00–0C7F – https://unicode.org/charts/PDF/U0C00.pdf&lt;br /&gt;
	Kannada						0C80–0CFF – https://unicode.org/charts/PDF/U0C80.pdf&lt;br /&gt;
	Malayalam					0D00–0D7F – https://unicode.org/charts/PDF/U0D00.pdf&lt;br /&gt;
plus the not-necessarily Indic scripts for Sinhala and Burmese:&lt;br /&gt;
	Sinhala						0D80-0DFF - https://unicode.org/charts/PDF/U0D80.pdf&lt;br /&gt;
	Myanmar						1000-109F - https://unicode.org/charts/PDF/U1000.pdf&lt;br /&gt;
		Myanmar extended A		AA60-AA7F - https://unicode.org/charts/PDF/UAA60.pdf&lt;br /&gt;
		Myanmar extended B		A9E0-A9FF - https://unicode.org/charts/PDF/UA9E0.pdf&lt;br /&gt;
the pattern is used by has_invisible_chars() and coins_cleanup()&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local indic_script = &#039;[\224\164\128-\224\181\191\224\163\160-\224\183\191\225\128\128-\225\130\159\234\167\160-\234\167\191\234\169\160-\234\169\191]&#039;;&lt;br /&gt;
&lt;br /&gt;
-- list of emoji that use a zwj character (U+200D) to combine with another emoji&lt;br /&gt;
-- from: https://unicode.org/Public/emoji/17.0/emoji-zwj-sequences.txt; version: 17.0; 2025-01-08&lt;br /&gt;
-- table created by: [[:en:Module:Make emoji zwj table]]&lt;br /&gt;
local emoji_t = {																-- indexes are decimal forms of the hex values in U+xxxx&lt;br /&gt;
	[8596] = true,																-- U+2194 ↔ left right arrow&lt;br /&gt;
	[8597] = true,																-- U+2195 ↕ up down arrow&lt;br /&gt;
	[9760] = true,																-- U+2620 ☠ skull and crossbones&lt;br /&gt;
	[9792] = true,																-- U+2640 ♀ female sign&lt;br /&gt;
	[9794] = true,																-- U+2642 ♂ male sign&lt;br /&gt;
	[9877] = true,																-- U+2695 ⚕ staff of aesculapius&lt;br /&gt;
	[9878] = true,																-- U+2696 ⚖ scales&lt;br /&gt;
	[9895] = true,																-- U+26A7 ⚧ male with stroke and male and female sign&lt;br /&gt;
	[9992] = true,																-- U+2708 ✈ airplane&lt;br /&gt;
	[10052] = true,																-- U+2744 ❄ snowflake&lt;br /&gt;
	[10084] = true,																-- U+2764 ❤ heavy black heart&lt;br /&gt;
	[10145] = true,																-- U+27A1 ➡ black rightwards arrow&lt;br /&gt;
	[11035] = true,																-- U+2B1B ⬛ black large square&lt;br /&gt;
	[127752] = true,															-- U+1F308 🌈 rainbow&lt;br /&gt;
	[127787] = true,															-- U+1F32B 🌫 fog&lt;br /&gt;
	[127806] = true,															-- U+1F33E 🌾 ear of rice&lt;br /&gt;
	[127859] = true,															-- U+1F373 🍳 cooking&lt;br /&gt;
	[127868] = true,															-- U+1F37C 🍼 baby bottle&lt;br /&gt;
	[127876] = true,															-- U+1F384 🎄 christmas tree&lt;br /&gt;
	[127891] = true,															-- U+1F393 🎓 graduation cap&lt;br /&gt;
	[127908] = true,															-- U+1F3A4 🎤 microphone&lt;br /&gt;
	[127912] = true,															-- U+1F3A8 🎨 artist palette&lt;br /&gt;
	[127979] = true,															-- U+1F3EB 🏫 school&lt;br /&gt;
	[127981] = true,															-- U+1F3ED 🏭 factory&lt;br /&gt;
	[128048] = true,															-- U+1F430 🐰 rabbit face&lt;br /&gt;
	[128102] = true,															-- U+1F466 👦 boy&lt;br /&gt;
	[128103] = true,															-- U+1F467 👧 girl&lt;br /&gt;
	[128104] = true,															-- U+1F468 👨 man&lt;br /&gt;
	[128105] = true,															-- U+1F469 👩 woman&lt;br /&gt;
	[128139] = true,															-- U+1F48B 💋 kiss mark&lt;br /&gt;
	[128165] = true,															-- U+1F4A5 💥 collision symbol&lt;br /&gt;
	[128168] = true,															-- U+1F4A8 💨 dash symbol&lt;br /&gt;
	[128171] = true,															-- U+1F4AB 💫 dizzy symbol&lt;br /&gt;
	[128187] = true,															-- U+1F4BB 💻 personal computer&lt;br /&gt;
	[128188] = true,															-- U+1F4BC 💼 brief case&lt;br /&gt;
	[128293] = true,															-- U+1F525 🔥 fire&lt;br /&gt;
	[128295] = true,															-- U+1F527 🔧 wrench&lt;br /&gt;
	[128300] = true,															-- U+1F52C 🔬 microscope&lt;br /&gt;
	[128488] = true,															-- U+1F5E8 🗨 left speech bubble&lt;br /&gt;
	[128640] = true,															-- U+1F680 🚀 rocket&lt;br /&gt;
	[128658] = true,															-- U+1F692 🚒 fire engine&lt;br /&gt;
	[129001] = true,															-- U+1F7E9 🟩 large green square&lt;br /&gt;
	[129003] = true,															-- U+1F7EB 🟫 large brown square&lt;br /&gt;
	[129309] = true,															-- U+1F91D 🤝 handshake&lt;br /&gt;
	[129455] = true,															-- U+1F9AF 🦯 probing cane&lt;br /&gt;
	[129456] = true,															-- U+1F9B0 🦰 emoji component red hair&lt;br /&gt;
	[129457] = true,															-- U+1F9B1 🦱 emoji component curly hair&lt;br /&gt;
	[129458] = true,															-- U+1F9B2 🦲 emoji component bald&lt;br /&gt;
	[129459] = true,															-- U+1F9B3 🦳 emoji component white hair&lt;br /&gt;
	[129466] = true,															-- U+1F9BA 🦺 safety vest&lt;br /&gt;
	[129468] = true,															-- U+1F9BC 🦼 motorized wheelchair&lt;br /&gt;
	[129469] = true,															-- U+1F9BD 🦽 manual wheelchair&lt;br /&gt;
	[129489] = true,															-- U+1F9D1 🧑 adult&lt;br /&gt;
	[129490] = true,															-- U+1F9D2 🧒 child&lt;br /&gt;
	[129648] = true,															-- U+1FA70 🩰 ballet shoes&lt;br /&gt;
	[129657] = true,															-- U+1FA79 🩹 adhesive bandage&lt;br /&gt;
	[129775] = true,															-- U+1FAEF 🫯 fight cloud&lt;br /&gt;
	[129778] = true,															-- U+1FAF2 🫲 leftwards hand&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------------&amp;lt; L A N G U A G E   S U P P O R T &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
These tables and constants support various language-specific functionality.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
--local this_wiki_code = mw.getContentLanguage():getCode();						-- get this wiki&#039;s language code&lt;br /&gt;
local this_wiki_code = lang_obj:getCode();										-- get this wiki&#039;s language code&lt;br /&gt;
if string.match (mw.site.server, &#039;wikidata&#039;) then&lt;br /&gt;
		this_wiki_code = mw.getCurrentFrame():callParserFunction(&#039;int&#039;, {&#039;lang&#039;}); -- on Wikidata so use interface language setting instead&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
local mw_languages_by_tag_t = mw.language.fetchLanguageNames (this_wiki_code, &#039;all&#039;);	-- get a table of language tag/name pairs known to Wikimedia; used for interwiki tests&lt;br /&gt;
local mw_languages_by_name_t = {};&lt;br /&gt;
	for k, v in pairs (mw_languages_by_tag_t) do								-- build a &#039;reversed&#039; table name/tag language pairs know to MediaWiki; used for |language=&lt;br /&gt;
		v = mw.ustring.lower (v);												-- lowercase for tag fetch; get name&#039;s proper case from mw_languages_by_tag_t[&amp;lt;tag&amp;gt;]&lt;br /&gt;
		if mw_languages_by_name_t[v] then										-- when name already in the table&lt;br /&gt;
			if 2 == #k or 3 == #k then											-- if tag does not have subtags&lt;br /&gt;
				mw_languages_by_name_t[v] = k;									-- prefer the shortest tag for this name&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- here when name not in the table&lt;br /&gt;
			mw_languages_by_name_t[v] = k;										-- so add name and matching tag&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
local inter_wiki_map = {};														-- map of interwiki prefixes that are language-code prefixes&lt;br /&gt;
	for k, v in pairs (mw.site.interwikiMap (&#039;local&#039;)) do						-- spin through the base interwiki map (limited to local)&lt;br /&gt;
		if mw_languages_by_tag_t[v[&amp;quot;prefix&amp;quot;]] then								-- if the prefix matches a known language tag&lt;br /&gt;
			inter_wiki_map[v[&amp;quot;prefix&amp;quot;]] = true;									-- add it to our local map&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------&amp;lt; S C R I P T _ L A N G _ C O D E S &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
This table is used to hold ISO 639-1 two-character and ISO 639-3 three-character&lt;br /&gt;
language codes that apply only to |script-title= and |script-chapter=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local script_lang_codes = {&lt;br /&gt;
	&#039;ab&#039;, &#039;am&#039;, &#039;ar&#039;, &#039;as&#039;, &#039;az&#039;, &#039;be&#039;, &#039;bg&#039;, &#039;bn&#039;, &#039;bo&#039;, &#039;bs&#039;, &#039;ce&#039;, &#039;chr&#039;,&lt;br /&gt;
	&#039;cu&#039;, &#039;dv&#039;, &#039;dz&#039;, &#039;el&#039;, &#039;fa&#039;, &#039;grc&#039;, &#039;gu&#039;, &#039;he&#039;, &#039;hi&#039;, &#039;hy&#039;, &#039;ja&#039;, &#039;ka&#039;,&lt;br /&gt;
	&#039;kaa&#039;, &#039;kk&#039;, &#039;km&#039;, &#039;kn&#039;, &#039;ko&#039;, &#039;ku&#039;, &#039;ky&#039;, &#039;lo&#039;, &#039;mk&#039;, &#039;ml&#039;, &#039;mn&#039;, &#039;mni&#039;,&lt;br /&gt;
	&#039;mr&#039;, &#039;my&#039;, &#039;ne&#039;, &#039;or&#039;, &#039;ota&#039;, &#039;pa&#039;, &#039;ps&#039;, &#039;ru&#039;, &#039;sd&#039;, &#039;si&#039;, &#039;sr&#039;, &#039;syc&#039;,&lt;br /&gt;
	&#039;ta&#039;, &#039;te&#039;, &#039;tg&#039;, &#039;th&#039;, &#039;ti&#039;, &#039;tkr&#039;, &#039;tt&#039;, &#039;ug&#039;, &#039;uk&#039;, &#039;ur&#039;, &#039;uz&#039;, &#039;yi&#039;,&lt;br /&gt;
	&#039;yue&#039;, &#039;zh&#039;, &#039;zgh&#039;&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------&amp;lt; L A N G U A G E   R E M A P P I N G &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
These tables hold language information that is different (correct) from MediaWiki&#039;s definitions&lt;br /&gt;
&lt;br /&gt;
For each [&#039;&amp;lt;tag&amp;gt;&#039;] = &#039;language name&#039; in lang_code_remap{} there must be a matching [&#039;language name&#039;] = {&#039;language name&#039;, &#039;&amp;lt;tag&amp;gt;&#039;} in lang_name_remap{}&lt;br /&gt;
&lt;br /&gt;
lang_tag_remap{}:&lt;br /&gt;
	key is always lowercase ISO 639-1, -2, -3 language tag or a valid lowercase IETF language tag&lt;br /&gt;
	value is properly spelled and capitalized language name associated with &amp;lt;tag&amp;gt;&lt;br /&gt;
	only one language name per &amp;lt;tag&amp;gt;;&lt;br /&gt;
	key/value pair must have matching entry in lang_name_remap{}&lt;br /&gt;
&lt;br /&gt;
lang_name_remap{}:&lt;br /&gt;
	key is always lowercase language name&lt;br /&gt;
	value is a table the holds correctly spelled and capitalized language name [1] and associated tag [2] (tag must match a tag key in lang_tag_remap{})&lt;br /&gt;
	may have multiple keys referring to a common preferred name and tag; For example:&lt;br /&gt;
		[&#039;kolsch&#039;] and [&#039;kölsch&#039;] both refer to &#039;Kölsch&#039; and &#039;ksh&#039;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local lang_tag_remap = {														-- used for |language= and |script-title= / |script-chapter=&lt;br /&gt;
	[&#039;als&#039;] = &#039;Tosk Albanian&#039;,													-- MediaWiki returns Alemannisch &lt;br /&gt;
	[&#039;bh&#039;] = &#039;Bihari&#039;,															-- MediaWiki uses &#039;bh&#039; as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org&lt;br /&gt;
	[&#039;bla&#039;] = &#039;Blackfoot&#039;,														-- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name&lt;br /&gt;
	[&#039;bn&#039;] = &#039;Bengali&#039;,															-- MediaWiki returns Bangla&lt;br /&gt;
	[&#039;ca-valencia&#039;] = &#039;Valencian&#039;,												-- IETF variant of Catalan&lt;br /&gt;
	[&#039;fkv&#039;] = &#039;Kven&#039;,															-- MediaWiki returns Kvensk&lt;br /&gt;
	[&#039;gsw&#039;] = &#039;Swiss German&#039;,&lt;br /&gt;
	[&#039;ilo&#039;] = &#039;Ilocano&#039;,														-- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name&lt;br /&gt;
	[&#039;ksh&#039;] = &#039;Kölsch&#039;,															-- MediaWiki: Colognian; use IANA/ISO 639 preferred name&lt;br /&gt;
	[&#039;ksh-x-colog&#039;] = &#039;Colognian&#039;,												-- override MediaWiki ksh; no IANA/ISO 639 code for Colognian; IETF private code created at Module:Lang/data&lt;br /&gt;
	[&#039;mis-x-ripuar&#039;] = &#039;Ripuarian&#039;,												-- override MediaWiki ksh; no IANA/ISO 639 code for Ripuarian; IETF private code created at Module:Lang/data&lt;br /&gt;
	[&#039;nan-tw&#039;] = &#039;Taiwanese Hokkien&#039;,											-- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese and support en.wiki preferred name&lt;br /&gt;
	[&#039;sr-ec&#039;] = &#039;Serbian (Cyrillic script)&#039;,									-- MediaWiki returns српски (ћирилица)&lt;br /&gt;
	[&#039;sr-el&#039;] = &#039;Serbian (Latin script)&#039;,										-- MediaWiki returns srpski (latinica)&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
local lang_name_remap = {														-- used for |language=; names require proper capitalization; tags must be lowercase&lt;br /&gt;
	[&#039;alemannic&#039;] = {&#039;Swiss German&#039;, &#039;gsw&#039;},									-- ISO 639-2, -3 alternate for Swiss German; MediaWiki mediawiki returns Alemannic for gsw; en.wiki preferred name&lt;br /&gt;
	[&#039;alemannisch&#039;] = {&#039;Swiss German&#039;, &#039;gsw&#039;},									-- not an ISO or IANA language name; MediaWiki uses &#039;als&#039; as a subdomain name for Alemannic Wikipedia: als.wikipedia.org&lt;br /&gt;
	[&#039;bangla&#039;] = {&#039;Bengali&#039;, &#039;bn&#039;},												-- MediaWiki returns Bangla (the endonym) but we want Bengali (the exonym); here we remap&lt;br /&gt;
	[&#039;bengali&#039;] = {&#039;Bengali&#039;, &#039;bn&#039;},											-- MediaWiki doesn&#039;t use exonym so here we provide correct language name and 639-1 code&lt;br /&gt;
	[&#039;bhojpuri&#039;] = {&#039;Bhojpuri&#039;, &#039;bho&#039;},											-- MediaWiki uses &#039;bh&#039; as a subdomain name for Bhojpuri Wikipedia: bh.wikipedia.org&lt;br /&gt;
	[&#039;bihari&#039;] = {&#039;Bihari&#039;, &#039;bh&#039;},												-- MediaWiki replaces &#039;Bihari&#039; with &#039;Bhojpuri&#039; so &#039;Bihari&#039; cannot be found&lt;br /&gt;
	[&#039;blackfoot&#039;] = {&#039;Blackfoot&#039;, &#039;bla&#039;},										-- MediaWiki/IANA/ISO 639: Siksika; use en.wiki preferred name&lt;br /&gt;
	[&#039;colognian&#039;] = {&#039;Colognian&#039;, &#039;ksh-x-colog&#039;},								-- MediaWiki preferred name for ksh&lt;br /&gt;
	[&#039;ilocano&#039;] = {&#039;Ilocano&#039;, &#039;ilo&#039;},											-- MediaWiki/IANA/ISO 639: Iloko; use en.wiki preferred name&lt;br /&gt;
	[&#039;kolsch&#039;] = {&#039;Kölsch&#039;, &#039;ksh&#039;},												-- use IANA/ISO 639 preferred name (use non-diacritical o instead of umlaut ö)&lt;br /&gt;
	[&#039;kölsch&#039;] = {&#039;Kölsch&#039;, &#039;ksh&#039;},												-- use IANA/ISO 639 preferred name&lt;br /&gt;
	[&#039;kven&#039;] = {&#039;Kven&#039;, &#039;fkv&#039;},													-- Unicode CLDR have decided not to support English language name for these two...&lt;br /&gt;
	[&#039;kvensk&#039;] = {&#039;Kven&#039;, &#039;fkv&#039;},												-- ...they say to refer to IANA registry for English names&lt;br /&gt;
	[&#039;ripuarian&#039;] = {&#039;Ripuarian&#039;, &#039;mis-x-ripuar&#039;},								-- group of dialects; no code in MediaWiki or in IANA/ISO 639&lt;br /&gt;
	[&#039;serbian (cyrillic script)&#039;] = {&#039;Serbian (Cyrillic script)&#039;, &#039;sr-cyrl&#039;},	-- special case to get correct tag when |language=sr-ec&lt;br /&gt;
	[&#039;serbian (latin script)&#039;] = {&#039;Serbian (Latin script)&#039;, &#039;sr-latn&#039;},			-- special case to get correct tag when |language=sr-el&lt;br /&gt;
	[&#039;swiss german&#039;] = {&#039;Swiss German&#039;, &#039;gsw&#039;},&lt;br /&gt;
	[&#039;taiwanese hokkien&#039;] = {&#039;Taiwanese Hokkien&#039;, &#039;nan-tw&#039;},					-- make room for MediaWiki/IANA/ISO 639 nan: Min Nan Chinese &lt;br /&gt;
	[&#039;tosk albanian&#039;] = {&#039;Tosk Albanian&#039;, &#039;als&#039;},								-- MediaWiki replaces &#039;Tosk Albanian&#039; with &#039;Alemannisch&#039; so &#039;Tosk Albanian&#039; cannot be found&lt;br /&gt;
	[&#039;valencian&#039;] = {&#039;Valencian&#039;, &#039;ca-valencia&#039;},								-- variant of Catalan; categorizes as Valencian&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------&amp;lt; P R O P E R T I E S _ C A T E G O R I E S &amp;gt;----------------&lt;br /&gt;
&lt;br /&gt;
Properties categories. These are used for investigating qualities of citations.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local prop_cats = {&lt;br /&gt;
	[&#039;foreign-lang-source&#039;] = &#039;CS1 $1-language sources ($2)&#039;,					-- |language= categories; $1 is foreign-language name, $2 is ISO639-1 code&lt;br /&gt;
	[&#039;foreign-lang-source-2&#039;] = &#039;CS1 foreign language sources (ISO 639-2)|$1&#039;,	-- |language= category; a cat for ISO639-2 languages; $1 is the ISO 639-2 code used as a sort key&lt;br /&gt;
	[&#039;interproj-linked-name&#039;] = &#039;CS1 interproject-linked names|$1&#039;,				-- any author, editor, etc that has an interproject link; $1 is interproject tag used as a sort key&lt;br /&gt;
	[&#039;interwiki-linked-name&#039;] = &#039;CS1 interwiki-linked names|$1&#039;,				-- any author, editor, etc that has an interwiki link; $1 is interwiki tag used as a sort key; yeilds to interproject&lt;br /&gt;
	[&#039;local-lang-source&#039;] = &#039;CS1 $1-language sources ($2)&#039;,						-- |language= categories; $1 is local-language name, $2 is ISO639-1 code; not emitted when local_lang_cat_enable is false&lt;br /&gt;
	[&#039;location-test&#039;] = &#039;CS1 location test&#039;,&lt;br /&gt;
	[&#039;long-vol&#039;] = &#039;CS1: long volume value&#039;,									-- probably temporary cat to identify scope of |volume= values longer than 4 characters&lt;br /&gt;
	[&#039;script&#039;] = &#039;CS1 uses $1-language script ($2)&#039;,							-- |script-title=xx: has matching category; $1 is language name, $2 is language tag&lt;br /&gt;
	[&#039;tracked-param&#039;] = &#039;CS1 tracked parameter: $1&#039;,							-- $1 is base (enumerators removed) parameter name&lt;br /&gt;
	[&#039;unfit&#039;] = &#039;CS1: unfit URL&#039;,												-- |url-status=unfit or |url-status=usurped; used to be a maint cat&lt;br /&gt;
	[&#039;vanc-accept&#039;] = &#039;CS1:Vancouver names with accept markup&#039;,					-- for |vauthors=/|veditors= with accept-as-written markup&lt;br /&gt;
	[&#039;year-range-abbreviated&#039;] = &#039;CS1: abbreviated year range&#039;,					-- probably temporary cat to identify scope of |date=, |year= values using YYYY–YY form&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; T I T L E _ T Y P E S &amp;gt;--------------------------------&lt;br /&gt;
&lt;br /&gt;
Here we map a template&#039;s CitationClass to TitleType (default values for |type= parameter)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local title_types = {&lt;br /&gt;
	[&#039;AV-media-notes&#039;] = &#039;Media notes&#039;,&lt;br /&gt;
	[&#039;document&#039;] = &#039;Document&#039;,&lt;br /&gt;
	[&#039;interview&#039;] = &#039;Interview&#039;,&lt;br /&gt;
	[&#039;mailinglist&#039;] = &#039;Mailing list&#039;,&lt;br /&gt;
	[&#039;map&#039;] = &#039;Map&#039;,&lt;br /&gt;
	[&#039;podcast&#039;] = &#039;Podcast&#039;,&lt;br /&gt;
	[&#039;pressrelease&#039;] = &#039;Press release&#039;,&lt;br /&gt;
	[&#039;report&#039;] = &#039;Report&#039;,&lt;br /&gt;
	[&#039;speech&#039;] = &#039;Speech&#039;,&lt;br /&gt;
	[&#039;techreport&#039;] = &#039;Technical report&#039;,&lt;br /&gt;
	[&#039;thesis&#039;] = &#039;Thesis&#039;,&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; B U I L D _ K N O W N _ F R E E _ D O I _ R E G I S T R A N T S _ T A B L E &amp;gt;--&lt;br /&gt;
&lt;br /&gt;
build a table of doi registrants known to be free-to-read  In a doi, the registrant ID is the series of digits&lt;br /&gt;
between the &#039;10.&#039; and the first &#039;/&#039;: in doi 10.1100/sommat, 1100 is the registrant ID&lt;br /&gt;
&lt;br /&gt;
see §3.2.2 DOI prefix of the Doi Handbook p. 43&lt;br /&gt;
https://www.doi.org/doi-handbook/DOI_Handbook_Final.pdf#page=43&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function build_free_doi_registrants_table()&lt;br /&gt;
	local registrants_t = {};&lt;br /&gt;
	for _, v in ipairs ({&lt;br /&gt;
		&#039;1045&#039;, &#039;1074&#039;, &#039;1096&#039;, &#039;1100&#039;, &#039;1155&#039;, &#039;1186&#039;, &#039;1194&#039;, &#039;1371&#039;, &#039;1613&#039;, &#039;1629&#039;, &#039;1989&#039;, &#039;1999&#039;, &#039;2147&#039;, &#039;2196&#039;, &#039;3285&#039;, &#039;3389&#039;, &#039;3390&#039;, &#039;3906&#039;,&lt;br /&gt;
		&#039;3748&#039;, &#039;3814&#039;, &#039;3847&#039;, &#039;3897&#039;, &#039;4061&#039;, &#039;4089&#039;, &#039;4103&#039;, &#039;4172&#039;, &#039;4175&#039;, &#039;4230&#039;, &#039;4236&#039;, &#039;4239&#039;, &#039;4240&#039;, &#039;4249&#039;, &#039;4251&#039;,&lt;br /&gt;
		&#039;4252&#039;, &#039;4253&#039;, &#039;4254&#039;, &#039;4291&#039;, &#039;4292&#039;, &#039;4329&#039;, &#039;4330&#039;, &#039;4331&#039;, &#039;5086&#039;, &#039;5194&#039;, &#039;5210&#039;, &#039;5306&#039;, &#039;5312&#039;, &#039;5313&#039;, &#039;5314&#039;,&lt;br /&gt;
		&#039;5315&#039;, &#039;5316&#039;, &#039;5317&#039;, &#039;5318&#039;, &#039;5319&#039;, &#039;5320&#039;, &#039;5321&#039;, &#039;5334&#039;, &#039;5402&#039;, &#039;5409&#039;, &#039;5410&#039;, &#039;5411&#039;, &#039;5412&#039;,&lt;br /&gt;
		&#039;5492&#039;, &#039;5493&#039;, &#039;5494&#039;, &#039;5495&#039;, &#039;5496&#039;, &#039;5497&#039;, &#039;5498&#039;, &#039;5499&#039;, &#039;5500&#039;, &#039;5501&#039;, &#039;5527&#039;, &#039;5528&#039;, &#039;5662&#039;,&lt;br /&gt;
		&#039;6064&#039;, &#039;6219&#039;, &#039;7167&#039;, &#039;7217&#039;, &#039;7287&#039;, &#039;7482&#039;, &#039;7490&#039;, &#039;7554&#039;, &#039;7717&#039;, &#039;7759&#039;, &#039;7766&#039;, &#039;9778&#039;, &#039;11131&#039;, &#039;11569&#039;, &#039;11647&#039;,&lt;br /&gt;
		&#039;11648&#039;, &#039;12688&#039;, &#039;12703&#039;, &#039;12715&#039;, &#039;12942&#039;, &#039;12998&#039;, &#039;13105&#039;, &#039;14256&#039;, &#039;14293&#039;, &#039;14303&#039;, &#039;15215&#039;, &#039;15347&#039;, &#039;15412&#039;, &#039;15560&#039;, &#039;16995&#039;,&lt;br /&gt;
		&#039;17645&#039;, &#039;18637&#039;, &#039;19080&#039;, &#039;19173&#039;, &#039;20944&#039;, &#039;21037&#039;, &#039;21105&#039;, &#039;21468&#039;, &#039;21767&#039;, &#039;21425&#039;, &#039;22261&#039;, &#039;22323&#039;, &#039;22459&#039;, &#039;24105&#039;, &#039;24196&#039;, &#039;24966&#039;,&lt;br /&gt;
		&#039;26775&#039;, &#039;30845&#039;, &#039;32545&#039;, &#039;35711&#039;, &#039;35712&#039;, &#039;35713&#039;, &#039;35995&#039;, &#039;36648&#039;, &#039;37126&#039;, &#039;37532&#039;, &#039;37871&#039;, &#039;47128&#039;,&lt;br /&gt;
		&#039;47622&#039;, &#039;47959&#039;, &#039;52437&#039;, &#039;52975&#039;, &#039;53288&#039;, &#039;53347&#039;, &#039;54081&#039;, &#039;54947&#039;, &#039;55667&#039;, &#039;55914&#039;, &#039;57009&#039;, &#039;58647&#039;, &#039;59081&#039;,&lt;br /&gt;
		}) do&lt;br /&gt;
			registrants_t[v] = true;											-- build a k/v table of known free-to-read doi registrants&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return registrants_t;&lt;br /&gt;
end&lt;br /&gt;
																				-- known free registrants identifiable by the doi suffix incipit&lt;br /&gt;
local extended_registrants_t = {												-- doi suffix incipits are evaluated as lua patterns&lt;br /&gt;
	[&#039;1002&#039;] = {&#039;aelm&#039;, &#039;leap&#039;, &#039;loe2%.&#039;, &#039;lol2%.&#039;},							    	-- Advanced Electronic Materials, Learned Publishing, L&amp;amp;O e-Lectures, L&amp;amp;O Letters&lt;br /&gt;
	[&#039;1016&#039;] = {&#039;j%.aace&#039;, &#039;j%.aed&#039;, &#039;j%.aiopen&#039;, &#039;j%.animal&#039;, &#039;j%.apsb&#039;, &#039;j%.addicn&#039;,	-- AACE Endocrinology and Diabetes, AACE Endocrinology and Diabetes, AI Open, Animal, Acta Pharmaceutica Sinica B, Addiction Neuroscience&lt;br /&gt;
				&#039;j%.abrep&#039;, &#039;j%.gpb&#039;, &#039;j%.heliyon&#039;, &#039;j%.nlp&#039;, &#039;j%.patter&#039;, &#039;j%.proche&#039;, -- Addictive Behaviors Reports, Genomics, Proteomics &amp;amp; Bioinformatics after 2015, Heliyon, Natural Language Processing, Patterns, Procedia Chemistry&lt;br /&gt;
				&#039;j%.vgie&#039;, &#039;S1672-0229&#039;},		                                -- VideoGIE, Genomics, Proteomics &amp;amp; Bioinformatics before 2015&lt;br /&gt;
	[&#039;1017&#039;] = {&#039;apj%.&#039;, &#039;nlp&#039;, &#039;mdh&#039;, &#039;S15574660&#039;},  							-- Natural Language Processing Journal, Medical History, Asia Pacific Journal&lt;br /&gt;
	[&#039;1046&#039;] = {&#039;j%.1365-8711&#039;, &#039;j%.1365-246x&#039;},								-- MNRAS, GJI&lt;br /&gt;
	[&#039;1021&#039;] = {&#039;acscentsci&#039;, &#039;acsomega&#039;},                                      -- ACS Central Science, ACS Omega&lt;br /&gt;
	[&#039;1093&#039;] = {&#039;mnras&#039;, &#039;mnrasl&#039;, &#039;gji&#039;, &#039;pnasnexus&#039;, &#039;rasti&#039;},				-- MNRAS, MNRAS Letters, GJI, PNAS Nexus, RASTI&lt;br /&gt;
	[&#039;1098&#039;] = {&#039;rsbm&#039;, &#039;rsob&#039;, &#039;rsos&#039;},                                        -- Biographical Memoirs of Fellows of the Royal Society, Open Biology, Royal Society Open Science&lt;br /&gt;
	[&#039;1099&#039;] = {&#039;acmi&#039;, &#039;mic&#039;, &#039;00221287&#039;, &#039;mgen&#039;},                             -- Access Microbiology, Microbiology, Journal of General Microbiology, Microbial Genomics&lt;br /&gt;
	[&#039;1107&#039;] = {&#039;S20569890&#039;, &#039;S20522525&#039;, &#039;S16005775&#039;, &#039;S24143146&#039;},            -- Acta Crystallographica E, IUCrJ, Journal of Synchrotron Radiation, IUCrData&lt;br /&gt;
	[&#039;1109&#039;] = {&#039;oa&#039;, &#039;oj&#039;},                                                    -- IEEE Open Access..., IEEE Open Journal...&lt;br /&gt;
	[&#039;1111&#039;] = {&#039;aogs&#039;, &#039;j%.1365-2966&#039;, &#039;j%.1745-3933&#039;, &#039;j%.1365-246X&#039;},			-- Acta Obstetricia et Gynecologica Scandinavica, MNRAS, MNRAS Letters, GJI&lt;br /&gt;
	[&#039;1128&#039;] = {&#039;asmcr&#039;, &#039;jmbe&#039;, &#039;mbio&#039;, &#039;mra&#039;, &#039;spectrum&#039;, &#039;msphere&#039;, &#039;msystems&#039;}, --ASM Case Reports, Journal of Microbiology &amp;amp; Biology Education, mBio, Microbiology Resource Announcements, Microbiology Spectrum, mSphere, mSystems&lt;br /&gt;
	[&#039;1136&#039;] = {&#039;bmjopen&#039;},                                                     -- BMJ Open&lt;br /&gt;
	[&#039;1140&#039;] = {&#039;epjc&#039;},														-- European Physical Journal C&lt;br /&gt;
	[&#039;1192&#039;] = {&#039;bjo&#039;},                                                         -- BJPsych Open&lt;br /&gt;
	[&#039;1210&#039;] = {&#039;jendso&#039;,&#039;jcemcr&#039;},												-- Journal of the Endocrine Society, JCEM Case Reports&lt;br /&gt;
	[&#039;1215&#039;] = {&#039;21573689&#039;, &#039;21573698&#039;},                                        -- L&amp;amp;O Fluids &lt;br /&gt;
	[&#039;1590&#039;] = {&#039;0102-3306&#039;},                                                   -- Acta Botanica Brasilica&lt;br /&gt;
	[&#039;4171&#039;] = {&#039;dm&#039;,&#039;mag&#039;},												    -- Documenta Mathematica, EMS Magazine&lt;br /&gt;
	[&#039;4319&#039;] = {&#039;lo%.&#039;, &#039;lol%.&#039;, &#039;lom%.&#039;},                                         -- L&amp;amp;O, L&amp;amp;O e-Lectures, L&amp;amp;O Methods&lt;br /&gt;
	[&#039;5852&#039;] = {&#039;ejt&#039;},                                                         -- European Journal of Taxonomy&lt;br /&gt;
	[&#039;7155&#039;] = {&#039;jgaa&#039;},                                                        -- Journal of Graph Algorithms and Applications&lt;br /&gt;
	[&#039;11158&#039;] = {&#039;saasp&#039;},                                                      -- Systematic and Applied Acarology Special Publications&lt;br /&gt;
	[&#039;11646&#039;] = {&#039;megataxa&#039;, &#039;mesozoic&#039;},                                       -- Megataxa, Mesozoic&lt;br /&gt;
	[&#039;14231&#039;] = {&#039;ag&#039;},															-- Algebraic Geometry&lt;br /&gt;
	[&#039;15446&#039;] = {&#039;abc&#039;},                                                        -- Acta Biológica Colombiana&lt;br /&gt;
	[&#039;17239&#039;] = {&#039;jowr&#039;},                                                       -- Journal of Writing Research&lt;br /&gt;
	[&#039;22073&#039;] = {&#039;pja&#039;},                                                        -- Persian Journal of Acarology&lt;br /&gt;
	[&#039;24310&#039;] = {&#039;abm&#039;},                                                        -- Acta Botanica Malacitana&lt;br /&gt;
	[&#039;24425&#039;] = {&#039;agp&#039;},                                                        -- Acta  Geologica  Polonica&lt;br /&gt;
	[&#039;35249&#039;] = {&#039;rche&#039;},                                                       -- Revista Chilena de Entomología&lt;br /&gt;
	[&#039;37520&#039;] = {&#039;fi&#039;},                                                         -- Fossil Imprint&lt;br /&gt;
	[&#039;53562&#039;] = {&#039;ajcb&#039;}                                                        -- Asian Journal of Conservation Biology&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[===================&amp;lt;&amp;lt; E R R O R   M E S S A G I N G &amp;gt;&amp;gt;======================&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
--[[----------&amp;lt; E R R O R   M E S S A G E   S U P P L E M E N T S &amp;gt;-------------&lt;br /&gt;
&lt;br /&gt;
I18N for those messages that are supplemented with additional specific text that&lt;br /&gt;
describes the reason for the error&lt;br /&gt;
&lt;br /&gt;
TODO: merge this with special_case_translations{}?&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local err_msg_supl = {&lt;br /&gt;
	[&#039;char&#039;] = &#039;invalid character&#039;,												-- |isbn=, |sbn=&lt;br /&gt;
	[&#039;check&#039;] = &#039;checksum&#039;,														-- |isbn=, |sbn=&lt;br /&gt;
	empty_str = &#039;(empty string)&#039;,												-- empty unknown parameter check when cite has |=&lt;br /&gt;
	[&#039;flag&#039;] = &#039;flag&#039;,															-- |archive-url=&lt;br /&gt;
	[&#039;form&#039;] = &#039;invalid form&#039;,													-- |isbn=, |sbn=&lt;br /&gt;
	[&#039;group&#039;] = &#039;invalid group id&#039;,												-- |isbn=&lt;br /&gt;
	[&#039;initials&#039;] = &#039;initials&#039;,													-- Vancouver&lt;br /&gt;
	[&#039;invalid language code&#039;] = &#039;invalid language code&#039;,						-- |script-&amp;lt;param&amp;gt;=&lt;br /&gt;
	[&#039;journal&#039;] = &#039;journal&#039;,													-- |bibcode=&lt;br /&gt;
	[&#039;length&#039;] = &#039;length&#039;,														-- |isbn=, |bibcode=, |sbn=&lt;br /&gt;
	[&#039;liveweb&#039;] = &#039;liveweb&#039;,													-- |archive-url=&lt;br /&gt;
	[&#039;missing comma&#039;] = &#039;missing comma&#039;,										-- Vancouver&lt;br /&gt;
	[&#039;missing prefix&#039;] = &#039;missing prefix&#039;,										-- |script-&amp;lt;param&amp;gt;=&lt;br /&gt;
	[&#039;missing title part&#039;] = &#039;missing title part&#039;,								-- |script-&amp;lt;param&amp;gt;=&lt;br /&gt;
	[&#039;name&#039;] = &#039;name&#039;,															-- Vancouver&lt;br /&gt;
	[&#039;non-Latin char&#039;] = &#039;non-Latin character&#039;,									-- Vancouver&lt;br /&gt;
	[&#039;path&#039;] = &#039;path&#039;,															-- |archive-url=&lt;br /&gt;
	[&#039;prefix&#039;] = &#039;invalid prefix&#039;,												-- |isbn=&lt;br /&gt;
	[&#039;punctuation&#039;] = &#039;punctuation&#039;,											-- Vancouver&lt;br /&gt;
	[&#039;save&#039;] = &#039;save command&#039;,													-- |archive-url=&lt;br /&gt;
	[&#039;suffix&#039;] = &#039;suffix&#039;,														-- Vancouver&lt;br /&gt;
	[&#039;timestamp&#039;] = &#039;timestamp&#039;,												-- |archive-url=&lt;br /&gt;
	[&#039;unknown language code&#039;] = &#039;unknown language code&#039;,						-- |script-&amp;lt;param&amp;gt;=&lt;br /&gt;
	[&#039;value&#039;] = &#039;value&#039;,														-- |bibcode=&lt;br /&gt;
	[&#039;year&#039;] = &#039;year&#039;,															-- |bibcode=&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------&amp;lt; E R R O R _ C O N D I T I O N S &amp;gt;---------------------------&lt;br /&gt;
&lt;br /&gt;
Error condition table.  This table has two sections: errors at the top, maintenance&lt;br /&gt;
at the bottom.  Maint &#039;messaging&#039; does not have a &#039;message&#039; (message=nil)&lt;br /&gt;
&lt;br /&gt;
The following contains a list of IDs for various error conditions defined in the&lt;br /&gt;
code.  For each ID, we specify a text message to display, an error category to&lt;br /&gt;
include, and whether the error message should be wrapped as a hidden comment.&lt;br /&gt;
&lt;br /&gt;
Anchor changes require identical changes to matching anchor in Help:CS1 errors&lt;br /&gt;
&lt;br /&gt;
TODO: rename error_conditions{} to something more generic; create separate error&lt;br /&gt;
and maint tables inside that?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local error_conditions = {&lt;br /&gt;
	err_accessdate_missing_url = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;access-date=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;url=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
		anchor = &#039;accessdate_missing_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: access-date without URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
 		},&lt;br /&gt;
	err_apostrophe_markup = {&lt;br /&gt;
		message = &#039;Italic or bold markup not allowed in: &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;apostrophe_markup&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: markup&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
 		},&lt;br /&gt;
	err_archive_date_missing_url = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-date=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-url=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
		anchor = &#039;archive_date_missing_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: archive-url&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_archive_date_url_ts_mismatch = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-date=&amp;lt;/code&amp;gt; / &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-url=&amp;lt;/code&amp;gt; timestamp mismatch; $1 suggested&#039;,&lt;br /&gt;
		anchor = &#039;archive_date_url_ts_mismatch&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: archive-url&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_archive_missing_date = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-url=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-date=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
		anchor = &#039;archive_missing_date&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: archive-url&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_archive_missing_url = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-url=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;url=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
		anchor = &#039;archive_missing_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: archive-url&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_archive_url = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;archive-url=&amp;lt;/code&amp;gt; is malformed: $1&#039;,	-- $1 is error message detail&lt;br /&gt;
		anchor = &#039;archive_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: archive-url&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_arxiv_missing = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;arxiv=&amp;lt;/code&amp;gt; required&#039;,&lt;br /&gt;
		anchor = &#039;arxiv_missing&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: arXiv&#039;,											-- same as bad arxiv&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_asintld_missing_asin = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;asin=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;asintld_missing_asin&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: ASIN TLD&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_arxiv = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;arxiv=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_arxiv&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: arXiv&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_asin = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;asin=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_asin&#039;,&lt;br /&gt;
		category =&#039;CS1 errors: ASIN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_asin_tld = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;asin-tld=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_asin_tld&#039;,&lt;br /&gt;
		category =&#039;CS1 errors: ASIN TLD&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_bibcode = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;bibcode=&amp;lt;/code&amp;gt; $1&#039;,		-- $1 is error message detail&lt;br /&gt;
		anchor = &#039;bad_bibcode&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: bibcode&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_biorxiv = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;biorxiv=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_biorxiv&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: bioRxiv&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_citeseerx = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;citeseerx=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_citeseerx&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: citeseerx&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_date = {&lt;br /&gt;
		message = &#039;Check date values in: $1&#039;,									-- $1 is a parameter name list&lt;br /&gt;
		anchor = &#039;bad_date&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: dates&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_doi = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;doi=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_doi&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: DOI&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_hdl = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;hdl=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_hdl&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: HDL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_isbn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;isbn=&amp;lt;/code&amp;gt; value: $1&#039;,	-- $1 is error message detail&lt;br /&gt;
		anchor = &#039;bad_isbn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: ISBN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_ismn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;ismn=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_ismn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: ISMN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_issn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1issn=&amp;lt;/code&amp;gt; value&#039;,	-- $1 is &#039;e&#039; or &#039;&#039; for eissn or issn&lt;br /&gt;
		anchor = &#039;bad_issn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: ISSN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_jfm = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;jfm=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_jfm&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: JFM&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_jstor = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;jstor=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_jstor&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: JSTOR&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_lccn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;lccn=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_lccn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: LCCN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_medrxiv = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;medrxiv=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_medrxiv&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: medRxiv&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_mr = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;mr=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_mr&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: MR&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_oclc = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;oclc=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_oclc&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: OCLC&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_ol = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;ol=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_ol&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: OL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_osti = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;osti=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_osti&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: OSTI&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_paramlink = {														-- for |title-link=, |author/editor/translator-link=, |series-link=, |episode-link=&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; value&#039;,		-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;bad_paramlink&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: parameter link&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_pmc = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;pmc=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_pmc&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: PMC&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_pmid = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;pmid=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_pmid&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: PMID&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_rfc = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;rfc=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_rfc&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: RFC&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_s2cid = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;s2cid=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_s2cid&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: S2CID&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_sbn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;sbn=&amp;lt;/code&amp;gt; value: $1&#039;,	-- $1 is error message detail&lt;br /&gt;
		anchor = &#039;bad_sbn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: SBN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_ssrn = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;ssrn=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_ssrn&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: SSRN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_url = {&lt;br /&gt;
		message = &#039;Check $1 value&#039;,												-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;bad_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_usenet_id = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;message-id=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_message_id&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: message-id&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bad_zbl = {&lt;br /&gt;
		message = &#039;Check &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;zbl=&amp;lt;/code&amp;gt; value&#039;,&lt;br /&gt;
		anchor = &#039;bad_zbl&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: Zbl&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_bare_url_missing_title = {&lt;br /&gt;
		message = &#039;$1 missing title&#039;,											-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;bare_url_missing_title&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: bare URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_biorxiv_missing = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;biorxiv=&amp;lt;/code&amp;gt; required&#039;,&lt;br /&gt;
		anchor = &#039;biorxiv_missing&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: bioRxiv&#039;,										-- same as bad bioRxiv&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_chapter_ignored = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; ignored&#039;,			-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;chapter_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: chapter ignored&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_citation_missing_title = {&lt;br /&gt;
		message = &#039;Missing or empty &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;citation_missing_title&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing title&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_citeseerx_missing = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;citeseerx=&amp;lt;/code&amp;gt; required&#039;,&lt;br /&gt;
		anchor = &#039;citeseerx_missing&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: citeseerx&#039;,										-- same as bad citeseerx&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_cite_web_url = {														-- this error applies to cite web and to cite podcast&lt;br /&gt;
		message = &#039;Missing or empty &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;url=&amp;lt;/code&amp;gt;&#039;,&lt;br /&gt;
		anchor = &#039;cite_web_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: requires URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_class_ignored = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;class=&amp;lt;/code&amp;gt; ignored&#039;,&lt;br /&gt;
		anchor = &#039;class_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: class&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_contributor_ignored = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;contributor=&amp;lt;/code&amp;gt; ignored&#039;,&lt;br /&gt;
		anchor = &#039;contributor_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: contributor&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_contributor_missing_required_param = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;contributor=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;contributor_missing_required_param&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: contributor&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_deprecated_params = {&lt;br /&gt;
		message = &#039;Cite uses deprecated parameter &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;deprecated_params&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: deprecated parameters&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_disp_name = {&lt;br /&gt;
		message = &#039;Invalid &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=$2&amp;lt;/code&amp;gt;&#039;,			-- $1 is parameter name; $2 is the assigned value&lt;br /&gt;
		anchor = &#039;disp_name&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: display-names&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_doibroken_missing_doi = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;doi=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;doibroken_missing_doi&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: DOI&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_embargo_missing_pmc = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;pmc=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;embargo_missing_pmc&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: PMC embargo&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_empty_citation = {&lt;br /&gt;
		message = &#039;Empty citation&#039;,&lt;br /&gt;
		anchor = &#039;empty_citation&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: empty citation&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_etal = {&lt;br /&gt;
		message = &#039;Explicit use of et al. in: &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;explicit_et_al&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: explicit use of et al.&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_extra_text_edition = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;edition=&amp;lt;/code&amp;gt; has extra text&#039;,&lt;br /&gt;
		anchor = &#039;extra_text_edition&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: extra text: edition&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_extra_text_issue = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; has extra text&#039;,		-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;extra_text_issue&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: extra text: issue&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_extra_text_pages = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; has extra text&#039;,		-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;extra_text_pages&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: extra text: pages&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_extra_text_volume = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; has extra text&#039;,		-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;extra_text_volume&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: extra text: volume&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_first_missing_last = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; missing &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt;&#039;,	-- $1 is first alias, $2 is matching last alias&lt;br /&gt;
		anchor = &#039;first_missing_last&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing name&#039;,									-- author, contributor, editor, interviewer, translator&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_format_missing_url = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt;&#039;,	-- $1 is format parameter $2 is url parameter&lt;br /&gt;
		anchor = &#039;format_missing_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: format without URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_generic_name = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; has generic name&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;generic_name&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: generic name&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_generic_title = {&lt;br /&gt;
		message = &#039;Cite uses generic title&#039;,&lt;br /&gt;
		anchor = &#039;generic_title&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: generic title&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_invalid_isbn_date = {&lt;br /&gt;
		message = &#039;ISBN / Date incompatibility&#039;,&lt;br /&gt;
		anchor = &#039;invalid_isbn_date&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: ISBN date&#039;,&lt;br /&gt;
		hidden = true&lt;br /&gt;
		},&lt;br /&gt;
	err_invalid_param_val = {&lt;br /&gt;
		message = &#039;Invalid &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=$2&amp;lt;/code&amp;gt;&#039;,			-- $1 is parameter name $2 is parameter value&lt;br /&gt;
		anchor = &#039;invalid_param_val&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: invalid parameter value&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_invisible_char = {&lt;br /&gt;
		message = &#039;$1 in $2 at position $3&#039;,									-- $1 is invisible char $2 is parameter name $3 is position number&lt;br /&gt;
		anchor = &#039;invisible_char&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: invisible characters&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_medrxiv_missing = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;medrxiv=&amp;lt;/code&amp;gt; required&#039;,&lt;br /&gt;
		anchor = &#039;medrxiv_missing&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: medRxiv&#039;,										-- same as bad medRxiv&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_missing_name = {&lt;br /&gt;
		message = &#039;Missing &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1$2=&amp;lt;/code&amp;gt;&#039;,			-- $1 is modified NameList; $2 is enumerator&lt;br /&gt;
		anchor = &#039;missing_name&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing name&#039;,									-- author, contributor, editor, interviewer, translator&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_missing_periodical = {&lt;br /&gt;
		message = &#039;Cite $1 requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt;&#039;,	-- $1 is cs1 template name; $2 is canonical periodical parameter name for cite $1&lt;br /&gt;
		anchor = &#039;missing_periodical&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing periodical&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_missing_pipe = {&lt;br /&gt;
		message = &#039;Missing pipe in: &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;missing_pipe&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing pipe&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_missing_publisher = {&lt;br /&gt;
		message = &#039;Cite $1 requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt;&#039;,	-- $1 is cs1 template name; $2 is canonical publisher parameter name for cite $1&lt;br /&gt;
		anchor = &#039;missing_publisher&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: missing publisher&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_numeric_names = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; has numeric name&#039;,	-- $1 is parameter name&#039;,&lt;br /&gt;
		anchor = &#039;numeric_names&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: numeric name&#039;,&lt;br /&gt;
		hidden = false,&lt;br /&gt;
		},&lt;br /&gt;
	err_param_access_requires_param = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1-access=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;param_access_requires_param&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: param-access&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_param_has_ext_link = {&lt;br /&gt;
		message = &#039;External link in &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;$1&amp;lt;/code&amp;gt;&#039;,			-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;param_has_ext_link&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: external links&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_param_has_twl_url = {&lt;br /&gt;
		message = &#039;Wikipedia Library link in &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;$1&amp;lt;/code&amp;gt;&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;param_has_twl_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: URL&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_parameter_ignored = {&lt;br /&gt;
		message = &#039;Unknown parameter &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; ignored&#039;,	-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;parameter_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: unsupported parameter&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_parameter_ignored_suggest = {&lt;br /&gt;
		message = &#039;Unknown parameter &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; ignored (&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$2=&amp;lt;/code&amp;gt; suggested)&#039;,	-- $1 is unknown parameter $2 is suggested parameter name&lt;br /&gt;
		anchor = &#039;parameter_ignored_suggest&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: unsupported parameter&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_periodical_ignored = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; ignored&#039;,			-- $1 is parameter name&lt;br /&gt;
		anchor = &#039;periodical_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: periodical ignored&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_redundant_parameters = {&lt;br /&gt;
		message = &#039;More than one of $1 specified&#039;,								-- $1 is error message detail&lt;br /&gt;
		anchor = &#039;redundant_parameters&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: redundant parameter&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_script_parameter = {&lt;br /&gt;
		message = &#039;Invalid &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt;: $2&#039;,		-- $1 is parameter name $2 is script language code or error detail&lt;br /&gt;
		anchor = &#039;script_parameter&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: script parameters&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_ssrn_missing = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;ssrn=&amp;lt;/code&amp;gt; required&#039;,&lt;br /&gt;
		anchor = &#039;ssrn_missing&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: SSRN&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_text_ignored = {&lt;br /&gt;
		message = &#039;Text &amp;quot;$1&amp;quot; ignored&#039;,											-- $1 is ignored text&lt;br /&gt;
		anchor = &#039;text_ignored&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: unrecognized parameter&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_trans_missing_title = {&lt;br /&gt;
		message = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;trans-$1=&amp;lt;/code&amp;gt; requires &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;$1=&amp;lt;/code&amp;gt; or &amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;&amp;amp;#124;script-$1=&amp;lt;/code&amp;gt;&#039;,	-- $1 is base parameter name&lt;br /&gt;
		anchor = &#039;trans_missing_title&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: translated title&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_param_unknown_empty = {&lt;br /&gt;
		message = &#039;Cite has empty unknown parameter$1: $2&#039;,						-- $1 is &#039;s&#039; or empty space; $2 is emty unknown param list&lt;br /&gt;
		anchor = &#039;param_unknown_empty&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: empty unknown parameters&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_vancouver = {&lt;br /&gt;
		message = &#039;Vancouver style error: $1 in name $2&#039;,						-- $1 is error detail, $2 is the nth name&lt;br /&gt;
		anchor = &#039;vancouver&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: Vancouver style&#039;,&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
	err_wikilink_in_url = {&lt;br /&gt;
		message = &#039;URL–wikilink conflict&#039;,										-- uses ndash&lt;br /&gt;
		anchor = &#039;wikilink_in_url&#039;,&lt;br /&gt;
		category = &#039;CS1 errors: URL–wikilink conflict&#039;,							-- uses ndash&lt;br /&gt;
		hidden = false&lt;br /&gt;
		},&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M A I N T &amp;gt;-------------------------------------&lt;br /&gt;
&lt;br /&gt;
maint messages do not have a message (message = nil); otherwise the structure&lt;br /&gt;
is the same as error messages&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
	maint_archive_origin = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;archive_origin&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: archive origin&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_archived_copy = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;archived_copy&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: archived copy as title&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_bibcode = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;bibcode&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: bibcode&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_location_no_publisher = {												-- cite book, conference, encyclopedia; citation as book cite or encyclopedia cite&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;location_no_publisher&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: location missing publisher&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_bot_unknown = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;bot:_unknown&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: bot: original URL status unknown&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_date_auto_xlated = {													-- date auto-translation not supported by en.wiki&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;date_auto_xlated&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: date auto-translated&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_date_format = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;date_format&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: date format&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_date_year = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;date_year&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: date and year&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_deprecated_archive = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;deprecated_archive&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: deprecated archival service&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_doi_ignore = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;doi_ignore&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: ignored DOI errors&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_doi_inactive = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;doi_inactive&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: DOI inactive&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_doi_inactive_dated = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;doi_inactive_dated&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: DOI inactive as of $2$3$1&#039;,						-- $1 is year, $2 is month-name or empty string, $3 is space or empty string&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_doi_unflagged_free = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;doi_unflagged_free&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: unflagged free DOI&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_extra_punct = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;extra_punct&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: extra punctuation&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_id_limit_load_fail = {												-- applies to all cs1|2 templates on a page; &lt;br /&gt;
		message = nil,															-- maint message (category link) never emitted&lt;br /&gt;
		anchor = &#039;id_limit_load_fail&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: ID limit load fail&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_isbn_ignore = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;ignore_isbn_err&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: ignored ISBN errors&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_issn_ignore = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;ignore_issn&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: ignored ISSN errors&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_jfm_format = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;jfm_format&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: JFM format&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_location = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;location&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: location&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_missing_class = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;missing_class&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: missing class&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_mr_format = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;mr_format&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: MR format&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_mult_names = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;mult_names&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: multiple names: $1&#039;,								-- $1 is &#039;&amp;lt;name&amp;gt;s list&#039;; gets value from special_case_translation table&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_numeric_names = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;numeric_names&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: numeric names: $1&#039;,								-- $1 is &#039;&amp;lt;name&amp;gt;s list&#039;; gets value from special_case_translation table&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_others = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;others&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: others&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_others_avm = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;others_avm&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: others in cite AV media (notes)&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_overridden_setting = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;overridden&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: overridden setting&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_page_art_num = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;page_art_num&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: article number as page number&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_pmc_embargo = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;embargo&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: PMC embargo expired&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_pmc_format = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;pmc_format&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: PMC format&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_postscript = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;postscript&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: postscript&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
	},&lt;br /&gt;
	maint_publisher_location = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;publisher_location&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: publisher location&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
	},&lt;br /&gt;
	maint_ref_duplicates_default = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;ref_default&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: ref duplicates default&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
	},&lt;br /&gt;
	maint_shortened_archive_url = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;shortened_archive_url&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: shortened archive url&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
	},&lt;br /&gt;
	maint_unknown_lang = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;unknown_lang&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: unrecognized language&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_untitled = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;untitled&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: untitled periodical&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_url_status = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;url_status&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: url-status&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_work_isbn = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;work_isbn&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: work parameter with ISBN&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_year= {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;year&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: year&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	maint_zbl = {&lt;br /&gt;
		message = nil,&lt;br /&gt;
		anchor = &#039;zbl&#039;,&lt;br /&gt;
		category = &#039;CS1 maint: Zbl&#039;,&lt;br /&gt;
		hidden = true,&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I D _ L I M I T S _ D A T A _ T &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fetch id limits for certain identifiers from c:Data:CS1/Identifier limits.tab.  This source is a json tabular &lt;br /&gt;
data file maintained at wikipedia commons.  Convert the json format to a table of k/v pairs.&lt;br /&gt;
&lt;br /&gt;
The values from &amp;lt;id_limits_data_t&amp;gt; are used to set handle.id_limit.&lt;br /&gt;
&lt;br /&gt;
From 2025-02-21, MediaWiki is broken.  Use this link to edit the tablular data file:&lt;br /&gt;
	https://commons.wikimedia.org/w/index.php?title=Data:CS1/Identifier_limits.tab&amp;amp;action=edit&lt;br /&gt;
See Phab:T389105&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local id_limits_data_t = {};&lt;br /&gt;
&lt;br /&gt;
local use_commons_data = true;													-- set to false if your wiki does not have access to mediawiki commons; then,&lt;br /&gt;
if false == use_commons_data then												-- update this table from https://commons.wikimedia.org/wiki/Data:CS1/Identifier_limits.tab; last update: 2025-02-21&lt;br /&gt;
	id_limits_data_t = {[&#039;OCLC&#039;] = 10450000000, [&#039;OSTI&#039;] = 23010000, [&#039;PMC&#039;] = 11900000, [&#039;PMID&#039;] = 40400000, [&#039;RFC&#039;] = 9300, [&#039;SSRN&#039;] = 5200000, [&#039;S2CID&#039;] = 276000000};	-- this table must be maintained locally&lt;br /&gt;
&lt;br /&gt;
else																			-- here for wikis that do have access to mediawiki commons&lt;br /&gt;
	local load_fail_limit = 99999999999;										-- very high number to avoid error messages on load failure&lt;br /&gt;
	id_limits_data_t = {[&#039;OCLC&#039;] = load_fail_limit, [&#039;OSTI&#039;] = load_fail_limit, [&#039;PMC&#039;] = load_fail_limit, [&#039;PMID&#039;] = load_fail_limit, [&#039;RFC&#039;] = load_fail_limit, [&#039;SSRN&#039;] = load_fail_limit, [&#039;S2CID&#039;] = load_fail_limit};&lt;br /&gt;
&lt;br /&gt;
	local id_limits_data_load_fail = false;										-- flag; assume that we will be successful when loading json id limit tabular data&lt;br /&gt;
&lt;br /&gt;
	if mw.ext.data == nil then&lt;br /&gt;
		id_limits_data_load_fail = true;										-- safeguard against Lua errors if mw.ext.data is not available for some reason&lt;br /&gt;
	else&lt;br /&gt;
		local tab_data_t = mw.ext.data.get (&#039;CS1/Identifier limits.tab&#039;);		-- attempt to load the tabular data from commons into &amp;lt;tab_data_t&amp;gt;&lt;br /&gt;
		if false == tab_data_t then												-- undocumented &#039;feature&#039;: mw.ext.data.get() sometimes returns false&lt;br /&gt;
			id_limits_data_load_fail = true;									-- set the flag so that Module:Citation/CS1 can create an unannotated maint category&lt;br /&gt;
		else&lt;br /&gt;
			for _, limit_t in ipairs (tab_data_t.data) do						-- overwrite default &amp;lt;load_fail_limit&amp;gt; values from the data table in the tabular data&lt;br /&gt;
				id_limits_data_t[limit_t[1]] = limit_t[2];						-- &amp;lt;limit[1]&amp;gt; is identifier; &amp;lt;limit[2]&amp;gt; is upper limit for that identifier&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I D _ H A N D L E R S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
The following contains a list of values for various defined identifiers.  For each&lt;br /&gt;
identifier we specify a variety of information necessary to properly render the&lt;br /&gt;
identifier in the citation.&lt;br /&gt;
&lt;br /&gt;
	parameters: a list of parameter aliases for this identifier; first in the list is the canonical form&lt;br /&gt;
	link: Wikipedia article name&lt;br /&gt;
	redirect: a local redirect to a local Wikipedia article name;  at en.wiki, &#039;ISBN (identifier)&#039; is a redirect to &#039;International Standard Book Number&#039;&lt;br /&gt;
	q: Wikidata q number for the identifier&lt;br /&gt;
	label: the label preceding the identifier; label is linked to a Wikipedia article (in this order):&lt;br /&gt;
		redirect from id_handlers[&#039;&amp;lt;id&amp;gt;&#039;].redirect when use_identifier_redirects is true&lt;br /&gt;
		Wikidata-supplied article name for the local wiki from id_handlers[&#039;&amp;lt;id&amp;gt;&#039;].q&lt;br /&gt;
		local article name from id_handlers[&#039;&amp;lt;id&amp;gt;&#039;].link&lt;br /&gt;
	prefix: the first part of a URL that will be concatenated with a second part which usually contains the identifier&lt;br /&gt;
	suffix: optional third part to be added after the identifier&lt;br /&gt;
	encode: true if URI should be percent-encoded; otherwise false&lt;br /&gt;
	COinS: identifier link or keyword for use in COinS:&lt;br /&gt;
		for identifiers registered at info-uri.info use: info:.... where &#039;...&#039; is the appropriate identifier label &lt;br /&gt;
		for identifiers that have COinS keywords, use the keyword: rft.isbn, rft.issn, rft.eissn&lt;br /&gt;
		for |asin= and |ol=, which require assembly, use the keyword: url&lt;br /&gt;
		for others make a URL using the value in prefix/suffix and #label, use the keyword: pre (not checked; any text other than &#039;info&#039;, &#039;rft&#039;, or &#039;url&#039; works here)&lt;br /&gt;
		set to nil to leave the identifier out of the COinS&lt;br /&gt;
	separator: character or text between label and the identifier in the rendered citation&lt;br /&gt;
	id_limit: for those identifiers with established limits, this property holds the upper limit&lt;br /&gt;
	access: use this parameter to set the access level for all instances of this identifier.&lt;br /&gt;
		the value must be a valid access level for an identifier (see [&#039;id-access&#039;] in this file).&lt;br /&gt;
	custom_access: to enable custom access level for an identifier, set this parameter&lt;br /&gt;
		to the parameter that should control it (normally &#039;id-access&#039;)&lt;br /&gt;
		&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local id_handlers = {&lt;br /&gt;
	[&#039;ARXIV&#039;] = {&lt;br /&gt;
		parameters = {&#039;arxiv&#039;, &#039;eprint&#039;},&lt;br /&gt;
		link = &#039;arXiv&#039;,&lt;br /&gt;
		redirect = &#039;arXiv (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q118398&#039;,&lt;br /&gt;
		label = &#039;arXiv&#039;,&lt;br /&gt;
		prefix = &#039;https://arxiv.org/abs/&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		COinS = &#039;info:arxiv&#039;,&lt;br /&gt;
		separator = &#039;:&#039;,&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;ASIN&#039;] = {&lt;br /&gt;
		parameters = { &#039;asin&#039;, &#039;ASIN&#039; },&lt;br /&gt;
		link = &#039;Amazon Standard Identification Number&#039;,&lt;br /&gt;
		redirect = &#039;ASIN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q1753278&#039;,&lt;br /&gt;
		label = &#039;ASIN&#039;,&lt;br /&gt;
		prefix = &#039;https://www.amazon.&#039;,&lt;br /&gt;
		COinS = &#039;url&#039;,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		encode = false;&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;BIBCODE&#039;] = {&lt;br /&gt;
		parameters = {&#039;bibcode&#039;},&lt;br /&gt;
		link = &#039;Bibcode&#039;,&lt;br /&gt;
		redirect = &#039;Bibcode (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q25754&#039;,&lt;br /&gt;
		label = &#039;Bibcode&#039;,&lt;br /&gt;
		prefix = &#039;https://ui.adsabs.harvard.edu/abs/&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		COinS = &#039;info:bibcode&#039;,&lt;br /&gt;
		separator = &#039;:&#039;,&lt;br /&gt;
		custom_access = &#039;bibcode-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;BIORXIV&#039;] = {&lt;br /&gt;
		parameters = {&#039;biorxiv&#039;},&lt;br /&gt;
		link = &#039;bioRxiv&#039;,&lt;br /&gt;
		redirect = &#039;bioRxiv (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q19835482&#039;,&lt;br /&gt;
		label = &#039;bioRxiv&#039;,&lt;br /&gt;
		prefix = &#039;https://doi.org/&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;CITESEERX&#039;] = {&lt;br /&gt;
		parameters = {&#039;citeseerx&#039;},&lt;br /&gt;
		link = &#039;CiteSeerX&#039;,&lt;br /&gt;
		redirect = &#039;CiteSeerX (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q2715061&#039;,&lt;br /&gt;
		label = &#039;CiteSeerX&#039;,&lt;br /&gt;
		prefix = &#039;https://citeseerx.ist.psu.edu/viewdoc/summary?doi=&#039;,&lt;br /&gt;
		COinS =  &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;DOI&#039;] = {																	-- Used by InternetArchiveBot&lt;br /&gt;
		parameters = { &#039;doi&#039;, &#039;DOI&#039;},&lt;br /&gt;
		link = &#039;Digital object identifier&#039;,&lt;br /&gt;
		redirect = &#039;doi (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q25670&#039;,&lt;br /&gt;
		label = &#039;doi&#039;,&lt;br /&gt;
		prefix = &#039;https://doi.org/&#039;,&lt;br /&gt;
		COinS = &#039;info:doi&#039;,&lt;br /&gt;
		separator = &#039;:&#039;,&lt;br /&gt;
		encode = true,&lt;br /&gt;
		custom_access = &#039;doi-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;EISSN&#039;] = {&lt;br /&gt;
		parameters = {&#039;eissn&#039;, &#039;EISSN&#039;},&lt;br /&gt;
		link = &#039;International Standard Serial Number#Electronic ISSN&#039;,&lt;br /&gt;
		redirect = &#039;eISSN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q46339674&#039;,&lt;br /&gt;
		label = &#039;eISSN&#039;,&lt;br /&gt;
		prefix = &#039;https://search.worldcat.org/issn/&#039;,&lt;br /&gt;
		COinS = &#039;rft.eissn&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;HDL&#039;] = {&lt;br /&gt;
		parameters = { &#039;hdl&#039;, &#039;HDL&#039; },&lt;br /&gt;
		link = &#039;Handle System&#039;,&lt;br /&gt;
		redirect = &#039;hdl (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q3126718&#039;,&lt;br /&gt;
		label = &#039;hdl&#039;,&lt;br /&gt;
		prefix = &#039;https://hdl.handle.net/&#039;,&lt;br /&gt;
		COinS = &#039;info:hdl&#039;,&lt;br /&gt;
		separator = &#039;:&#039;,&lt;br /&gt;
		encode = true,&lt;br /&gt;
		custom_access = &#039;hdl-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;ISBN&#039;] = {																-- Used by InternetArchiveBot&lt;br /&gt;
		parameters = {&#039;isbn&#039;, &#039;ISBN&#039;},&lt;br /&gt;
		link = &#039;International Standard Book Number&#039;,&lt;br /&gt;
		redirect = &#039;ISBN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q33057&#039;,&lt;br /&gt;
		label = &#039;ISBN&#039;,&lt;br /&gt;
		prefix = &#039;Special:BookSources/&#039;,&lt;br /&gt;
		COinS = &#039;rft.isbn&#039;,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;ISMN&#039;] = {&lt;br /&gt;
		parameters = {&#039;ismn&#039;, &#039;ISMN&#039;},&lt;br /&gt;
		link = &#039;International Standard Music Number&#039;,&lt;br /&gt;
		redirect = &#039;ISMN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q1666938&#039;,&lt;br /&gt;
		label = &#039;ISMN&#039;,&lt;br /&gt;
		prefix = &#039;&#039;,															-- not currently used;&lt;br /&gt;
		COinS = nil,															-- nil because we can&#039;t use pre or rft or info:&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;ISSN&#039;] = {&lt;br /&gt;
		parameters = {&#039;issn&#039;, &#039;ISSN&#039;},&lt;br /&gt;
		link = &#039;International Standard Serial Number&#039;,&lt;br /&gt;
		redirect = &#039;ISSN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q131276&#039;,&lt;br /&gt;
		label = &#039;ISSN&#039;,&lt;br /&gt;
		prefix = &#039;https://search.worldcat.org/issn/&#039;,&lt;br /&gt;
		COinS = &#039;rft.issn&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;JFM&#039;] = {&lt;br /&gt;
		parameters = {&#039;jfm&#039;, &#039;JFM&#039;},&lt;br /&gt;
		link = &#039;Jahrbuch über die Fortschritte der Mathematik&#039;,&lt;br /&gt;
		redirect = &#039;JFM (identifier)&#039;,&lt;br /&gt;
		q = &#039;&#039;,&lt;br /&gt;
		label = &#039;JFM&#039;,&lt;br /&gt;
		prefix = &#039;https://zbmath.org/?format=complete&amp;amp;q=an:&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;JSTOR&#039;] = {&lt;br /&gt;
		parameters = {&#039;jstor&#039;, &#039;JSTOR&#039;},&lt;br /&gt;
		link = &#039;JSTOR&#039;,&lt;br /&gt;
		redirect = &#039;JSTOR (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q1420342&#039;,&lt;br /&gt;
		label = &#039;JSTOR&#039;,&lt;br /&gt;
		prefix = &#039;https://www.jstor.org/stable/&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		custom_access = &#039;jstor-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;LCCN&#039;] = {&lt;br /&gt;
		parameters = {&#039;lccn&#039;, &#039;LCCN&#039;},&lt;br /&gt;
		link = &#039;Library of Congress Control Number&#039;,&lt;br /&gt;
		redirect = &#039;LCCN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q620946&#039;,&lt;br /&gt;
		label = &#039;LCCN&#039;,&lt;br /&gt;
		prefix = &#039;https://lccn.loc.gov/&#039;,&lt;br /&gt;
		COinS = &#039;info:lccn&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;MEDRXIV&#039;] = {&lt;br /&gt;
		parameters = {&#039;medrxiv&#039;},&lt;br /&gt;
		link = &#039;medRxiv&#039;,&lt;br /&gt;
		redirect = &#039;medRxiv (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q58465838&#039;,&lt;br /&gt;
		label = &#039;medRxiv&#039;,&lt;br /&gt;
		prefix = &#039;https://www.medrxiv.org/content/&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;MR&#039;] = {&lt;br /&gt;
		parameters = {&#039;mr&#039;, &#039;MR&#039;},&lt;br /&gt;
		link = &#039;Mathematical Reviews&#039;,&lt;br /&gt;
		redirect = &#039;MR (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q211172&#039;,&lt;br /&gt;
		label = &#039;MR&#039;,&lt;br /&gt;
		prefix = &#039;https://mathscinet.ams.org/mathscinet-getitem?mr=&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;OCLC&#039;] = {&lt;br /&gt;
		parameters = {&#039;oclc&#039;, &#039;OCLC&#039;},&lt;br /&gt;
		link = &#039;OCLC&#039;,&lt;br /&gt;
		redirect = &#039;OCLC (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q190593&#039;,&lt;br /&gt;
		label = &#039;OCLC&#039;,&lt;br /&gt;
		prefix = &#039;https://search.worldcat.org/oclc/&#039;,&lt;br /&gt;
		COinS = &#039;info:oclcnum&#039;,&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.OCLC or 0,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;OL&#039;] = {&lt;br /&gt;
		parameters = { &#039;ol&#039;, &#039;OL&#039; },&lt;br /&gt;
		link = &#039;Open Library&#039;,&lt;br /&gt;
		redirect = &#039;OL (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q1201876&#039;,&lt;br /&gt;
		label = &#039;OL&#039;,&lt;br /&gt;
		prefix = &#039;https://openlibrary.org/&#039;,&lt;br /&gt;
		COinS = &#039;url&#039;,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		encode = true,&lt;br /&gt;
		custom_access = &#039;ol-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;OSTI&#039;] = {&lt;br /&gt;
		parameters = {&#039;osti&#039;, &#039;OSTI&#039;},&lt;br /&gt;
		link = &#039;Office of Scientific and Technical Information&#039;,&lt;br /&gt;
		redirect = &#039;OSTI (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q2015776&#039;,&lt;br /&gt;
		label = &#039;OSTI&#039;,&lt;br /&gt;
		prefix = &#039;https://www.osti.gov/biblio/&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.OSTI or 0,&lt;br /&gt;
		custom_access = &#039;osti-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;PMC&#039;] = {&lt;br /&gt;
		parameters = {&#039;pmc&#039;, &#039;PMC&#039;},&lt;br /&gt;
		link = &#039;PubMed Central&#039;,&lt;br /&gt;
		redirect = &#039;PMC (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q229883&#039;,&lt;br /&gt;
		label = &#039;PMC&#039;,&lt;br /&gt;
		prefix = &#039;https://www.ncbi.nlm.nih.gov/pmc/articles/PMC&#039;,&lt;br /&gt;
		suffix = &#039;&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.PMC or 0,&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;PMID&#039;] = {&lt;br /&gt;
		parameters = {&#039;pmid&#039;, &#039;PMID&#039;},&lt;br /&gt;
		link = &#039;PubMed Identifier&#039;,&lt;br /&gt;
		redirect = &#039;PMID (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q2082879&#039;,&lt;br /&gt;
		label = &#039;PMID&#039;,&lt;br /&gt;
		prefix = &#039;https://pubmed.ncbi.nlm.nih.gov/&#039;,&lt;br /&gt;
		COinS = &#039;info:pmid&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.PMID or 0,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;RFC&#039;] = {&lt;br /&gt;
		parameters = {&#039;rfc&#039;, &#039;RFC&#039;},&lt;br /&gt;
		link = &#039;Request for Comments&#039;,&lt;br /&gt;
		redirect = &#039;RFC (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q212971&#039;,&lt;br /&gt;
		label = &#039;RFC&#039;,&lt;br /&gt;
		prefix = &#039;https://tools.ietf.org/html/rfc&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.RFC or 0,&lt;br /&gt;
		access = &#039;free&#039;,														-- free to read&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;SBN&#039;] = {&lt;br /&gt;
		parameters = {&#039;sbn&#039;, &#039;SBN&#039;},&lt;br /&gt;
		link = &#039;Standard Book Number&#039;,											-- redirect to International_Standard_Book_Number#History&lt;br /&gt;
		redirect = &#039;SBN (identifier)&#039;,&lt;br /&gt;
		label = &#039;SBN&#039;,&lt;br /&gt;
		prefix = &#039;Special:BookSources/0-&#039;,										-- prefix has leading zero necessary to make 9-digit sbn a 10-digit isbn&lt;br /&gt;
		COinS = nil,															-- nil because we can&#039;t use pre or rft or info:&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;SSRN&#039;] = {&lt;br /&gt;
		parameters = {&#039;ssrn&#039;, &#039;SSRN&#039;},&lt;br /&gt;
		link = &#039;Social Science Research Network&#039;,&lt;br /&gt;
		redirect = &#039;SSRN (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q7550801&#039;,&lt;br /&gt;
		label = &#039;SSRN&#039;,&lt;br /&gt;
		prefix = &#039;https://papers.ssrn.com/sol3/papers.cfm?abstract_id=&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.SSRN or 0,&lt;br /&gt;
		custom_access = &#039;ssrn-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;S2CID&#039;] = {&lt;br /&gt;
		parameters = {&#039;s2cid&#039;, &#039;S2CID&#039;},&lt;br /&gt;
		link = &#039;Semantic Scholar&#039;,&lt;br /&gt;
		redirect = &#039;S2CID (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q22908627&#039;,&lt;br /&gt;
		label = &#039;S2CID&#039;,&lt;br /&gt;
		prefix = &#039;https://api.semanticscholar.org/CorpusID:&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = false,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		id_limit = id_limits_data_t.S2CID or 0,&lt;br /&gt;
		custom_access = &#039;s2cid-access&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;USENETID&#039;] = {&lt;br /&gt;
		parameters = {&#039;message-id&#039;},&lt;br /&gt;
		link = &#039;Usenet&#039;,&lt;br /&gt;
		redirect = &#039;Usenet (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q193162&#039;,&lt;br /&gt;
		label = &#039;Usenet:&#039;,&lt;br /&gt;
		prefix = &#039;news:&#039;,&lt;br /&gt;
		encode = false,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	[&#039;ZBL&#039;] = {&lt;br /&gt;
		parameters = {&#039;zbl&#039;, &#039;ZBL&#039; },&lt;br /&gt;
		link = &#039;Zentralblatt MATH&#039;,&lt;br /&gt;
		redirect = &#039;Zbl (identifier)&#039;,&lt;br /&gt;
		q = &#039;Q190269&#039;,&lt;br /&gt;
		label = &#039;Zbl&#039;,&lt;br /&gt;
		prefix = &#039;https://zbmath.org/?format=complete&amp;amp;q=an:&#039;,&lt;br /&gt;
		COinS = &#039;pre&#039;,															-- use prefix value&lt;br /&gt;
		encode = true,&lt;br /&gt;
		separator = &#039;&amp;amp;nbsp;&#039;,&lt;br /&gt;
		},&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T S &amp;gt;---------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return 	{&lt;br /&gt;
	use_identifier_redirects = use_identifier_redirects,						-- booleans defined in the settings at the top of this module&lt;br /&gt;
	local_lang_cat_enable = local_lang_cat_enable,&lt;br /&gt;
	date_name_auto_xlate_enable = date_name_auto_xlate_enable,&lt;br /&gt;
	date_digit_auto_xlate_enable = date_digit_auto_xlate_enable,&lt;br /&gt;
	enable_sort_keys = enable_sort_keys,&lt;br /&gt;
	suppress_archive_today_urls = suppress_archive_today_urls,&lt;br /&gt;
	&lt;br /&gt;
																				-- tables and variables created when this module is loaded&lt;br /&gt;
	dependencies_t = dependencies_t,											-- used to suppress parameters dependent on url-holding parameters holding archive.today urls&lt;br /&gt;
	enum_needs_xlation = &#039;1&#039; ~= date_names.xlate_digits[&#039;1&#039;],					-- to avoid unnecessary enumerator translation&lt;br /&gt;
	global_df = get_date_format (),												-- this line can be replaced with &amp;quot;global_df = &#039;dmy-all&#039;,&amp;quot; to have all dates auto translated to dmy format.&lt;br /&gt;
	global_cs1_config_t = global_cs1_config_t,									-- global settings from {{cs1 config}}&lt;br /&gt;
	id_limits_data_load_fail = id_limits_data_load_fail,						-- true when commons tabular identifier-limit data fails to load&lt;br /&gt;
	known_free_doi_registrants_t = build_free_doi_registrants_table(),&lt;br /&gt;
	punct_skip = build_skip_table (punct_skip, punct_meta_params),&lt;br /&gt;
	url_skip = build_skip_table (url_skip, url_meta_params),&lt;br /&gt;
&lt;br /&gt;
	archive_today_tlds_t = {[&#039;today&#039;] = true, [&#039;ph&#039;] = true, [&#039;is&#039;] = true, [&#039;md&#039;] = true, [&#039;li&#039;] = true, [&#039;fo&#039;] = true, [&#039;vn&#039;] = true};	-- used by is_archive_today_url()&lt;br /&gt;
	name_space_sort_keys = name_space_sort_keys,&lt;br /&gt;
	aliases = aliases,&lt;br /&gt;
	special_case_translation = special_case_translation,&lt;br /&gt;
	date_names = date_names,&lt;br /&gt;
	err_msg_supl = err_msg_supl,&lt;br /&gt;
	error_conditions = error_conditions,&lt;br /&gt;
	editor_markup_patterns = editor_markup_patterns,&lt;br /&gt;
	et_al_patterns = et_al_patterns,&lt;br /&gt;
	extended_registrants_t = extended_registrants_t,&lt;br /&gt;
	id_handlers = id_handlers,&lt;br /&gt;
	keywords_lists = keywords_lists,&lt;br /&gt;
	keywords_xlate = keywords_xlate,&lt;br /&gt;
	stripmarkers = stripmarkers,&lt;br /&gt;
	invisible_chars = invisible_chars,&lt;br /&gt;
	invisible_defs = invisible_defs,&lt;br /&gt;
	indic_script = indic_script,&lt;br /&gt;
	emoji_t = emoji_t,&lt;br /&gt;
	maint_cats = maint_cats,&lt;br /&gt;
	messages = messages,&lt;br /&gt;
	presentation = presentation,&lt;br /&gt;
	prop_cats = prop_cats,&lt;br /&gt;
	script_lang_codes = script_lang_codes,&lt;br /&gt;
	lang_tag_remap = lang_tag_remap,&lt;br /&gt;
	lang_name_remap = lang_name_remap,&lt;br /&gt;
	this_wiki_code = this_wiki_code,&lt;br /&gt;
	title_types = title_types,&lt;br /&gt;
	uncategorized_namespaces = uncategorized_namespaces_t,&lt;br /&gt;
	uncategorized_subpages = uncategorized_subpages,&lt;br /&gt;
	templates_using_volume = templates_using_volume,&lt;br /&gt;
	templates_using_issue = templates_using_issue,&lt;br /&gt;
	templates_not_using_page = templates_not_using_page,&lt;br /&gt;
	vol_iss_pg_patterns = vol_iss_pg_patterns,&lt;br /&gt;
	single_letter_2nd_lvl_domains_t = single_letter_2nd_lvl_domains_t,&lt;br /&gt;
	url_access_map_t = url_access_map_t,&lt;br /&gt;
	&lt;br /&gt;
	inter_wiki_map = inter_wiki_map,&lt;br /&gt;
	mw_languages_by_tag_t = mw_languages_by_tag_t,&lt;br /&gt;
	mw_languages_by_name_t = mw_languages_by_name_t,&lt;br /&gt;
	citation_class_map_t = citation_class_map_t,&lt;br /&gt;
&lt;br /&gt;
	citation_issue_t = citation_issue_t,&lt;br /&gt;
	citation_no_volume_t = citation_no_volume_t,&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1&amp;diff=603</id>
		<title>Module:Citation/CS1</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Citation/CS1&amp;diff=603"/>
		<updated>2026-06-06T21:27:51Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;require (&amp;#039;strict&amp;#039;);  ----------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------  each of these counts against the Lua upvalue limit    local validation;																-- functions in Module:Citation/CS1/Date_validation  local utilities;																-- functions in Module:Citation/CS1/Utilities local z = {};																	-- table of tables in Module:Citation/CS1/Utilities  local identifiers;																-- f...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require (&#039;strict&#039;);&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F O R W A R D   D E C L A R A T I O N S &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
each of these counts against the Lua upvalue limit&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local validation;																-- functions in Module:Citation/CS1/Date_validation&lt;br /&gt;
&lt;br /&gt;
local utilities;																-- functions in Module:Citation/CS1/Utilities&lt;br /&gt;
local z = {};																	-- table of tables in Module:Citation/CS1/Utilities&lt;br /&gt;
&lt;br /&gt;
local identifiers;																-- functions and tables in Module:Citation/CS1/Identifiers&lt;br /&gt;
local metadata;																	-- functions in Module:Citation/CS1/COinS&lt;br /&gt;
local cfg = {};																	-- table of configuration tables that are defined in Module:Citation/CS1/Configuration&lt;br /&gt;
local whitelist = {};															-- table of tables listing valid template parameter names; defined in Module:Citation/CS1/Whitelist&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------------&amp;lt; P A G E   S C O P E   V A R I A B L E S &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
declare variables here that have page-wide scope that are not brought in from&lt;br /&gt;
other modules; that are created here and used here&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local added_deprecated_cat;														-- boolean flag so that the category is added only once&lt;br /&gt;
local added_vanc_errs;															-- boolean flag so we only emit one Vancouver error / category&lt;br /&gt;
local added_generic_name_errs;													-- boolean flag so we only emit one generic name error / category and stop testing names once an error is encountered&lt;br /&gt;
local added_numeric_name_errs;													-- boolean flag so we only emit one numeric name error / category and stop testing names once an error is encountered&lt;br /&gt;
local added_numeric_name_maint;													-- boolean flag so we only emit one numeric name maint category and stop testing names once a category has been emitted&lt;br /&gt;
local is_preview_mode;															-- true when article is in preview mode; false when using &#039;Preview page with this template&#039; (previewing the module)&lt;br /&gt;
local is_sandbox;																-- true when using sandbox modules to render citation&lt;br /&gt;
local url_was_archive_today;													-- boolean flag set to true when has_archive_today_url() has unset |url= because it held a deprecated archive.today url&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F I R S T _ S E T &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Locates and returns the first set value in a table of values where the order established in the table,&lt;br /&gt;
left-to-right (or top-to-bottom), is the order in which the values are evaluated.  Returns nil if none are set.&lt;br /&gt;
&lt;br /&gt;
This version replaces the original &#039;for _, val in pairs do&#039; and a similar version that used ipairs.  With the pairs&lt;br /&gt;
version the order of evaluation could not be guaranteed.  With the ipairs version, a nil value would terminate&lt;br /&gt;
the for-loop before it reached the actual end of the list.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function first_set (list, count)&lt;br /&gt;
	local i = 1;&lt;br /&gt;
	while i &amp;lt;= count do															-- loop through all items in list&lt;br /&gt;
		if utilities.is_set( list[i] ) then&lt;br /&gt;
			return list[i];														-- return the first set list member&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- point to next&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A D D _ V A N C _ E R R O R &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Adds a single Vancouver system error message to the template&#039;s output regardless of how many error actually exist.&lt;br /&gt;
To prevent duplication, added_vanc_errs is nil until an error message is emitted.&lt;br /&gt;
&lt;br /&gt;
added_vanc_errs is a Boolean declared in page scope variables above&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function add_vanc_error (source, position)&lt;br /&gt;
	if added_vanc_errs then return end&lt;br /&gt;
		&lt;br /&gt;
	added_vanc_errs = true;														-- note that we&#039;ve added this category&lt;br /&gt;
	utilities.set_message (&#039;err_vancouver&#039;, {source, position});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S C H E M E &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
does this thing that purports to be a URI scheme seem to be a valid scheme?  The scheme is checked to see if it&lt;br /&gt;
is in agreement with http://tools.ietf.org/html/std66#section-3.1 which says:&lt;br /&gt;
	Scheme names consist of a sequence of characters beginning with a&lt;br /&gt;
   letter and followed by any combination of letters, digits, plus&lt;br /&gt;
   (&amp;quot;+&amp;quot;), period (&amp;quot;.&amp;quot;), or hyphen (&amp;quot;-&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
returns true if it does, else false&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_scheme (scheme)&lt;br /&gt;
	return scheme and scheme:match (&#039;^%a[%a%d%+%.%-]*:&#039;);						-- true if scheme is set and matches the pattern&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ D O M A I N _ N A M E &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Does this thing that purports to be a domain name seem to be a valid domain name?&lt;br /&gt;
&lt;br /&gt;
Syntax defined here: http://tools.ietf.org/html/rfc1034#section-3.5&lt;br /&gt;
BNF defined here: https://tools.ietf.org/html/rfc4234&lt;br /&gt;
Single character names are generally reserved; see https://tools.ietf.org/html/draft-ietf-dnsind-iana-dns-01#page-15;&lt;br /&gt;
	see also [[Single-letter second-level domain]]&lt;br /&gt;
list of TLDs: https://www.iana.org/domains/root/db&lt;br /&gt;
&lt;br /&gt;
RFC 952 (modified by RFC 1123) requires the first and last character of a hostname to be a letter or a digit.  Between&lt;br /&gt;
the first and last characters the name may use letters, digits, and the hyphen.&lt;br /&gt;
&lt;br /&gt;
Also allowed are IPv4 addresses. IPv6 not supported&lt;br /&gt;
&lt;br /&gt;
domain is expected to be stripped of any path so that the last character in the last character of the TLD.  tld&lt;br /&gt;
is two or more alpha characters.  Any preceding &#039;//&#039; (from splitting a URL with a scheme) will be stripped&lt;br /&gt;
here.  Perhaps not necessary but retained in case it is necessary for IPv4 dot decimal.&lt;br /&gt;
&lt;br /&gt;
There are several tests:&lt;br /&gt;
	the first character of the whole domain name including subdomains must be a letter or a digit&lt;br /&gt;
	internationalized domain name (ASCII characters with .xn-- ASCII Compatible Encoding (ACE) prefix xn-- in the TLD) see https://tools.ietf.org/html/rfc3490&lt;br /&gt;
	single-letter/digit second-level domains in the .org, .cash, and .today TLDs&lt;br /&gt;
	q, x, and z SL domains in the .com TLD&lt;br /&gt;
	i and q SL domains in the .net TLD&lt;br /&gt;
	single-letter SL domains in the ccTLDs (where the ccTLD is two letters)&lt;br /&gt;
	two-character SL domains in gTLDs (where the gTLD is two or more letters)&lt;br /&gt;
	three-plus-character SL domains in gTLDs (where the gTLD is two or more letters)&lt;br /&gt;
	IPv4 dot-decimal address format; TLD not allowed&lt;br /&gt;
&lt;br /&gt;
returns true if domain appears to be a proper name and TLD or IPv4 address, else false&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_domain_name (domain)&lt;br /&gt;
	if not domain then&lt;br /&gt;
		return false;															-- if not set, abandon&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain = domain:gsub (&#039;^//&#039;, &#039;&#039;);											-- strip &#039;//&#039; from domain name if present; done here so we only have to do it once&lt;br /&gt;
	&lt;br /&gt;
	if not domain:match (&#039;^[%w]&#039;) then											-- first character must be letter or digit&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if domain:match (&#039;^%a+:&#039;) then												-- hack to detect things that look like s:Page:Title where Page: is namespace at Wikisource&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local patterns = {															-- patterns that look like URLs&lt;br /&gt;
		&#039;%f[%w][%w][%w%-]+[%w]%.%a%a+$&#039;,										-- three or more character hostname.hostname or hostname.tld&lt;br /&gt;
		&#039;%f[%w][%w][%w%-]+[%w]%.xn%-%-[%w]+$&#039;,									-- internationalized domain name with ACE prefix&lt;br /&gt;
		&#039;%f[%a][qxz]%.com$&#039;,													-- assigned one character .com hostname (x.com times out 2015-12-10)&lt;br /&gt;
		&#039;%f[%a][iq]%.net$&#039;,														-- assigned one character .net hostname (q.net registered but not active 2015-12-10)&lt;br /&gt;
		&#039;%f[%w][%w]%.%a%a$&#039;,													-- one character hostname and ccTLD (2 chars)&lt;br /&gt;
		&#039;%f[%w][%w][%w]%.%a%a+$&#039;,												-- two character hostname and TLD&lt;br /&gt;
		&#039;^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?&#039;,								-- IPv4 address&lt;br /&gt;
		&#039;[%a%d]+%:?&#039;                                                            -- IPv6 address&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	for _, pattern in ipairs (patterns) do										-- loop through the patterns list&lt;br /&gt;
		if domain:match (pattern) then&lt;br /&gt;
			return true;														-- if a match then we think that this thing that purports to be a URL is a URL&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for _, d in ipairs (cfg.single_letter_2nd_lvl_domains_t) do					-- look for single letter second level domain names for these top level domains&lt;br /&gt;
		if domain:match (&#039;%f[%w][%w]%.&#039; .. d) then&lt;br /&gt;
			return true&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return false;																-- no matches, we don&#039;t know what this thing is&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ U R L &amp;gt;------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if the scheme and domain parts of a URL appear to be a valid URL; else false.&lt;br /&gt;
&lt;br /&gt;
This function is the last step in the validation process.  This function is separate because there are cases that&lt;br /&gt;
are not covered by split_url(), for example is_parameter_ext_wikilink() which is looking for bracketted external&lt;br /&gt;
wikilinks.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_url (scheme, domain)&lt;br /&gt;
	if utilities.is_set (scheme) then											-- if scheme is set check it and domain&lt;br /&gt;
		return is_scheme (scheme) and is_domain_name (domain);&lt;br /&gt;
	else&lt;br /&gt;
		return is_domain_name (domain);											-- scheme not set when URL is protocol-relative&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S P L I T _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Split a URL into a scheme, authority indicator, and domain.&lt;br /&gt;
&lt;br /&gt;
First remove Fully Qualified Domain Name terminator (a dot following TLD) (if any) and any path(/), query(?) or fragment(#).&lt;br /&gt;
&lt;br /&gt;
If protocol-relative URL, return nil scheme and domain else return nil for both scheme and domain.&lt;br /&gt;
&lt;br /&gt;
When not protocol-relative, get scheme, authority indicator, and domain.  If there is an authority indicator (one&lt;br /&gt;
or more &#039;/&#039; characters immediately following the scheme&#039;s colon), make sure that there are only 2.&lt;br /&gt;
&lt;br /&gt;
Any URL that does not have news: scheme must have authority indicator (//).  TODO: are there other common schemes&lt;br /&gt;
like news: that don&#039;t use authority indicator?&lt;br /&gt;
&lt;br /&gt;
Strip off any port and path;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function split_url (url_str)&lt;br /&gt;
	local scheme, authority, domain;&lt;br /&gt;
	&lt;br /&gt;
	url_str = url_str:gsub (&#039;([%a%d])%.?[/%?#].*$&#039;, &#039;%1&#039;);						-- strip FQDN terminator and path(/), query(?), fragment (#) (the capture prevents false replacement of &#039;//&#039;)&lt;br /&gt;
&lt;br /&gt;
	if url_str:match (&#039;^//%S*&#039;) then											-- if there is what appears to be a protocol-relative URL&lt;br /&gt;
		domain = url_str:match (&#039;^//(%S*)&#039;)&lt;br /&gt;
	elseif url_str:match (&#039;%S-:/*%S+&#039;) then										-- if there is what appears to be a scheme, optional authority indicator, and domain name&lt;br /&gt;
		scheme, authority, domain = url_str:match (&#039;(%S-:)(/*)(%S+)&#039;);			-- extract the scheme, authority indicator, and domain portions&lt;br /&gt;
		if utilities.is_set (authority) then&lt;br /&gt;
			authority = authority:gsub (&#039;//&#039;, &#039;&#039;, 1);							-- replace place 1 pair of &#039;/&#039; with nothing;&lt;br /&gt;
			if utilities.is_set(authority) then									-- if anything left (1 or 3+ &#039;/&#039; where authority should be) then&lt;br /&gt;
				return scheme;													-- return scheme only making domain nil which will cause an error message&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if not scheme:match (&#039;^news:&#039;) then									-- except for news:..., MediaWiki won&#039;t link URLs that do not have authority indicator; TODO: a better way to do this test?&lt;br /&gt;
				return scheme;													-- return scheme only making domain nil which will cause an error message&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		domain = domain:gsub (&#039;(%a):%d+&#039;, &#039;%1&#039;);								-- strip port number if present&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return scheme, domain;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ P A R A M _ O K &amp;gt;---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
checks the content of |title-link=, |series-link=, |author-link=, etc. for properly formatted content: no wikilinks, no URLs&lt;br /&gt;
&lt;br /&gt;
Link parameters are to hold the title of a Wikipedia article, so none of the WP:TITLESPECIALCHARACTERS are allowed:&lt;br /&gt;
	# &amp;lt; &amp;gt; [ ] | { } _&lt;br /&gt;
except the underscore which is used as a space in wiki URLs and # which is used for section links&lt;br /&gt;
&lt;br /&gt;
returns false when the value contains any of these characters.&lt;br /&gt;
&lt;br /&gt;
When there are no illegal characters, this function returns TRUE if value DOES NOT appear to be a valid URL (the&lt;br /&gt;
|&amp;lt;param&amp;gt;-link= parameter is ok); else false when value appears to be a valid URL (the |&amp;lt;param&amp;gt;-link= parameter is NOT ok).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_param_ok (value)&lt;br /&gt;
	local scheme, domain;&lt;br /&gt;
	if value:find (&#039;[&amp;lt;&amp;gt;%[%]|{}]&#039;) then                                          -- if any prohibited characters&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	scheme, domain = split_url (value);											-- get scheme or nil and domain or nil from URL; &lt;br /&gt;
	return not is_url (scheme, domain);											-- return true if value DOES NOT appear to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I N K _ T I T L E _ O K &amp;gt;---------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Use link_param_ok() to validate |&amp;lt;param&amp;gt;-link= value and its matching |&amp;lt;title&amp;gt;= value.&lt;br /&gt;
&lt;br /&gt;
|&amp;lt;title&amp;gt;= may be wiki-linked but not when |&amp;lt;param&amp;gt;-link= has a value.  This function emits an error message when&lt;br /&gt;
that condition exists&lt;br /&gt;
&lt;br /&gt;
check &amp;lt;link&amp;gt; for inter-language interwiki-link prefix.  prefix must be a MediaWiki-recognized language&lt;br /&gt;
code and must begin with a colon.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function link_title_ok (link, lorig, title, torig)&lt;br /&gt;
	local orig;&lt;br /&gt;
	if utilities.is_set (link) then 											-- don&#039;t bother if &amp;lt;param&amp;gt;-link doesn&#039;t have a value&lt;br /&gt;
		if not link_param_ok (link) then										-- check |&amp;lt;param&amp;gt;-link= markup&lt;br /&gt;
			orig = lorig;														-- identify the failing link parameter&lt;br /&gt;
		elseif title:find (&#039;%[%[&#039;) then											-- check |title= for wikilink markup&lt;br /&gt;
			orig = torig;														-- identify the failing |title= parameter&lt;br /&gt;
		elseif link:match (&#039;^%a+:&#039;) then										-- if the link is what looks like an interwiki&lt;br /&gt;
			local prefix = link:match (&#039;^(%a+):&#039;):lower();						-- get the interwiki prefix&lt;br /&gt;
&lt;br /&gt;
			if cfg.inter_wiki_map[prefix] then									-- if prefix is in the map, must have preceding colon&lt;br /&gt;
				orig = lorig;													-- flag as error&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (orig) then&lt;br /&gt;
		link = &#039;&#039;;																-- unset&lt;br /&gt;
		utilities.set_message (&#039;err_bad_paramlink&#039;, orig);						-- URL or wikilink in |title= with |title-link=;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return link;																-- link if ok, empty string else&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ U R L &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines whether a URL string appears to be valid.&lt;br /&gt;
&lt;br /&gt;
First we test for space characters.  If any are found, return false.  Then split the URL into scheme and domain&lt;br /&gt;
portions, or for protocol-relative (//example.com) URLs, just the domain.  Use is_url() to validate the two&lt;br /&gt;
portions of the URL.  If both are valid, or for protocol-relative if domain is valid, return true, else false.&lt;br /&gt;
&lt;br /&gt;
Because it is different from a standard URL, and because this module used external_link() to make external links&lt;br /&gt;
that work for standard and news: links, we validate newsgroup names here.  The specification for a newsgroup name&lt;br /&gt;
is at https://tools.ietf.org/html/rfc5536#section-3.1.4&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_url( url_str )&lt;br /&gt;
	if nil == url_str:match (&amp;quot;^%S+$&amp;quot;) then										-- if there are any spaces in |url=value it can&#039;t be a proper URL&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
	local scheme, domain;&lt;br /&gt;
&lt;br /&gt;
	scheme, domain = split_url (url_str);										-- get scheme or nil and domain or nil from URL;&lt;br /&gt;
	&lt;br /&gt;
	if &#039;news:&#039; == scheme then													-- special case for newsgroups&lt;br /&gt;
		return domain:match(&#039;^[%a%d%+%-_]+%.[%a%d%+%-_%.]*[%a%d%+%-_]$&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return is_url (scheme, domain);												-- return true if value appears to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ P A R A M E T E R _ E X T _ W I K I L I N K &amp;gt;----------------------------&lt;br /&gt;
&lt;br /&gt;
Return true if a parameter value has a string that begins and ends with square brackets [ and ] and the first&lt;br /&gt;
non-space characters following the opening bracket appear to be a URL.  The test will also find external wikilinks&lt;br /&gt;
that use protocol-relative URLs. Also finds bare URLs.&lt;br /&gt;
&lt;br /&gt;
The frontier pattern prevents a match on interwiki-links which are similar to scheme:path URLs.  The tests that&lt;br /&gt;
find bracketed URLs are required because the parameters that call this test (currently |title=, |chapter=, |work=,&lt;br /&gt;
and |publisher=) may have wikilinks and there are articles or redirects like &#039;//Hus&#039; so, while uncommon, |title=[[//Hus]]&lt;br /&gt;
is possible as might be [[en://Hus]].&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_parameter_ext_wikilink (value)&lt;br /&gt;
local scheme, domain;&lt;br /&gt;
&lt;br /&gt;
	if value:match (&#039;%f[%[]%[%a%S*:%S+.*%]&#039;) then								-- if ext. wikilink with scheme and domain: [xxxx://yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;%f[%[]%[(%a%S*:%S+).*%]&#039;));&lt;br /&gt;
	elseif value:match (&#039;%f[%[]%[//%S+.*%]&#039;) then								-- if protocol-relative ext. wikilink: [//yyyyy.zzz]&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;%f[%[]%[(//%S+).*%]&#039;));&lt;br /&gt;
	elseif value:match (&#039;%a%S*:%S+&#039;) then										-- if bare URL with scheme; may have leading or trailing plain text&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;(%a%S*:%S+)&#039;));&lt;br /&gt;
	elseif value:match (&#039;^//%S+&#039;) or value:match (&#039;%s//%S+&#039;) then				-- if protocol-relative bare URL: //yyyyy.zzz; authority indicator (//) must be be preceded nothing or by whitespace&lt;br /&gt;
		scheme, domain = split_url (value:match (&#039;(//%S+)&#039;));					-- what is left should be the domain&lt;br /&gt;
	else&lt;br /&gt;
		return false;															-- didn&#039;t find anything that is obviously a URL&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return is_url (scheme, domain);												-- return true if value appears to be a valid URL&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ A R C H I V E _ T O D A Y _ U R L &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
archive.today (and .ph, .is, .md, .li, .fo, .vn) are deprecated.  See Wikipedia:Requests_for_comment/Archive.is_RFC_5&lt;br /&gt;
(Special:Permalink/1339352976)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;val&amp;gt; is a string that may or may not be a url&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_archive_today_url (val)&lt;br /&gt;
	if is_parameter_ext_wikilink (val) then										-- is &amp;lt;val&amp;gt; a url?&lt;br /&gt;
		local tld = val:match (&#039;archive%.(%l+)&#039;);								-- get the tld&lt;br /&gt;
		return tld and cfg.archive_today_tlds_t[tld];							-- return true if &amp;lt;tld&amp;gt; is one of the archive.today tlds; nil else&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ A R C H I V E _ T O D A Y _ U R L &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
blank any parameter that holds one of the archive.today tlds (.today, .ph, .is, .md, .li, .fo, .vn) and also &lt;br /&gt;
blank parameters that are dependent on the offending parameter.&lt;br /&gt;
&lt;br /&gt;
input &amp;lt;cite_args_t&amp;gt; is a table of all of this template&#039;s parameters  This function modifies &amp;lt;cite_args_t&amp;gt;&lt;br /&gt;
when |url= or its alias |URL= hold an archive.today url, this function sets the flag &amp;lt;url_was_archive_today&amp;gt;&lt;br /&gt;
which is used later to suppress the missing url error message from {{citation}} when it has |website=&amp;lt;summat&amp;gt;&lt;br /&gt;
or from the templates {{cite web}}, {{cite podcast}}, {{cite mailing list}} which all require a url.&lt;br /&gt;
&lt;br /&gt;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_archive_today_url (cite_args_t)&lt;br /&gt;
	local unset_params_t = {};													-- to hold a sequence of parameters to unset from cite_args_t&lt;br /&gt;
&lt;br /&gt;
	for p, v in pairs (cite_args_t) do											-- look at each parameter in the template&lt;br /&gt;
		if is_archive_today_url (v:lower()) then								-- if it has a parameter with an archive.today url&lt;br /&gt;
			table.insert (unset_params_t, p);									-- add the url-holding parameter name to our list of parameters to unset (may or may not be a legitimate url parameter)&lt;br /&gt;
			if &#039;url&#039; == p:lower() then											-- if this parameter is |url= or |URL=&lt;br /&gt;
				url_was_archive_today = true;									-- set a flag so that cite web / podcast / mailinglist don&#039;t emit a missing url error message&lt;br /&gt;
			end&lt;br /&gt;
			if cfg.dependencies_t[p] then										-- if this url-holding parameter (&amp;lt;p&amp;gt;) has dependencies&lt;br /&gt;
				for _, dependent in ipairs (cfg.dependencies_t[p]) do			-- loop through the url-holding parameter&#039;s dependency sequence&lt;br /&gt;
					table.insert (unset_params_t, dependent);					-- add dependent parameter to the list to be unset&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if 0 &amp;lt; #unset_params_t then													-- when there are parameters to unset&lt;br /&gt;
		if not is_preview_mode then												-- when in preview mode do not suppress any parameters&lt;br /&gt;
			for _, unset_param in ipairs (unset_params_t) do					-- loop through the sequence&lt;br /&gt;
				cite_args_t[unset_param] = nil;									-- and unset the url-holding parameter and its dependent parameters to avoid parameter-requires-other-parameter errors&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		utilities.set_message (&#039;maint_deprecated_archive&#039;);						-- add a maintenance message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; C H E C K _ F O R _ U R L &amp;gt;-----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
loop through a list of parameters and their values.  Look at the value and if it has an external link, emit an error message.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_for_url (parameter_list, error_list)&lt;br /&gt;
	for k, v in pairs (parameter_list) do										-- for each parameter in the list&lt;br /&gt;
		if is_parameter_ext_wikilink (v) then									-- look at the value; if there is a URL add an error message&lt;br /&gt;
			table.insert (error_list, utilities.wrap_style (&#039;parameter&#039;, k));&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S A F E _ F O R _ U R L &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Escape sequences for content that will be used for URL descriptions&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function safe_for_url( str )&lt;br /&gt;
	if str:match( &amp;quot;%[%[.-%]%]&amp;quot; ) ~= nil then &lt;br /&gt;
		utilities.set_message (&#039;err_wikilink_in_url&#039;, {});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return str:gsub( &#039;[%[%]\n]&#039;, {	&lt;br /&gt;
		[&#039;[&#039;] = &#039;&amp;amp;#91;&#039;,&lt;br /&gt;
		[&#039;]&#039;] = &#039;&amp;amp;#93;&#039;,&lt;br /&gt;
		[&#039;\n&#039;] = &#039; &#039; } );&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T E R N A L _ L I N K &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Format an external link with error checking&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function external_link (URL, label, source, access)&lt;br /&gt;
	local err_msg = &#039;&#039;;&lt;br /&gt;
	local domain;&lt;br /&gt;
	local path;&lt;br /&gt;
	local base_url;&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (label) then&lt;br /&gt;
		label = URL;&lt;br /&gt;
		if utilities.is_set (source) then&lt;br /&gt;
			utilities.set_message (&#039;err_bare_url_missing_title&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});&lt;br /&gt;
		else&lt;br /&gt;
			error (cfg.messages[&amp;quot;bare_url_no_origin&amp;quot;]);							-- programmer error; valid parameter name does not have matching meta-parameter&lt;br /&gt;
		end			&lt;br /&gt;
	end&lt;br /&gt;
	if not check_url (URL) then&lt;br /&gt;
		utilities.set_message (&#039;err_bad_url&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	domain, path = URL:match (&#039;^([/%.%-%+:%a%d]+)([/%?#].*)$&#039;);					-- split the URL into scheme plus domain and path&lt;br /&gt;
	if path then																-- if there is a path portion&lt;br /&gt;
		path = path:gsub (&#039;[%[%]]&#039;, {[&#039;[&#039;] = &#039;%5b&#039;, [&#039;]&#039;] = &#039;%5d&#039;});			-- replace &#039;[&#039; and &#039;]&#039; with their percent-encoded values&lt;br /&gt;
		URL = table.concat ({domain, path});									-- and reassemble&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	base_url = table.concat ({ &amp;quot;[&amp;quot;, URL, &amp;quot; &amp;quot;, safe_for_url (label), &amp;quot;]&amp;quot; });		-- assemble a wiki-markup URL&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (access) then											-- access level (subscription, registration, limited)&lt;br /&gt;
		base_url = utilities.substitute (cfg.presentation[&#039;ext-link-access-signal&#039;], {cfg.presentation[access].class, cfg.presentation[access].title, base_url});	-- add the appropriate icon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return base_url;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D E P R E C A T E D _ P A R A M E T E R &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
Categorize and emit an error message when the citation contains one or more deprecated parameters.  The function includes the&lt;br /&gt;
offending parameter name to the error message.  Only one error message is emitted regardless of the number of deprecated&lt;br /&gt;
parameters in the citation.&lt;br /&gt;
&lt;br /&gt;
added_deprecated_cat is a Boolean declared in page scope variables above&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function deprecated_parameter(name)&lt;br /&gt;
	if not added_deprecated_cat then&lt;br /&gt;
		added_deprecated_cat = true;											-- note that we&#039;ve added this category&lt;br /&gt;
		utilities.set_message (&#039;err_deprecated_params&#039;, {name});				-- add error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; K E R N _ Q U O T E S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Apply kerning to open the space between the quote mark provided by the module and a leading or trailing quote&lt;br /&gt;
mark contained in a |title= or |chapter= parameter&#039;s value.&lt;br /&gt;
&lt;br /&gt;
This function will positive kern either single or double quotes:&lt;br /&gt;
	&amp;quot;&#039;Unkerned title with leading and trailing single quote marks&#039;&amp;quot;&lt;br /&gt;
	&amp;quot; &#039;Kerned title with leading and trailing single quote marks&#039; &amp;quot; (in real life the kerning isn&#039;t as wide as this example)&lt;br /&gt;
Double single quotes (italic or bold wiki-markup) are not kerned.&lt;br /&gt;
&lt;br /&gt;
Replaces Unicode quote marks in plain text or in the label portion of a [[L|D]] style wikilink with typewriter&lt;br /&gt;
quote marks regardless of the need for kerning.  Unicode quote marks are not replaced in simple [[D]] wikilinks.&lt;br /&gt;
&lt;br /&gt;
Call this function for chapter titles, for website titles, etc.; not for book titles.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function kern_quotes (str)&lt;br /&gt;
	local cap = &#039;&#039;;&lt;br /&gt;
	local wl_type, label, link;&lt;br /&gt;
&lt;br /&gt;
	wl_type, label, link = utilities.is_wikilink (str);							-- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]&lt;br /&gt;
	&lt;br /&gt;
	if 1 == wl_type then														-- [[D]] simple wikilink with or without quote marks&lt;br /&gt;
		if mw.ustring.match (str, &#039;%[%[[\&amp;quot;“”\&#039;‘’].+[\&amp;quot;“”\&#039;‘’]%]%]&#039;) then		-- leading and trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], str);&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], str);&lt;br /&gt;
		elseif mw.ustring.match (str, &#039;%[%[[\&amp;quot;“”\&#039;‘’].+%]%]&#039;)	then			-- leading quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], str);&lt;br /&gt;
		elseif mw.ustring.match (str, &#039;%[%[.+[\&amp;quot;“”\&#039;‘’]%]%]&#039;) then				-- trailing quote marks&lt;br /&gt;
			str = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], str);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	else																		-- plain text or [[L|D]]; text in label variable&lt;br /&gt;
		label = mw.ustring.gsub (label, &#039;[“”]&#039;, &#039;\&amp;quot;&#039;);							-- replace “” (U+201C &amp;amp; U+201D) with &amp;quot; (typewriter double quote mark)&lt;br /&gt;
		label = mw.ustring.gsub (label, &#039;[‘’]&#039;, &#039;\&#039;&#039;);							-- replace ‘’ (U+2018 &amp;amp; U+2019) with &#039; (typewriter single quote mark)&lt;br /&gt;
&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^([\&amp;quot;\&#039;][^\&#039;].+)&amp;quot;);						-- match leading double or single quote but not doubled single quotes (italic markup)&lt;br /&gt;
		if utilities.is_set (cap) then&lt;br /&gt;
			label = utilities.substitute (cfg.presentation[&#039;kern-left&#039;], cap);&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		cap = mw.ustring.match (label, &amp;quot;^(.+[^\&#039;][\&amp;quot;\&#039;])$&amp;quot;)						-- match trailing double or single quote but not doubled single quotes (italic markup)&lt;br /&gt;
		if utilities.is_set (cap) then&lt;br /&gt;
			label = utilities.substitute (cfg.presentation[&#039;kern-right&#039;], cap);&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if 2 == wl_type then&lt;br /&gt;
			str = utilities.make_wikilink (link, label);						-- reassemble the wikilink&lt;br /&gt;
		else&lt;br /&gt;
			str = label;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return str;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F O R M A T _ S C R I P T _ V A L U E &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
|script-title= holds title parameters that are not written in Latin-based scripts: Chinese, Japanese, Arabic, Hebrew, etc. These scripts should&lt;br /&gt;
not be italicized and may be written right-to-left.  The value supplied by |script-title= is concatenated onto Title after Title has been wrapped&lt;br /&gt;
in italic markup.&lt;br /&gt;
&lt;br /&gt;
Regardless of language, all values provided by |script-title= are wrapped in &amp;lt;bdi&amp;gt;...&amp;lt;/bdi&amp;gt; tags to isolate RTL languages from the English left to right.&lt;br /&gt;
&lt;br /&gt;
|script-title= provides a unique feature.  The value in |script-title= may be prefixed with a two-character ISO 639-1 language code and a colon:&lt;br /&gt;
	|script-title=ja:*** *** (where * represents a Japanese character)&lt;br /&gt;
Spaces between the two-character code and the colon and the colon and the first script character are allowed:&lt;br /&gt;
	|script-title=ja : *** ***&lt;br /&gt;
	|script-title=ja: *** ***&lt;br /&gt;
	|script-title=ja :*** ***&lt;br /&gt;
Spaces preceding the prefix are allowed: |script-title = ja:*** ***&lt;br /&gt;
&lt;br /&gt;
The prefix is checked for validity.  If it is a valid ISO 639-1 language code, the lang attribute (lang=&amp;quot;ja&amp;quot;) is added to the &amp;lt;bdi&amp;gt; tag so that browsers can&lt;br /&gt;
know the language the tag contains.  This may help the browser render the script more correctly.  If the prefix is invalid, the lang attribute&lt;br /&gt;
is not added.  At this time there is no error message for this condition.&lt;br /&gt;
&lt;br /&gt;
Supports |script-title=, |script-chapter=, |script-&amp;lt;periodical&amp;gt;=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_script_value (script_value, script_param)&lt;br /&gt;
	local lang=&#039;&#039;;																-- initialize to empty string&lt;br /&gt;
	local name;&lt;br /&gt;
	if script_value:match(&#039;^%l%l%l?%s*:&#039;) then									-- if first 3 or 4 non-space characters are script language prefix&lt;br /&gt;
		lang = script_value:match(&#039;^(%l%l%l?)%s*:%s*%S.*&#039;);						-- get the language prefix or nil if there is no script&lt;br /&gt;
		if not utilities.is_set (lang) then&lt;br /&gt;
			utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;missing title part&#039;]});		-- prefix without &#039;title&#039;; add error message&lt;br /&gt;
			return &#039;&#039;;															-- script_value was just the prefix so return empty string&lt;br /&gt;
		end&lt;br /&gt;
																				-- if we get this far we have prefix and script&lt;br /&gt;
		name = cfg.lang_tag_remap[lang] or mw.language.fetchLanguageName( lang, cfg.this_wiki_code );	-- get language name so that we can use it to categorize&lt;br /&gt;
		if utilities.is_set (name) then											-- is prefix a proper ISO 639-1 language code?&lt;br /&gt;
			script_value = script_value:gsub (&#039;^%l+%s*:%s*&#039;, &#039;&#039;);				-- strip prefix from script&lt;br /&gt;
																				-- is prefix one of these language codes?&lt;br /&gt;
			if utilities.in_array (lang, cfg.script_lang_codes) then&lt;br /&gt;
				utilities.add_prop_cat (&#039;script&#039;, {name, lang})&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;unknown language code&#039;]});	-- unknown script-language; add error message&lt;br /&gt;
			end&lt;br /&gt;
			lang = &#039; lang=&amp;quot;&#039; .. lang .. &#039;&amp;quot; &#039;;									-- convert prefix into a lang attribute&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;invalid language code&#039;]});		-- invalid language code; add error message&lt;br /&gt;
			lang = &#039;&#039;;															-- invalid so set lang to empty string&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message (&#039;err_script_parameter&#039;, {script_param, cfg.err_msg_supl[&#039;missing prefix&#039;]});				-- no language code prefix; add error message&lt;br /&gt;
	end&lt;br /&gt;
	script_value = utilities.substitute (cfg.presentation[&#039;bdi&#039;], {lang, script_value});	-- isolate in case script is RTL&lt;br /&gt;
&lt;br /&gt;
	return script_value;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S C R I P T _ C O N C A T E N A T E &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Initially for |title= and |script-title=, this function concatenates those two parameter values after the script&lt;br /&gt;
value has been wrapped in &amp;lt;bdi&amp;gt; tags.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function script_concatenate (title, script, script_param)&lt;br /&gt;
	if utilities.is_set (script) then&lt;br /&gt;
		script = format_script_value (script, script_param);					-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; returns empty string on error&lt;br /&gt;
		if utilities.is_set (script) then&lt;br /&gt;
			title = title .. &#039; &#039; .. script;										-- concatenate title and script title&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return title;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W R A P _ M S G &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Applies additional message text to various parameter values. Supplied string is wrapped using a message_list&lt;br /&gt;
configuration taking one argument.  Supports lower case text for {{citation}} templates.  Additional text taken&lt;br /&gt;
from citation_config.messages - the reason this function is similar to but separate from wrap_style().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wrap_msg (key, str, lower)&lt;br /&gt;
	if not utilities.is_set ( str ) then&lt;br /&gt;
		return &amp;quot;&amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
	if true == lower then&lt;br /&gt;
		local msg;&lt;br /&gt;
		msg = cfg.messages[key]:lower();										-- set the message to lower case before &lt;br /&gt;
		return utilities.substitute ( msg, str );								-- including template text&lt;br /&gt;
	else&lt;br /&gt;
		return utilities.substitute ( cfg.messages[key], str );&lt;br /&gt;
	end		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; W I K I S O U R C E _ U R L _ M A K E &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
Makes a Wikisource URL from Wikisource interwiki-link.  Returns the URL and appropriate&lt;br /&gt;
label; nil else.&lt;br /&gt;
&lt;br /&gt;
str is the value assigned to |chapter= (or aliases) or |title= or |title-link=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wikisource_url_make (str)&lt;br /&gt;
	local wl_type, D, L;&lt;br /&gt;
	local ws_url, ws_label;&lt;br /&gt;
	local wikisource_prefix = table.concat ({&#039;https://&#039;, cfg.this_wiki_code, &#039;.wikisource.org/wiki/&#039;});&lt;br /&gt;
&lt;br /&gt;
	wl_type, D, L = utilities.is_wikilink (str);								-- wl_type is 0 (not a wikilink), 1 (simple wikilink), 2 (complex wikilink)&lt;br /&gt;
&lt;br /&gt;
	if 0 == wl_type then														-- not a wikilink; might be from |title-link=&lt;br /&gt;
		str = D:match (&#039;^[Ww]ikisource:(.+)&#039;) or D:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title&lt;br /&gt;
				});&lt;br /&gt;
			ws_label = str;														-- label for the URL&lt;br /&gt;
		end&lt;br /&gt;
	elseif 1 == wl_type then													-- simple wikilink: [[Wikisource:ws article]]&lt;br /&gt;
		str = D:match (&#039;^[Ww]ikisource:(.+)&#039;) or D:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title&lt;br /&gt;
				});&lt;br /&gt;
			ws_label = str;														-- label for the URL&lt;br /&gt;
		end&lt;br /&gt;
	elseif 2 == wl_type then													-- non-so-simple wikilink: [[Wikisource:ws article|displayed text]] ([[L|D]])&lt;br /&gt;
		str = L:match (&#039;^[Ww]ikisource:(.+)&#039;) or L:match (&#039;^[Ss]:(.+)&#039;);		-- article title from interwiki link with long-form or short-form namespace&lt;br /&gt;
		if utilities.is_set (str) then&lt;br /&gt;
			ws_label = D;														-- get ws article name from display portion of interwiki link&lt;br /&gt;
			ws_url = table.concat ({											-- build a Wikisource URL&lt;br /&gt;
				wikisource_prefix,												-- prefix&lt;br /&gt;
				str,															-- article title without namespace from link portion of wikilink&lt;br /&gt;
				});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if ws_url then&lt;br /&gt;
		ws_url = mw.uri.encode (ws_url, &#039;WIKI&#039;);								-- make a usable URL&lt;br /&gt;
		ws_url = ws_url:gsub (&#039;%%23&#039;, &#039;#&#039;);										-- undo percent-encoding of fragment marker&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return ws_url, ws_label, L or D;											-- return proper URL or nil and a label or nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; F O R M A T _ P E R I O D I C A L &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Format the three periodical parameters: |script-&amp;lt;periodical&amp;gt;=, |&amp;lt;periodical&amp;gt;=,&lt;br /&gt;
and |trans-&amp;lt;periodical&amp;gt;= into a single Periodical meta-parameter.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_periodical (script_periodical, script_periodical_source, periodical, trans_periodical)&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (periodical) then&lt;br /&gt;
		periodical = &#039;&#039;;														-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		periodical = utilities.wrap_style (&#039;italic-title&#039;, periodical);			-- style &lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	periodical = script_concatenate (periodical, script_periodical, script_periodical_source);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (trans_periodical) then&lt;br /&gt;
		trans_periodical = utilities.wrap_style (&#039;trans-italic-title&#039;, trans_periodical);&lt;br /&gt;
		if utilities.is_set (periodical) then&lt;br /&gt;
			periodical = periodical .. &#039; &#039; .. trans_periodical;&lt;br /&gt;
		else																	-- here when trans-periodical without periodical or script-periodical&lt;br /&gt;
			periodical = trans_periodical;&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;periodical&#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return periodical;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[------------------&amp;lt; F O R M A T _ C H A P T E R _ T I T L E &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
Format the four chapter parameters: |script-chapter=, |chapter=, |trans-chapter=,&lt;br /&gt;
and |chapter-url= into a single chapter meta- parameter (chapter_url_source used&lt;br /&gt;
for error messages).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_chapter_title (script_chapter, script_chapter_source, chapter, chapter_source, trans_chapter, trans_chapter_source, chapter_url, chapter_url_source, no_quotes, access)&lt;br /&gt;
	local ws_url, ws_label, L = wikisource_url_make (chapter);					-- make a wikisource URL and label from a wikisource interwiki link&lt;br /&gt;
	if ws_url then&lt;br /&gt;
		ws_label = ws_label:gsub (&#039;_&#039;, &#039; &#039;);									-- replace underscore separators with space characters&lt;br /&gt;
		chapter = ws_label;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (chapter) then&lt;br /&gt;
		chapter = &#039;&#039;;															-- to be safe for concatenation&lt;br /&gt;
	else&lt;br /&gt;
		if false == no_quotes then&lt;br /&gt;
			chapter = kern_quotes (chapter);									-- if necessary, separate chapter title&#039;s leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			chapter = utilities.wrap_style (&#039;quoted-title&#039;, chapter);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	chapter = script_concatenate (chapter, script_chapter, script_chapter_source);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (chapter_url) then&lt;br /&gt;
		chapter = external_link (chapter_url, chapter, chapter_url_source, access);	-- adds bare_url_missing_title error if appropriate&lt;br /&gt;
	elseif ws_url then&lt;br /&gt;
		chapter = external_link (ws_url, chapter .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in chapter&#039;);	-- adds bare_url_missing_title error if appropriate; space char to move icon away from chap text; TODO: better way to do this?&lt;br /&gt;
		chapter = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, chapter});				&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (trans_chapter) then&lt;br /&gt;
		trans_chapter = utilities.wrap_style (&#039;trans-quoted-title&#039;, trans_chapter);&lt;br /&gt;
		if utilities.is_set (chapter) then&lt;br /&gt;
			chapter = chapter .. &#039; &#039; .. trans_chapter;&lt;br /&gt;
		else																	-- here when trans_chapter without chapter or script-chapter&lt;br /&gt;
			chapter = trans_chapter;&lt;br /&gt;
			chapter_source = trans_chapter_source:match (&#039;trans%-?(.+)&#039;);		-- when no chapter, get matching name from trans-&amp;lt;param&amp;gt;&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {chapter_source});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return chapter;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------&amp;lt; H A S _ I N V I S I B L E _ C H A R S &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
This function searches a parameter&#039;s value for non-printable or invisible characters.&lt;br /&gt;
The search stops at the first match.&lt;br /&gt;
&lt;br /&gt;
This function will detect the visible replacement character when it is part of the Wikisource.&lt;br /&gt;
&lt;br /&gt;
Detects but ignores nowiki and math stripmarkers.  Also detects other named stripmarkers&lt;br /&gt;
(gallery, math, pre, ref) and identifies them with a slightly different error message.&lt;br /&gt;
See also coins_cleanup().&lt;br /&gt;
&lt;br /&gt;
Output of this function is an error message that identifies the character or the&lt;br /&gt;
Unicode group, or the stripmarker that was detected along with its position (or,&lt;br /&gt;
for multi-byte characters, the position of its first byte) in the parameter value.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_invisible_chars (param, v)&lt;br /&gt;
	local position = &#039;&#039;;														-- position of invisible char or starting position of stripmarker&lt;br /&gt;
	local capture;																-- used by stripmarker detection to hold name of the stripmarker&lt;br /&gt;
	local stripmarker;															-- boolean set true when a stripmarker is found&lt;br /&gt;
&lt;br /&gt;
	capture = string.match (v, &#039;[%w%p ]*&#039;);										-- test for values that are simple ASCII text and bypass other tests if true&lt;br /&gt;
	if capture == v then														-- if same there are no Unicode characters&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for _, invisible_char in ipairs (cfg.invisible_chars) do&lt;br /&gt;
		local char_name = invisible_char[1];									-- the character or group name&lt;br /&gt;
		local pattern = invisible_char[2];										-- the pattern used to find it&lt;br /&gt;
		position, _, capture = mw.ustring.find (v, pattern);					-- see if the parameter value contains characters that match the pattern&lt;br /&gt;
		&lt;br /&gt;
		if position and (cfg.invisible_defs.zwj == capture) then				-- if we found a zero-width joiner character&lt;br /&gt;
			if mw.ustring.find (v, cfg.indic_script) then						-- it&#039;s ok if one of the Indic scripts&lt;br /&gt;
				position = nil;													-- unset position&lt;br /&gt;
			elseif cfg.emoji_t[mw.ustring.codepoint (v, position+1)] then			-- is zwj followed by a character listed in emoji{}?&lt;br /&gt;
				position = nil;													-- unset position&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if position then&lt;br /&gt;
			if &#039;nowiki&#039; == capture or &#039;math&#039; == capture or						-- nowiki and math stripmarkers (not an error condition)&lt;br /&gt;
				(&#039;templatestyles&#039; == capture and utilities.in_array (param, {&#039;id&#039;, &#039;quote&#039;})) then	-- templatestyles stripmarker allowed in these parameters&lt;br /&gt;
					stripmarker = true;											-- set a flag&lt;br /&gt;
			elseif true == stripmarker and cfg.invisible_defs.del == capture then	-- because stripmakers begin and end with the delete char, assume that we&#039;ve found one end of a stripmarker&lt;br /&gt;
				position = nil;													-- unset&lt;br /&gt;
			else&lt;br /&gt;
				local err_msg;&lt;br /&gt;
				if capture and not (cfg.invisible_defs.del == capture or cfg.invisible_defs.zwj == capture) then&lt;br /&gt;
					err_msg = utilities.substitute (cfg.messages.invisible_1, {capture, char_name});	-- &amp;lt;capture&amp;gt; here is stripmarker name&lt;br /&gt;
				else&lt;br /&gt;
					err_msg = utilities.substitute (cfg.messages.invisible_2, char_name);&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				utilities.set_message (&#039;err_invisible_char&#039;, {err_msg, utilities.wrap_style (&#039;parameter&#039;, param), position});	-- add error message&lt;br /&gt;
				return;															-- and done with this parameter&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; A R G U M E N T _ W R A P P E R &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
Argument wrapper.  This function provides support for argument mapping defined&lt;br /&gt;
in the configuration file so that multiple names can be transparently aliased to&lt;br /&gt;
single internal variable.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function argument_wrapper ( args )&lt;br /&gt;
	local origin = {};&lt;br /&gt;
	&lt;br /&gt;
	return setmetatable({&lt;br /&gt;
		ORIGIN = function ( self, k )&lt;br /&gt;
			local dummy = self[k];												-- force the variable to be loaded.&lt;br /&gt;
			return origin[k];&lt;br /&gt;
		end&lt;br /&gt;
	},&lt;br /&gt;
	{&lt;br /&gt;
		__index = function ( tbl, k )&lt;br /&gt;
			if origin[k] ~= nil then&lt;br /&gt;
				return nil;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local args, list, v = args, cfg.aliases[k];&lt;br /&gt;
			&lt;br /&gt;
			if type( list ) == &#039;table&#039; then&lt;br /&gt;
				v, origin[k] = utilities.select_one ( args, list, &#039;err_redundant_parameters&#039; );&lt;br /&gt;
				if origin[k] == nil then&lt;br /&gt;
					origin[k] = &#039;&#039;;												-- Empty string, not nil&lt;br /&gt;
				end&lt;br /&gt;
			elseif list ~= nil then&lt;br /&gt;
				v, origin[k] = args[list], list;&lt;br /&gt;
			else&lt;br /&gt;
				-- maybe let through instead of raising an error?&lt;br /&gt;
				-- v, origin[k] = args[k], k;&lt;br /&gt;
				error( cfg.messages[&#039;unknown_argument_map&#039;] .. &#039;: &#039; .. k);&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			-- Empty strings, not nil;&lt;br /&gt;
			if v == nil then&lt;br /&gt;
				v = &#039;&#039;;&lt;br /&gt;
				origin[k] = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			tbl = rawset( tbl, k, v );&lt;br /&gt;
			return v;&lt;br /&gt;
		end,&lt;br /&gt;
	});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N O W R A P _ D A T E &amp;gt;-------------------------&lt;br /&gt;
&lt;br /&gt;
When date is YYYY-MM-DD format wrap in nowrap span: &amp;lt;span ...&amp;gt;YYYY-MM-DD&amp;lt;/span&amp;gt;.&lt;br /&gt;
When date is DD MMMM YYYY or is MMMM DD, YYYY then wrap in nowrap span:&lt;br /&gt;
&amp;lt;span ...&amp;gt;DD MMMM&amp;lt;/span&amp;gt; YYYY or &amp;lt;span ...&amp;gt;MMMM DD,&amp;lt;/span&amp;gt; YYYY&lt;br /&gt;
&lt;br /&gt;
DOES NOT yet support MMMM YYYY or any of the date ranges.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function nowrap_date (date)&lt;br /&gt;
	local cap = &#039;&#039;;&lt;br /&gt;
	local cap2 = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
	if date:match(&amp;quot;^%d%d%d%d%-%d%d%-%d%d$&amp;quot;) then&lt;br /&gt;
		date = utilities.substitute (cfg.presentation[&#039;nowrap1&#039;], date);&lt;br /&gt;
	&lt;br /&gt;
	elseif date:match(&amp;quot;^%a+%s*%d%d?,%s+%d%d%d%d$&amp;quot;) or date:match (&amp;quot;^%d%d?%s*%a+%s+%d%d%d%d$&amp;quot;) then&lt;br /&gt;
		cap, cap2 = string.match (date, &amp;quot;^(.*)%s+(%d%d%d%d)$&amp;quot;);&lt;br /&gt;
		date = utilities.substitute (cfg.presentation[&#039;nowrap2&#039;], {cap, cap2});&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return date;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ T I T L E T Y P E &amp;gt;---------------------&lt;br /&gt;
&lt;br /&gt;
This function sets default title types (equivalent to the citation including&lt;br /&gt;
|type=&amp;lt;default value&amp;gt;) for those templates that have defaults. Also handles the&lt;br /&gt;
special case where it is desirable to omit the title type from the rendered citation&lt;br /&gt;
(|type=none).&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_titletype (cite_class, title_type)&lt;br /&gt;
	if utilities.is_set (title_type) then&lt;br /&gt;
		if &#039;none&#039; == cfg.keywords_xlate[title_type] then&lt;br /&gt;
			title_type = &#039;&#039;;													-- if |type=none then type parameter not displayed&lt;br /&gt;
		end&lt;br /&gt;
		return title_type;														-- if |type= has been set to any other value use that value&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return cfg.title_types [cite_class] or &#039;&#039;;									-- set template&#039;s default title type; else empty string for concatenation&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S A F E _ J O I N &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
Joins a sequence of strings together while checking for duplicate separation characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function safe_join( tbl, duplicate_char )&lt;br /&gt;
	local f = {};																-- create a function table appropriate to type of &#039;duplicate character&#039;&lt;br /&gt;
		if 1 == #duplicate_char then											-- for single byte ASCII characters use the string library functions&lt;br /&gt;
			f.gsub = string.gsub&lt;br /&gt;
			f.match = string.match&lt;br /&gt;
			f.sub = string.sub&lt;br /&gt;
		else																	-- for multi-byte characters use the ustring library functions&lt;br /&gt;
			f.gsub = mw.ustring.gsub&lt;br /&gt;
			f.match = mw.ustring.match&lt;br /&gt;
			f.sub = mw.ustring.sub&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	local str = &#039;&#039;;																-- the output string&lt;br /&gt;
	local comp = &#039;&#039;;															-- what does &#039;comp&#039; mean?&lt;br /&gt;
	local end_chr = &#039;&#039;;&lt;br /&gt;
	local trim;&lt;br /&gt;
	for _, value in ipairs( tbl ) do&lt;br /&gt;
		if value == nil then value = &#039;&#039;; end&lt;br /&gt;
		&lt;br /&gt;
		if str == &#039;&#039; then														-- if output string is empty&lt;br /&gt;
			str = value;														-- assign value to it (first time through the loop)&lt;br /&gt;
		elseif value ~= &#039;&#039; then&lt;br /&gt;
			if value:sub(1, 1) == &#039;&amp;lt;&#039; then										-- special case of values enclosed in spans and other markup.&lt;br /&gt;
				comp = value:gsub( &amp;quot;%b&amp;lt;&amp;gt;&amp;quot;, &amp;quot;&amp;quot; );								-- remove HTML markup (&amp;lt;span&amp;gt;string&amp;lt;/span&amp;gt; -&amp;gt; string)&lt;br /&gt;
			else&lt;br /&gt;
				comp = value;&lt;br /&gt;
			end&lt;br /&gt;
																				-- typically duplicate_char is sepc&lt;br /&gt;
			if f.sub(comp, 1, 1) == duplicate_char then							-- is first character same as duplicate_char? why test first character?&lt;br /&gt;
																				--   Because individual string segments often (always?) begin with terminal punct for the&lt;br /&gt;
																				--   preceding segment: &#039;First element&#039; .. &#039;sepc next element&#039; .. etc.?&lt;br /&gt;
				trim = false;&lt;br /&gt;
				end_chr = f.sub(str, -1, -1);									-- get the last character of the output string&lt;br /&gt;
				-- str = str .. &amp;quot;&amp;lt;HERE(enchr=&amp;quot; .. end_chr .. &amp;quot;)&amp;quot;				-- debug stuff?&lt;br /&gt;
				if end_chr == duplicate_char then								-- if same as separator&lt;br /&gt;
					str = f.sub(str, 1, -2);									-- remove it&lt;br /&gt;
				elseif end_chr == &amp;quot;&#039;&amp;quot; then										-- if it might be wiki-markup&lt;br /&gt;
					if f.sub(str, -3, -1) == duplicate_char .. &amp;quot;&#039;&#039;&amp;quot; then		-- if last three chars of str are sepc&#039;&#039; &lt;br /&gt;
						str = f.sub(str, 1, -4) .. &amp;quot;&#039;&#039;&amp;quot;;						-- remove them and add back &#039;&#039;&lt;br /&gt;
					elseif  f.sub(str, -5, -1) == duplicate_char .. &amp;quot;]]&#039;&#039;&amp;quot; then	-- if last five chars of str are sepc]]&#039;&#039; &lt;br /&gt;
						trim = true;											-- why? why do this and next differently from previous?&lt;br /&gt;
					elseif f.sub(str, -4, -1) == duplicate_char .. &amp;quot;]&#039;&#039;&amp;quot; then	-- if last four chars of str are sepc]&#039;&#039; &lt;br /&gt;
						trim = true;											-- same question&lt;br /&gt;
					end&lt;br /&gt;
				elseif end_chr == &amp;quot;]&amp;quot; then										-- if it might be wiki-markup&lt;br /&gt;
					if f.sub(str, -3, -1) == duplicate_char .. &amp;quot;]]&amp;quot; then		-- if last three chars of str are sepc]] wikilink &lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif f.sub(str, -3, -1) == duplicate_char .. &#039;&amp;quot;]&#039; then	-- if last three chars of str are sepc&amp;quot;] quoted external link &lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif  f.sub(str, -2, -1) == duplicate_char .. &amp;quot;]&amp;quot; then	-- if last two chars of str are sepc] external link&lt;br /&gt;
						trim = true;&lt;br /&gt;
					elseif f.sub(str, -4, -1) == duplicate_char .. &amp;quot;&#039;&#039;]&amp;quot; then	-- normal case when |url=something &amp;amp; |title=Title.&lt;br /&gt;
						trim = true;&lt;br /&gt;
					end&lt;br /&gt;
				elseif end_chr == &amp;quot; &amp;quot; then										-- if last char of output string is a space&lt;br /&gt;
					if f.sub(str, -2, -1) == duplicate_char .. &amp;quot; &amp;quot; then			-- if last two chars of str are &amp;lt;sepc&amp;gt;&amp;lt;space&amp;gt;&lt;br /&gt;
						str = f.sub(str, 1, -3);								-- remove them both&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				if trim then&lt;br /&gt;
					if value ~= comp then 										-- value does not equal comp when value contains HTML markup&lt;br /&gt;
						local dup2 = duplicate_char;&lt;br /&gt;
						if f.match(dup2, &amp;quot;%A&amp;quot; ) then dup2 = &amp;quot;%&amp;quot; .. dup2; end	-- if duplicate_char not a letter then escape it&lt;br /&gt;
						&lt;br /&gt;
						value = f.gsub(value, &amp;quot;(%b&amp;lt;&amp;gt;)&amp;quot; .. dup2, &amp;quot;%1&amp;quot;, 1 )		-- remove duplicate_char if it follows HTML markup&lt;br /&gt;
					else&lt;br /&gt;
						value = f.sub(value, 2, -1 );							-- remove duplicate_char when it is first character&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			str = str .. value; 												-- add it to the output string&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	return str;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ S U F F I X &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
returns true if suffix is properly formed Jr, Sr, or ordinal in the range 1–9.&lt;br /&gt;
Puncutation not allowed.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_suffix (suffix)&lt;br /&gt;
	if utilities.in_array (suffix, {&#039;Jr&#039;, &#039;Sr&#039;, &#039;Jnr&#039;, &#039;Snr&#039;, &#039;1st&#039;, &#039;2nd&#039;, &#039;3rd&#039;}) or suffix:match (&#039;^%dth$&#039;) then&lt;br /&gt;
		return true;&lt;br /&gt;
	end&lt;br /&gt;
	return false;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------&amp;lt; I S _ G O O D _ V A N C _ N A M E &amp;gt;-------------------&lt;br /&gt;
&lt;br /&gt;
For Vancouver style, author/editor names are supposed to be rendered in Latin&lt;br /&gt;
(read ASCII) characters.  When a name uses characters that contain diacritical&lt;br /&gt;
marks, those characters are to be converted to the corresponding Latin&lt;br /&gt;
character. When a name is written using a non-Latin alphabet or logogram, that&lt;br /&gt;
name is to be transliterated into Latin characters. The module doesn&#039;t do this&lt;br /&gt;
so editors may/must.&lt;br /&gt;
&lt;br /&gt;
This test allows |first= and |last= names to contain any of the letters defined&lt;br /&gt;
in the four Unicode Latin character sets&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0000.pdf C0 Controls and Basic Latin] 0041–005A, 0061–007A&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0080.pdf C1 Controls and Latin-1 Supplement] 00C0–00D6, 00D8–00F6, 00F8–00FF&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0100.pdf Latin Extended-A] 0100–017F&lt;br /&gt;
	[http://www.unicode.org/charts/PDF/U0180.pdf Latin Extended-B] 0180–01BF, 01C4–024F&lt;br /&gt;
&lt;br /&gt;
|lastn= also allowed to contain hyphens, spaces, and apostrophes.&lt;br /&gt;
	(http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)&lt;br /&gt;
|firstn= also allowed to contain hyphens, spaces, apostrophes, and periods&lt;br /&gt;
&lt;br /&gt;
This original test:&lt;br /&gt;
	if nil == mw.ustring.find (last, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%&#039;]*$&amp;quot;)&lt;br /&gt;
	or nil == mw.ustring.find (first, &amp;quot;^[A-Za-zÀ-ÖØ-öø-ƿǄ-ɏ%-%s%&#039;%.]+[2-6%a]*$&amp;quot;) then&lt;br /&gt;
was written outside of the code editor and pasted here because the code editor&lt;br /&gt;
gets confused between character insertion point and cursor position. The test has&lt;br /&gt;
been rewritten to use decimal character escape sequence for the individual bytes&lt;br /&gt;
of the Unicode characters so that it is not necessary to use an external editor&lt;br /&gt;
to maintain this code.&lt;br /&gt;
&lt;br /&gt;
	\195\128-\195\150 – À-Ö (U+00C0–U+00D6 – C0 controls)&lt;br /&gt;
	\195\152-\195\182 – Ø-ö (U+00D8-U+00F6 – C0 controls)&lt;br /&gt;
	\195\184-\198\191 – ø-ƿ (U+00F8-U+01BF – C0 controls, Latin extended A &amp;amp; B)&lt;br /&gt;
	\199\132-\201\143 – Ǆ-ɏ (U+01C4-U+024F – Latin extended B)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_good_vanc_name (last, first, suffix, position)&lt;br /&gt;
	if not suffix then&lt;br /&gt;
		if first:find (&#039;[,%s]&#039;) then											-- when there is a space or comma, might be first name/initials + generational suffix&lt;br /&gt;
			first = first:match (&#039;(.-)[,%s]+&#039;);									-- get name/initials&lt;br /&gt;
			suffix = first:match (&#039;[,%s]+(.+)$&#039;);								-- get generational suffix&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (suffix) then&lt;br /&gt;
		if not is_suffix (suffix) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl.suffix, position);&lt;br /&gt;
			return false;														-- not a name with an appropriate suffix&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if nil == mw.ustring.find (last, &amp;quot;^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%&#039;]*$&amp;quot;) or&lt;br /&gt;
		nil == mw.ustring.find (first, &amp;quot;^[A-Za-z\195\128-\195\150\195\152-\195\182\195\184-\198\191\199\132-\201\143\225\184\128-\225\187\191%-%s%&#039;%.]*$&amp;quot;) then&lt;br /&gt;
			add_vanc_error (cfg.err_msg_supl[&#039;non-Latin char&#039;], position);&lt;br /&gt;
			return false;														-- not a string of Latin characters; Vancouver requires Romanization&lt;br /&gt;
	end;&lt;br /&gt;
	return true;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; R E D U C E _ T O _ I N I T I A L S &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Attempts to convert names to initials in support of |name-list-style=vanc.  &lt;br /&gt;
&lt;br /&gt;
Names in |firstn= may be separated by spaces or hyphens, or for initials, a period.&lt;br /&gt;
See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35062/.&lt;br /&gt;
&lt;br /&gt;
Vancouver style requires family rank designations (Jr, II, III, etc.) to be rendered&lt;br /&gt;
as Jr, 2nd, 3rd, etc.  See http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35085/.&lt;br /&gt;
This code only accepts and understands generational suffix in the Vancouver format&lt;br /&gt;
because Roman numerals look like, and can be mistaken for, initials.&lt;br /&gt;
&lt;br /&gt;
This function uses ustring functions because firstname initials may be any of the&lt;br /&gt;
Unicode Latin characters accepted by is_good_vanc_name ().&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function reduce_to_initials (first, position)&lt;br /&gt;
	if first:find (&#039;,&#039;, 1, true) then&lt;br /&gt;
		return first;															-- commas not allowed; abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local name, suffix = mw.ustring.match (first, &amp;quot;^(%u+) ([%dJS][%drndth]+)$&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	if not name then															-- if not initials and a suffix&lt;br /&gt;
		name = mw.ustring.match (first, &amp;quot;^(%u+)$&amp;quot;);								-- is it just initials?&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if name then																-- if first is initials with or without suffix&lt;br /&gt;
		if 3 &amp;gt; mw.ustring.len (name) then										-- if one or two initials&lt;br /&gt;
			if suffix then														-- if there is a suffix&lt;br /&gt;
				if is_suffix (suffix) then										-- is it legitimate?&lt;br /&gt;
					return first;												-- one or two initials and a valid suffix so nothing to do&lt;br /&gt;
				else&lt;br /&gt;
					add_vanc_error (cfg.err_msg_supl.suffix, position);			-- one or two initials with invalid suffix so error message&lt;br /&gt;
					return first;												-- and return first unmolested&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				return first;													-- one or two initials without suffix; nothing to do&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end																			-- if here then name has 3 or more uppercase letters so treat them as a word&lt;br /&gt;
&lt;br /&gt;
	local initials_t, names_t = {}, {};											-- tables to hold name parts and initials&lt;br /&gt;
	local i = 1;																-- counter for number of initials&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (first, &#039;[%s%-]+&#039;);									-- split into a sequence of names and possible suffix&lt;br /&gt;
&lt;br /&gt;
	while names_t[i] do															-- loop through the sequence&lt;br /&gt;
		if 1 &amp;lt; i and names_t[i]:match (&#039;[%dJS][%drndth]+%.?$&#039;) then				-- if not the first name, and looks like a suffix (may have trailing dot)&lt;br /&gt;
			names_t[i] = names_t[i]:gsub (&#039;%.&#039;, &#039;&#039;);							-- remove terminal dot if present&lt;br /&gt;
			if is_suffix (names_t[i]) then										-- if a legitimate suffix&lt;br /&gt;
				table.insert (initials_t, &#039; &#039; .. names_t[i]);					-- add a separator space, insert at end of initials sequence&lt;br /&gt;
				break;															-- and done because suffix must fall at the end of a name&lt;br /&gt;
			end																	-- no error message if not a suffix; possibly because of Romanization&lt;br /&gt;
		end&lt;br /&gt;
		if 3 &amp;gt; i then&lt;br /&gt;
			table.insert (initials_t, mw.ustring.sub (names_t[i], 1, 1));		-- insert the initial at end of initials sequence&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- bump the counter&lt;br /&gt;
	end&lt;br /&gt;
			&lt;br /&gt;
	return table.concat (initials_t);											-- Vancouver format does not include spaces.&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N T E R W I K I _ P R E F I X E N _ G E T &amp;gt;----------------------------------&lt;br /&gt;
&lt;br /&gt;
extract interwiki prefixen from &amp;lt;value&amp;gt;.  Returns two one or two values:&lt;br /&gt;
	false – no prefixen&lt;br /&gt;
	nil – prefix exists but not recognized&lt;br /&gt;
	project prefix, language prefix – when value has either of:&lt;br /&gt;
		:&amp;lt;project&amp;gt;:&amp;lt;language&amp;gt;:&amp;lt;article&amp;gt;&lt;br /&gt;
		:&amp;lt;language&amp;gt;:&amp;lt;project&amp;gt;:&amp;lt;article&amp;gt;&lt;br /&gt;
	project prefix, nil – when &amp;lt;value&amp;gt; has only a known single-letter prefix&lt;br /&gt;
	nil, language prefix – when &amp;lt;value&amp;gt; has only a known language prefix&lt;br /&gt;
&lt;br /&gt;
accepts single-letter project prefixen: &#039;d&#039; (wikidata), &#039;s&#039; (wikisource), and &#039;w&#039; (wikipedia) prefixes; at this&lt;br /&gt;
writing, the other single-letter prefixen (b (wikibook), c (commons), m (meta), n (wikinews), q (wikiquote), and&lt;br /&gt;
v (wikiversity)) are not supported.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function interwiki_prefixen_get (value, is_link)&lt;br /&gt;
	if not value:find (&#039;:%l+:&#039;) then											-- if no prefix&lt;br /&gt;
		return false;															-- abandon; boolean here to distinguish from nil fail returns later&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local prefix_patterns_linked_t = {											-- sequence of valid interwiki and inter project prefixen&lt;br /&gt;
		&#039;^%[%[:([dsw]):(%l%l+):&#039;,												-- wikilinked; project and language prefixes&lt;br /&gt;
		&#039;^%[%[:(%l%l+):([dsw]):&#039;,												-- wikilinked; language and project prefixes&lt;br /&gt;
		&#039;^%[%[:([dsw]):&#039;,														-- wikilinked; project prefix&lt;br /&gt;
		&#039;^%[%[:(%l%l+):&#039;,														-- wikilinked; language prefix&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
	local prefix_patterns_unlinked_t = {										-- sequence of valid interwiki and inter project prefixen&lt;br /&gt;
		&#039;^:([dsw]):(%l%l+):&#039;,													-- project and language prefixes&lt;br /&gt;
		&#039;^:(%l%l+):([dsw]):&#039;,													-- language and project prefixes&lt;br /&gt;
		&#039;^:([dsw]):&#039;,															-- project prefix&lt;br /&gt;
		&#039;^:(%l%l+):&#039;,															-- language prefix&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	local cap1, cap2;&lt;br /&gt;
	for _, pattern in ipairs ((is_link and prefix_patterns_linked_t) or prefix_patterns_unlinked_t) do&lt;br /&gt;
		cap1, cap2 = value:match (pattern);&lt;br /&gt;
		if cap1 then&lt;br /&gt;
			break;																-- found a match so stop looking&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if cap1 and cap2 then														-- when both then :project:language: or :language:project: (both forms allowed)&lt;br /&gt;
		if 1 == #cap1 then														-- length == 1 then :project:language:&lt;br /&gt;
			if cfg.inter_wiki_map[cap2] then									-- is language prefix in the interwiki map?&lt;br /&gt;
				return cap1, cap2;												-- return interwiki project and interwiki language&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- here when :language:project:&lt;br /&gt;
			if cfg.inter_wiki_map[cap1] then									-- is language prefix in the interwiki map?&lt;br /&gt;
				return cap2, cap1;												-- return interwiki project and interwiki language&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		return nil;																-- unknown interwiki language&lt;br /&gt;
	elseif not (cap1 or cap2) then												-- both are nil?&lt;br /&gt;
		return nil;																-- we got something that looks like a project prefix but isn&#039;t; return fail&lt;br /&gt;
	elseif 1 == #cap1 then														-- here when one capture&lt;br /&gt;
		return cap1, nil;														-- length is 1 so return project, nil language&lt;br /&gt;
	else																		-- here when one capture and its length it more than 1&lt;br /&gt;
		if cfg.inter_wiki_map[cap1] then										-- is language prefix in the interwiki map?&lt;br /&gt;
			return nil, cap1;													-- return nil project, language&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I S T _ P E O P L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Formats a list of people (authors, contributors, editors, interviewers, translators) &lt;br /&gt;
&lt;br /&gt;
names in the list will be linked when&lt;br /&gt;
	|&amp;lt;name&amp;gt;-link= has a value&lt;br /&gt;
	|&amp;lt;name&amp;gt;-mask- does NOT have a value; masked names are presumed to have been&lt;br /&gt;
		rendered previously so should have been linked there&lt;br /&gt;
&lt;br /&gt;
when |&amp;lt;name&amp;gt;-mask=0, the associated name is not rendered&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function list_people (control, people, etal)&lt;br /&gt;
	local sep;&lt;br /&gt;
	local namesep;&lt;br /&gt;
	local format = control.format;&lt;br /&gt;
	local maximum = control.maximum;&lt;br /&gt;
	local name_list = {};&lt;br /&gt;
&lt;br /&gt;
	if &#039;vanc&#039; == format then													-- Vancouver-like name styling?&lt;br /&gt;
		sep = cfg.presentation[&#039;sep_nl_vanc&#039;];									-- name-list separator between names is a comma&lt;br /&gt;
		namesep = cfg.presentation[&#039;sep_name_vanc&#039;];							-- last/first separator is a space&lt;br /&gt;
	else&lt;br /&gt;
		sep = cfg.presentation[&#039;sep_nl&#039;];										-- name-list separator between names is a semicolon&lt;br /&gt;
		namesep = cfg.presentation[&#039;sep_name&#039;];									-- last/first separator is &amp;lt;comma&amp;gt;&amp;lt;space&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if sep:sub (-1, -1) ~= &amp;quot; &amp;quot; then sep = sep .. &amp;quot; &amp;quot; end&lt;br /&gt;
	if utilities.is_set (maximum) and maximum &amp;lt; 1 then return &amp;quot;&amp;quot;, 0; end		-- returned 0 is for EditorCount; not used for other names&lt;br /&gt;
	&lt;br /&gt;
	for i, person in ipairs (people) do&lt;br /&gt;
		if utilities.is_set (person.last) then&lt;br /&gt;
			local mask = person.mask;&lt;br /&gt;
			local one;&lt;br /&gt;
			local sep_one = sep;&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (maximum) and i &amp;gt; maximum then&lt;br /&gt;
				etal = true;&lt;br /&gt;
				break;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			if mask then&lt;br /&gt;
				local n = tonumber (mask);										-- convert to a number if it can be converted; nil else&lt;br /&gt;
				if n then&lt;br /&gt;
					one = 0 ~= n and string.rep(&amp;quot;&amp;amp;mdash;&amp;quot;, n) or nil;			-- make a string of (n &amp;gt; 0) mdashes, nil else, to replace name&lt;br /&gt;
					person.link = nil;											-- don&#039;t create link to name if name is replaces with mdash string or has been set nil&lt;br /&gt;
				else&lt;br /&gt;
					one = mask;													-- replace name with mask text (must include name-list separator)&lt;br /&gt;
					sep_one = &amp;quot; &amp;quot;;												-- modify name-list separator&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				one = person.last;												-- get surname&lt;br /&gt;
				local first = person.first										-- get given name&lt;br /&gt;
				if utilities.is_set (first) then&lt;br /&gt;
					if (&amp;quot;vanc&amp;quot; == format) then									-- if Vancouver format&lt;br /&gt;
						one = one:gsub (&#039;%.&#039;, &#039;&#039;);								-- remove periods from surnames (http://www.ncbi.nlm.nih.gov/books/NBK7271/box/A35029/)&lt;br /&gt;
						if not person.corporate and is_good_vanc_name (one, first, nil, i) then		-- and name is all Latin characters; corporate authors not tested&lt;br /&gt;
							first = reduce_to_initials (first, i);				-- attempt to convert first name(s) to initials&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					one = one .. namesep .. first;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if utilities.is_set (person.link) then&lt;br /&gt;
				one = utilities.make_wikilink (person.link, one);				-- link author/editor&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if one then															-- if &amp;lt;one&amp;gt; has a value (name, mdash replacement, or mask text replacement)&lt;br /&gt;
				local proj, tag = interwiki_prefixen_get (one, true);			-- get the interwiki prefixen if present&lt;br /&gt;
				if &#039;w&#039; == proj and (&#039;Wikipedia&#039; == mw.site.namespaces.Project[&#039;name&#039;]) then&lt;br /&gt;
					proj = nil;													-- for stuff like :w:de:&amp;lt;article&amp;gt;, :w is unnecessary TODO: maint cat?&lt;br /&gt;
				end&lt;br /&gt;
				if proj then&lt;br /&gt;
					local proj_name = ({[&#039;d&#039;] = cfg.messages.wikidata, [&#039;s&#039;] = cfg.messages.wikisource, [&#039;w&#039;] = cfg.messages.wikipedia})[proj];	-- :w (wikipedia) for linking from a non-wikipedia project&lt;br /&gt;
					if proj_name then &lt;br /&gt;
						one = one .. utilities.wrap_style (&#039;interproj&#039;, proj_name);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						utilities.add_prop_cat (&#039;interproj-linked-name&#039;, proj);	-- categorize it; &amp;lt;proj&amp;gt; is sort key&lt;br /&gt;
						tag = nil;												-- unset; don&#039;t do both project and language&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
				if tag == cfg.this_wiki_code then&lt;br /&gt;
					tag = nil;													-- stuff like :en:&amp;lt;article&amp;gt; at en.wiki is pointless TODO: maint cat?&lt;br /&gt;
				end&lt;br /&gt;
				if tag then&lt;br /&gt;
					local lang = cfg.lang_tag_remap[tag] or cfg.mw_languages_by_tag_t[tag];&lt;br /&gt;
					if lang then												-- error messaging done in extract_names() where we know parameter names&lt;br /&gt;
						one = one .. utilities.wrap_style (&#039;interwiki&#039;, lang);	-- add resized leading space, brackets, static text, language name&lt;br /&gt;
						utilities.add_prop_cat (&#039;interwiki-linked-name&#039;, tag);	-- categorize it; &amp;lt;tag&amp;gt; is sort key&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
&lt;br /&gt;
				table.insert (name_list, one);									-- add it to the list of names&lt;br /&gt;
				table.insert (name_list, sep_one);								-- add the proper name-list separator&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local count = #name_list / 2;												-- (number of names + number of separators) divided by 2&lt;br /&gt;
	if 0 &amp;lt; count then &lt;br /&gt;
		if 1 &amp;lt; count and not etal then&lt;br /&gt;
			if &#039;amp&#039; == format then&lt;br /&gt;
				name_list[#name_list-2] = &amp;quot; &amp;amp; &amp;quot;;								-- replace last separator with ampersand text&lt;br /&gt;
			elseif &#039;and&#039; == format then&lt;br /&gt;
				if 2 == count then&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_and;		-- replace last separator with &#039;and&#039; text&lt;br /&gt;
				else&lt;br /&gt;
					name_list[#name_list-2] = cfg.presentation.sep_nl_end;		-- replace last separator with &#039;(sep) and&#039; text&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		name_list[#name_list] = nil;											-- erase the last separator&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local result = table.concat (name_list);									-- construct list&lt;br /&gt;
	if etal and utilities.is_set (result) then									-- etal may be set by |display-authors=etal but we might not have a last-first list&lt;br /&gt;
		result = result .. sep .. cfg.messages[&#039;et al&#039;];						-- we&#039;ve got a last-first list and etal so add et al.&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return result, count;														-- return name-list string and count of number of names (count used for editor names only)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------&amp;lt; M A K E _ C I T E R E F _ I D &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Generates a CITEREF anchor ID if we have at least one name or a date.  Otherwise&lt;br /&gt;
returns an empty string.&lt;br /&gt;
&lt;br /&gt;
namelist is one of the contributor-, author-, or editor-name lists chosen in that&lt;br /&gt;
order.  year is Year or anchor_year.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function make_citeref_id (namelist, year)&lt;br /&gt;
	local names={};							-- a table for the one to four names and year&lt;br /&gt;
	for i,v in ipairs (namelist) do			-- loop through the list and take up to the first four last names&lt;br /&gt;
		names[i] = v.last&lt;br /&gt;
		if i == 4 then break end			-- if four then done&lt;br /&gt;
	end&lt;br /&gt;
	table.insert (names, year);				-- add the year at the end&lt;br /&gt;
	local id = table.concat(names);			-- concatenate names and year for CITEREF id&lt;br /&gt;
	if utilities.is_set (id) then			-- if concatenation is not an empty string&lt;br /&gt;
		return &amp;quot;CITEREF&amp;quot; .. id;				-- add the CITEREF portion&lt;br /&gt;
	else&lt;br /&gt;
		return &#039;&#039;;							-- return an empty string; no reason to include CITEREF id in this citation&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T E _ C L A S S _A T T R I B U T E _M A K E &amp;gt;------------------------------&lt;br /&gt;
&lt;br /&gt;
construct &amp;lt;cite&amp;gt; tag class attribute for this citation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;cite_class&amp;gt; – config.CitationClass from calling template&lt;br /&gt;
&amp;lt;mode&amp;gt; – value from |mode= parameter&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function cite_class_attribute_make (cite_class, mode)&lt;br /&gt;
	local class_t = {};&lt;br /&gt;
	table.insert (class_t, &#039;citation&#039;);											-- required for blue highlight&lt;br /&gt;
	if &#039;citation&#039; ~= cite_class then&lt;br /&gt;
		table.insert (class_t, cite_class);										-- identify this template for user css&lt;br /&gt;
		table.insert (class_t, utilities.is_set (mode) and mode or &#039;cs1&#039;);		-- identify the citation style for user css or javascript&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (class_t, utilities.is_set (mode) and mode or &#039;cs2&#039;);		-- identify the citation style for user css or javascript&lt;br /&gt;
	end&lt;br /&gt;
	for _, prop_key in ipairs (z.prop_keys_t) do&lt;br /&gt;
		table.insert (class_t, prop_key);										-- identify various properties for user css or javascript&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat (class_t, &#039; &#039;);											-- make a big string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; N A M E _ H A S _ E T A L &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Evaluates the content of name parameters (author, editor, etc.) for variations on&lt;br /&gt;
the theme of et al.  If found, the et al. is removed, a flag is set to true and&lt;br /&gt;
the function returns the modified name and the flag.&lt;br /&gt;
&lt;br /&gt;
This function never sets the flag to false but returns its previous state because&lt;br /&gt;
it may have been set by previous passes through this function or by the associated&lt;br /&gt;
|display-&amp;lt;names&amp;gt;=etal parameter&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_etal (name, etal, nocat, param)&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (name) then												-- name can be nil in which case just return&lt;br /&gt;
		local patterns = cfg.et_al_patterns; 									-- get patterns from configuration&lt;br /&gt;
		&lt;br /&gt;
		for _, pattern in ipairs (patterns) do									-- loop through all of the patterns&lt;br /&gt;
			if name:match (pattern) then										-- if this &#039;et al&#039; pattern is found in name&lt;br /&gt;
				name = name:gsub (pattern, &#039;&#039;);									-- remove the offending text&lt;br /&gt;
				etal = true;													-- set flag (may have been set previously here or by |display-&amp;lt;names&amp;gt;=etal)&lt;br /&gt;
				if not nocat then												-- no categorization for |vauthors=&lt;br /&gt;
					utilities.set_message (&#039;err_etal&#039;, {param});				-- and set an error if not added&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return name, etal;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; N A M E _ I S _ N U M E R I C &amp;gt;----------------------&lt;br /&gt;
&lt;br /&gt;
Add an error message and category when &amp;lt;name&amp;gt; parameter value does not contain letters.  &lt;br /&gt;
&lt;br /&gt;
Add a maintenance category when &amp;lt;name&amp;gt; parameter value has numeric characters mixed with characters that are &lt;br /&gt;
not numeric characters; could be letters and/or punctuation characters.&lt;br /&gt;
&lt;br /&gt;
This function will only emit one error and one maint message for the current template.  Does not emit both error&lt;br /&gt;
and maint messages/categories for the same parameter value.&lt;br /&gt;
&lt;br /&gt;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_is_numeric (name, name_alias, list_name)&lt;br /&gt;
	local patterns = {&lt;br /&gt;
		&#039;^%D+%d&#039;,																-- &amp;lt;name&amp;gt; must have digits preceded by other characters&lt;br /&gt;
		&#039;^%D*%d+%D+&#039;,															-- &amp;lt;name&amp;gt; must have digits followed by other characters&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	if not added_numeric_name_errs and mw.ustring.match (name, &#039;^[%A]+$&#039;) then	-- if we have not already set an error message and &amp;lt;name&amp;gt; does not have any alpha characters&lt;br /&gt;
		utilities.set_message (&#039;err_numeric_names&#039;, name_alias);				-- add an error message&lt;br /&gt;
		added_numeric_name_errs = true;											-- set the flag so we emit only one error message&lt;br /&gt;
		return;																	-- when here no point in further testing; abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not added_numeric_name_maint then										-- if we have already set a maint message&lt;br /&gt;
		for _, pattern in ipairs (patterns) do									-- spin through list of patterns&lt;br /&gt;
			if mw.ustring.match (name, pattern) then							-- digits preceded or followed by anything but digits; %D+ includes punctuation&lt;br /&gt;
				utilities.set_message (&#039;maint_numeric_names&#039;, cfg.special_case_translation [list_name]);	-- add a maint cat for this template&lt;br /&gt;
				added_numeric_name_maint = true;								-- set the flag so we emit only one maint message&lt;br /&gt;
				return;															-- when here no point in further testing; abandon&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------------&amp;lt; N A M E _ H A S _ M U L T _ N A M E S &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Evaluates the content of last/surname (authors etc.) parameters for multiple names.&lt;br /&gt;
Multiple names are indicated if there is more than one comma or any &amp;quot;unescaped&amp;quot;&lt;br /&gt;
semicolons. Escaped semicolons are ones used as part of selected HTML entities.&lt;br /&gt;
If the condition is met, the function adds the multiple name maintenance category.&lt;br /&gt;
&lt;br /&gt;
Same test for first except that commas should not appear in given names (MOS:JR says&lt;br /&gt;
that the generational suffix does not take a separator character).  Titles, degrees,&lt;br /&gt;
postnominals, affiliations, all normally comma separated don&#039;t belong in a citation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;name&amp;gt; – name parameter value&lt;br /&gt;
&amp;lt;list_name&amp;gt; – AuthorList, EditorList, etc&lt;br /&gt;
&amp;lt;limit&amp;gt; – number of allowed commas; 1 (default) for surnames; 0 for given names&lt;br /&gt;
&lt;br /&gt;
returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_has_mult_names (name, list_name, limit)&lt;br /&gt;
	local _, commas, semicolons, nbsps;&lt;br /&gt;
	limit = limit and limit or 1;&lt;br /&gt;
	if utilities.is_set (name) then&lt;br /&gt;
		_, commas = name:gsub (&#039;,&#039;, &#039;&#039;);										-- count the number of commas&lt;br /&gt;
		_, semicolons = name:gsub (&#039;;&#039;, &#039;&#039;);									-- count the number of semicolons&lt;br /&gt;
		-- nbsps probably should be its own separate count rather than merged in&lt;br /&gt;
		-- some way with semicolons because Lua patterns do not support the&lt;br /&gt;
		-- grouping operator that regex does, which means there is no way to add&lt;br /&gt;
		-- more entities to escape except by adding more counts with the new&lt;br /&gt;
		-- entities&lt;br /&gt;
		_, nbsps = name:gsub (&#039;&amp;amp;nbsp;&#039;,&#039;&#039;);										-- count nbsps&lt;br /&gt;
		&lt;br /&gt;
		-- There is exactly 1 semicolon per &amp;amp;nbsp; entity, so subtract nbsps&lt;br /&gt;
		-- from semicolons to &#039;escape&#039; them. If additional entities are added,&lt;br /&gt;
		-- they also can be subtracted.&lt;br /&gt;
		if limit &amp;lt; commas or 0 &amp;lt; (semicolons - nbsps) then&lt;br /&gt;
			utilities.set_message (&#039;maint_mult_names&#039;, cfg.special_case_translation [list_name]);	-- add a maint message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ G E N E R I C &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Compares values assigned to various parameters according to the string provided as &amp;lt;item&amp;gt; in the function call.&lt;br /&gt;
&amp;lt;item&amp;gt; can have on of two values:&lt;br /&gt;
	&#039;generic_names&#039; – for name-holding parameters: |last=, |first=, |editor-last=, etc&lt;br /&gt;
	&#039;generic_titles&#039; – for |title=&lt;br /&gt;
&lt;br /&gt;
There are two types of generic tests.  The &#039;accept&#039; tests look for a pattern that should not be rejected by the&lt;br /&gt;
&#039;reject&#039; test.  For example,&lt;br /&gt;
	|author=[[John Smith (author)|Smith, John]]&lt;br /&gt;
would be rejected by the &#039;author&#039; reject test.  But piped wikilinks with &#039;author&#039; disambiguation should not be&lt;br /&gt;
rejected so the &#039;accept&#039; test prevents that from happening.  Accept tests are always performed before reject&lt;br /&gt;
tests.&lt;br /&gt;
&lt;br /&gt;
Each of the &#039;accept&#039; and &#039;reject&#039; sequence tables hold tables for en.wiki ([&#039;en&#039;]) and local.wiki ([&#039;local&#039;])&lt;br /&gt;
that each can hold a test sequence table  The sequence table holds, at index [1], a test pattern, and, at index&lt;br /&gt;
[2], a boolean control value.  The control value tells string.find() or mw.ustring.find() to do plain-text search (true)&lt;br /&gt;
or a pattern search (false).  The intent of all this complexity is to make these searches as fast as possible so&lt;br /&gt;
that we don&#039;t run out of processing time on very large articles.&lt;br /&gt;
&lt;br /&gt;
Returns&lt;br /&gt;
	true when a reject test finds the pattern or string&lt;br /&gt;
	false when an accept test finds the pattern or string&lt;br /&gt;
	nil else&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_generic (item, value, wiki)&lt;br /&gt;
	local test_val;&lt;br /&gt;
	local str_lower = {															-- use string.lower() for en.wiki ([&#039;en&#039;]) and use mw.ustring.lower() or local.wiki ([&#039;local&#039;])&lt;br /&gt;
		[&#039;en&#039;] = string.lower,&lt;br /&gt;
		[&#039;local&#039;] = mw.ustring.lower,&lt;br /&gt;
		}&lt;br /&gt;
	local str_find = {															-- use string.find() for en.wiki ([&#039;en&#039;]) and use mw.ustring.find() or local.wiki ([&#039;local&#039;])&lt;br /&gt;
		[&#039;en&#039;] = string.find,&lt;br /&gt;
		[&#039;local&#039;] = mw.ustring.find,&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	local function test (val, test_t, wiki)										-- local function to do the testing; &amp;lt;wiki&amp;gt; selects lower() and find() functions&lt;br /&gt;
		val = test_t[2] and str_lower[wiki](value) or val;						-- when &amp;lt;test_t[2]&amp;gt; set to &#039;true&#039;, plaintext search using lowercase value&lt;br /&gt;
		return str_find[wiki] (val, test_t[1], 1, test_t[2]);					-- return nil when not found or matched&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	local test_types_t = {&#039;accept&#039;, &#039;reject&#039;};									-- test accept patterns first, then reject patterns&lt;br /&gt;
	local wikis_t = {&#039;en&#039;, &#039;local&#039;};											-- do tests for each of these keys; en.wiki first, local.wiki second&lt;br /&gt;
&lt;br /&gt;
	for _, test_type in ipairs (test_types_t) do								-- for each test type&lt;br /&gt;
		for _, generic_value in pairs (cfg.special_case_translation[item][test_type]) do	-- spin through the list of generic value fragments to accept or reject&lt;br /&gt;
			for _, wiki in ipairs (wikis_t) do&lt;br /&gt;
				if generic_value[wiki] then&lt;br /&gt;
					if test (value, generic_value[wiki], wiki) then				-- go do the test&lt;br /&gt;
						return (&#039;reject&#039; == test_type);							-- param value rejected, return true; false else&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ I S _ G E N E R I C &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
calls is_generic() to determine if &amp;lt;name&amp;gt; is a &#039;generic name&#039; listed in cfg.generic_names; &amp;lt;name_alias&amp;gt; is the&lt;br /&gt;
parameter name used in error messaging&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_is_generic (name, name_alias)&lt;br /&gt;
	if not added_generic_name_errs  and is_generic (&#039;generic_names&#039;, name) then&lt;br /&gt;
		utilities.set_message (&#039;err_generic_name&#039;, name_alias);					-- set an error message&lt;br /&gt;
		added_generic_name_errs = true;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ C H E C K S &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function calls various name checking functions used to validate the content of the various name-holding parameters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_checks (last, first, list_name, last_alias, first_alias)&lt;br /&gt;
	local accept_name;&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (last) then&lt;br /&gt;
		last, accept_name = utilities.has_accept_as_written (last);				-- remove accept-this-as-written markup when it wraps all of &amp;lt;last&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if not accept_name then													-- &amp;lt;last&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
			name_has_mult_names (last, list_name);								-- check for multiple names in the parameter&lt;br /&gt;
			name_is_numeric (last, last_alias, list_name);						-- check for names that have no letters or are a mix of digits and other characters&lt;br /&gt;
			name_is_generic (last, last_alias);									-- check for names found in the generic names list&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (first) then&lt;br /&gt;
		first, accept_name = utilities.has_accept_as_written (first);			-- remove accept-this-as-written markup when it wraps all of &amp;lt;first&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if not accept_name then													-- &amp;lt;first&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
			name_has_mult_names (first, list_name, 0);							-- check for multiple names in the parameter; 0 is number of allowed commas in a given name&lt;br /&gt;
			name_is_numeric (first, first_alias, list_name);					-- check for names that have no letters or are a mix of digits and other characters&lt;br /&gt;
			name_is_generic (first, first_alias);								-- check for names found in the generic names list&lt;br /&gt;
		end&lt;br /&gt;
		local wl_type, D = utilities.is_wikilink (first);&lt;br /&gt;
		if 0 ~= wl_type then&lt;br /&gt;
			first = D;&lt;br /&gt;
			utilities.set_message (&#039;err_bad_paramlink&#039;, first_alias);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return last, first;															-- done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------------------&amp;lt; E X T R A C T _ N A M E S &amp;gt;-------------------------&lt;br /&gt;
&lt;br /&gt;
Gets name list from the input arguments&lt;br /&gt;
&lt;br /&gt;
Searches through args in sequential order to find |lastn= and |firstn= parameters&lt;br /&gt;
(or their aliases), and their matching link and mask parameters. Stops searching&lt;br /&gt;
when both |lastn= and |firstn= are not found in args after two sequential attempts:&lt;br /&gt;
found |last1=, |last2=, and |last3= but doesn&#039;t find |last4= and |last5= then the&lt;br /&gt;
search is done.&lt;br /&gt;
&lt;br /&gt;
This function emits an error message when there is a |firstn= without a matching&lt;br /&gt;
|lastn=.  When there are &#039;holes&#039; in the list of last names, |last1= and |last3=&lt;br /&gt;
are present but |last2= is missing, an error message is emitted. |lastn= is not&lt;br /&gt;
required to have a matching |firstn=.&lt;br /&gt;
&lt;br /&gt;
When an author or editor parameter contains some form of &#039;et al.&#039;, the &#039;et al.&#039;&lt;br /&gt;
is stripped from the parameter and a flag (etal) returned that will cause list_people()&lt;br /&gt;
to add the static &#039;et al.&#039; text from Module:Citation/CS1/Configuration.  This keeps&lt;br /&gt;
&#039;et al.&#039; out of the template&#039;s metadata.  When this occurs, an error is emitted.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extract_names(args, list_name)&lt;br /&gt;
	local names = {};															-- table of names&lt;br /&gt;
	local last;																	-- individual name components&lt;br /&gt;
	local first;&lt;br /&gt;
	local link;&lt;br /&gt;
	local mask;&lt;br /&gt;
	local i = 1;																-- loop counter/indexer&lt;br /&gt;
	local n = 1;																-- output table indexer&lt;br /&gt;
	local count = 0;															-- used to count the number of times we haven&#039;t found a |last= (or alias for authors, |editor-last or alias for editors)&lt;br /&gt;
	local etal = false;															-- return value set to true when we find some form of et al. in an author parameter&lt;br /&gt;
&lt;br /&gt;
	local last_alias, first_alias, link_alias;									-- selected parameter aliases used in error messaging&lt;br /&gt;
	while true do&lt;br /&gt;
		last, last_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;err_redundant_parameters&#039;, i );		-- search through args for name components beginning at 1&lt;br /&gt;
		first, first_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		link, link_alias = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Link&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Mask&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
	&lt;br /&gt;
		if last then															-- error check |lastn= alias for unknown interwiki link prefix; done here because this is where we have the parameter name&lt;br /&gt;
			local project, language = interwiki_prefixen_get (last, true);		-- true because we expect interwiki links in |lastn= to be wikilinked&lt;br /&gt;
			if nil == project and nil == language then							-- when both are nil&lt;br /&gt;
				utilities.set_message (&#039;err_bad_paramlink&#039;, last_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				last = utilities.remove_wiki_link (last);						-- remove wikilink markup; show display value only&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if link then															-- error check |linkn= alias for unknown interwiki link prefix&lt;br /&gt;
			local project, language = interwiki_prefixen_get (link, false);		-- false because wiki links in |author-linkn= is an error&lt;br /&gt;
			if nil == project and nil == language then							-- when both are nil&lt;br /&gt;
				utilities.set_message (&#039;err_bad_paramlink&#039;, link_alias);		-- not known, emit an error message	-- TODO: err_bad_interwiki?&lt;br /&gt;
				link = nil;														-- unset so we don&#039;t link&lt;br /&gt;
				link_alias = nil;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		last, etal = name_has_etal (last, etal, false, last_alias);				-- find and remove variations on et al.&lt;br /&gt;
		first, etal = name_has_etal (first, etal, false, first_alias);			-- find and remove variations on et al.&lt;br /&gt;
		last, first = name_checks (last, first, list_name, last_alias, first_alias);						-- multiple names, extraneous annotation, etc. checks&lt;br /&gt;
&lt;br /&gt;
		if first and not last then												-- if there is a firstn without a matching lastn&lt;br /&gt;
			local alias = first_alias:find (&#039;given&#039;, 1, true) and &#039;given&#039; or &#039;first&#039;;	-- get first or given form of the alias&lt;br /&gt;
			utilities.set_message (&#039;err_first_missing_last&#039;, {&lt;br /&gt;
				first_alias,													-- param name of alias missing its mate&lt;br /&gt;
				first_alias:gsub (alias, {[&#039;first&#039;] = &#039;last&#039;, [&#039;given&#039;] = &#039;surname&#039;}),	-- make param name appropriate to the alias form&lt;br /&gt;
				});																-- add this error message&lt;br /&gt;
		elseif not first and not last then										-- if both firstn and lastn aren&#039;t found, are we done?&lt;br /&gt;
			count = count + 1;													-- number of times we haven&#039;t found last and first&lt;br /&gt;
			if 2 &amp;lt;= count then													-- two missing names and we give up&lt;br /&gt;
				break;															-- normal exit or there is a two-name hole in the list; can&#039;t tell which&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- we have last with or without a first&lt;br /&gt;
			local result;&lt;br /&gt;
			link = link_title_ok (link, link_alias, last, last_alias);			-- check for improper wiki-markup&lt;br /&gt;
&lt;br /&gt;
			if first then&lt;br /&gt;
				link = link_title_ok (link, link_alias, first, first_alias);	-- check for improper wiki-markup&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			names[n] = {last = last, first = first, link = link, mask = mask, corporate = false};	-- add this name to our names list (corporate for |vauthors= only)&lt;br /&gt;
			n = n + 1;															-- point to next location in the names table&lt;br /&gt;
			if 1 == count then													-- if the previous name was missing&lt;br /&gt;
				utilities.set_message (&#039;err_missing_name&#039;, {list_name:match (&amp;quot;(%w+)List&amp;quot;):lower(), i - 1});	-- add this error message&lt;br /&gt;
			end&lt;br /&gt;
			count = 0;															-- reset the counter, we&#039;re looking for two consecutive missing names&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;																-- point to next args location&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return names, etal;															-- all done, return our list of names and the etal flag&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; N A M E _ T A G _ G E T &amp;gt;------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
attempt to decode |language=&amp;lt;lang_param&amp;gt; and return language name and matching tag; nil else.&lt;br /&gt;
&lt;br /&gt;
This function looks for:&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a tag in cfg.lang_tag_remap{}&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a name in cfg.lang_name_remap{}&lt;br /&gt;
	&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a name in cfg.mw_languages_by_name_t&lt;br /&gt;
	&amp;lt;lang_param&amp;gt; as a tag in cfg.mw_languages_by_tag_t&lt;br /&gt;
when those fail, presume that &amp;lt;lang_param&amp;gt; is an IETF-like tag that MediaWiki does not recognize.  Strip all&lt;br /&gt;
script, region, variant, whatever subtags from &amp;lt;lang_param&amp;gt; to leave just a two or three character language tag&lt;br /&gt;
and look for the new &amp;lt;lang_param&amp;gt; in cfg.mw_languages_by_tag_t{}&lt;br /&gt;
&lt;br /&gt;
on success, returns name (in properly capitalized form) and matching tag (in lowercase); on failure returns nil&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function name_tag_get (lang_param)&lt;br /&gt;
	local lang_param_lc = mw.ustring.lower (lang_param);						-- use lowercase as an index into the various tables&lt;br /&gt;
	local name;&lt;br /&gt;
	local tag;&lt;br /&gt;
&lt;br /&gt;
	name = cfg.lang_tag_remap[lang_param_lc];									-- assume &amp;lt;lang_param_lc&amp;gt; is a tag; attempt to get remapped language name &lt;br /&gt;
	if name then																-- when &amp;lt;name&amp;gt;, &amp;lt;lang_param&amp;gt; is a tag for a remapped language name&lt;br /&gt;
		if cfg.lang_name_remap[name:lower()][2] ~= lang_param_lc then&lt;br /&gt;
			utilities.set_message (&#039;maint_unknown_lang&#039;);						-- add maint category if not already added&lt;br /&gt;
			return name, cfg.lang_name_remap[name:lower()][2];					-- so return name and tag from lang_name_remap[name]; special case to xlate sr-ec and sr-el to sr-cyrl and sr-latn&lt;br /&gt;
		end&lt;br /&gt;
		return name, lang_param_lc;												-- so return &amp;lt;name&amp;gt; from remap and &amp;lt;lang_param_lc&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	tag = lang_param_lc:match (&#039;^(%a%a%a?)%-.*&#039;);								-- still assuming that &amp;lt;lang_param_lc&amp;gt; is a tag; strip script, region, variant subtags&lt;br /&gt;
	name = cfg.lang_tag_remap[tag];												-- attempt to get remapped language name with language subtag only&lt;br /&gt;
	if name then																-- when &amp;lt;name&amp;gt;, &amp;lt;tag&amp;gt; is a tag for a remapped language name&lt;br /&gt;
		return name, tag;														-- so return &amp;lt;name&amp;gt; from remap and &amp;lt;tag&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.lang_name_remap[lang_param_lc] then									-- not a remapped tag, assume &amp;lt;lang_param_lc&amp;gt; is a name; attempt to get remapped language tag &lt;br /&gt;
		return cfg.lang_name_remap[lang_param_lc][1], cfg.lang_name_remap[lang_param_lc][2];	-- for this &amp;lt;lang_param_lc&amp;gt;, return a (possibly) new name and appropriate tag&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	name = cfg.mw_languages_by_tag_t[lang_param_lc];							-- assume that &amp;lt;lang_param_lc&amp;gt; is a tag; attempt to get its matching language name&lt;br /&gt;
	&lt;br /&gt;
	if name then&lt;br /&gt;
		return name, lang_param_lc;												-- &amp;lt;lang_param_lc&amp;gt; is a tag so return it and &amp;lt;name&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	tag = cfg.mw_languages_by_name_t[lang_param_lc];							-- assume that &amp;lt;lang_param_lc&amp;gt; is a language name; attempt to get its matching tag&lt;br /&gt;
	&lt;br /&gt;
	if tag then&lt;br /&gt;
		return cfg.mw_languages_by_tag_t[tag], tag;								-- &amp;lt;lang_param_lc&amp;gt; is a name so return the name from the table and &amp;lt;tag&amp;gt;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	tag = lang_param_lc:match (&#039;^(%a%a%a?)%-.*&#039;);								-- is &amp;lt;lang_param_lc&amp;gt; an IETF-like tag that MediaWiki doesn&#039;t recognize? &amp;lt;tag&amp;gt; gets the language subtag; nil else&lt;br /&gt;
&lt;br /&gt;
	if tag then&lt;br /&gt;
		name = cfg.mw_languages_by_tag_t[tag];									-- attempt to get a language name using the shortened &amp;lt;tag&amp;gt;&lt;br /&gt;
		if name then&lt;br /&gt;
			return name, tag;													-- &amp;lt;lang_param_lc&amp;gt; is an unrecognized IETF-like tag so return &amp;lt;name&amp;gt; and language subtag&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------&amp;lt; L A N G U A G E _ P A R A M E T E R &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Gets language name from a provided two- or three-character ISO 639 code.  If a code&lt;br /&gt;
is recognized by MediaWiki, use the returned name; if not, then use the value that&lt;br /&gt;
was provided with the language parameter.&lt;br /&gt;
&lt;br /&gt;
When |language= contains a recognized language (either code or name), the page is&lt;br /&gt;
assigned to the category for that code: Category:Norwegian-language sources (no).&lt;br /&gt;
For valid three-character code languages, the page is assigned to the single category&lt;br /&gt;
for &#039;639-2&#039; codes: Category:CS1 ISO 639-2 language sources.&lt;br /&gt;
&lt;br /&gt;
Languages that are the same as the local wiki are not categorized.  MediaWiki does&lt;br /&gt;
not recognize three-character equivalents of two-character codes: code &#039;ar&#039; is&lt;br /&gt;
recognized but code &#039;ara&#039; is not.&lt;br /&gt;
&lt;br /&gt;
This function supports multiple languages in the form |language=nb, French, th&lt;br /&gt;
where the language names or codes are separated from each other by commas with&lt;br /&gt;
optional space characters.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function language_parameter (lang)&lt;br /&gt;
	local tag;																	-- some form of IETF-like language tag; language subtag with optional region, sript, vatiant, etc subtags&lt;br /&gt;
	local lang_subtag;															-- ve populates |language= with mostly unecessary region subtags the MediaWiki does not recognize; this is the base language subtag&lt;br /&gt;
	local name;																	-- the language name&lt;br /&gt;
	local language_list = {};													-- table of language names to be rendered&lt;br /&gt;
	local names_t = {};															-- table made from the value assigned to |language=&lt;br /&gt;
&lt;br /&gt;
	local this_wiki_name = mw.language.fetchLanguageName (cfg.this_wiki_code, cfg.this_wiki_code);	-- get this wiki&#039;s language name&lt;br /&gt;
&lt;br /&gt;
	names_t = mw.text.split (lang, &#039;%s*,%s*&#039;);									-- names should be a comma separated list&lt;br /&gt;
&lt;br /&gt;
	for _, lang in ipairs (names_t) do											-- reuse lang here because we don&#039;t yet know if lang is a language name or a language tag&lt;br /&gt;
		name, tag = name_tag_get (lang);										-- attempt to get name/tag pair for &amp;lt;lang&amp;gt;; &amp;lt;name&amp;gt; has proper capitalization; &amp;lt;tag&amp;gt; is lowercase&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (tag) then&lt;br /&gt;
			lang_subtag = tag:gsub (&#039;^(%a%a%a?)%-.*&#039;, &#039;%1&#039;);					-- for categorization, strip any IETF-like tags from language tag&lt;br /&gt;
&lt;br /&gt;
			if cfg.this_wiki_code ~= lang_subtag then							-- when the language is not the same as this wiki&#039;s language&lt;br /&gt;
				if 2 == lang_subtag:len() then									-- and is a two-character tag&lt;br /&gt;
					utilities.add_prop_cat (&#039;foreign-lang-source&#039;, {name, tag}, lang_subtag);		-- categorize it; tag appended to allow for multiple language categorization&lt;br /&gt;
				else															-- or is a recognized language (but has a three-character tag)&lt;br /&gt;
					utilities.add_prop_cat (&#039;foreign-lang-source-2&#039;, {lang_subtag}, lang_subtag);			-- categorize it differently TODO: support multiple three-character tag categories per cs1|2 template?&lt;br /&gt;
				end&lt;br /&gt;
			elseif cfg.local_lang_cat_enable then								-- when the language and this wiki&#039;s language are the same and categorization is enabled&lt;br /&gt;
				utilities.add_prop_cat (&#039;local-lang-source&#039;, {name, lang_subtag});		-- categorize it&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			name = lang;														-- return whatever &amp;lt;lang&amp;gt; has so that we show something&lt;br /&gt;
			utilities.set_message (&#039;maint_unknown_lang&#039;);						-- add maint category if not already added&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		table.insert (language_list, name);&lt;br /&gt;
		name = &#039;&#039;;																-- so we can reuse it&lt;br /&gt;
	end&lt;br /&gt;
 &lt;br /&gt;
	name = utilities.make_sep_list (#language_list, language_list);&lt;br /&gt;
	if (1 == #language_list) and (lang_subtag == cfg.this_wiki_code) then		-- when only one language, find lang name in this wiki lang name; for |language=en-us, &#039;English&#039; in &#039;American English&#039;&lt;br /&gt;
		return &#039;&#039;;																-- if one language and that language is this wiki&#039;s return an empty string (no annotation)&lt;br /&gt;
	end&lt;br /&gt;
	return (&amp;quot; &amp;quot; .. wrap_msg (&#039;language&#039;, name));								-- otherwise wrap with &#039;(in ...)&#039;&lt;br /&gt;
	--[[ TODO: should only return blank or name rather than full list&lt;br /&gt;
	so we can clean up the bunched parenthetical elements Language, Type, Format&lt;br /&gt;
	]]&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-----------------------&amp;lt; S E T _ C S _ S T Y L E &amp;gt;--------------------------&lt;br /&gt;
&lt;br /&gt;
Gets the default CS style configuration for the given mode.&lt;br /&gt;
Returns default separator and either postscript as passed in or the default.&lt;br /&gt;
In CS1, the default postscript and separator are &#039;.&#039;.&lt;br /&gt;
In CS2, the default postscript is the empty string and the default separator is &#039;,&#039;.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_cs_style (postscript, mode)&lt;br /&gt;
	if utilities.is_set(postscript) then&lt;br /&gt;
		-- emit a maintenance message if user postscript is the default cs1 postscript&lt;br /&gt;
		-- we catch the opposite case for cs2 in set_style&lt;br /&gt;
		if mode == &#039;cs1&#039; and postscript == cfg.presentation[&#039;ps_&#039; .. mode] then&lt;br /&gt;
			utilities.set_message (&#039;maint_postscript&#039;);&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		postscript = cfg.presentation[&#039;ps_&#039; .. mode];&lt;br /&gt;
	end&lt;br /&gt;
	return cfg.presentation[&#039;sep_&#039; .. mode], postscript;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E T _ S T Y L E &amp;gt;-----------------------------&lt;br /&gt;
&lt;br /&gt;
Sets the separator and postscript styles. Checks the |mode= first and the&lt;br /&gt;
#invoke CitationClass second. Removes the postscript if postscript == none.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function set_style (mode, postscript, cite_class)&lt;br /&gt;
	local sep;&lt;br /&gt;
	if &#039;cs2&#039; == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs2&#039;);&lt;br /&gt;
	elseif &#039;cs1&#039; == mode then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs1&#039;);&lt;br /&gt;
	elseif &#039;citation&#039; == cite_class	then&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs2&#039;);&lt;br /&gt;
	else&lt;br /&gt;
		sep, postscript = set_cs_style (postscript, &#039;cs1&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.keywords_xlate[postscript:lower()] == &#039;none&#039; then&lt;br /&gt;
		-- emit a maintenance message if user postscript is the default cs2 postscript&lt;br /&gt;
		-- we catch the opposite case for cs1 in set_cs_style&lt;br /&gt;
		if &#039;cs2&#039; == mode or (&#039;cs1&#039; ~= mode and &#039;citation&#039; == cite_class) then	-- {{citation |title=Title |mode=cs1 |postscript=none}} should not emit maint message&lt;br /&gt;
			utilities.set_message (&#039;maint_postscript&#039;);&lt;br /&gt;
		end&lt;br /&gt;
		postscript = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return sep, postscript&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I S _ P D F &amp;gt;-----------------------------------&lt;br /&gt;
&lt;br /&gt;
Determines if a URL has the file extension that is one of the PDF file extensions&lt;br /&gt;
used by [[MediaWiki:Common.css]] when applying the PDF icon to external links.&lt;br /&gt;
&lt;br /&gt;
returns true if file extension is one of the recognized extensions, else false&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function is_pdf (url)&lt;br /&gt;
	return url:match (&#039;%.pdf$&#039;) or url:match (&#039;%.PDF$&#039;) or&lt;br /&gt;
		url:match (&#039;%.pdf[%?#]&#039;) or url:match (&#039;%.PDF[%?#]&#039;) or&lt;br /&gt;
		url:match (&#039;%.PDF&amp;amp;#035&#039;) or url:match (&#039;%.pdf&amp;amp;#035&#039;);&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S T Y L E _ F O R M A T &amp;gt;-----------------------&lt;br /&gt;
&lt;br /&gt;
Applies CSS style to |format=, |chapter-format=, etc.  Also emits an error message&lt;br /&gt;
if the format parameter does not have a matching URL parameter.  If the format parameter&lt;br /&gt;
is not set and the URL contains a file extension that is recognized as a PDF document&lt;br /&gt;
by MediaWiki&#039;s commons.css, this code will set the format parameter to (PDF) with&lt;br /&gt;
the appropriate styling.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function style_format (format, url, fmt_param, url_param)&lt;br /&gt;
	if utilities.is_set (format) then&lt;br /&gt;
		format = utilities.wrap_style (&#039;format&#039;, format);						-- add leading space, parentheses, resize&lt;br /&gt;
		if not utilities.is_set (url) then&lt;br /&gt;
			utilities.set_message (&#039;err_format_missing_url&#039;, {fmt_param, url_param});	-- add an error message&lt;br /&gt;
		end&lt;br /&gt;
	elseif is_pdf (url) then													-- format is not set so if URL is a PDF file then&lt;br /&gt;
		format = utilities.wrap_style (&#039;format&#039;, &#039;PDF&#039;);						-- set format to PDF&lt;br /&gt;
	else&lt;br /&gt;
		format = &#039;&#039;;															-- empty string for concatenation&lt;br /&gt;
	end&lt;br /&gt;
	return format;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[---------------------&amp;lt; G E T _ D I S P L A Y _ N A M E S &amp;gt;------------------&lt;br /&gt;
&lt;br /&gt;
Returns a number that defines the number of names displayed for author and editor&lt;br /&gt;
name lists and a Boolean flag to indicate when et al. should be appended to the name list.&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is a number greater than or equal to zero,&lt;br /&gt;
return the number and the previous state of the &#039;etal&#039; flag (false by default&lt;br /&gt;
but may have been set to true if the name list contains some variant of the text &#039;et al.&#039;).&lt;br /&gt;
&lt;br /&gt;
When the value assigned to |display-xxxxors= is the keyword &#039;etal&#039;, return a number&lt;br /&gt;
that is one greater than the number of authors in the list and set the &#039;etal&#039; flag true.&lt;br /&gt;
This will cause the list_people() to display all of the names in the name list followed by &#039;et al.&#039;&lt;br /&gt;
&lt;br /&gt;
In all other cases, returns nil and the previous state of the &#039;etal&#039; flag.&lt;br /&gt;
&lt;br /&gt;
inputs:&lt;br /&gt;
	max: A[&#039;DisplayAuthors&#039;] or A[&#039;DisplayEditors&#039;], etc; a number or some flavor of etal&lt;br /&gt;
	count: #a or #e&lt;br /&gt;
	list_name: &#039;authors&#039; or &#039;editors&#039;&lt;br /&gt;
	etal: author_etal or editor_etal&lt;br /&gt;
&lt;br /&gt;
This function sets an error message when |display-xxxxors= value greater than or equal to number of names but&lt;br /&gt;
not when &amp;lt;max&amp;gt; comes from {{cs1 config}} global settings.  When using global settings, &amp;lt;param&amp;gt; is set to the&lt;br /&gt;
keyword &#039;cs1 config&#039; which is used to supress the normal error.  Error is suppressed because it is to be expected&lt;br /&gt;
that some citations in an article will have the same or fewer names that the limit specified in {{cs1 config}}.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function get_display_names (max, count, list_name, etal, param)&lt;br /&gt;
	if utilities.is_set (max) then&lt;br /&gt;
		if &#039;etal&#039; == max:lower():gsub(&amp;quot;[ &#039;%.]&amp;quot;, &#039;&#039;) then						-- the :gsub() portion makes &#039;etal&#039; from a variety of &#039;et al.&#039; spellings and stylings&lt;br /&gt;
			max = count + 1;													-- number of authors + 1 so display all author name plus et al.&lt;br /&gt;
			etal = true;														-- overrides value set by extract_names()&lt;br /&gt;
		elseif max:match (&#039;^%d+$&#039;) then											-- if is a string of numbers&lt;br /&gt;
			max = tonumber (max);												-- make it a number&lt;br /&gt;
			if (max &amp;gt;= count) and (&#039;cs1 config&#039; ~= param) then					-- error when local |display-xxxxors= value greater than or equal to number of names; not an error when using global setting&lt;br /&gt;
				utilities.set_message (&#039;err_disp_name&#039;, {param, max});			-- add error message&lt;br /&gt;
				max = nil;&lt;br /&gt;
			end&lt;br /&gt;
		else																	-- not a valid keyword or number&lt;br /&gt;
			utilities.set_message (&#039;err_disp_name&#039;, {param, max});				-- add error message&lt;br /&gt;
			max = nil;															-- unset; as if |display-xxxxors= had not been set&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return max, etal;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[----------&amp;lt; E X T R A _ T E X T _ I N _ P A G E _ C H E C K &amp;gt;---------------&lt;br /&gt;
&lt;br /&gt;
Adds error if |page=, |pages=, |quote-page=, |quote-pages= has what appears to be&lt;br /&gt;
some form of p. or pp. abbreviation in the first characters of the parameter content.&lt;br /&gt;
&lt;br /&gt;
check page for extraneous p, p., pp, pp., pg, pg. at start of parameter value:&lt;br /&gt;
	good pattern: &#039;^P[^%.P%l]&#039; matches when page begins PX or P# but not Px&lt;br /&gt;
		      where x and X are letters and # is a digit&lt;br /&gt;
	bad pattern:  &#039;^[Pp][PpGg]&#039; matches when page begins pp, pP, Pp, PP, pg, pG, Pg, PG&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extra_text_in_page_check (val, name)&lt;br /&gt;
	if not val:match (cfg.vol_iss_pg_patterns.good_ppattern) then&lt;br /&gt;
		for _, pattern in ipairs (cfg.vol_iss_pg_patterns.bad_ppatterns) do		-- spin through the selected sequence table of patterns&lt;br /&gt;
			if val:match (pattern) then											-- when a match, error so&lt;br /&gt;
				utilities.set_message (&#039;err_extra_text_pages&#039;, name);	 		-- add error message&lt;br /&gt;
				return;															-- and done&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end		&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X T R A _ T E X T _ I N _ V O L _ I S S _ C H E C K &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Adds error if |volume= or |issue= has what appears to be some form of redundant &#039;type&#039; indicator.  Applies to&lt;br /&gt;
both; this function looks for issue text in both |issue= and |volume= and looks for volume-like text in |voluem=&lt;br /&gt;
and |issue=.&lt;br /&gt;
&lt;br /&gt;
For |volume=:&lt;br /&gt;
	&#039;V.&#039;, or &#039;Vol.&#039; (with or without the dot) abbreviations or &#039;Volume&#039; in the first characters of the parameter&lt;br /&gt;
	content (all case insensitive). &#039;V&#039; and &#039;v&#039; (without the dot) are presumed to be roman numerals so&lt;br /&gt;
	are allowed.&lt;br /&gt;
&lt;br /&gt;
For |issue=:&lt;br /&gt;
	&#039;No.&#039;, &#039;I.&#039;, &#039;Iss.&#039; (with or without the dot) abbreviations, or &#039;Issue&#039; in the first characters of the&lt;br /&gt;
	parameter content (all case insensitive); numero styling: &#039;n°&#039; with degree sign U+00B0, and № precomposed&lt;br /&gt;
	numero sign U+2116.&lt;br /&gt;
	&lt;br /&gt;
Single character values (&#039;v&#039;, &#039;i&#039;, &#039;n&#039;) allowed when not followed by separator character (&#039;.&#039;, &#039;:&#039;, &#039;=&#039;, or&lt;br /&gt;
whitespace character) – param values are trimmed of whitespace by MediaWiki before delivered to the module.&lt;br /&gt;
	&lt;br /&gt;
&amp;lt;val&amp;gt; is |volume= or |issue= parameter value&lt;br /&gt;
&amp;lt;name&amp;gt; is |volume= or |issue= parameter name for error message&lt;br /&gt;
&amp;lt;selector&amp;gt; is &#039;v&#039; for |volume=, &#039;i&#039; for |issue=&lt;br /&gt;
&lt;br /&gt;
sets error message on failure; returns nothing&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function extra_text_in_vol_iss_check (val, name, selector)&lt;br /&gt;
	if not utilities.is_set (val) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local handler = &#039;v&#039; == selector and &#039;err_extra_text_volume&#039; or &#039;err_extra_text_issue&#039;;&lt;br /&gt;
	&lt;br /&gt;
	local accept_val;&lt;br /&gt;
	val, accept_val = utilities.has_accept_as_written (val);&lt;br /&gt;
	--if accept_val then														-- if uncomment this, |volume=((vol. 1)) suppresses error&lt;br /&gt;
	--	return;&lt;br /&gt;
	--end&lt;br /&gt;
	&lt;br /&gt;
	--val = mw.text.unstripNoWiki (val);										-- if uncomment this, |volume=&amp;lt;nowiki&amp;gt;vol. 1&amp;lt;/nowiki&amp;gt; shows error&lt;br /&gt;
	val = val:lower();															-- force parameter value to lower case&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (cfg.vol_iss_pg_patterns.vi_patterns_t) do			-- spin through the sequence table of patterns&lt;br /&gt;
		if val:match (pattern) then												-- when a match, error so&lt;br /&gt;
			utilities.set_message (handler, name);								-- add error message&lt;br /&gt;
			return;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; G E T _ V _ N A M E _ T A B L E &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
split apart a |vauthors= or |veditors= parameter.  This function allows for corporate names, wrapped in doubled&lt;br /&gt;
parentheses to also have commas; in the old version of the code, the doubled parentheses were included in the&lt;br /&gt;
rendered citation and in the metadata.  Individual author names may be wikilinked&lt;br /&gt;
&lt;br /&gt;
	|vauthors=Jones AB, [[E. B. White|White EB]], ((Black, Brown, and Co.))&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function get_v_name_table (vparam, output_table, output_link_table)&lt;br /&gt;
	local _, accept = utilities.has_accept_as_written (vparam);&lt;br /&gt;
	if accept then&lt;br /&gt;
		utilities.add_prop_cat (&#039;vanc-accept&#039;);									-- add properties category&lt;br /&gt;
	end&lt;br /&gt;
	local name_table = mw.text.split(vparam, &amp;quot;%s*,%s*&amp;quot;);						-- names are separated by commas&lt;br /&gt;
	local wl_type, label, link;													-- wl_type not used here; just a placeholder&lt;br /&gt;
	&lt;br /&gt;
	local i = 1;&lt;br /&gt;
	&lt;br /&gt;
	while name_table[i] do&lt;br /&gt;
		if name_table[i]:match (&#039;^%(%(.*[^%)][^%)]$&#039;) then						-- first segment of corporate with one or more commas; this segment has the opening doubled parentheses&lt;br /&gt;
			local name = name_table[i];&lt;br /&gt;
			i = i + 1;															-- bump indexer to next segment&lt;br /&gt;
			while name_table[i] do&lt;br /&gt;
				name = name .. &#039;, &#039; .. name_table[i];							-- concatenate with previous segments&lt;br /&gt;
				if name_table[i]:match (&#039;^.*%)%)$&#039;) then						-- if this table member has the closing doubled parentheses&lt;br /&gt;
					break;														-- and done reassembling so&lt;br /&gt;
				end&lt;br /&gt;
				i = i + 1;														-- bump indexer&lt;br /&gt;
			end&lt;br /&gt;
			table.insert (output_table, name);									-- and add corporate name to the output table&lt;br /&gt;
			table.insert (output_link_table, &#039;&#039;);								-- no wikilink&lt;br /&gt;
		else&lt;br /&gt;
			wl_type, label, link = utilities.is_wikilink (name_table[i]);		-- wl_type is: 0, no wl (text in label variable); 1, [[D]]; 2, [[L|D]]&lt;br /&gt;
			table.insert (output_table, label);									-- add this name&lt;br /&gt;
			if 1 == wl_type then&lt;br /&gt;
				table.insert (output_link_table, label);						-- simple wikilink [[D]]&lt;br /&gt;
			else&lt;br /&gt;
				table.insert (output_link_table, link);							-- no wikilink or [[L|D]]; add this link if there is one, else empty string&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		i = i + 1;&lt;br /&gt;
	end	&lt;br /&gt;
	return output_table;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P A R S E _ V A U T H O R S _ V E D I T O R S &amp;gt;--------------------------------&lt;br /&gt;
&lt;br /&gt;
This function extracts author / editor names from |vauthors= or |veditors= and finds matching |xxxxor-maskn= and&lt;br /&gt;
|xxxxor-linkn= in args.  It then returns a table of assembled names just as extract_names() does.&lt;br /&gt;
&lt;br /&gt;
Author / editor names in |vauthors= or |veditors= must be in Vancouver system style. Corporate or institutional names&lt;br /&gt;
may sometimes be required and because such names will often fail the is_good_vanc_name() and other format compliance&lt;br /&gt;
tests, are wrapped in doubled parentheses ((corporate name)) to suppress the format tests.&lt;br /&gt;
&lt;br /&gt;
Supports generational suffixes Jr, 2nd, 3rd, 4th–6th.&lt;br /&gt;
&lt;br /&gt;
This function sets the Vancouver error when a required comma is missing and when there is a space between an author&#039;s initials.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function parse_vauthors_veditors (args, vparam, list_name)&lt;br /&gt;
	local names = {};															-- table of names assembled from |vauthors=, |author-maskn=, |author-linkn=&lt;br /&gt;
	local v_name_table = {};&lt;br /&gt;
	local v_link_table = {};													-- when name is wikilinked, targets go in this table&lt;br /&gt;
	local etal = false;															-- return value set to true when we find some form of et al. vauthors parameter&lt;br /&gt;
	local last, first, link, mask, suffix;&lt;br /&gt;
	local corporate = false;&lt;br /&gt;
&lt;br /&gt;
	vparam, etal = name_has_etal (vparam, etal, true);							-- find and remove variations on et al. do not categorize (do it here because et al. might have a period)&lt;br /&gt;
	v_name_table = get_v_name_table (vparam, v_name_table, v_link_table);		-- names are separated by commas&lt;br /&gt;
&lt;br /&gt;
	for i, v_name in ipairs(v_name_table) do&lt;br /&gt;
		first = &#039;&#039;;																-- set to empty string for concatenation and because it may have been set for previous author/editor&lt;br /&gt;
		local accept_name;&lt;br /&gt;
		v_name, accept_name = utilities.has_accept_as_written (v_name);			-- remove accept-this-as-written markup when it wraps all of &amp;lt;v_name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
		if accept_name then&lt;br /&gt;
			last = v_name;&lt;br /&gt;
			corporate = true;													-- flag used in list_people()&lt;br /&gt;
		elseif string.find(v_name, &amp;quot;%s&amp;quot;) then&lt;br /&gt;
			if v_name:find(&#039;[;%.]&#039;) then										-- look for commonly occurring punctuation characters; &lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.punctuation, i);&lt;br /&gt;
			end&lt;br /&gt;
			local lastfirstTable = {}&lt;br /&gt;
			lastfirstTable = mw.text.split(v_name, &amp;quot;%s+&amp;quot;)&lt;br /&gt;
			first = table.remove(lastfirstTable);								-- removes and returns value of last element in table which should be initials or generational suffix&lt;br /&gt;
&lt;br /&gt;
			if not mw.ustring.match (first, &#039;^%u+$&#039;) then						-- mw.ustring here so that later we will catch non-Latin characters&lt;br /&gt;
				suffix = first;													-- not initials so assume that whatever we got is a generational suffix&lt;br /&gt;
				first = table.remove(lastfirstTable);							-- get what should be the initials from the table&lt;br /&gt;
			end&lt;br /&gt;
			last = table.concat(lastfirstTable, &#039; &#039;)							-- returns a string that is the concatenation of all other names that are not initials and generational suffix&lt;br /&gt;
			if not utilities.is_set (last) then&lt;br /&gt;
				first = &#039;&#039;;														-- unset&lt;br /&gt;
				last = v_name;													-- last empty because something wrong with first&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.name, i);&lt;br /&gt;
			end&lt;br /&gt;
			if mw.ustring.match (last, &#039;%a+%s+%u+%s+%a+&#039;) then&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl[&#039;missing comma&#039;], i);			-- matches last II last; the case when a comma is missing&lt;br /&gt;
			end&lt;br /&gt;
			if mw.ustring.match (v_name, &#039; %u %u$&#039;) then						-- this test is in the wrong place TODO: move or replace with a more appropriate test&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.initials, i);					-- matches a space between two initials&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			last = v_name;														-- last name or single corporate name?  Doesn&#039;t support multiword corporate names? do we need this?&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set (first) then&lt;br /&gt;
			if not mw.ustring.match (first, &amp;quot;^%u?%u$&amp;quot;) then						-- first shall contain one or two upper-case letters, nothing else&lt;br /&gt;
				add_vanc_error (cfg.err_msg_supl.initials, i);					-- too many initials; mixed case initials (which may be ok Romanization); hyphenated initials&lt;br /&gt;
			end&lt;br /&gt;
			is_good_vanc_name (last, first, suffix, i);							-- check first and last before restoring the suffix which may have a non-Latin digit&lt;br /&gt;
			if utilities.is_set (suffix) then&lt;br /&gt;
				first = first .. &#039; &#039; .. suffix;									-- if there was a suffix concatenate with the initials&lt;br /&gt;
				suffix = &#039;&#039;;													-- unset so we don&#039;t add this suffix to all subsequent names&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if not corporate then&lt;br /&gt;
				is_good_vanc_name (last, &#039;&#039;, nil, i);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		link = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Link&#039;], &#039;err_redundant_parameters&#039;, i ) or v_link_table[i];&lt;br /&gt;
		mask = utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Mask&#039;], &#039;err_redundant_parameters&#039;, i );&lt;br /&gt;
		names[i] = {last = last, first = first, link = link, mask = mask, corporate = corporate};		-- add this assembled name to our names list&lt;br /&gt;
	end&lt;br /&gt;
	return names, etal;															-- all done, return our list of names&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; S E L E C T _ A U T H O R _ E D I T O R _ S O U R C E &amp;gt;------------------------&lt;br /&gt;
&lt;br /&gt;
Select one of |authors=, |authorn= / |lastn / firstn=, or |vauthors= as the source of the author name list or&lt;br /&gt;
select one of |editorn= / editor-lastn= / |editor-firstn= or |veditors= as the source of the editor name list.&lt;br /&gt;
&lt;br /&gt;
Only one of these appropriate three will be used.  The hierarchy is: |authorn= (and aliases) highest and |authors= lowest;&lt;br /&gt;
|editorn= (and aliases) highest and |veditors= lowest (support for |editors= withdrawn)&lt;br /&gt;
&lt;br /&gt;
When looking for |authorn= / |editorn= parameters, test |xxxxor1= and |xxxxor2= (and all of their aliases); stops after the second&lt;br /&gt;
test which mimicks the test used in extract_names() when looking for a hole in the author name list.  There may be a better&lt;br /&gt;
way to do this, I just haven&#039;t discovered what that way is.&lt;br /&gt;
&lt;br /&gt;
Emits an error message when more than one xxxxor name source is provided.&lt;br /&gt;
&lt;br /&gt;
In this function, vxxxxors = vauthors or veditors; xxxxors = authors as appropriate.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function select_author_editor_source (vxxxxors, xxxxors, args, list_name)&lt;br /&gt;
	local lastfirst = false;&lt;br /&gt;
	if utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;none&#039;, 1 ) or		-- do this twice in case we have a |first1= without a |last1=; this ...&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;none&#039;, 1 ) or		-- ... also catches the case where |first= is used with |vauthors=&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-Last&#039;], &#039;none&#039;, 2 ) or&lt;br /&gt;
		utilities.select_one ( args, cfg.aliases[list_name .. &#039;-First&#039;], &#039;none&#039;, 2 ) then&lt;br /&gt;
			lastfirst = true;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (utilities.is_set (vxxxxors) and true == lastfirst) or					-- these are the three error conditions&lt;br /&gt;
		(utilities.is_set (vxxxxors) and utilities.is_set (xxxxors)) or&lt;br /&gt;
		(true == lastfirst and utilities.is_set (xxxxors)) then&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;,&lt;br /&gt;
				utilities.substitute (cfg.special_case_translation.name_list_params,&lt;br /&gt;
					(&#039;AuthorList&#039; == list_name) and cfg.special_case_translation.author or cfg.special_case_translation.editor));	-- add error message&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if true == lastfirst then return 1 end;										-- return a number indicating which author name source to use&lt;br /&gt;
	if utilities.is_set (vxxxxors) then return 2 end;&lt;br /&gt;
	if utilities.is_set (xxxxors) then return 3 end;&lt;br /&gt;
	return 1;																	-- no authors so return 1; this allows missing author name test to run in case there is a first without last &lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ V A L I D _ P A R A M E T E R _ V A L U E &amp;gt;------------------------------&lt;br /&gt;
&lt;br /&gt;
This function is used to validate a parameter&#039;s assigned value for those parameters that have only a limited number&lt;br /&gt;
of allowable values (yes, y, true, live, dead, etc.).  When the parameter value has not been assigned a value (missing&lt;br /&gt;
or empty in the source template) the function returns the value specified by ret_val.  If the parameter value is one&lt;br /&gt;
of the list of allowed values returns the translated value; else, emits an error message and returns the value&lt;br /&gt;
specified by ret_val.&lt;br /&gt;
&lt;br /&gt;
TODO: explain &amp;lt;invert&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_valid_parameter_value (value, name, possible, ret_val, invert)&lt;br /&gt;
	if not utilities.is_set (value) then&lt;br /&gt;
		return ret_val;															-- an empty parameter is ok&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not invert and utilities.in_array (value, possible)) then				-- normal; &amp;lt;value&amp;gt; is in &amp;lt;possible&amp;gt; table&lt;br /&gt;
		return cfg.keywords_xlate[value];										-- return translation of parameter keyword&lt;br /&gt;
	elseif invert and not utilities.in_array (value, possible) then				-- invert; &amp;lt;value&amp;gt; is not in &amp;lt;possible&amp;gt; table&lt;br /&gt;
		return value;															-- return &amp;lt;value&amp;gt; as it is&lt;br /&gt;
	else&lt;br /&gt;
		utilities.set_message (&#039;err_invalid_param_val&#039;, {name, value});			-- not an allowed value so add error message&lt;br /&gt;
		return ret_val;&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; T E R M I N A T E _ N A M E _ L I S T &amp;gt;----------------------------------------&lt;br /&gt;
&lt;br /&gt;
This function terminates a name list (author, contributor, editor) with a separator character (sepc) and a space&lt;br /&gt;
when the last character is not a sepc character or when the last three characters are not sepc followed by two&lt;br /&gt;
closing square brackets (close of a wikilink).  When either of these is true, the name_list is terminated with a&lt;br /&gt;
single space character.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function terminate_name_list (name_list, sepc)&lt;br /&gt;
	if (string.sub (name_list, -3, -1) == sepc .. &#039;. &#039;) then					-- if already properly terminated&lt;br /&gt;
		return name_list;														-- just return the name list&lt;br /&gt;
	elseif (string.sub (name_list, -1, -1) == sepc) or (string.sub (name_list, -3, -1) == sepc .. &#039;]]&#039;) then	-- if last name in list ends with sepc char&lt;br /&gt;
		return name_list .. &amp;quot; &amp;quot;;												-- don&#039;t add another&lt;br /&gt;
	else&lt;br /&gt;
		return name_list .. sepc .. &#039; &#039;;										-- otherwise terminate the name list&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; F O R M A T _ V O L U M E _ I S S U E &amp;gt;-----------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns the concatenation of the formatted volume and issue (or journal article number) parameters as a single&lt;br /&gt;
string; or formatted volume or formatted issue, or an empty string if neither are set.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
	&lt;br /&gt;
local function format_volume_issue (volume, issue, article, cite_class, origin, sepc, lower)&lt;br /&gt;
	if not utilities.is_set (volume) and not utilities.is_set (issue) and not utilities.is_set (article) then&lt;br /&gt;
		return &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- same condition as in format_pages_sheets()&lt;br /&gt;
	local is_journal = &#039;journal&#039; == cite_class or (utilities.in_array (cite_class, {&#039;citation&#039;, &#039;map&#039;, &#039;interview&#039;}) and &#039;journal&#039; == origin);&lt;br /&gt;
&lt;br /&gt;
	local is_numeric_vol = volume and (volume:match (&#039;^[MDCLXVI]+$&#039;) or volume:match (&#039;^%d+$&#039;));	-- is only uppercase roman numerals or only digits?&lt;br /&gt;
	local is_long_vol = volume and (4 &amp;lt; mw.ustring.len(volume));				-- is |volume= value longer than 4 characters?&lt;br /&gt;
	&lt;br /&gt;
	if volume and (not is_numeric_vol and is_long_vol) then						-- when not all digits or Roman numerals, is |volume= longer than 4 characters?&lt;br /&gt;
		utilities.add_prop_cat (&#039;long-vol&#039;);									-- yes, add properties cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if is_journal then															-- journal-style formatting&lt;br /&gt;
		local vol = &#039;&#039;;&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (volume) then&lt;br /&gt;
			if is_numeric_vol then												-- |volume= value all digits or all uppercase Roman numerals?&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation[&#039;vol-bold&#039;], {sepc, volume});	-- render in bold face&lt;br /&gt;
			elseif is_long_vol then												-- not all digits or Roman numerals; longer than 4 characters?&lt;br /&gt;
				vol = utilities.substitute (cfg.messages[&#039;j-vol&#039;], {sepc, utilities.hyphen_to_dash (volume)});	-- not bold&lt;br /&gt;
			else																-- four or fewer characters&lt;br /&gt;
				vol = utilities.substitute (cfg.presentation[&#039;vol-bold&#039;], {sepc, utilities.hyphen_to_dash (volume)});	-- bold&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		vol = vol .. (utilities.is_set (issue) and utilities.substitute (cfg.messages[&#039;j-issue&#039;], issue) or &#039;&#039;)&lt;br /&gt;
		vol = vol .. (utilities.is_set (article) and utilities.substitute (cfg.messages[&#039;j-article-num&#039;], article) or &#039;&#039;)&lt;br /&gt;
		return vol;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;podcast&#039; == cite_class and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg (&#039;issue&#039;, {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if &#039;conference&#039; == cite_class and utilities.is_set (article) then			-- |article-number= supported only in journal and conference cites&lt;br /&gt;
		if utilities.is_set (volume) and utilities.is_set (article) then		-- both volume and article number&lt;br /&gt;
			return wrap_msg (&#039;vol-art&#039;, {sepc, utilities.hyphen_to_dash (volume), article}, lower);&lt;br /&gt;
		elseif utilities.is_set (article) then									-- article number alone; when volume alone, handled below&lt;br /&gt;
			return wrap_msg (&#039;art&#039;, {sepc, article}, lower);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- all other types of citation&lt;br /&gt;
	if utilities.is_set (volume) and utilities.is_set (issue) then&lt;br /&gt;
		return wrap_msg (&#039;vol-no&#039;, {sepc, utilities.hyphen_to_dash (volume), issue}, lower);&lt;br /&gt;
	elseif utilities.is_set (volume) then&lt;br /&gt;
		return wrap_msg (&#039;vol&#039;, {sepc, utilities.hyphen_to_dash (volume)}, lower);&lt;br /&gt;
	else&lt;br /&gt;
		return wrap_msg (&#039;issue&#039;, {sepc, issue}, lower);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[-------------------------&amp;lt; F O R M A T _ P A G E S _ S H E E T S &amp;gt;-----------------------------------------&lt;br /&gt;
&lt;br /&gt;
adds static text to one of |page(s)= or |sheet(s)= values and returns it with all of the others set to empty strings.&lt;br /&gt;
The return order is:&lt;br /&gt;
	page, pages, sheet, sheets&lt;br /&gt;
&lt;br /&gt;
Singular has priority over plural when both are provided.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function format_pages_sheets (page, pages, sheet, sheets, cite_class, origin, sepc, nopp, lower)&lt;br /&gt;
	if &#039;map&#039; == cite_class then													-- only cite map supports sheet(s) as in-source locators&lt;br /&gt;
		if utilities.is_set (sheet) then&lt;br /&gt;
			if &#039;journal&#039; == origin then&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, wrap_msg (&#039;j-sheet&#039;, sheet, lower), &#039;&#039;;&lt;br /&gt;
			else&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, wrap_msg (&#039;sheet&#039;, {sepc, sheet}, lower), &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (sheets) then&lt;br /&gt;
			if &#039;journal&#039; == origin then&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, &#039;&#039;, wrap_msg (&#039;j-sheets&#039;, sheets, lower);&lt;br /&gt;
			else&lt;br /&gt;
				return &#039;&#039;, &#039;&#039;, &#039;&#039;, wrap_msg (&#039;sheets&#039;, {sepc, sheets}, lower);&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local is_journal = &#039;journal&#039; == cite_class or (utilities.in_array (cite_class, {&#039;citation&#039;, &#039;map&#039;, &#039;interview&#039;}) and &#039;journal&#039; == origin);&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (page) then&lt;br /&gt;
		if is_journal then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;j-page(s)&#039;], page), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		else&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (pages) then&lt;br /&gt;
		if is_journal then&lt;br /&gt;
			return utilities.substitute (cfg.messages[&#039;j-page(s)&#039;], pages), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif tonumber(pages) ~= nil and not nopp then							-- if pages is only digits, assume a single page number&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		elseif not nopp then&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;pp-prefix&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		else&lt;br /&gt;
			return &#039;&#039;, utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return &#039;&#039;, &#039;&#039;, &#039;&#039;, &#039;&#039;;														-- return empty strings&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I N S O U R C E _ L O C _ G E T &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns one of the in-source locators: page, pages, or at. &lt;br /&gt;
&lt;br /&gt;
If any of these are interwiki links to Wikisource, returns the label portion of the interwiki-link as plain text&lt;br /&gt;
for use in COinS.  This COinS thing is done because here we convert an interwiki-link to an external link and&lt;br /&gt;
add an icon span around that; get_coins_pages() doesn&#039;t know about the span.  TODO: should it?  &lt;br /&gt;
&lt;br /&gt;
TODO: add support for sheet and sheets?; streamline;&lt;br /&gt;
&lt;br /&gt;
TODO: make it so that this function returns only one of the three as the single in-source (the return value assigned&lt;br /&gt;
to a new name)?&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function insource_loc_get (page, page_orig, pages, pages_orig, at)&lt;br /&gt;
	local ws_url, ws_label, coins_pages, L;										-- for Wikisource interwiki-links; TODO: this corrupts page metadata (span remains in place after cleanup; fix there?)&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (page) then&lt;br /&gt;
		if utilities.is_set (pages) or utilities.is_set (at) then&lt;br /&gt;
			pages = &#039;&#039;;															-- unset the others&lt;br /&gt;
			at = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
		extra_text_in_page_check (page, page_orig);								-- emit error message when |page= value begins with what looks like p., pp., etc.&lt;br /&gt;
&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (page);						-- make ws URL from |page= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			page = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in page&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			page = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, page});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (pages) then&lt;br /&gt;
		if utilities.is_set (at) then&lt;br /&gt;
			at = &#039;&#039;;															-- unset&lt;br /&gt;
		end&lt;br /&gt;
		extra_text_in_page_check (pages, pages_orig);							-- emit error message when |page= value begins with what looks like p., pp., etc.&lt;br /&gt;
&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (pages);						-- make ws URL from |pages= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			pages = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in pages&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			pages = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, pages});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (at) then&lt;br /&gt;
		ws_url, ws_label, L = wikisource_url_make (at);							-- make ws URL from |at= interwiki link; link portion L becomes tooltip label&lt;br /&gt;
		if ws_url then&lt;br /&gt;
			at = external_link (ws_url, ws_label .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in at&#039;);	-- space char after label to move icon away from in-source text; TODO: a better way to do this?&lt;br /&gt;
			at = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, at});&lt;br /&gt;
			coins_pages = ws_label;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return page, pages, at, coins_pages;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ U N I Q U E _ A R C H I V E _ U R L &amp;gt;------------------------------------&lt;br /&gt;
&lt;br /&gt;
add error message when |archive-url= value is same as |url= or chapter-url= (or alias...) value&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_unique_archive_url (archive, url, c_url, source, date)&lt;br /&gt;
	if utilities.is_set (archive) then&lt;br /&gt;
		if archive == url or archive == c_url then&lt;br /&gt;
			utilities.set_message (&#039;err_bad_url&#039;, {utilities.wrap_style (&#039;parameter&#039;, source)});	-- add error message&lt;br /&gt;
			return &#039;&#039;, &#039;&#039;;														-- unset |archive-url= and |archive-date= because same as |url= or |chapter-url=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return archive, date;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; A R C H I V E _ U R L _ C H E C K &amp;gt;--------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Check archive.org URLs to make sure they at least look like they are pointing at valid archives and not to the &lt;br /&gt;
save snapshot URL or to calendar pages.  When the archive URL is &#039;https://web.archive.org/save/&#039; (or http://...)&lt;br /&gt;
archive.org saves a snapshot of the target page in the URL.  That is something that Wikipedia should not allow&lt;br /&gt;
unwitting readers to do.&lt;br /&gt;
&lt;br /&gt;
When the archive.org URL does not have a complete timestamp, archive.org chooses a snapshot according to its own&lt;br /&gt;
algorithm or provides a calendar &#039;search&#039; result.  [[WP:ELNO]] discourages links to search results.&lt;br /&gt;
&lt;br /&gt;
This function looks at the value assigned to |archive-url= and returns empty strings for |archive-url= and&lt;br /&gt;
|archive-date= and an error message when:&lt;br /&gt;
	|archive-url= holds an archive.org save command URL&lt;br /&gt;
	|archive-url= is an archive.org URL that does not have a complete timestamp (YYYYMMDDhhmmss 14 digits) in the&lt;br /&gt;
		correct place&lt;br /&gt;
otherwise returns |archive-url= and |archive-date=&lt;br /&gt;
&lt;br /&gt;
There are two mostly compatible archive.org URLs:&lt;br /&gt;
	//web.archive.org/&amp;lt;timestamp&amp;gt;...		-- the old form&lt;br /&gt;
	//web.archive.org/web/&amp;lt;timestamp&amp;gt;...	-- the new form&lt;br /&gt;
&lt;br /&gt;
The old form does not support or map to the new form when it contains a display flag.  There are four identified flags&lt;br /&gt;
(&#039;id_&#039;, &#039;js_&#039;, &#039;cs_&#039;, &#039;im_&#039;) but since archive.org ignores others following the same form (two letters and an underscore)&lt;br /&gt;
we don&#039;t check for these specific flags but we do check the form.&lt;br /&gt;
&lt;br /&gt;
This function supports a preview mode.  When the article is rendered in preview mode, this function may return a modified&lt;br /&gt;
archive URL:&lt;br /&gt;
	for save command errors, return undated wildcard (/*/)&lt;br /&gt;
	for timestamp errors when the timestamp has a wildcard, return the URL unmodified&lt;br /&gt;
	for timestamp errors when the timestamp does not have a wildcard, return with timestamp limited to six digits plus wildcard (/yyyymm*/)&lt;br /&gt;
&lt;br /&gt;
A secondary function is to return an archive-url timestamp from those archive urls that have them.  The timestamp&lt;br /&gt;
is used by validation.archive_date_check() to see if the value in |archive-date= matches the timestamp in the&lt;br /&gt;
archive url.&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function archive_url_check (url, date)&lt;br /&gt;
	local err_msg = &#039;&#039;;															-- start with the error message empty&lt;br /&gt;
	local path, timestamp, flag;												-- portions of the archive.org URL&lt;br /&gt;
	&lt;br /&gt;
	local function is_ts_date_valid (timestamp, origin_date)					-- local function to validate archive url taimestamp date; time ignored&lt;br /&gt;
		local y, m, d = timestamp:match (&#039;(%d%d%d%d)(%d%d)(%d%d)&#039;);				-- split into parts&lt;br /&gt;
		if y and validation.is_valid_date (y, m, d) and (tonumber (y) &amp;gt;= 1996) then&lt;br /&gt;
			return true, tonumber (y) &amp;gt;= origin_date;							-- &amp;lt;origin_date&amp;gt; is 1996 for archive.org&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not url:match(&#039;//web%.archive%.org/&#039;)) and (not url:match(&#039;//liveweb%.archive%.org/&#039;)) then		-- also deprecated liveweb Wayback machine URL&lt;br /&gt;
		return url, date;														-- not an archive.org archive, return ArchiveURL and ArchiveDate&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if url:match(&#039;//web%.archive%.org/save/&#039;) then								-- if a save command URL, we don&#039;t want to allow saving of the target page &lt;br /&gt;
		err_msg = cfg.err_msg_supl.save;&lt;br /&gt;
		url = url:gsub (&#039;(//web%.archive%.org)/save/&#039;, &#039;%1/*/&#039;, 1);				-- for preview mode: modify ArchiveURL&lt;br /&gt;
	elseif url:match(&#039;//liveweb%.archive%.org/&#039;) then&lt;br /&gt;
		err_msg = cfg.err_msg_supl.liveweb;&lt;br /&gt;
	else&lt;br /&gt;
		path, timestamp, flag = url:match(&#039;//web%.archive%.org/([^%d]*)(%d+)([^/]*)/&#039;);	-- split out some of the URL parts for evaluation&lt;br /&gt;
		if not path then														-- malformed in some way; pattern did not match&lt;br /&gt;
			err_msg = cfg.err_msg_supl.timestamp;&lt;br /&gt;
		elseif 14 ~= timestamp:len() then										-- path and flag optional, must have 14-digit timestamp here&lt;br /&gt;
			err_msg = cfg.err_msg_supl.timestamp;&lt;br /&gt;
			if &#039;*&#039; ~= flag then&lt;br /&gt;
				local replacement = timestamp:match (&#039;^%d%d%d%d%d%d&#039;) or timestamp:match (&#039;^%d%d%d%d&#039;);	-- get the first 6 (YYYYMM) or first 4 digits (YYYY)&lt;br /&gt;
				if replacement then												-- nil if there aren&#039;t at least 4 digits (year)&lt;br /&gt;
					replacement = replacement .. string.rep (&#039;0&#039;, 14 - replacement:len());	-- year or yearmo (4 or 6 digits) zero-fill to make 14-digit timestamp&lt;br /&gt;
					url=url:gsub (&#039;(//web%.archive%.org/[^%d]*)%d[^/]*&#039;, &#039;%1&#039; .. replacement .. &#039;*&#039;, 1)	-- for preview, modify ts to 14 digits plus splat for calendar display&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		elseif not is_ts_date_valid (timestamp, 1996) then						-- is ymd portion of timestamp a valid date?&lt;br /&gt;
			err_msg = cfg.err_msg_supl.timestamp;&lt;br /&gt;
			timestamp = nil;													-- unset because invalid&lt;br /&gt;
		elseif utilities.is_set (path) and &#039;web/&#039; ~= path then					-- older archive URLs do not have the extra &#039;web/&#039; path element&lt;br /&gt;
			err_msg = cfg.err_msg_supl.path;&lt;br /&gt;
		elseif utilities.is_set (flag) and not utilities.is_set (path) then		-- flag not allowed with the old form URL (without the &#039;web/&#039; path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		elseif utilities.is_set (flag) and not flag:match (&#039;%a%a_&#039;) then		-- flag if present must be two alpha characters and underscore (requires &#039;web/&#039; path element)&lt;br /&gt;
			err_msg = cfg.err_msg_supl.flag;&lt;br /&gt;
		else&lt;br /&gt;
			return url, date, timestamp;										-- return ArchiveURL, ArchiveDate, and timestamp from |archive-url=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- if here, something not right so&lt;br /&gt;
	utilities.set_message (&#039;err_archive_url&#039;, {err_msg});						-- add error message and&lt;br /&gt;
&lt;br /&gt;
	if is_preview_mode then&lt;br /&gt;
		return url, date, timestamp;											-- preview mode so return ArchiveURL, ArchiveDate, and timestamp from |archive-url=&lt;br /&gt;
	else&lt;br /&gt;
		return &#039;&#039;, &#039;&#039;;															-- return empty strings for ArchiveURL and ArchiveDate&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; P L A C E _ C H E C K &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check |place=, |publication-place=, |location= to see if these params include digits.  This function added because&lt;br /&gt;
many editors misuse location to specify the in-source location (|page(s)= and |at= are supposed to do that)&lt;br /&gt;
&lt;br /&gt;
returns the original parameter value without modification; added maint cat when parameter value contains digits&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function place_check (param_val)&lt;br /&gt;
	if not utilities.is_set (param_val) then									-- parameter empty or omitted&lt;br /&gt;
		return param_val;														-- return that empty state&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if mw.ustring.find (param_val, &#039;%d&#039;) then									-- not empty, are there digits in the parameter value&lt;br /&gt;
		utilities.set_message (&#039;maint_location&#039;);								-- yep, add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	return param_val;															-- and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ A R C H I V E D _ C O P Y &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
compares |title= to &#039;Archived copy&#039; (placeholder added by bots that can&#039;t find proper title); if matches, return true; nil else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_archived_copy (title)&lt;br /&gt;
	title = mw.ustring.lower(title);											-- switch title to lower case&lt;br /&gt;
	if title:find (cfg.special_case_translation.archived_copy.en) then			-- if title is &#039;Archived copy&#039;&lt;br /&gt;
		return true;&lt;br /&gt;
	elseif cfg.special_case_translation.archived_copy[&#039;local&#039;] then&lt;br /&gt;
		if mw.ustring.find (title, cfg.special_case_translation.archived_copy[&#039;local&#039;]) then	-- mw.ustring() because might not be Latin script&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; D I S P L A Y _ N A M E S _ S E L E C T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
for any of the |display-authors=, |display-editors=, etc parameters, select either the local or global setting.&lt;br /&gt;
When both are present, look at &amp;lt;local_display_names&amp;gt; value.  When the value is some sort of &#039;et al.&#039;string,&lt;br /&gt;
special handling is required.&lt;br /&gt;
&lt;br /&gt;
When {{cs1 config}} has |display-&amp;lt;namelist&amp;gt;= AND this template has |display-&amp;lt;namelist&amp;gt;=etal AND:&lt;br /&gt;
	the number of names specified by &amp;lt;number_of_names&amp;gt; is:&lt;br /&gt;
		greater than the number specified in the global |display-&amp;lt;namelist&amp;gt;= parameter (&amp;lt;global_display_names&amp;gt;)&lt;br /&gt;
			use global |display-&amp;lt;namelist&amp;gt;= parameter value&lt;br /&gt;
			set overridden maint category&lt;br /&gt;
		less than or equal to the number specified in the global |display-&amp;lt;namelist&amp;gt;=  parameter&lt;br /&gt;
			use local |display-&amp;lt;namelist&amp;gt;= parameter value&lt;br /&gt;
&lt;br /&gt;
The purpose of this function is to prevent categorizing a template that has fewer names than the global setting&lt;br /&gt;
to keep the etal annotation specified by &amp;lt;local_display_names&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function display_names_select (global_display_names, local_display_names, param_name, number_of_names, test)&lt;br /&gt;
	if global_display_names and utilities.is_set (local_display_names) then		-- when both&lt;br /&gt;
		if &#039;etal&#039; == local_display_names:lower():gsub(&amp;quot;[ &#039;%.]&amp;quot;, &#039;&#039;) then		-- the :gsub() portion makes &#039;etal&#039; from a variety of &#039;et al.&#039; spellings and stylings&lt;br /&gt;
			number_of_names = tonumber (number_of_names);						-- convert these to numbers for comparison&lt;br /&gt;
			local global_display_names_num = tonumber (global_display_names);	-- &amp;lt;global_display_names&amp;gt; not set when parameter value is not digits&lt;br /&gt;
&lt;br /&gt;
			if number_of_names &amp;gt; global_display_names_num then					-- template has more names than global config allows to be displayed?&lt;br /&gt;
				utilities.set_message (&#039;maint_overridden_setting&#039;);				-- set a maint message because global is overriding local |display-&amp;lt;namelist&amp;gt;=etal&lt;br /&gt;
				return global_display_names, &#039;cs1 config&#039;;						-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
			else&lt;br /&gt;
				return local_display_names, param_name;							-- return local because fewer names so let &amp;lt;local_display_names&amp;gt; control&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
																				-- here when &amp;lt;global_display_names&amp;gt; and &amp;lt;local_display_names&amp;gt; both numbers; &amp;lt;global_display_names&amp;gt; controls&lt;br /&gt;
		utilities.set_message (&#039;maint_overridden_setting&#039;);						-- set a maint message&lt;br /&gt;
		return global_display_names, &#039;cs1 config&#039;;								-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
	end&lt;br /&gt;
																				-- here when only one of &amp;lt;global_display_names&amp;gt; or &amp;lt;local_display_names&amp;gt; set&lt;br /&gt;
	if global_display_names then&lt;br /&gt;
		return global_display_names, &#039;cs1 config&#039;;								-- return global with spoof parameter name (for get_display_names())&lt;br /&gt;
	else&lt;br /&gt;
		return local_display_names, param_name;									-- return local&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M O D E _ S E T &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
fetch global mode setting from {{cs1 config}} (if present) or from |mode= (if present); global setting overrides&lt;br /&gt;
local |mode= parameter value.  When both are present, emit maintenance message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function mode_set (Mode, Mode_origin)&lt;br /&gt;
	local mode;&lt;br /&gt;
	if cfg.global_cs1_config_t[&#039;Mode&#039;] then										-- global setting in {{cs1 config}}; nil when empty or assigned value invalid&lt;br /&gt;
		mode = is_valid_parameter_value (cfg.global_cs1_config_t[&#039;Mode&#039;], &#039;cs1 config: mode&#039;, cfg.keywords_lists[&#039;mode&#039;], &#039;&#039;);	-- error messaging &#039;param&#039; here is a hoax&lt;br /&gt;
	else&lt;br /&gt;
		mode = is_valid_parameter_value (Mode, Mode_origin, cfg.keywords_lists[&#039;mode&#039;], &#039;&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.global_cs1_config_t[&#039;Mode&#039;] and utilities.is_set (Mode) then			-- when template has |mode=&amp;lt;something&amp;gt; which global setting has overridden&lt;br /&gt;
		utilities.set_message (&#039;maint_overridden_setting&#039;);						-- set a maint message&lt;br /&gt;
	end&lt;br /&gt;
	return mode;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; Q U O T E _ M A K E &amp;gt;----------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
create quotation from |quote=, |trans-quote=, and/or script-quote= with or without |quote-page= or |quote-pages=&lt;br /&gt;
&lt;br /&gt;
when any of those three quote parameters are set, this function unsets &amp;lt;PostScript&amp;gt;.  When none of those parameters&lt;br /&gt;
are set, |quote-page= and |quote-pages= are unset to nil so that they are not included in the template&#039;s metadata&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function quote_make (quote, trans_quote, script_quote, quote_page, quote_pages, nopp, sepc, postscript)&lt;br /&gt;
	if utilities.is_set (quote) or utilities.is_set (trans_quote) or utilities.is_set (script_quote) then&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (quote) then&lt;br /&gt;
			if quote:sub(1, 1) == &#039;&amp;quot;&#039; and quote:sub(-1, -1) == &#039;&amp;quot;&#039; then			-- if first and last characters of quote are quote marks&lt;br /&gt;
				quote = quote:sub(2, -2);										-- strip them off&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		quote = kern_quotes (quote);											-- kern if needed&lt;br /&gt;
		quote = utilities.wrap_style (&#039;quoted-text&#039;, quote );					-- wrap in &amp;lt;q&amp;gt;...&amp;lt;/q&amp;gt; tags&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (script_quote) then&lt;br /&gt;
			quote = script_concatenate (quote, script_quote, &#039;script-quote&#039;);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after quote is wrapped&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (trans_quote) then&lt;br /&gt;
			if trans_quote:sub(1, 1) == &#039;&amp;quot;&#039; and trans_quote:sub(-1, -1) == &#039;&amp;quot;&#039; then -- if first and last characters of |trans-quote are quote marks&lt;br /&gt;
				trans_quote = trans_quote:sub(2, -2); -- strip them off&lt;br /&gt;
			end&lt;br /&gt;
			quote = quote .. &amp;quot; &amp;quot; .. utilities.wrap_style (&#039;trans-quoted-title&#039;, trans_quote );&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (quote_page) or utilities.is_set (quote_pages) then	-- add page prefix&lt;br /&gt;
			local quote_prefix = &#039;&#039;;&lt;br /&gt;
			if utilities.is_set (quote_page) then&lt;br /&gt;
				extra_text_in_page_check (quote_page, &#039;quote-page&#039;);			-- add to maint cat if |quote-page= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if not nopp then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, quote_page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, quote_page}), &#039;&#039;, &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (quote_pages) then&lt;br /&gt;
				extra_text_in_page_check (quote_pages, &#039;quote-pages&#039;);			-- add to maint cat if |quote-pages= value begins with what looks like p., pp., etc.&lt;br /&gt;
				if tonumber(quote_pages) ~= nil and not nopp then				-- if only digits, assume single page&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;p-prefix&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				elseif not nopp then&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;pp-prefix&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				else&lt;br /&gt;
					quote_prefix = utilities.substitute (cfg.messages[&#039;nopp&#039;], {sepc, quote_pages}), &#039;&#039;, &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
                        &lt;br /&gt;
			quote = quote_prefix .. &amp;quot;: &amp;quot; .. quote;&lt;br /&gt;
		else&lt;br /&gt;
			quote = sepc .. &amp;quot; &amp;quot; .. quote;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		postscript = &amp;quot;&amp;quot;;														-- cs1|2 does not supply terminal punctuation when |quote= is set&lt;br /&gt;
	&lt;br /&gt;
	elseif utilities.is_set (quote_page) or utilities.is_set (quote_pages) then&lt;br /&gt;
		quote_page = nil;														-- unset; these require |quote=; TODO: error message?&lt;br /&gt;
		quote_pages = nil;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return quote, quote_page, quote_pages, postscript;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C H E C K _ P U B L I S H E R _ N A M E &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for variations of &#039;&amp;lt;text&amp;gt;: &amp;lt;text&amp;gt;&#039; that might be &#039;&amp;lt;location&amp;gt;: &amp;lt;publisher&amp;gt;&#039; in |publisher= parameter value.&lt;br /&gt;
when found, emit a maintenance message; return nil else&lt;br /&gt;
&lt;br /&gt;
&amp;lt;publisher&amp;gt; is the value assigned to |publisher= or |institution=&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function check_publisher_name (publisher)&lt;br /&gt;
	local patterns_t = {&lt;br /&gt;
		&#039;^[%w%s]+%s*:%s*[%w%s]+$&#039;,												-- plain text &amp;lt;location&amp;gt;: &amp;lt;publisher&amp;gt;&lt;br /&gt;
		&#039;^%[+[%w%s:|]+%]+%s*:%s*[%w%s]+$&#039;,										-- partially wikilinked [[&amp;lt;location&amp;gt;]]: &amp;lt;publisher&amp;gt;&lt;br /&gt;
		&#039;^[%w%s]+%s*:%s*%[+[%w%s:|]+%]+$&#039;,										-- partially wikilinked &amp;lt;location&amp;gt;: [[&amp;lt;publisher&amp;gt;]]&lt;br /&gt;
		&#039;^%[+[%w%s:|]+%]+%s*:%s*%[+[%w%s:|]+%]+$&#039;,								-- wikilinked [[&amp;lt;location&amp;gt;]]: [[&amp;lt;publisher&amp;gt;]]&lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	for _, pattern in ipairs (patterns_t) do									-- spin through the patterns_t sequence&lt;br /&gt;
		if mw.ustring.match (publisher, pattern) then							-- does this pattern match?&lt;br /&gt;
			utilities.set_message (&#039;maint_publisher_location&#039;);					-- set a maint message&lt;br /&gt;
			return;																-- and done&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ P A G E _ A R T _ N U M &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
compare the trailing (rightmost) characters of the |doi= value against the whole value assigned to |page(s)=.&lt;br /&gt;
&lt;br /&gt;
return boolean true when:&lt;br /&gt;
	|page(s)= has exactly 8 digits and a dot between the fourth and fifth digits matches the trailing 9 characters&lt;br /&gt;
		of the |doi= value: |page=12345678 → |page=1234.5678 matches |doi=10.xxxx/yyyy1234.5678&lt;br /&gt;
	|page(s)= is 5 or more characters and matches |doi= values&#039;s trailing characters&lt;br /&gt;
	|page(s)= begins with a lowercase &#039;e&#039; and |page(s)= without the &#039;e&#039; matches |doi= values&#039;s trailing&lt;br /&gt;
		characters: |page=e12345 → |page=12345 matches |doi=10.xxxx/yyyy12345&lt;br /&gt;
	|page(s)= begins with a uppercase &#039;CD&#039; followed by (typically) six digits matches |doi= values that ends with&lt;br /&gt;
		&#039;CDxxxxxx.pubx&#039; (where &#039;x&#039; is any single digit)&lt;br /&gt;
&lt;br /&gt;
return nil when |page(s)= values:&lt;br /&gt;
	are ranges separated by underscore, hyphen, emdash, endash, figure dash, or minus character&lt;br /&gt;
	are comma- or semicolon-separated lists of pages&lt;br /&gt;
	have external urls (has text &#039;http&#039;)&lt;br /&gt;
	are digit-only values less than 10000&lt;br /&gt;
	do not match |doi= values&#039;s trailing characters&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_page_art_num (page, doi)&lt;br /&gt;
	if not (utilities.is_set (page) and utilities.is_set (doi)) then			-- both required&lt;br /&gt;
		return;																	-- abandon; nothing to do&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if page:match (&#039;[,;_−–—‒%-]&#039;) then											-- when |page(s)= might be a page range or a separated list of pages&lt;br /&gt;
		return;																	-- abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	page = page:lower();														-- because doi names are case insensitive&lt;br /&gt;
	doi = doi:lower();															-- force these to lowercase for testing&lt;br /&gt;
	&lt;br /&gt;
	if page:match (&#039;http&#039;) then													-- when |page(s)= appears to hold a url&lt;br /&gt;
		return;																	-- abandon&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if tonumber (page) then														-- is |page(s)= digits only&lt;br /&gt;
		if 10000 &amp;gt; tonumber (page) then											-- when |page(s)= less than 10000&lt;br /&gt;
			return;																-- abandon&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		if doi:match (page .. &#039;$&#039;) then											-- digits only page number match the last digits in |doi=?&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if 8 == page:len() then													-- special case when |page(s)= is exactly 8 digits&lt;br /&gt;
			local dot_page = page:gsub (&#039;(%d%d%d%d)(%d%d%d%d)&#039;, &#039;%1.%2&#039;);		-- make a |page=xxxx.yyyy version commonly used in |doi=&lt;br /&gt;
			if doi:match (dot_page .. &#039;$&#039;) then									-- 8-digit dotted page number match the last characters in |doi=?&lt;br /&gt;
				return true;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
	else																		-- here when |page(s)= is alpha-numeric&lt;br /&gt;
		if 4 &amp;lt; page:len() then													-- when |page(s)= is five or more characters&lt;br /&gt;
			if doi:match (page .. &#039;$&#039;) then										-- alpha-numeric page match the last characters in |doi=?&lt;br /&gt;
				return true;&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
			local epage = page:match (&#039;^e([%w]+)$&#039;);							-- if first character of |page= is &#039;e&#039;, remove it&lt;br /&gt;
			if epage and doi:match (epage .. &#039;$&#039;) then							-- page number match the last characters in |doi=?&lt;br /&gt;
				return true;&lt;br /&gt;
			end&lt;br /&gt;
	&lt;br /&gt;
			local cdpage = page:match (&#039;^cd%d+$&#039;);								-- if first characters of |page= are &#039;CD&#039; and last characters are digits (typically 6 digits)&lt;br /&gt;
			if cdpage and doi:match (cdpage .. &#039;%.pub%d$&#039;) then					-- page number matches doi &#039;CDxxxxxx.pubx&#039; where &#039;x&#039; is a digit&lt;br /&gt;
				return true;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T A T I O N 0 &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
This is the main function doing the majority of the citation formatting.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation0( config, args )&lt;br /&gt;
	--[[ &lt;br /&gt;
	Load Input Parameters&lt;br /&gt;
	The argument_wrapper facilitates the mapping of multiple aliases to single internal variable.&lt;br /&gt;
	]]&lt;br /&gt;
	local A = argument_wrapper ( args );&lt;br /&gt;
	local i &lt;br /&gt;
&lt;br /&gt;
	-- Pick out the relevant fields from the arguments.  Different citation templates&lt;br /&gt;
	-- define different field names for the same underlying things.	&lt;br /&gt;
&lt;br /&gt;
	local author_etal;&lt;br /&gt;
	local a	= {};																-- authors list from |lastn= / |firstn= pairs or |vauthors=&lt;br /&gt;
	local Authors;&lt;br /&gt;
	local NameListStyle;&lt;br /&gt;
		if cfg.global_cs1_config_t[&#039;NameListStyle&#039;] then						-- global setting in {{cs1 config}} overrides local |name-list-style= parameter value; nil when empty or assigned value invalid&lt;br /&gt;
			NameListStyle = is_valid_parameter_value (cfg.global_cs1_config_t[&#039;NameListStyle&#039;], &#039;cs1 config: name-list-style&#039;, cfg.keywords_lists[&#039;name-list-style&#039;], &#039;&#039;);	-- error messaging &#039;param&#039; here is a hoax&lt;br /&gt;
		else&lt;br /&gt;
			NameListStyle = is_valid_parameter_value (A[&#039;NameListStyle&#039;], A:ORIGIN(&#039;NameListStyle&#039;), cfg.keywords_lists[&#039;name-list-style&#039;], &#039;&#039;);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if cfg.global_cs1_config_t[&#039;NameListStyle&#039;] and utilities.is_set (A[&#039;NameListStyle&#039;]) then	-- when template has |name-list-style=&amp;lt;something&amp;gt; which global setting has overridden&lt;br /&gt;
			utilities.set_message (&#039;maint_overridden_setting&#039;);					-- set a maint message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	local Collaboration = A[&#039;Collaboration&#039;];&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A[&#039;Vauthors&#039;], A[&#039;Authors&#039;], args, &#039;AuthorList&#039;);&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			a, author_etal = extract_names (args, &#039;AuthorList&#039;);				-- fetch author list from |authorn= / |lastn= / |firstn=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = &#039;vanc&#039;;												-- override whatever |name-list-style= might be&lt;br /&gt;
			a, author_etal = parse_vauthors_veditors (args, A[&#039;Vauthors&#039;], &#039;AuthorList&#039;);	-- fetch author list from |vauthors=, |author-linkn=, and |author-maskn=&lt;br /&gt;
		elseif 3 == selected then&lt;br /&gt;
			Authors = A[&#039;Authors&#039;];												-- use content of |people= or |credits=; |authors= is deprecated; TODO: constrain |people= and |credits= to cite av media, episode, serial?&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Collaboration) then&lt;br /&gt;
			author_etal = true;													-- so that |display-authors=etal not required&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local editor_etal;&lt;br /&gt;
	local e	= {};																-- editors list from |editor-lastn= / |editor-firstn= pairs or |veditors=&lt;br /&gt;
&lt;br /&gt;
	do																			-- to limit scope of selected&lt;br /&gt;
		local selected = select_author_editor_source (A[&#039;Veditors&#039;], nil, args, &#039;EditorList&#039;);	-- support for |editors= withdrawn&lt;br /&gt;
		if 1 == selected then&lt;br /&gt;
			e, editor_etal = extract_names (args, &#039;EditorList&#039;);				-- fetch editor list from |editorn= / |editor-lastn= / |editor-firstn=, |editor-linkn=, and |editor-maskn=&lt;br /&gt;
		elseif 2 == selected then&lt;br /&gt;
			NameListStyle = &#039;vanc&#039;;												-- override whatever |name-list-style= might be&lt;br /&gt;
			e, editor_etal = parse_vauthors_veditors (args, args.veditors, &#039;EditorList&#039;);	-- fetch editor list from |veditors=, |editor-linkn=, and |editor-maskn=&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
							&lt;br /&gt;
	local Chapter = A[&#039;Chapter&#039;];												-- done here so that we have access to |contribution= from |chapter= and |script-chapter= aliases&lt;br /&gt;
	local Chapter_origin = A:ORIGIN (&#039;Chapter&#039;);&lt;br /&gt;
	local ScriptChapter = A[&#039;ScriptChapter&#039;];&lt;br /&gt;
	local ScriptChapter_origin = A:ORIGIN (&#039;ScriptChapter&#039;);&lt;br /&gt;
&lt;br /&gt;
	local Contribution;															-- because contribution is required for contributor(s)&lt;br /&gt;
	if &#039;contribution&#039; == Chapter_origin then									-- is there a |contribution= parameter?&lt;br /&gt;
		Contribution = Chapter;													-- get the name of the contribution&lt;br /&gt;
	elseif &#039;script-contribution&#039; == ScriptChapter_origin then					-- no, so is there a |script-contribution= parameter?&lt;br /&gt;
		Contribution = ScriptChapter;											-- get the name of the contribution&lt;br /&gt;
	end&lt;br /&gt;
	local c = {};																-- contributors list from |contributor-lastn= / contributor-firstn= pairs&lt;br /&gt;
	&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&amp;quot;book&amp;quot;, &amp;quot;citation&amp;quot;}) and not utilities.is_set (A[&#039;Periodical&#039;]) then	-- |contributor= and |contribution= only supported in book cites&lt;br /&gt;
		c = extract_names (args, &#039;ContributorList&#039;);							-- fetch contributor list from |contributorn= / |contributor-lastn=, -firstn=, -linkn=, -maskn=&lt;br /&gt;
		&lt;br /&gt;
		if 0 &amp;lt; #c then&lt;br /&gt;
			if not utilities.is_set (Contribution) then							-- |contributor= requires |contribution=&lt;br /&gt;
				utilities.set_message (&#039;err_contributor_missing_required_param&#039;, &#039;contribution&#039;);	-- add missing contribution error message&lt;br /&gt;
				c = {};															-- blank the contributors&#039; table; it is used as a flag later&lt;br /&gt;
			end&lt;br /&gt;
			if 0 == #a then														-- |contributor= requires |author=&lt;br /&gt;
				utilities.set_message (&#039;err_contributor_missing_required_param&#039;, &#039;author&#039;);	-- add missing author error message&lt;br /&gt;
				c = {};															-- blank the contributors&#039; table; it is used as a flag later&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else																		-- if not a book cite&lt;br /&gt;
		if utilities.select_one (args, cfg.aliases[&#039;ContributorList-Last&#039;], &#039;err_redundant_parameters&#039;, 1 ) then	-- are there contributor name list parameters?&lt;br /&gt;
			utilities.set_message (&#039;err_contributor_ignored&#039;);					-- add contributor ignored error message&lt;br /&gt;
		end&lt;br /&gt;
		Contribution = nil;														-- unset&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Title = A[&#039;Title&#039;];&lt;br /&gt;
	local TitleLink = A[&#039;TitleLink&#039;];&lt;br /&gt;
&lt;br /&gt;
	local auto_select = &#039;&#039;;														-- default is auto&lt;br /&gt;
	local accept_link;&lt;br /&gt;
	TitleLink, accept_link = utilities.has_accept_as_written (TitleLink, true);	-- test for accept-this-as-written markup&lt;br /&gt;
	if (not accept_link) and utilities.in_array (TitleLink, {&#039;none&#039;, &#039;pmc&#039;, &#039;doi&#039;}) then -- check for special keywords&lt;br /&gt;
		auto_select = TitleLink;												-- remember selection for later&lt;br /&gt;
		TitleLink = &#039;&#039;;															-- treat as if |title-link= would have been empty&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	TitleLink = link_title_ok (TitleLink, A:ORIGIN (&#039;TitleLink&#039;), Title, &#039;title&#039;);	-- check for wiki-markup in |title-link= or wiki-markup in |title= when |title-link= is set&lt;br /&gt;
&lt;br /&gt;
	local Section = &#039;&#039;;															-- {{cite map}} only; preset to empty string for concatenation if not used&lt;br /&gt;
	if &#039;map&#039; == config.CitationClass and &#039;section&#039; == Chapter_origin then&lt;br /&gt;
		Section = A[&#039;Chapter&#039;];													-- get |section= from |chapter= alias list; |chapter= and the other aliases not supported in {{cite map}}&lt;br /&gt;
		Chapter = &#039;&#039;;															-- unset for now; will be reset later from |map= if present&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Periodical = A[&#039;Periodical&#039;];&lt;br /&gt;
	local Periodical_origin = A:ORIGIN(&#039;Periodical&#039;);&lt;br /&gt;
	local ScriptPeriodical = A[&#039;ScriptPeriodical&#039;];&lt;br /&gt;
	local ScriptPeriodical_origin = A:ORIGIN(&#039;ScriptPeriodical&#039;);&lt;br /&gt;
	local TransPeriodical =  A[&#039;TransPeriodical&#039;];&lt;br /&gt;
	local TransPeriodical_origin =  A:ORIGIN (&#039;TransPeriodical&#039;);&lt;br /&gt;
	&lt;br /&gt;
	if (utilities.in_array (config.CitationClass, {&#039;book&#039;, &#039;encyclopaedia&#039;}) and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical))) then&lt;br /&gt;
		local param;&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- get a parameter name from one of these periodical related meta-parameters&lt;br /&gt;
			Periodical = &#039;&#039;;													-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = Periodical_origin											-- get parameter name for error messaging&lt;br /&gt;
		elseif utilities.is_set (TransPeriodical) then&lt;br /&gt;
			TransPeriodical = &#039;&#039;;												-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = TransPeriodical_origin;										-- get parameter name for error messaging&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			ScriptPeriodical = &#039;&#039;;												-- unset because not valid {{cite book}} or {{cite encyclopedia}} parameters &lt;br /&gt;
			param = ScriptPeriodical_origin;									-- get parameter name for error messaging&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (param) then										-- if we found one&lt;br /&gt;
			utilities.set_message (&#039;err_periodical_ignored&#039;, {param});			-- emit an error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Periodical) then&lt;br /&gt;
		local i;&lt;br /&gt;
		Periodical, i = utilities.strip_apostrophe_markup (Periodical);			-- strip apostrophe markup so that metadata isn&#039;t contaminated &lt;br /&gt;
		if i then																-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message (&#039;err_apostrophe_markup&#039;, {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;mailinglist&#039; == config.CitationClass then								-- special case for {{cite mailing list}}&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (A [&#039;MailingList&#039;]) then	-- both set emit an error TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, Periodical_origin) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;mailinglist&#039;)});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = A [&#039;MailingList&#039;];											-- error or no, set Periodical to |mailinglist= value because this template is {{cite mailing list}}&lt;br /&gt;
		Periodical_origin = A:ORIGIN(&#039;MailingList&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- web and news not tested for now because of &lt;br /&gt;
	-- Wikipedia:Administrators%27_noticeboard#Is_there_a_semi-automated_tool_that_could_fix_these_annoying_&amp;quot;Cite_Web&amp;quot;_errors?&lt;br /&gt;
	if not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) then	-- &#039;periodical&#039; templates require periodical parameter&lt;br /&gt;
	--	local p = {[&#039;journal&#039;] = &#039;journal&#039;, [&#039;magazine&#039;] = &#039;magazine&#039;, [&#039;news&#039;] = &#039;newspaper&#039;, [&#039;web&#039;] = &#039;website&#039;};	-- for error message&lt;br /&gt;
		local p = {[&#039;journal&#039;] = &#039;journal&#039;, [&#039;magazine&#039;] = &#039;magazine&#039;};			-- for error message&lt;br /&gt;
		if p[config.CitationClass]  then&lt;br /&gt;
			utilities.set_message (&#039;err_missing_periodical&#039;, {config.CitationClass, p[config.CitationClass]});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Volume;&lt;br /&gt;
	if &#039;citation&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (Periodical) then&lt;br /&gt;
			if not utilities.in_array (Periodical_origin, cfg.citation_no_volume_t) then	-- {{citation}} does not render |volume= when these parameters are used&lt;br /&gt;
				Volume = A[&#039;Volume&#039;];											-- but does for all other &#039;periodicals&#039;&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (ScriptPeriodical) then&lt;br /&gt;
			if &#039;script-website&#039; ~= ScriptPeriodical_origin then					-- {{citation}} does not render volume for |script-website=&lt;br /&gt;
				Volume = A[&#039;Volume&#039;];											-- but does for all other &#039;periodicals&#039;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			Volume = A[&#039;Volume&#039;];												-- and does for non-&#039;periodical&#039; cites&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.in_array (config.CitationClass, cfg.templates_using_volume) then	-- render |volume= for cs1 according to the configuration settings&lt;br /&gt;
		Volume = A[&#039;Volume&#039;];&lt;br /&gt;
	end	&lt;br /&gt;
	extra_text_in_vol_iss_check (Volume, A:ORIGIN (&#039;Volume&#039;), &#039;v&#039;);&lt;br /&gt;
&lt;br /&gt;
	local Issue;&lt;br /&gt;
	if &#039;citation&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.in_array (Periodical_origin, cfg.citation_issue_t) then	-- {{citation}} may render |issue= when these parameters are used&lt;br /&gt;
			Issue =  A[&#039;Issue&#039;];&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.in_array (config.CitationClass, cfg.templates_using_issue) then	-- conference &amp;amp; map books do not support issue; {{citation}} listed here because included in settings table&lt;br /&gt;
		if not (utilities.in_array (config.CitationClass, {&#039;conference&#039;, &#039;map&#039;, &#039;citation&#039;}) and not (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical))) then&lt;br /&gt;
			Issue =  A[&#039;Issue&#039;];&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ArticleNumber;&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;journal&#039;, &#039;conference&#039;}) or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Periodical) and &#039;journal&#039; == Periodical_origin) then&lt;br /&gt;
		ArticleNumber = A[&#039;ArticleNumber&#039;];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	extra_text_in_vol_iss_check (Issue, A:ORIGIN (&#039;Issue&#039;), &#039;i&#039;);&lt;br /&gt;
	Issue = utilities.hyphen_to_dash (Issue);&lt;br /&gt;
&lt;br /&gt;
	local Page;&lt;br /&gt;
	local Pages;&lt;br /&gt;
	local At;&lt;br /&gt;
	local QuotePage;&lt;br /&gt;
	local QuotePages;&lt;br /&gt;
	if not utilities.in_array (config.CitationClass, cfg.templates_not_using_page) then		-- TODO: rewrite to emit ignored parameter error message?&lt;br /&gt;
		Page = A[&#039;Page&#039;];&lt;br /&gt;
		Pages = utilities.hyphen_to_dash (A[&#039;Pages&#039;]);	&lt;br /&gt;
		At = A[&#039;At&#039;];&lt;br /&gt;
		QuotePage = A[&#039;QuotePage&#039;];&lt;br /&gt;
		QuotePages = utilities.hyphen_to_dash (A[&#039;QuotePages&#039;]);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local NoPP = is_valid_parameter_value (A[&#039;NoPP&#039;], A:ORIGIN(&#039;NoPP&#039;), cfg.keywords_lists[&#039;yes_true_y&#039;], nil);&lt;br /&gt;
&lt;br /&gt;
	local Mode = mode_set (A[&#039;Mode&#039;], A:ORIGIN(&#039;Mode&#039;));&lt;br /&gt;
&lt;br /&gt;
	-- separator character and postscript&lt;br /&gt;
	local sepc, PostScript = set_style (Mode:lower(), A[&#039;PostScript&#039;], config.CitationClass);&lt;br /&gt;
	local Quote;&lt;br /&gt;
	Quote, QuotePage, QuotePages, PostScript = quote_make (A[&#039;Quote&#039;], A[&#039;TransQuote&#039;], A[&#039;ScriptQuote&#039;], QuotePage, QuotePages, NoPP, sepc, PostScript);&lt;br /&gt;
&lt;br /&gt;
	local Edition = A[&#039;Edition&#039;];&lt;br /&gt;
	local PublicationPlace = place_check (A[&#039;PublicationPlace&#039;], A:ORIGIN(&#039;PublicationPlace&#039;));&lt;br /&gt;
	local Place = place_check (A[&#039;Place&#039;], A:ORIGIN(&#039;Place&#039;));&lt;br /&gt;
	&lt;br /&gt;
	local PublisherName = A[&#039;PublisherName&#039;];&lt;br /&gt;
	local PublisherName_origin = A:ORIGIN(&#039;PublisherName&#039;);&lt;br /&gt;
	if utilities.is_set (PublisherName) and (cfg.keywords_xlate[&#039;none&#039;] ~= PublisherName) then&lt;br /&gt;
		local i = 0;&lt;br /&gt;
		PublisherName, i = utilities.strip_apostrophe_markup (PublisherName);	-- strip apostrophe markup so that metadata isn&#039;t contaminated; publisher is never italicized&lt;br /&gt;
		if i and (0 &amp;lt; i) then													-- non-zero when markup was stripped so emit an error message&lt;br /&gt;
			utilities.set_message (&#039;err_apostrophe_markup&#039;, {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if (&#039;document&#039; == config.CitationClass) and not utilities.is_set (PublisherName) then&lt;br /&gt;
		utilities.set_message (&#039;err_missing_publisher&#039;, {config.CitationClass, &#039;publisher&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Newsgroup = A[&#039;Newsgroup&#039;];											-- TODO: strip apostrophe markup?&lt;br /&gt;
	local Newsgroup_origin = A:ORIGIN(&#039;Newsgroup&#039;);	&lt;br /&gt;
&lt;br /&gt;
	if &#039;newsgroup&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (PublisherName) and (cfg.keywords_xlate[&#039;none&#039;] ~= PublisherName) then	-- general use parameter |publisher= not allowed in cite newsgroup&lt;br /&gt;
			utilities.set_message (&#039;err_parameter_ignored&#039;, {PublisherName_origin});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		PublisherName = nil;													-- ensure that this parameter is unset for the time being; will be used again after COinS&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;book&#039; == config.CitationClass or &#039;encyclopaedia&#039; == config.CitationClass or (&#039;citation&#039; == config.CitationClass and not utilities.is_set (Periodical)) then&lt;br /&gt;
		local accept;&lt;br /&gt;
		PublisherName, accept = utilities.has_accept_as_written (PublisherName);	-- check for and remove accept-as-written markup from |publisher= wrapped&lt;br /&gt;
		if not accept then														-- when no accept-as-written markup&lt;br /&gt;
			check_publisher_name (PublisherName);								-- emit maint message when |publisher= might be prefixed with publisher&#039;s location&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local URL = A[&#039;URL&#039;];														-- TODO: better way to do this for URL, ChapterURL, and MapURL?&lt;br /&gt;
	local UrlAccess = is_valid_parameter_value (A[&#039;UrlAccess&#039;], A:ORIGIN(&#039;UrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	&lt;br /&gt;
	if not utilities.is_set (URL) and utilities.is_set (UrlAccess) then&lt;br /&gt;
		UrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, &#039;url&#039;);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local ChapterURL = A[&#039;ChapterURL&#039;];&lt;br /&gt;
	local ChapterUrlAccess = is_valid_parameter_value (A[&#039;ChapterUrlAccess&#039;], A:ORIGIN(&#039;ChapterUrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	if not utilities.is_set (ChapterURL) and utilities.is_set (ChapterUrlAccess) then&lt;br /&gt;
		ChapterUrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, {A:ORIGIN(&#039;ChapterUrlAccess&#039;):gsub (&#039;%-access&#039;, &#039;&#039;)});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local MapUrlAccess = is_valid_parameter_value (A[&#039;MapUrlAccess&#039;], A:ORIGIN(&#039;MapUrlAccess&#039;), cfg.keywords_lists[&#039;url-access&#039;], nil);&lt;br /&gt;
	if not utilities.is_set (A[&#039;MapURL&#039;]) and utilities.is_set (MapUrlAccess) then&lt;br /&gt;
		MapUrlAccess = nil;&lt;br /&gt;
		utilities.set_message (&#039;err_param_access_requires_param&#039;, {&#039;map-url&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local this_page = mw.title.getCurrentTitle();								-- also used for COinS and for language&lt;br /&gt;
	local no_tracking_cats = is_valid_parameter_value (A[&#039;NoTracking&#039;], A:ORIGIN(&#039;NoTracking&#039;), cfg.keywords_lists[&#039;yes_true_y&#039;], nil);&lt;br /&gt;
&lt;br /&gt;
	-- check this page to see if it is in one of the namespaces that cs1 is not supposed to add to the error categories&lt;br /&gt;
	if not utilities.is_set (no_tracking_cats) then								-- ignore if we are already not going to categorize this page&lt;br /&gt;
		if cfg.uncategorized_namespaces[this_page.namespace] then				-- is this page&#039;s namespace id one of the uncategorized namespace ids?&lt;br /&gt;
			no_tracking_cats = &amp;quot;true&amp;quot;;											-- set no_tracking_cats&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (cfg.uncategorized_subpages) do						-- cycle through page name patterns&lt;br /&gt;
			if this_page.text:match (v) then									-- test page name against each pattern&lt;br /&gt;
				no_tracking_cats = &amp;quot;true&amp;quot;;										-- set no_tracking_cats&lt;br /&gt;
				break;															-- bail out if one is found&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
																				-- check for extra |page=, |pages= or |at= parameters. (also sheet and sheets while we&#039;re at it)&lt;br /&gt;
	utilities.select_one (args, {&#039;page&#039;, &#039;p&#039;, &#039;pp&#039;, &#039;pages&#039;, &#039;at&#039;, &#039;sheet&#039;, &#039;sheets&#039;}, &#039;err_redundant_parameters&#039;);	-- this is a dummy call simply to get the error message and category&lt;br /&gt;
&lt;br /&gt;
	local coins_pages;&lt;br /&gt;
	&lt;br /&gt;
	Page, Pages, At, coins_pages = insource_loc_get (Page, A:ORIGIN(&#039;Page&#039;), Pages, A:ORIGIN(&#039;Pages&#039;), At);&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (PublicationPlace) and utilities.is_set (Place) then	-- both |publication-place= and |place= (|location=) allowed if different&lt;br /&gt;
		utilities.add_prop_cat (&#039;location-test&#039;);								-- add property cat to evaluate how often PublicationPlace and Place are used together&lt;br /&gt;
		if PublicationPlace == Place then&lt;br /&gt;
			Place = &#039;&#039;;															-- unset; don&#039;t need both if they are the same&lt;br /&gt;
		end&lt;br /&gt;
	elseif not utilities.is_set (PublicationPlace) and utilities.is_set (Place) then	-- when only |place= (|location=) is set ...&lt;br /&gt;
		PublicationPlace = Place;												-- promote |place= (|location=) to |publication-place&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationPlace == Place then Place = &#039;&#039;; end							-- don&#039;t need both if they are the same&lt;br /&gt;
&lt;br /&gt;
	local URL_origin = A:ORIGIN(&#039;URL&#039;);											-- get name of parameter that holds URL&lt;br /&gt;
	local ChapterURL_origin = A:ORIGIN(&#039;ChapterURL&#039;);							-- get name of parameter that holds ChapterURL&lt;br /&gt;
--	local ScriptChapter = A[&#039;ScriptChapter&#039;];&lt;br /&gt;
--	local ScriptChapter_origin = A:ORIGIN (&#039;ScriptChapter&#039;);&lt;br /&gt;
	local Format = A[&#039;Format&#039;];&lt;br /&gt;
	local ChapterFormat = A[&#039;ChapterFormat&#039;];&lt;br /&gt;
	local TransChapter = A[&#039;TransChapter&#039;];&lt;br /&gt;
	local TransChapter_origin = A:ORIGIN (&#039;TransChapter&#039;);&lt;br /&gt;
	local TransTitle = A[&#039;TransTitle&#039;];&lt;br /&gt;
	local ScriptTitle = A[&#039;ScriptTitle&#039;];&lt;br /&gt;
	&lt;br /&gt;
	--[[&lt;br /&gt;
	Parameter remapping for cite encyclopedia:&lt;br /&gt;
	When the citation has these parameters:&lt;br /&gt;
		|encyclopedia= and |title= then map |title= to |article= and |encyclopedia= to |title= for rendering&lt;br /&gt;
		|encyclopedia= and |article= then map |encyclopedia= to |title= for rendering&lt;br /&gt;
&lt;br /&gt;
		|trans-title= maps to |trans-chapter= when |title= is re-mapped&lt;br /&gt;
		|url= maps to |chapter-url= when |title= is remapped&lt;br /&gt;
	&lt;br /&gt;
	All other combinations of |encyclopedia=, |title=, and |article= are not modified&lt;br /&gt;
	&lt;br /&gt;
	]]&lt;br /&gt;
&lt;br /&gt;
	local Encyclopedia = A[&#039;Encyclopedia&#039;];										-- used as a flag by this module and by ~/COinS&lt;br /&gt;
	local ScriptEncyclopedia = A[&#039;ScriptEncyclopedia&#039;];&lt;br /&gt;
	local TransEncyclopedia = A[&#039;TransEncyclopedia&#039;];&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then	-- emit error message when Encyclopedia set but template is other than {{cite encyclopedia}} or {{citation}}&lt;br /&gt;
		if &#039;encyclopaedia&#039; ~= config.CitationClass and &#039;citation&#039; ~= config.CitationClass then&lt;br /&gt;
			if utilities.is_set (Encyclopedia) then&lt;br /&gt;
				utilities.set_message (&#039;err_parameter_ignored&#039;, {A:ORIGIN (&#039;Encyclopedia&#039;)});&lt;br /&gt;
			else&lt;br /&gt;
				utilities.set_message (&#039;err_parameter_ignored&#039;, {A:ORIGIN (&#039;ScriptEncyclopedia&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
			Encyclopedia = nil;													-- unset these because not supported by this template&lt;br /&gt;
			ScriptEncyclopedia = nil;&lt;br /&gt;
			TransEncyclopedia = nil;&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (TransEncyclopedia) then&lt;br /&gt;
		utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;encyclopedia&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (&#039;encyclopaedia&#039; == config.CitationClass) or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Periodical) and utilities.is_set (Encyclopedia) then	-- when both parameters set emit an error message; {{citation}} only; Periodical not allowed in {{cite encyclopedia}}&lt;br /&gt;
			utilities.set_message (&#039;err_periodical_ignored&#039;, {Periodical_origin});&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Encyclopedia) or utilities.is_set (ScriptEncyclopedia) then&lt;br /&gt;
			Periodical = Encyclopedia;											-- error or no, set Periodical to Encyclopedia for rendering; {{citation}} could (not legitimately) have both; use Encyclopedia&lt;br /&gt;
			Periodical_origin = A:ORIGIN (&#039;Encyclopedia&#039;);&lt;br /&gt;
			ScriptPeriodical = ScriptEncyclopedia;&lt;br /&gt;
			ScriptPeriodical_origin = A:ORIGIN (&#039;ScriptEncyclopedia&#039;);&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (Title) or utilities.is_set (ScriptTitle) then&lt;br /&gt;
				if not utilities.is_set (Chapter) then&lt;br /&gt;
					Chapter = Title;											-- |encyclopedia= and |title= are set so map |title= params to |article= params for rendering&lt;br /&gt;
					ScriptChapter = ScriptTitle;&lt;br /&gt;
					ScriptChapter_origin = A:ORIGIN(&#039;ScriptTitle&#039;)&lt;br /&gt;
					TransChapter = TransTitle;&lt;br /&gt;
					ChapterURL = URL;&lt;br /&gt;
					ChapterURL_origin = URL_origin;&lt;br /&gt;
					ChapterUrlAccess = UrlAccess;&lt;br /&gt;
					ChapterFormat = Format;&lt;br /&gt;
&lt;br /&gt;
					if not utilities.is_set (ChapterURL) and utilities.is_set (TitleLink) then&lt;br /&gt;
						Chapter = utilities.make_wikilink (TitleLink, Chapter);&lt;br /&gt;
					end&lt;br /&gt;
					Title = Periodical;											-- now map |encyclopedia= params to |title= params for rendering&lt;br /&gt;
					ScriptTitle = ScriptPeriodical or &#039;&#039;;&lt;br /&gt;
					TransTitle = TransEncyclopedia or &#039;&#039;;&lt;br /&gt;
					Periodical = &#039;&#039;;											-- redundant so unset&lt;br /&gt;
					ScriptPeriodical = &#039;&#039;;&lt;br /&gt;
					URL = &#039;&#039;;&lt;br /&gt;
					Format = &#039;&#039;;&lt;br /&gt;
					TitleLink = &#039;&#039;;&lt;br /&gt;
				end&lt;br /&gt;
			elseif utilities.is_set (Chapter) or utilities.is_set (ScriptChapter) then	-- |title= not set&lt;br /&gt;
				Title = Periodical;												-- |encyclopedia= set and |article= set so map |encyclopedia= to |title= for rendering&lt;br /&gt;
				ScriptTitle = ScriptPeriodical or &#039;&#039;;&lt;br /&gt;
				TransTitle = TransEncyclopedia or &#039;&#039;;&lt;br /&gt;
				Periodical = &#039;&#039;;												-- redundant so unset&lt;br /&gt;
				ScriptPeriodical = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- special case for cite techreport.&lt;br /&gt;
	local ID = A[&#039;ID&#039;];&lt;br /&gt;
	if (config.CitationClass == &amp;quot;techreport&amp;quot;) then								-- special case for cite techreport&lt;br /&gt;
		if utilities.is_set (A[&#039;Number&#039;]) then									-- cite techreport uses &#039;number&#039;, which other citations alias to &#039;issue&#039;&lt;br /&gt;
			if not utilities.is_set (ID) then									-- can we use ID for the &amp;quot;number&amp;quot;?&lt;br /&gt;
				ID = A[&#039;Number&#039;];												-- yes, use it&lt;br /&gt;
			else																-- ID has a value so emit error message&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;id&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;number&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddity that is {{cite conference}}, before generation of COinS data.&lt;br /&gt;
	local ChapterLink -- = A[&#039;ChapterLink&#039;];									-- deprecated as a parameter but still used internally by cite episode&lt;br /&gt;
	local Conference = A[&#039;Conference&#039;];&lt;br /&gt;
	local BookTitle = A[&#039;BookTitle&#039;];&lt;br /&gt;
	local TransTitle_origin = A:ORIGIN (&#039;TransTitle&#039;);&lt;br /&gt;
	if &#039;conference&#039; == config.CitationClass then&lt;br /&gt;
		if utilities.is_set (BookTitle) then&lt;br /&gt;
			Chapter = Title;&lt;br /&gt;
			Chapter_origin = &#039;title&#039;;&lt;br /&gt;
	--		ChapterLink = TitleLink;											-- |chapter-link= is deprecated&lt;br /&gt;
			ChapterURL = URL;&lt;br /&gt;
			ChapterUrlAccess = UrlAccess;&lt;br /&gt;
			ChapterURL_origin = URL_origin;&lt;br /&gt;
			URL_origin = &#039;&#039;;&lt;br /&gt;
			ChapterFormat = Format;&lt;br /&gt;
			TransChapter = TransTitle;&lt;br /&gt;
			TransChapter_origin = TransTitle_origin;&lt;br /&gt;
			Title = BookTitle;&lt;br /&gt;
			Format = &#039;&#039;;&lt;br /&gt;
	--		TitleLink = &#039;&#039;;&lt;br /&gt;
			TransTitle = &#039;&#039;;&lt;br /&gt;
			URL = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	elseif &#039;speech&#039; ~= config.CitationClass then&lt;br /&gt;
		Conference = &#039;&#039;;														-- not cite conference or cite speech so make sure this is empty string&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local cs2_lower = function (text)											-- if mode is cs2, use lower case&lt;br /&gt;
		if (sepc ~= &#039;.&#039;) then&lt;br /&gt;
			return text:lower();&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		return text;&lt;br /&gt;
	end&lt;br /&gt;
	local use_lowercase = ( sepc == &#039;,&#039; );										-- controls capitalization of certain static text&lt;br /&gt;
	&lt;br /&gt;
	-- cite map oddities&lt;br /&gt;
	local Cartography = &amp;quot;&amp;quot;;&lt;br /&gt;
	local Scale = &amp;quot;&amp;quot;;&lt;br /&gt;
	local Sheet = A[&#039;Sheet&#039;] or &#039;&#039;;&lt;br /&gt;
	local Sheets = A[&#039;Sheets&#039;] or &#039;&#039;;&lt;br /&gt;
	if config.CitationClass == &amp;quot;map&amp;quot; then&lt;br /&gt;
		if utilities.is_set (Chapter) then										--TODO: make a function for this and similar?&lt;br /&gt;
			utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;map&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, Chapter_origin)});	-- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Chapter = A[&#039;Map&#039;];&lt;br /&gt;
		Chapter_origin = A:ORIGIN(&#039;Map&#039;);&lt;br /&gt;
		ChapterURL = A[&#039;MapURL&#039;];&lt;br /&gt;
		ChapterURL_origin = A:ORIGIN(&#039;MapURL&#039;);&lt;br /&gt;
		TransChapter = A[&#039;TransMap&#039;];&lt;br /&gt;
		ScriptChapter = A[&#039;ScriptMap&#039;]&lt;br /&gt;
		ScriptChapter_origin = A:ORIGIN(&#039;ScriptMap&#039;)&lt;br /&gt;
&lt;br /&gt;
		ChapterUrlAccess = MapUrlAccess;&lt;br /&gt;
		ChapterFormat = A[&#039;MapFormat&#039;];&lt;br /&gt;
&lt;br /&gt;
		Cartography = A[&#039;Cartography&#039;];&lt;br /&gt;
		if utilities.is_set ( Cartography ) then&lt;br /&gt;
			Cartography = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;cartography&#039;, Cartography, use_lowercase);&lt;br /&gt;
		end		&lt;br /&gt;
		Scale = A[&#039;Scale&#039;];&lt;br /&gt;
		if utilities.is_set ( Scale ) then&lt;br /&gt;
			Scale = sepc .. &amp;quot; &amp;quot; .. Scale;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite episode}} and {{cite serial}}, before generation of COinS data.&lt;br /&gt;
	local Series = A[&#039;Series&#039;];&lt;br /&gt;
	if &#039;episode&#039; == config.CitationClass or &#039;serial&#039; == config.CitationClass then&lt;br /&gt;
		local SeriesLink = A[&#039;SeriesLink&#039;];&lt;br /&gt;
&lt;br /&gt;
		SeriesLink = link_title_ok (SeriesLink, A:ORIGIN (&#039;SeriesLink&#039;), Series, &#039;series&#039;);	-- check for wiki-markup in |series-link= or wiki-markup in |series= when |series-link= is set&lt;br /&gt;
&lt;br /&gt;
		local Network = A[&#039;Network&#039;];&lt;br /&gt;
		local Station = A[&#039;Station&#039;];&lt;br /&gt;
		local s, n = {}, {};&lt;br /&gt;
																				-- do common parameters first&lt;br /&gt;
		if utilities.is_set (Network) then table.insert(n, Network); end&lt;br /&gt;
		if utilities.is_set (Station) then table.insert(n, Station); end&lt;br /&gt;
		ID = table.concat(n, sepc .. &#039; &#039;);&lt;br /&gt;
		&lt;br /&gt;
		if &#039;episode&#039; == config.CitationClass then								-- handle the oddities that are strictly {{cite episode}}&lt;br /&gt;
			local Season = A[&#039;Season&#039;];&lt;br /&gt;
			local SeriesNumber = A[&#039;SeriesNumber&#039;];&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (Season) and utilities.is_set (SeriesNumber) then	-- these are mutually exclusive so if both are set TODO: make a function for this and similar?&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;season&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;seriesno&#039;)});		-- add error message&lt;br /&gt;
				SeriesNumber = &#039;&#039;;												-- unset; prefer |season= over |seriesno=&lt;br /&gt;
			end&lt;br /&gt;
																				-- assemble a table of parts concatenated later into Series&lt;br /&gt;
			if utilities.is_set (Season) then table.insert(s, wrap_msg (&#039;season&#039;, Season, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (SeriesNumber) then table.insert(s, wrap_msg (&#039;seriesnum&#039;, SeriesNumber, use_lowercase)); end&lt;br /&gt;
			if utilities.is_set (Issue) then table.insert(s, wrap_msg (&#039;episode&#039;, Issue, use_lowercase)); end&lt;br /&gt;
			Issue = &#039;&#039;;															-- unset because this is not a unique parameter&lt;br /&gt;
	&lt;br /&gt;
			Chapter = Title;													-- promote title parameters to chapter&lt;br /&gt;
			ScriptChapter = ScriptTitle;&lt;br /&gt;
			ScriptChapter_origin = A:ORIGIN(&#039;ScriptTitle&#039;);&lt;br /&gt;
			ChapterLink = TitleLink;											-- alias |episode-link=&lt;br /&gt;
			TransChapter = TransTitle;&lt;br /&gt;
			ChapterURL = URL;&lt;br /&gt;
			ChapterUrlAccess = UrlAccess;&lt;br /&gt;
			ChapterURL_origin = URL_origin;&lt;br /&gt;
			ChapterFormat = Format;&lt;br /&gt;
&lt;br /&gt;
			Title = Series;														-- promote series to title&lt;br /&gt;
			TitleLink = SeriesLink;&lt;br /&gt;
			Series = table.concat(s, sepc .. &#039; &#039;);								-- this is concatenation of season, seriesno, episode number&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (ChapterLink) and not utilities.is_set (ChapterURL) then	-- link but not URL&lt;br /&gt;
				Chapter = utilities.make_wikilink (ChapterLink, Chapter);&lt;br /&gt;
			elseif utilities.is_set (ChapterLink) and utilities.is_set (ChapterURL) then	-- if both are set, URL links episode;&lt;br /&gt;
				Series = utilities.make_wikilink (ChapterLink, Series);&lt;br /&gt;
			end&lt;br /&gt;
			URL = &#039;&#039;;															-- unset&lt;br /&gt;
			TransTitle = &#039;&#039;;&lt;br /&gt;
			ScriptTitle = &#039;&#039;;&lt;br /&gt;
			Format = &#039;&#039;;&lt;br /&gt;
			&lt;br /&gt;
		else																	-- now oddities that are cite serial&lt;br /&gt;
			Issue = &#039;&#039;;															-- unset because this parameter no longer supported by the citation/core version of cite serial&lt;br /&gt;
			Chapter = A[&#039;Episode&#039;];												-- TODO: make |episode= available to cite episode someday?&lt;br /&gt;
			if utilities.is_set (Series) and utilities.is_set (SeriesLink) then&lt;br /&gt;
				Series = utilities.make_wikilink (SeriesLink, Series);&lt;br /&gt;
			end&lt;br /&gt;
			Series = utilities.wrap_style (&#039;italic-title&#039;, Series);				-- series is italicized&lt;br /&gt;
		end	&lt;br /&gt;
	end&lt;br /&gt;
	-- end of {{cite episode}} stuff&lt;br /&gt;
&lt;br /&gt;
	-- handle type parameter for those CS1 citations that have default values&lt;br /&gt;
	local TitleType = A[&#039;TitleType&#039;];&lt;br /&gt;
	local Degree = A[&#039;Degree&#039;];&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;AV-media-notes&#039;, &#039;document&#039;, &#039;interview&#039;, &#039;mailinglist&#039;, &#039;map&#039;, &#039;podcast&#039;, &#039;pressrelease&#039;, &#039;report&#039;, &#039;speech&#039;, &#039;techreport&#039;, &#039;thesis&#039;}) then&lt;br /&gt;
		TitleType = set_titletype (config.CitationClass, TitleType);&lt;br /&gt;
		if utilities.is_set (Degree) and &amp;quot;Thesis&amp;quot; == TitleType then				-- special case for cite thesis&lt;br /&gt;
			TitleType = Degree .. &#039; &#039; .. cfg.title_types [&#039;thesis&#039;]:lower();&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (TitleType) then										-- if type parameter is specified&lt;br /&gt;
		TitleType = utilities.substitute ( cfg.messages[&#039;type&#039;], TitleType);	-- display it in parentheses&lt;br /&gt;
	-- TODO: Hack on TitleType to fix bunched parentheses problem&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- legacy: promote PublicationDate to Date if neither Date nor Year are set.&lt;br /&gt;
	local Date = A[&#039;Date&#039;];&lt;br /&gt;
 	local Date_origin;															-- to hold the name of parameter promoted to Date; required for date error messaging&lt;br /&gt;
	local PublicationDate = A[&#039;PublicationDate&#039;];&lt;br /&gt;
	local Year = A[&#039;Year&#039;];&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Year) then&lt;br /&gt;
		validation.year_check (Year);											-- returns nothing; emits maint message when |year= doesn&#039;t hold a &#039;year&#039; value&lt;br /&gt;
	end&lt;br /&gt;
		&lt;br /&gt;
	if not utilities.is_set (Date) then&lt;br /&gt;
		Date = Year;															-- promote Year to Date&lt;br /&gt;
		Year = nil;																-- make nil so Year as empty string isn&#039;t used for CITEREF&lt;br /&gt;
		if not utilities.is_set (Date) and utilities.is_set (PublicationDate) then	-- use PublicationDate when |date= and |year= are not set&lt;br /&gt;
			Date = PublicationDate;												-- promote PublicationDate to Date&lt;br /&gt;
			PublicationDate = &#039;&#039;;												-- unset, no longer needed&lt;br /&gt;
			Date_origin = A:ORIGIN(&#039;PublicationDate&#039;);							-- save the name of the promoted parameter&lt;br /&gt;
		else&lt;br /&gt;
			Date_origin = A:ORIGIN(&#039;Year&#039;);										-- save the name of the promoted parameter&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Date_origin = A:ORIGIN(&#039;Date&#039;);											-- not a promotion; name required for error messaging&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if PublicationDate == Date then PublicationDate = &#039;&#039;; end					-- if PublicationDate is same as Date, don&#039;t display in rendered citation&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	Go test all of the date-holding parameters for valid MOS:DATE format and make sure that dates are real dates. This must be done before we do COinS because here is where&lt;br /&gt;
	we get the date used in the metadata.&lt;br /&gt;
	&lt;br /&gt;
	Date validation supporting code is in Module:Citation/CS1/Date_validation&lt;br /&gt;
	]]&lt;br /&gt;
&lt;br /&gt;
	local DF = is_valid_parameter_value (A[&#039;DF&#039;], A:ORIGIN(&#039;DF&#039;), cfg.keywords_lists[&#039;df&#039;], &#039;&#039;);&lt;br /&gt;
	if not utilities.is_set (DF) then&lt;br /&gt;
		DF = cfg.global_df;														-- local |df= if present overrides global df set by {{use xxx date}} template&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ArchiveURL;&lt;br /&gt;
	local ArchiveDate;&lt;br /&gt;
	local ArchiveFormat = A[&#039;ArchiveFormat&#039;];&lt;br /&gt;
	local archive_url_timestamp;												-- timestamp from wayback machine url&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate, archive_url_timestamp = archive_url_check (A[&#039;ArchiveURL&#039;], A[&#039;ArchiveDate&#039;])&lt;br /&gt;
	ArchiveFormat = style_format (ArchiveFormat, ArchiveURL, &#039;archive-format&#039;, &#039;archive-url&#039;);&lt;br /&gt;
	&lt;br /&gt;
	ArchiveURL, ArchiveDate = is_unique_archive_url (ArchiveURL, URL, ChapterURL, A:ORIGIN(&#039;ArchiveURL&#039;), ArchiveDate);		-- add error message when URL or ChapterURL == ArchiveURL&lt;br /&gt;
&lt;br /&gt;
	local AccessDate = A[&#039;AccessDate&#039;];&lt;br /&gt;
	local COinS_date = {};														-- holds date info extracted from |date= for the COinS metadata by Module:Date verification&lt;br /&gt;
	local DoiBroken = A[&#039;DoiBroken&#039;];&lt;br /&gt;
	local Embargo = A[&#039;Embargo&#039;];&lt;br /&gt;
	local anchor_year;															-- used in the CITEREF identifier&lt;br /&gt;
	do	-- create defined block to contain local variables error_message, date_parameters_list, mismatch&lt;br /&gt;
		local error_message = &#039;&#039;;&lt;br /&gt;
																				-- AirDate has been promoted to Date so not necessary to check it&lt;br /&gt;
		local date_parameters_list = {&lt;br /&gt;
			[&#039;access-date&#039;] = {val = AccessDate, name = A:ORIGIN (&#039;AccessDate&#039;)},&lt;br /&gt;
			[&#039;archive-date&#039;] = {val = ArchiveDate, name = A:ORIGIN (&#039;ArchiveDate&#039;)},&lt;br /&gt;
			[&#039;date&#039;] = {val = Date, name = Date_origin},&lt;br /&gt;
			[&#039;doi-broken-date&#039;] = {val = DoiBroken, name = A:ORIGIN (&#039;DoiBroken&#039;)},&lt;br /&gt;
			[&#039;pmc-embargo-date&#039;] = {val = Embargo, name = A:ORIGIN (&#039;Embargo&#039;)},&lt;br /&gt;
			[&#039;publication-date&#039;] = {val = PublicationDate, name = A:ORIGIN (&#039;PublicationDate&#039;)},&lt;br /&gt;
			[&#039;year&#039;] = {val = Year, name = A:ORIGIN (&#039;Year&#039;)},&lt;br /&gt;
			};&lt;br /&gt;
&lt;br /&gt;
		local error_list = {};&lt;br /&gt;
		anchor_year, Embargo = validation.dates(date_parameters_list, COinS_date, error_list);&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Year) and utilities.is_set (Date) then				-- both |date= and |year= not normally needed; &lt;br /&gt;
			validation.year_date_check (Year, A:ORIGIN (&#039;Year&#039;), Date, A:ORIGIN (&#039;Date&#039;), error_list);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if 0 == #error_list then												-- error free dates only; 0 when error_list is empty&lt;br /&gt;
			local modified = false;												-- flag&lt;br /&gt;
			&lt;br /&gt;
			if utilities.is_set (DF) then										-- if we need to reformat dates&lt;br /&gt;
				modified = validation.reformat_dates (date_parameters_list, DF);	-- reformat to DF format, use long month names if appropriate&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if true == validation.date_hyphen_to_dash (date_parameters_list) then	-- convert hyphens to dashes where appropriate&lt;br /&gt;
				modified = true;&lt;br /&gt;
				utilities.set_message (&#039;maint_date_format&#039;);					-- hyphens were converted so add maint category&lt;br /&gt;
			end&lt;br /&gt;
			&lt;br /&gt;
	-- for those wikis that can and want to have English date names translated to the local language; not supported at en.wiki&lt;br /&gt;
			if cfg.date_name_auto_xlate_enable and validation.date_name_xlate (date_parameters_list, cfg.date_digit_auto_xlate_enable ) then&lt;br /&gt;
				utilities.set_message (&#039;maint_date_auto_xlated&#039;);				-- add maint cat&lt;br /&gt;
				modified = true;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if modified then													-- if the date_parameters_list values were modified&lt;br /&gt;
				AccessDate = date_parameters_list[&#039;access-date&#039;].val;			-- overwrite date holding parameters with modified values&lt;br /&gt;
				ArchiveDate = date_parameters_list[&#039;archive-date&#039;].val;&lt;br /&gt;
				Date = date_parameters_list[&#039;date&#039;].val;&lt;br /&gt;
				DoiBroken = date_parameters_list[&#039;doi-broken-date&#039;].val;&lt;br /&gt;
				PublicationDate = date_parameters_list[&#039;publication-date&#039;].val;&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if archive_url_timestamp and utilities.is_set (ArchiveDate) then&lt;br /&gt;
				validation.archive_date_check (ArchiveDate, archive_url_timestamp, DF);	-- does YYYYMMDD in archive_url_timestamp match date in ArchiveDate&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_bad_date&#039;, {utilities.make_sep_list (#error_list, error_list)});	-- add this error message&lt;br /&gt;
		end&lt;br /&gt;
	end	-- end of do&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;book&#039;, &#039;encyclopaedia&#039;}) or	-- {{cite book}}, {{cite encyclopedia}}; TODO: {{cite conference}} and others?&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) or			-- {{citation}} as an encylopedia citation&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and not utilities.is_set (Periodical)) then		-- {{citation}} as a book citation&lt;br /&gt;
			if utilities.is_set (PublicationPlace) then&lt;br /&gt;
				if not utilities.is_set (PublisherName) then&lt;br /&gt;
					local date = COinS_date.rftdate and tonumber (COinS_date.rftdate:match (&#039;%d%d%d%d&#039;));	-- get year portion of COinS date (because in Arabic numerals); convert string to number&lt;br /&gt;
					if date and (1850 &amp;lt;= date) then								-- location has no publisher; if date is 1850 or later&lt;br /&gt;
						utilities.set_message (&#039;maint_location_no_publisher&#039;);	-- add maint cat&lt;br /&gt;
					end&lt;br /&gt;
				else															-- PublisherName has a value&lt;br /&gt;
					if cfg.keywords_xlate[&#039;none&#039;] == PublisherName then			-- if that value is &#039;none&#039; (only for book and encyclopedia citations)&lt;br /&gt;
						PublisherName = &#039;&#039;;										-- unset&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ID_list = {};															-- sequence table of rendered identifiers&lt;br /&gt;
	local ID_list_coins = {};													-- table of identifiers and their values from args; key is same as cfg.id_handlers&#039;s key&lt;br /&gt;
	local Class = A[&#039;Class&#039;];													-- arxiv class identifier&lt;br /&gt;
	&lt;br /&gt;
	local ID_support = {&lt;br /&gt;
		{A[&#039;ASINTLD&#039;], &#039;ASIN&#039;, &#039;err_asintld_missing_asin&#039;, A:ORIGIN (&#039;ASINTLD&#039;)},				&lt;br /&gt;
		{DoiBroken, &#039;DOI&#039;, &#039;err_doibroken_missing_doi&#039;, A:ORIGIN (&#039;DoiBroken&#039;)},&lt;br /&gt;
		{Embargo, &#039;PMC&#039;, &#039;err_embargo_missing_pmc&#039;, A:ORIGIN (&#039;Embargo&#039;)},&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
	ID_list, ID_list_coins = identifiers.identifier_lists_get (args, {&lt;br /&gt;
		DoiBroken = DoiBroken,													-- for |doi=&lt;br /&gt;
		ASINTLD = A[&#039;ASINTLD&#039;],													-- for |asin=&lt;br /&gt;
		Embargo = Embargo,														-- for |pmc=&lt;br /&gt;
		Class = Class,															-- for |arxiv=&lt;br /&gt;
		CitationClass = config.CitationClass,									-- for |arxiv=&lt;br /&gt;
		Year=anchor_year,														-- for |isbn=&lt;br /&gt;
		}, ID_support);&lt;br /&gt;
&lt;br /&gt;
	if &#039;citation&#039; == config.CitationClass then									-- catch ve/citoid malformed book cites in {{citation}} templates&lt;br /&gt;
		for _, id in ipairs (ID_list) do										-- search through the ID_list sequence looking for an ISBN identifier string&lt;br /&gt;
			if id:find (&#039;ISBN&#039;, 3, true) then									-- plain find, start at index 3 ([[ISBN)&lt;br /&gt;
				if utilities.is_set (Periodical) then							-- when a |work= alias is set&lt;br /&gt;
					utilities.set_message (&#039;maint_work_isbn&#039;);					-- add maint cat&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, {{cite ssrn}}, before generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then	-- |arxiv= or |eprint= required for cite arxiv; |biorxiv=, |citeseerx=, |medrxiv=, |ssrn= required for their templates&lt;br /&gt;
		if not (args[cfg.id_handlers[config.CitationClass:upper()].parameters[1]] or 		-- can&#039;t use ID_list_coins k/v table here because invalid parameters omitted&lt;br /&gt;
			args[cfg.id_handlers[config.CitationClass:upper()].parameters[2]]) then			-- which causes unexpected parameter missing error message&lt;br /&gt;
				utilities.set_message (&#039;err_&#039; .. config.CitationClass .. &#039;_missing&#039;);		-- add error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Periodical = ({[&#039;arxiv&#039;] = &#039;arXiv&#039;, [&#039;biorxiv&#039;] = &#039;bioRxiv&#039;, [&#039;citeseerx&#039;] = &#039;CiteSeerX&#039;, [&#039;medrxiv&#039;] = &#039;medRxiv&#039;, [&#039;ssrn&#039;] = &#039;Social Science Research Network&#039;})[config.CitationClass];&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Link the title of the work if no |url= was provided, but we have a |pmc= or a |doi= with |doi-access=free&lt;br /&gt;
&lt;br /&gt;
	if config.CitationClass == &amp;quot;journal&amp;quot; and not utilities.is_set (URL) and not utilities.is_set (TitleLink) and not utilities.in_array (cfg.keywords_xlate[Title], {&#039;off&#039;, &#039;none&#039;}) then -- TODO: remove &#039;none&#039; once existing citations have been switched to &#039;off&#039;, so &#039;none&#039; can be used as token for &amp;quot;no title&amp;quot; instead&lt;br /&gt;
		if &#039;none&#039; ~= cfg.keywords_xlate[auto_select] then						-- if auto-linking not disabled&lt;br /&gt;
 	 		if identifiers.auto_link_urls[auto_select] then						-- manual selection&lt;br /&gt;
		 		URL = identifiers.auto_link_urls[auto_select];					-- set URL to be the same as identifier&#039;s external link&lt;br /&gt;
 				URL_origin = cfg.id_handlers[auto_select:upper()].parameters[1];	-- set URL_origin to parameter name for use in error message if citation is missing a |title=&lt;br /&gt;
			elseif identifiers.auto_link_urls[&#039;pmc&#039;] then						-- auto-select PMC&lt;br /&gt;
				URL = identifiers.auto_link_urls[&#039;pmc&#039;];						-- set URL to be the same as the PMC external link if not embargoed&lt;br /&gt;
				URL_origin = cfg.id_handlers[&#039;PMC&#039;].parameters[1];				-- set URL_origin to parameter name for use in error message if citation is missing a |title=&lt;br /&gt;
			elseif identifiers.auto_link_urls[&#039;doi&#039;] then						-- auto-select DOI&lt;br /&gt;
				URL = identifiers.auto_link_urls[&#039;doi&#039;];&lt;br /&gt;
				URL_origin = cfg.id_handlers[&#039;DOI&#039;].parameters[1];&lt;br /&gt;
			end&lt;br /&gt;
 	 	end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (URL) then											-- set when using an identifier-created URL&lt;br /&gt;
			if utilities.is_set (AccessDate) then								-- |access-date= requires |url=; identifier-created URL is not |url=&lt;br /&gt;
				utilities.set_message (&#039;err_accessdate_missing_url&#039;);			-- add an error message&lt;br /&gt;
				AccessDate = &#039;&#039;;												-- unset&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (ArchiveURL) then								-- |archive-url= requires |url=; identifier-created URL is not |url=&lt;br /&gt;
				utilities.set_message (&#039;err_archive_missing_url&#039;);				-- add an error message&lt;br /&gt;
				ArchiveURL = &#039;&#039;;												-- unset&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- At this point fields may be nil if they weren&#039;t specified in the template use.  We can use that fact.&lt;br /&gt;
	-- Test if citation has no title&lt;br /&gt;
	if	not utilities.is_set (Title) and not utilities.is_set (TransTitle) and not utilities.is_set (ScriptTitle) then	-- has special case for cite episode&lt;br /&gt;
		utilities.set_message (&#039;err_citation_missing_title&#039;, {&#039;episode&#039; == config.CitationClass and &#039;series&#039; or &#039;title&#039;});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cfg.keywords_xlate[Title], {&#039;off&#039;, &#039;none&#039;}) and&lt;br /&gt;
			utilities.in_array (config.CitationClass, {&#039;journal&#039;, &#039;citation&#039;}) and&lt;br /&gt;
			(utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and&lt;br /&gt;
			(&#039;journal&#039; == Periodical_origin or &#039;script-journal&#039; == ScriptPeriodical_origin) then	-- special case for journal cites&lt;br /&gt;
				Title = &#039;&#039;;														-- set title to empty string&lt;br /&gt;
				utilities.set_message (&#039;maint_untitled&#039;);						-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if &#039;journal&#039; == config.CitationClass or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Periodical) and &#039;journal&#039; == Periodical_origin) then&lt;br /&gt;
		if is_page_art_num (((utilities.is_set (Page) and Page) or (utilities.is_set (Pages) and Pages)) or nil, ID_list_coins[&#039;DOI&#039;]) then			-- does |page(s)= look like it holds an article number&lt;br /&gt;
			utilities.set_message (&#039;maint_page_art_num&#039;);						-- add maint cat&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- COinS metadata (see &amp;lt;http://ocoins.info/&amp;gt;) for automated parsing of citation information.&lt;br /&gt;
	-- handle the oddity that is cite encyclopedia and {{citation |encyclopedia=something}}. Here we presume that&lt;br /&gt;
	-- when Periodical, Title, and Chapter are all set, then Periodical is the book (encyclopedia) title, Title&lt;br /&gt;
	-- is the article title, and Chapter is a section within the article.  So, we remap &lt;br /&gt;
	&lt;br /&gt;
	local coins_chapter = Chapter;												-- default assuming that remapping not required&lt;br /&gt;
	local coins_title = Title;													-- et tu&lt;br /&gt;
	if &#039;encyclopaedia&#039; == config.CitationClass or (&#039;citation&#039; == config.CitationClass and utilities.is_set (Encyclopedia)) then&lt;br /&gt;
		if utilities.is_set (Chapter) and utilities.is_set (Title) and utilities.is_set (Periodical) then		-- if all are used then&lt;br /&gt;
			coins_chapter = Title;												-- remap&lt;br /&gt;
			coins_title = Periodical;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local coins_author = a;														-- default for coins rft.au &lt;br /&gt;
	if 0 &amp;lt; #c then																-- but if contributor list&lt;br /&gt;
		coins_author = c;														-- use that instead&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- this is the function call to COinS()&lt;br /&gt;
	local OCinSoutput = metadata.COinS({&lt;br /&gt;
		[&#039;Periodical&#039;] = utilities.strip_apostrophe_markup (Periodical),		-- no markup in the metadata&lt;br /&gt;
		[&#039;Encyclopedia&#039;] = Encyclopedia,										-- just a flag; content ignored by ~/COinS&lt;br /&gt;
		[&#039;Chapter&#039;] = metadata.make_coins_title (coins_chapter, ScriptChapter),	-- Chapter and ScriptChapter stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		[&#039;Degree&#039;] = Degree;													-- cite thesis only&lt;br /&gt;
		[&#039;Title&#039;] = metadata.make_coins_title (coins_title, ScriptTitle),		-- Title and ScriptTitle stripped of bold / italic / accept-as-written markup&lt;br /&gt;
		[&#039;PublicationPlace&#039;] = PublicationPlace,&lt;br /&gt;
		[&#039;Date&#039;] = COinS_date.rftdate,											-- COinS_date.* has correctly formatted date values if Date is valid;&lt;br /&gt;
		[&#039;Season&#039;] = COinS_date.rftssn,&lt;br /&gt;
		[&#039;Quarter&#039;] = COinS_date.rftquarter,&lt;br /&gt;
		[&#039;Chron&#039;] =  COinS_date.rftchron,&lt;br /&gt;
		[&#039;Series&#039;] = Series,&lt;br /&gt;
		[&#039;Volume&#039;] = Volume,&lt;br /&gt;
		[&#039;Issue&#039;] = Issue,&lt;br /&gt;
		[&#039;ArticleNumber&#039;] = ArticleNumber,&lt;br /&gt;
		[&#039;Pages&#039;] = coins_pages or metadata.get_coins_pages (first_set ({Sheet, Sheets, Page, Pages, At, QuotePage, QuotePages}, 7)),	-- pages stripped of external links&lt;br /&gt;
		[&#039;Edition&#039;] = Edition,&lt;br /&gt;
		[&#039;PublisherName&#039;] = PublisherName or Newsgroup,							-- any apostrophe markup already removed from PublisherName&lt;br /&gt;
		[&#039;URL&#039;] = first_set ({ChapterURL, URL}, 2),&lt;br /&gt;
		[&#039;Authors&#039;] = coins_author,&lt;br /&gt;
		[&#039;ID_list&#039;] = ID_list_coins,&lt;br /&gt;
		[&#039;RawPage&#039;] = this_page.prefixedText,&lt;br /&gt;
	}, config.CitationClass);&lt;br /&gt;
&lt;br /&gt;
	-- Account for the oddities that are {{cite arxiv}}, {{cite biorxiv}}, {{cite citeseerx}}, {{cite medrxiv}}, and {{cite ssrn}} AFTER generation of COinS data.&lt;br /&gt;
	if utilities.in_array (config.CitationClass, whitelist.preprint_template_list_t) then	-- we have set rft.jtitle in COinS to arXiv, bioRxiv, CiteSeerX, medRxiv, or ssrn now unset so it isn&#039;t displayed&lt;br /&gt;
		Periodical = &#039;&#039;;														-- periodical not allowed in these templates; if article has been published, use cite journal&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- special case for cite newsgroup.  Do this after COinS because we are modifying Publishername to include some static text&lt;br /&gt;
	if &#039;newsgroup&#039; == config.CitationClass and utilities.is_set (Newsgroup) then&lt;br /&gt;
		PublisherName = utilities.substitute (cfg.messages[&#039;newsgroup&#039;], external_link( &#039;news:&#039; .. Newsgroup, Newsgroup, Newsgroup_origin, nil ));&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Editors;&lt;br /&gt;
	local EditorCount;															-- used only for choosing {ed.) or (eds.) annotation at end of editor name-list&lt;br /&gt;
	local Contributors;															-- assembled contributors name list&lt;br /&gt;
	local contributor_etal;&lt;br /&gt;
	local Translators;															-- assembled translators name list&lt;br /&gt;
	local translator_etal;&lt;br /&gt;
	local t = {};																-- translators list from |translator-lastn= / translator-firstn= pairs&lt;br /&gt;
	t = extract_names (args, &#039;TranslatorList&#039;);									-- fetch translator list from |translatorn= / |translator-lastn=, -firstn=, -linkn=, -maskn=&lt;br /&gt;
	local Interviewers;															&lt;br /&gt;
	local interviewers_list = {};					&lt;br /&gt;
	interviewers_list = extract_names (args, &#039;InterviewerList&#039;);				-- process preferred interviewers parameters&lt;br /&gt;
	local interviewer_etal;&lt;br /&gt;
	&lt;br /&gt;
	-- Now perform various field substitutions.&lt;br /&gt;
	-- We also add leading spaces and surrounding markup and punctuation to the&lt;br /&gt;
	-- various parts of the citation, but only when they are non-nil.&lt;br /&gt;
	do&lt;br /&gt;
		local last_first_list;&lt;br /&gt;
		local control = { &lt;br /&gt;
			format = NameListStyle,												-- empty string, &#039;&amp;amp;&#039;, &#039;amp&#039;, &#039;and&#039;, or &#039;vanc&#039;&lt;br /&gt;
			maximum = nil,														-- as if display-authors or display-editors not set&lt;br /&gt;
			mode = Mode&lt;br /&gt;
		};&lt;br /&gt;
&lt;br /&gt;
		do																		-- do editor name list first because the now unsupported coauthors used to modify control table&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayEditors&#039;], A[&#039;DisplayEditors&#039;], A:ORIGIN (&#039;DisplayEditors&#039;), #e);&lt;br /&gt;
			control.maximum, editor_etal = get_display_names (display_names, #e, &#039;editors&#039;, editor_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Editors, EditorCount = list_people (control, e, editor_etal);&lt;br /&gt;
&lt;br /&gt;
			if 1 == EditorCount and (true == editor_etal or 1 &amp;lt; #e) then		-- only one editor displayed but includes etal then &lt;br /&gt;
				EditorCount = 2;												-- spoof to display (eds.) annotation&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do interviewers&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayInterviewers&#039;], A[&#039;DisplayInterviewers&#039;], A:ORIGIN (&#039;DisplayInterviewers&#039;), #interviewers_list);&lt;br /&gt;
			control.maximum, interviewer_etal = get_display_names (display_names, #interviewers_list, &#039;interviewers&#039;, interviewer_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Interviewers = list_people (control, interviewers_list, interviewer_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do translators&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayTranslators&#039;], A[&#039;DisplayTranslators&#039;], A:ORIGIN (&#039;DisplayTranslators&#039;), #t);&lt;br /&gt;
			control.maximum, translator_etal = get_display_names (display_names, #t, &#039;translators&#039;, translator_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Translators = list_people (control, t, translator_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do contributors&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayContributors&#039;], A[&#039;DisplayContributors&#039;], A:ORIGIN (&#039;DisplayContributors&#039;), #c);&lt;br /&gt;
			control.maximum, contributor_etal = get_display_names (display_names, #c, &#039;contributors&#039;, contributor_etal, param);&lt;br /&gt;
&lt;br /&gt;
			Contributors = list_people (control, c, contributor_etal);&lt;br /&gt;
		end&lt;br /&gt;
		do																		-- now do authors&lt;br /&gt;
			local display_names, param = display_names_select (cfg.global_cs1_config_t[&#039;DisplayAuthors&#039;], A[&#039;DisplayAuthors&#039;], A:ORIGIN (&#039;DisplayAuthors&#039;), #a, author_etal);&lt;br /&gt;
			control.maximum, author_etal = get_display_names (display_names, #a, &#039;authors&#039;, author_etal, param);&lt;br /&gt;
&lt;br /&gt;
			last_first_list = list_people (control, a, author_etal);&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (Authors) then&lt;br /&gt;
				Authors, author_etal = name_has_etal (Authors, author_etal, false, &#039;authors&#039;);	-- find and remove variations on et al.&lt;br /&gt;
				if author_etal then&lt;br /&gt;
					Authors = Authors .. &#039; &#039; .. cfg.messages[&#039;et al&#039;];			-- add et al. to authors parameter&lt;br /&gt;
				end&lt;br /&gt;
			else&lt;br /&gt;
				Authors = last_first_list;										-- either an author name list or an empty string&lt;br /&gt;
			end&lt;br /&gt;
		end																		-- end of do&lt;br /&gt;
	&lt;br /&gt;
		if utilities.is_set (Authors) and utilities.is_set (Collaboration) then&lt;br /&gt;
			Authors = Authors .. &#039; (&#039; .. Collaboration .. &#039;)&#039;;					-- add collaboration after et al.&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceFormat = A[&#039;ConferenceFormat&#039;];&lt;br /&gt;
	local ConferenceURL = A[&#039;ConferenceURL&#039;];&lt;br /&gt;
	ConferenceFormat = style_format (ConferenceFormat, ConferenceURL, &#039;conference-format&#039;, &#039;conference-url&#039;);&lt;br /&gt;
	Format = style_format (Format, URL, &#039;format&#039;, &#039;url&#039;);&lt;br /&gt;
&lt;br /&gt;
	-- special case for chapter format so no error message or cat when chapter not supported&lt;br /&gt;
	if not (utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia))) then&lt;br /&gt;
			ChapterFormat = style_format (ChapterFormat, ChapterURL, &#039;chapter-format&#039;, &#039;chapter-url&#039;);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not utilities.is_set (URL) then&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&amp;quot;web&amp;quot;, &amp;quot;podcast&amp;quot;, &amp;quot;mailinglist&amp;quot;}) or		-- |url= required for {{cite web}}, {{cite podcast}}, and {{cite mailing list}}&lt;br /&gt;
			(&#039;citation&#039; == config.CitationClass and (&#039;website&#039; == Periodical_origin or &#039;script-website&#039; == ScriptPeriodical_origin)) then	-- and required for {{citation}} with |website= or |script-website=&lt;br /&gt;
				if not url_was_archive_today then								-- is &amp;lt;URL&amp;gt; empty/missing because it was a deprecated archive.today url&lt;br /&gt;
					utilities.set_message (&#039;err_cite_web_url&#039;);					-- no; emit an error message for an empty/ missing |url=&lt;br /&gt;
				end&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		-- do we have |accessdate= without either |url= or |chapter-url=?&lt;br /&gt;
		if utilities.is_set (AccessDate) and not utilities.is_set (ChapterURL) then		-- ChapterURL may be set when URL is not set;&lt;br /&gt;
			utilities.set_message (&#039;err_accessdate_missing_url&#039;);&lt;br /&gt;
			AccessDate = &#039;&#039;;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local UrlStatus = is_valid_parameter_value (A[&#039;UrlStatus&#039;], A:ORIGIN(&#039;UrlStatus&#039;), cfg.keywords_lists[&#039;url-status&#039;], &#039;&#039;);&lt;br /&gt;
	local OriginalURL&lt;br /&gt;
	local OriginalURL_origin&lt;br /&gt;
	local OriginalFormat&lt;br /&gt;
	local OriginalAccess;&lt;br /&gt;
	UrlStatus = UrlStatus:lower();												-- used later when assembling archived text&lt;br /&gt;
	if utilities.is_set ( ArchiveURL ) then&lt;br /&gt;
		if utilities.is_set (ChapterURL) then 									-- if chapter-url= is set apply archive url to it&lt;br /&gt;
			OriginalURL = ChapterURL;											-- save copy of source chapter&#039;s url for archive text&lt;br /&gt;
			OriginalURL_origin = ChapterURL_origin;								-- name of |chapter-url= parameter for error messages&lt;br /&gt;
			OriginalFormat = ChapterFormat;										-- and original |chapter-format=&lt;br /&gt;
&lt;br /&gt;
			if &#039;live&#039; ~= UrlStatus then&lt;br /&gt;
				ChapterURL = ArchiveURL											-- swap-in the archive&#039;s URL&lt;br /&gt;
				ChapterURL_origin = A:ORIGIN(&#039;ArchiveURL&#039;)						-- name of |archive-url= parameter for error messages&lt;br /&gt;
				ChapterFormat = ArchiveFormat or &#039;&#039;;							-- swap in archive&#039;s format&lt;br /&gt;
				ChapterUrlAccess = nil;											-- restricted access levels do not make sense for archived URLs&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (URL) then&lt;br /&gt;
			OriginalURL = URL;													-- save copy of original source URL&lt;br /&gt;
			OriginalURL_origin = URL_origin;									-- name of URL parameter for error messages&lt;br /&gt;
			OriginalFormat = Format; 											-- and original |format=&lt;br /&gt;
			OriginalAccess = UrlAccess;&lt;br /&gt;
&lt;br /&gt;
			if &#039;live&#039; ~= UrlStatus then											-- if URL set then |archive-url= applies to it&lt;br /&gt;
				URL = ArchiveURL												-- swap-in the archive&#039;s URL&lt;br /&gt;
				URL_origin = A:ORIGIN(&#039;ArchiveURL&#039;)								-- name of archive URL parameter for error messages&lt;br /&gt;
				Format = ArchiveFormat or &#039;&#039;;									-- swap in archive&#039;s format&lt;br /&gt;
				UrlAccess = nil;												-- restricted access levels do not make sense for archived URLs&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (UrlStatus) then									-- if |url-status= is set when |archive-url= is not set&lt;br /&gt;
 		utilities.set_message (&#039;maint_url_status&#039;);								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or	-- if any of the &#039;periodical&#039; cites except encyclopedia&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) then&lt;br /&gt;
			local chap_param;&lt;br /&gt;
			if utilities.is_set (Chapter) then									-- get a parameter name from one of these chapter related meta-parameters&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;Chapter&#039;)&lt;br /&gt;
			elseif utilities.is_set (TransChapter) then&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;TransChapter&#039;)&lt;br /&gt;
			elseif utilities.is_set (ChapterURL) then&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;ChapterURL&#039;)&lt;br /&gt;
			elseif utilities.is_set (ScriptChapter) then&lt;br /&gt;
				chap_param = ScriptChapter_origin;&lt;br /&gt;
			else utilities.is_set (ChapterFormat)&lt;br /&gt;
				chap_param = A:ORIGIN (&#039;ChapterFormat&#039;)&lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			if utilities.is_set (chap_param) then								-- if we found one&lt;br /&gt;
				utilities.set_message (&#039;err_chapter_ignored&#039;, {chap_param});	-- add error message&lt;br /&gt;
				Chapter = &#039;&#039;;													-- and set them to empty string to be safe with concatenation&lt;br /&gt;
				TransChapter = &#039;&#039;;&lt;br /&gt;
				ChapterURL = &#039;&#039;;&lt;br /&gt;
				ScriptChapter = &#039;&#039;;&lt;br /&gt;
				ChapterFormat = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
	else																		-- otherwise, format chapter / article title&lt;br /&gt;
		local no_quotes = false;												-- default assume that we will be quoting the chapter parameter value&lt;br /&gt;
		if utilities.is_set (Contribution) and 0 &amp;lt; #c then						-- if this is a contribution with contributor(s)&lt;br /&gt;
			if utilities.in_array (Contribution:lower(), cfg.keywords_lists.contribution) then	-- and a generic contribution title&lt;br /&gt;
				no_quotes = true;												-- then render it unquoted&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		Chapter = format_chapter_title (ScriptChapter, ScriptChapter_origin, Chapter, Chapter_origin, TransChapter, TransChapter_origin, ChapterURL, ChapterURL_origin, no_quotes, ChapterUrlAccess);		-- Contribution is also in Chapter&lt;br /&gt;
		if utilities.is_set (Chapter) then&lt;br /&gt;
			Chapter = Chapter .. ChapterFormat ;&lt;br /&gt;
			if &#039;map&#039; == config.CitationClass and utilities.is_set (TitleType) then&lt;br /&gt;
				Chapter = Chapter .. &#039; &#039; .. TitleType;							-- map annotation here; not after title&lt;br /&gt;
			end&lt;br /&gt;
			Chapter = Chapter .. sepc .. &#039; &#039;;&lt;br /&gt;
		elseif utilities.is_set (ChapterFormat) then							-- |chapter= not set but |chapter-format= is so ...&lt;br /&gt;
			Chapter = ChapterFormat .. sepc .. &#039; &#039;;								-- ... ChapterFormat has error message, we want to see it&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Format main title&lt;br /&gt;
	local plain_title = false;&lt;br /&gt;
	local accept_title;&lt;br /&gt;
	Title, accept_title = utilities.has_accept_as_written (Title, true);		-- remove accept-this-as-written markup when it wraps all of &amp;lt;Title&amp;gt;&lt;br /&gt;
	if accept_title and (&#039;&#039; == Title) then										-- only support forced empty for now &amp;quot;(())&amp;quot;&lt;br /&gt;
		Title = cfg.messages[&#039;notitle&#039;];										-- replace by predefined &amp;quot;No title&amp;quot; message&lt;br /&gt;
			-- TODO: utilities.set_message ( &#039;err_redundant_parameters&#039;, ...);	-- issue proper error message instead of muting	 &lt;br /&gt;
			ScriptTitle = &#039;&#039;;													-- just mute for now	 &lt;br /&gt;
			TransTitle = &#039;&#039;;													-- just mute for now&lt;br /&gt;
 		plain_title = true;														-- suppress text decoration for descriptive title&lt;br /&gt;
		utilities.set_message (&#039;maint_untitled&#039;);								-- add maint cat&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not accept_title then													-- &amp;lt;Title&amp;gt; not wrapped in accept-as-written markup&lt;br /&gt;
		if &#039;...&#039; == Title:sub (-3) then											-- if ellipsis is the last three characters of |title=&lt;br /&gt;
			Title = Title:gsub (&#039;(%.%.%.)%.+$&#039;, &#039;%1&#039;);							-- limit the number of dots to three&lt;br /&gt;
		elseif not mw.ustring.find (Title, &#039;%.%s*%a%.$&#039;) and					-- end of title is not a &#039;dot-(optional space-)letter-dot&#039; initialism ...&lt;br /&gt;
			not mw.ustring.find (Title, &#039;%s+%a%.$&#039;) then						-- ...and not a &#039;space-letter-dot&#039; initial (&#039;&#039;Allium canadense&#039;&#039; L.)&lt;br /&gt;
				Title = mw.ustring.gsub(Title, &#039;%&#039; .. sepc .. &#039;$&#039;, &#039;&#039;);			-- remove any trailing separator character; sepc and ms.ustring() here for languages that use multibyte separator characters&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (ArchiveURL) and is_archived_copy (Title) then&lt;br /&gt;
			utilities.set_message (&#039;maint_archived_copy&#039;);						-- add maintenance category before we modify the content of Title&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		if is_generic (&#039;generic_titles&#039;, Title) then&lt;br /&gt;
			utilities.set_message (&#039;err_generic_title&#039;);						-- set an error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if (not plain_title) and (utilities.in_array (config.CitationClass, {&#039;web&#039;, &#039;news&#039;, &#039;journal&#039;, &#039;magazine&#039;, &#039;document&#039;, &#039;pressrelease&#039;, &#039;podcast&#039;, &#039;newsgroup&#039;, &#039;mailinglist&#039;, &#039;interview&#039;, &#039;arxiv&#039;, &#039;biorxiv&#039;, &#039;citeseerx&#039;, &#039;medrxiv&#039;, &#039;ssrn&#039;}) or&lt;br /&gt;
		(&#039;citation&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)) and not utilities.is_set (Encyclopedia)) or&lt;br /&gt;
		(&#039;map&#039; == config.CitationClass and (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical)))) then		-- special case for cite map when the map is in a periodical treat as an article&lt;br /&gt;
			Title = kern_quotes (Title);										-- if necessary, separate title&#039;s leading and trailing quote marks from module provided quote marks&lt;br /&gt;
			Title = utilities.wrap_style (&#039;quoted-title&#039;, Title);&lt;br /&gt;
			Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);	-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
			TransTitle = utilities.wrap_style (&#039;trans-quoted-title&#039;, TransTitle );&lt;br /&gt;
	elseif plain_title or (&#039;report&#039; == config.CitationClass) then				-- no styling for cite report and descriptive titles (otherwise same as above)&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style (&#039;trans-quoted-title&#039;, TransTitle );	-- for cite report, use this form for trans-title&lt;br /&gt;
	else&lt;br /&gt;
		Title = utilities.wrap_style (&#039;italic-title&#039;, Title);&lt;br /&gt;
		Title = script_concatenate (Title, ScriptTitle, &#039;script-title&#039;);		-- &amp;lt;bdi&amp;gt; tags, lang attribute, categorization, etc.; must be done after title is wrapped&lt;br /&gt;
		TransTitle = utilities.wrap_style (&#039;trans-italic-title&#039;, TransTitle);&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (TransTitle) then&lt;br /&gt;
		if utilities.is_set (Title) then&lt;br /&gt;
			TransTitle = &amp;quot; &amp;quot; .. TransTitle;&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;err_trans_missing_title&#039;, {&#039;title&#039;});&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Title) then											-- TODO: is this the right place to be making Wikisource URLs?&lt;br /&gt;
		if utilities.is_set (TitleLink) and utilities.is_set (URL) then&lt;br /&gt;
			utilities.set_message (&#039;err_wikilink_in_url&#039;);						-- set an error message because we can&#039;t have both&lt;br /&gt;
			TitleLink = &#039;&#039;;														-- unset&lt;br /&gt;
		end&lt;br /&gt;
	&lt;br /&gt;
		if not utilities.is_set (TitleLink) and utilities.is_set (URL) then&lt;br /&gt;
			Title = external_link (URL, Title, URL_origin, UrlAccess) .. TransTitle .. Format;&lt;br /&gt;
			URL = &#039;&#039;;															-- unset these because no longer needed&lt;br /&gt;
			Format = &amp;quot;&amp;quot;;&lt;br /&gt;
		elseif utilities.is_set (TitleLink) and not utilities.is_set (URL) then&lt;br /&gt;
			local ws_url;&lt;br /&gt;
			ws_url = wikisource_url_make (TitleLink);							-- ignore ws_label return; not used here&lt;br /&gt;
			if ws_url then&lt;br /&gt;
				Title = external_link (ws_url, Title .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in title-link&#039;);	-- space char after Title to move icon away from italic text; TODO: a better way to do this?&lt;br /&gt;
				Title = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], TitleLink, Title});				&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			else&lt;br /&gt;
				Title = utilities.make_wikilink (TitleLink, Title) .. TransTitle;&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			local ws_url, ws_label, L;											-- Title has italic or quote markup by the time we get here which causes is_wikilink() to return 0 (not a wikilink)&lt;br /&gt;
			ws_url, ws_label, L = wikisource_url_make (Title:gsub(&#039;^[\&#039;&amp;quot;]*(.-)[\&#039;&amp;quot;]*$&#039;, &#039;%1&#039;));	-- make ws URL from |title= interwiki link (strip italic or quote markup); link portion L becomes tooltip label&lt;br /&gt;
			if ws_url then&lt;br /&gt;
				Title = Title:gsub (&#039;%b[]&#039;, ws_label);							-- replace interwiki link with ws_label to retain markup&lt;br /&gt;
				Title = external_link (ws_url, Title .. &#039;&amp;amp;nbsp;&#039;, &#039;ws link in title&#039;);	-- space char after Title to move icon away from italic text; TODO: a better way to do this?&lt;br /&gt;
				Title = utilities.substitute (cfg.presentation[&#039;interwiki-icon&#039;], {cfg.presentation[&#039;class-wikisource&#039;], L, Title});				&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			else&lt;br /&gt;
				Title = Title .. TransTitle;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Title = TransTitle;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (Place) then&lt;br /&gt;
		Place = &amp;quot; &amp;quot; .. wrap_msg (&#039;written&#039;, Place, use_lowercase) .. sepc .. &amp;quot; &amp;quot;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local ConferenceURL_origin = A:ORIGIN(&#039;ConferenceURL&#039;);						-- get name of parameter that holds ConferenceURL&lt;br /&gt;
	if utilities.is_set (Conference) then&lt;br /&gt;
		if utilities.is_set (ConferenceURL) then&lt;br /&gt;
			Conference = external_link( ConferenceURL, Conference, ConferenceURL_origin, nil );&lt;br /&gt;
		end&lt;br /&gt;
		Conference = sepc .. &amp;quot; &amp;quot; .. Conference .. ConferenceFormat;&lt;br /&gt;
	elseif utilities.is_set (ConferenceURL) then&lt;br /&gt;
		Conference = sepc .. &amp;quot; &amp;quot; .. external_link( ConferenceURL, nil, ConferenceURL_origin, nil );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Position = &#039;&#039;;&lt;br /&gt;
	if not utilities.is_set (Position) then&lt;br /&gt;
		local Minutes = A[&#039;Minutes&#039;];&lt;br /&gt;
		local Time = A[&#039;Time&#039;];&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Minutes) then&lt;br /&gt;
			if utilities.is_set (Time) then		--TODO: make a function for this and similar?&lt;br /&gt;
				utilities.set_message (&#039;err_redundant_parameters&#039;, {utilities.wrap_style (&#039;parameter&#039;, &#039;minutes&#039;) .. cfg.presentation[&#039;sep_list_pair&#039;] .. utilities.wrap_style (&#039;parameter&#039;, &#039;time&#039;)});&lt;br /&gt;
			end&lt;br /&gt;
			Position = utilities.substitute (cfg.messages.minutes, Minutes);&lt;br /&gt;
		else&lt;br /&gt;
			if utilities.is_set (Time) then&lt;br /&gt;
				local TimeCaption = A[&#039;TimeCaption&#039;]&lt;br /&gt;
				if not utilities.is_set (TimeCaption) then&lt;br /&gt;
					TimeCaption = cs2_lower(cfg.messages[&#039;event&#039;]);&lt;br /&gt;
				end&lt;br /&gt;
				Position = &amp;quot; &amp;quot; .. TimeCaption .. &amp;quot; &amp;quot; .. Time;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		Position = &amp;quot; &amp;quot; .. Position;&lt;br /&gt;
		At = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Page, Pages, Sheet, Sheets = format_pages_sheets (Page, Pages, Sheet, Sheets, config.CitationClass, Periodical_origin, sepc, NoPP, use_lowercase);&lt;br /&gt;
&lt;br /&gt;
	At = utilities.is_set (At) and (sepc .. &amp;quot; &amp;quot; .. At) or &amp;quot;&amp;quot;;&lt;br /&gt;
	Position = utilities.is_set (Position) and (sepc .. &amp;quot; &amp;quot; .. Position) or &amp;quot;&amp;quot;;&lt;br /&gt;
	if config.CitationClass == &#039;map&#039; then&lt;br /&gt;
		local Sections = A[&#039;Sections&#039;];											-- Section (singular) is an alias of Chapter so set earlier&lt;br /&gt;
		local Inset = A[&#039;Inset&#039;];&lt;br /&gt;
		&lt;br /&gt;
		if utilities.is_set ( Inset ) then&lt;br /&gt;
			Inset = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;inset&#039;, Inset, use_lowercase);&lt;br /&gt;
		end			&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set ( Sections ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;sections&#039;, Sections, use_lowercase);&lt;br /&gt;
		elseif utilities.is_set ( Section ) then&lt;br /&gt;
			Section = sepc .. &amp;quot; &amp;quot; .. wrap_msg (&#039;section&#039;, Section, use_lowercase);&lt;br /&gt;
		end&lt;br /&gt;
		At = At .. Inset .. Section;		&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
	local Others = A[&#039;Others&#039;];&lt;br /&gt;
	if utilities.is_set (Others) and 0 == #a and 0 == #e then					-- add maint cat when |others= has value and used without |author=, |editor=&lt;br /&gt;
		if config.CitationClass == &amp;quot;AV-media-notes&amp;quot;&lt;br /&gt;
		or config.CitationClass == &amp;quot;audio-visual&amp;quot; then							-- special maint for AV/M which has a lot of &#039;false&#039; positives right now&lt;br /&gt;
			utilities.set_message (&#039;maint_others_avm&#039;)&lt;br /&gt;
		else&lt;br /&gt;
			utilities.set_message (&#039;maint_others&#039;);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	Others = utilities.is_set (Others) and (sepc .. &amp;quot; &amp;quot; .. Others) or &amp;quot;&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (Translators) then&lt;br /&gt;
		Others = safe_join ({sepc .. &#039; &#039;, wrap_msg (&#039;translated&#039;, Translators, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (Interviewers) then&lt;br /&gt;
		Others = safe_join ({sepc .. &#039; &#039;, wrap_msg (&#039;interview&#039;, Interviewers, use_lowercase), Others}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TitleNote = A[&#039;TitleNote&#039;];&lt;br /&gt;
	TitleNote = utilities.is_set (TitleNote) and (sepc .. &amp;quot; &amp;quot; .. TitleNote) or &amp;quot;&amp;quot;;&lt;br /&gt;
	if utilities.is_set (Edition) then&lt;br /&gt;
		if Edition:match (&#039;%f[%a][Ee]d%n?%.?$&#039;) or Edition:match (&#039;%f[%a][Ee]dition$&#039;) then -- Ed, ed, Ed., ed., Edn, edn, Edn., edn.&lt;br /&gt;
			utilities.set_message (&#039;err_extra_text_edition&#039;);					 -- add error message&lt;br /&gt;
		end&lt;br /&gt;
		Edition = &amp;quot; &amp;quot; .. wrap_msg (&#039;edition&#039;, Edition);&lt;br /&gt;
	else&lt;br /&gt;
		Edition = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	Series = utilities.is_set (Series) and wrap_msg (&#039;series&#039;, {sepc, Series}) or &amp;quot;&amp;quot;;	-- not the same as SeriesNum&lt;br /&gt;
	local Agency = A[&#039;Agency&#039;] or &#039;&#039;;											-- |agency= is supported by {{cite magazine}}, {{cite news}}, {{cite press release}}, {{cite web}}, and certain {{citation}} templates&lt;br /&gt;
	if utilities.is_set (Agency) then											-- this testing done here because {{citation}} supports &#039;news&#039; citations&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&#039;magazine&#039;, &#039;news&#039;, &#039;pressrelease&#039;, &#039;web&#039;}) or (&#039;citation&#039; == config.CitationClass and utilities.in_array (Periodical_origin, {&amp;quot;magazine&amp;quot;, &amp;quot;newspaper&amp;quot;, &amp;quot;work&amp;quot;})) then&lt;br /&gt;
			Agency = wrap_msg (&#039;agency&#039;, {sepc, Agency});						-- format for rendering&lt;br /&gt;
		else&lt;br /&gt;
			Agency = &#039;&#039;;														-- unset; not supported&lt;br /&gt;
			utilities.set_message (&#039;err_parameter_ignored&#039;, {&#039;agency&#039;});		-- add error message&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	Volume = format_volume_issue (Volume, Issue, ArticleNumber, config.CitationClass, Periodical_origin, sepc, use_lowercase);&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (AccessDate) then&lt;br /&gt;
		local retrv_text = &amp;quot; &amp;quot; .. cfg.messages[&#039;retrieved&#039;];&lt;br /&gt;
&lt;br /&gt;
		AccessDate = nowrap_date (AccessDate);									-- wrap in nowrap span if date in appropriate format&lt;br /&gt;
		retrv_text = cs2_lower(retrv_text);										-- if mode is cs2, lower case&lt;br /&gt;
		AccessDate = utilities.substitute (retrv_text, AccessDate);				-- add retrieved text&lt;br /&gt;
&lt;br /&gt;
		AccessDate = utilities.substitute (cfg.presentation[&#039;accessdate&#039;], {sepc, AccessDate});	-- allow editors to hide accessdates&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if utilities.is_set (ID) then ID = sepc .. &amp;quot; &amp;quot; .. ID; end&lt;br /&gt;
	&lt;br /&gt;
	local Docket = A[&#039;Docket&#039;];&lt;br /&gt;
   	if &amp;quot;thesis&amp;quot; == config.CitationClass and utilities.is_set (Docket) then&lt;br /&gt;
		ID = sepc .. &amp;quot; Docket &amp;quot; .. Docket .. ID;&lt;br /&gt;
	end&lt;br /&gt;
   	if &amp;quot;report&amp;quot; == config.CitationClass and utilities.is_set (Docket) then		-- for cite report when |docket= is set&lt;br /&gt;
		ID = sepc .. &#039; &#039; .. Docket;												-- overwrite ID even if |id= is set&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (URL) then&lt;br /&gt;
		URL = &amp;quot; &amp;quot; .. external_link( URL, nil, URL_origin, UrlAccess );&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- We check length of PostScript here because it will have been nuked by&lt;br /&gt;
	-- the quote parameters. We&#039;d otherwise emit a message even if there wasn&#039;t&lt;br /&gt;
	-- a displayed postscript.&lt;br /&gt;
	-- TODO: Should the max size (1) be configurable?&lt;br /&gt;
	-- TODO: Should we check a specific pattern?&lt;br /&gt;
	if utilities.is_set(PostScript) and mw.ustring.len(PostScript) &amp;gt; 1 then&lt;br /&gt;
		utilities.set_message (&#039;maint_postscript&#039;)&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Archived;&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		if not utilities.is_set (ArchiveDate) then								-- ArchiveURL set but ArchiveDate not set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_missing_date&#039;);					-- emit an error message&lt;br /&gt;
			ArchiveURL = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			ArchiveDate = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	else														&lt;br /&gt;
		if utilities.is_set (ArchiveDate) then									-- ArchiveURL not set but ArchiveDate is set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_date_missing_url&#039;);				-- emit an error message&lt;br /&gt;
			ArchiveURL = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			ArchiveDate = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (ArchiveURL) then&lt;br /&gt;
		local arch_text;&lt;br /&gt;
		if &amp;quot;live&amp;quot; == UrlStatus then&lt;br /&gt;
			if utilities.is_set (ArchiveDate) then&lt;br /&gt;
				Archived = sepc .. &#039; &#039; .. utilities.substitute ( cfg.messages[&#039;archived-live&#039;],&lt;br /&gt;
					{ external_link( ArchiveURL, cs2_lower(cfg.messages[&#039;archived&#039;]), A:ORIGIN(&#039;ArchiveURL&#039;), nil) .. ArchiveFormat, ArchiveDate } );&lt;br /&gt;
			else&lt;br /&gt;
				Archived = &#039;&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			if not utilities.is_set (OriginalURL) then&lt;br /&gt;
				utilities.set_message (&#039;err_archive_missing_url&#039;);&lt;br /&gt;
				Archived = &#039;&#039;;													-- empty string for concatenation&lt;br /&gt;
			end&lt;br /&gt;
		elseif utilities.is_set (OriginalURL) then								-- UrlStatus is empty, &#039;dead&#039;, &#039;unfit&#039;, &#039;usurped&#039;, &#039;bot: unknown&#039;&lt;br /&gt;
			if utilities.in_array (UrlStatus, {&#039;unfit&#039;, &#039;usurped&#039;, &#039;bot: unknown&#039;}) then&lt;br /&gt;
				Archived = sepc .. &#039; &#039; .. utilities.substitute ( cs2_lower(cfg.messages[&#039;archived-unfit&#039;]), ArchiveDate);&lt;br /&gt;
				if &#039;bot: unknown&#039; == UrlStatus then&lt;br /&gt;
					utilities.set_message (&#039;maint_bot_unknown&#039;);				-- and add a category if not already added&lt;br /&gt;
				else&lt;br /&gt;
					utilities.add_prop_cat (&#039;unfit&#039;);							-- and add a category if not already added&lt;br /&gt;
				end&lt;br /&gt;
			else																-- UrlStatus is empty, &#039;dead&#039;&lt;br /&gt;
				if utilities.is_set (ArchiveDate) then&lt;br /&gt;
					Archived = sepc .. &#039; &#039; .. utilities.substitute ( cs2_lower(cfg.messages[&#039;archived-dead&#039;]),&lt;br /&gt;
						{ external_link( OriginalURL, cfg.messages[&#039;original&#039;], OriginalURL_origin, OriginalAccess ) .. OriginalFormat, ArchiveDate } );&lt;br /&gt;
				else&lt;br /&gt;
					Archived = &#039;&#039;;												-- unset for concatenation&lt;br /&gt;
				end&lt;br /&gt;
			end	&lt;br /&gt;
		else																	-- OriginalUrl not set&lt;br /&gt;
			utilities.set_message (&#039;err_archive_missing_url&#039;);&lt;br /&gt;
			Archived = &#039;&#039;;														-- empty string for concatenation&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (ArchiveFormat) then&lt;br /&gt;
		Archived = ArchiveFormat;												-- if set and ArchiveURL not set ArchiveFormat has error message&lt;br /&gt;
	else&lt;br /&gt;
		Archived = &#039;&#039;;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local TranscriptURL = A[&#039;TranscriptURL&#039;]&lt;br /&gt;
	local TranscriptFormat = A[&#039;TranscriptFormat&#039;];&lt;br /&gt;
	TranscriptFormat = style_format (TranscriptFormat, TranscriptURL, &#039;transcript-format&#039;, &#039;transcripturl&#039;);&lt;br /&gt;
	local Transcript = A[&#039;Transcript&#039;];&lt;br /&gt;
	local TranscriptURL_origin = A:ORIGIN(&#039;TranscriptURL&#039;);						-- get name of parameter that holds TranscriptURL&lt;br /&gt;
	if utilities.is_set (Transcript) then&lt;br /&gt;
		if utilities.is_set (TranscriptURL) then&lt;br /&gt;
			Transcript = external_link( TranscriptURL, Transcript, TranscriptURL_origin, nil );&lt;br /&gt;
		end&lt;br /&gt;
		Transcript = sepc .. &#039; &#039; .. Transcript .. TranscriptFormat;&lt;br /&gt;
	elseif utilities.is_set (TranscriptURL) then&lt;br /&gt;
		Transcript = external_link( TranscriptURL, nil, TranscriptURL_origin, nil );&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local Publisher;&lt;br /&gt;
	if utilities.is_set (PublicationDate) then&lt;br /&gt;
		PublicationDate = wrap_msg (&#039;published&#039;, PublicationDate);&lt;br /&gt;
	end&lt;br /&gt;
	if utilities.is_set (PublisherName) then&lt;br /&gt;
		if utilities.is_set (PublicationPlace) then&lt;br /&gt;
			Publisher = sepc .. &amp;quot; &amp;quot; .. PublicationPlace .. &amp;quot;: &amp;quot; .. PublisherName .. PublicationDate;&lt;br /&gt;
		else&lt;br /&gt;
			Publisher = sepc .. &amp;quot; &amp;quot; .. PublisherName .. PublicationDate;  &lt;br /&gt;
		end			&lt;br /&gt;
	elseif utilities.is_set (PublicationPlace) then &lt;br /&gt;
		Publisher= sepc .. &amp;quot; &amp;quot; .. PublicationPlace .. PublicationDate;&lt;br /&gt;
	else &lt;br /&gt;
		Publisher = PublicationDate;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	-- Several of the above rely upon detecting this as nil, so do it last.&lt;br /&gt;
	if (utilities.is_set (Periodical) or utilities.is_set (ScriptPeriodical) or utilities.is_set (TransPeriodical)) then&lt;br /&gt;
		if utilities.is_set (Title) or utilities.is_set (TitleNote) then &lt;br /&gt;
			Periodical = sepc .. &amp;quot; &amp;quot; .. format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);&lt;br /&gt;
		else &lt;br /&gt;
			Periodical = format_periodical (ScriptPeriodical, ScriptPeriodical_origin, Periodical, TransPeriodical, TransPeriodical_origin);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Language = A[&#039;Language&#039;];&lt;br /&gt;
	if utilities.is_set (Language) then&lt;br /&gt;
		Language = language_parameter (Language);								-- format, categories, name from ISO639-1, etc.&lt;br /&gt;
	else&lt;br /&gt;
		Language=&#039;&#039;;															-- language not specified so make sure this is an empty string;&lt;br /&gt;
	--[[ TODO: need to extract the wrap_msg from language_parameter&lt;br /&gt;
	so that we can solve parentheses bunching problem with Format/Language/TitleType&lt;br /&gt;
	]]&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	--[[&lt;br /&gt;
	Handle the oddity that is cite speech.  This code overrides whatever may be the value assigned to TitleNote (through |department=) and forces it to be &amp;quot; (Speech)&amp;quot; so that&lt;br /&gt;
	the annotation directly follows the |title= parameter value in the citation rather than the |event= parameter value (if provided).&lt;br /&gt;
	]]&lt;br /&gt;
	if &amp;quot;speech&amp;quot; == config.CitationClass then									-- cite speech only&lt;br /&gt;
		TitleNote = TitleType;													-- move TitleType to TitleNote so that it renders ahead of |event=&lt;br /&gt;
		TitleType = &#039;&#039;;															-- and unset&lt;br /&gt;
&lt;br /&gt;
		if utilities.is_set (Periodical) then									-- if Periodical, perhaps because of an included |website= or |journal= parameter &lt;br /&gt;
			if utilities.is_set (Conference) then								-- and if |event= is set&lt;br /&gt;
				Conference = Conference .. sepc .. &amp;quot; &amp;quot;;							-- then add appropriate punctuation to the end of the Conference variable before rendering&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Piece all bits together at last.  Here, all should be non-nil.&lt;br /&gt;
	-- We build things this way because it is more efficient in LUA&lt;br /&gt;
	-- not to keep reassigning to the same string variable over and over.&lt;br /&gt;
&lt;br /&gt;
	local tcommon;&lt;br /&gt;
	local tcommon2;																-- used for book cite when |contributor= is set&lt;br /&gt;
	local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;&lt;br /&gt;
--	Volume = safe_join ({Volume, pgtext}, sepc);&lt;br /&gt;
	&lt;br /&gt;
	if utilities.in_array (config.CitationClass, {&amp;quot;book&amp;quot;, &amp;quot;citation&amp;quot;}) and not utilities.is_set (Periodical) then		-- special cases for book cites&lt;br /&gt;
		if utilities.is_set (Contributors) then									-- when we are citing foreword, preface, introduction, etc.&lt;br /&gt;
			tcommon = safe_join ({Title, TitleNote}, sepc);						-- author and other stuff will come after this and before tcommon2&lt;br /&gt;
			tcommon2 = safe_join ({TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);&lt;br /&gt;
		else&lt;br /&gt;
			tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Volume, Others, Edition, Publisher}, sepc);&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
	elseif &#039;map&#039; == config.CitationClass then									-- special cases for cite map&lt;br /&gt;
		if utilities.is_set (Chapter) then										-- map in a book; TitleType is part of Chapter&lt;br /&gt;
			tcommon = safe_join ({Title, Edition, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);&lt;br /&gt;
		elseif utilities.is_set (Periodical) then								-- map in a periodical&lt;br /&gt;
			tcommon = safe_join ({Title, TitleType, Periodical, Scale, Series, Language, Cartography, Others, Publisher, Volume}, sepc);&lt;br /&gt;
		else																	-- a sheet or stand-alone map&lt;br /&gt;
			tcommon = safe_join ({Title, TitleType, Edition, Scale, Series, Language, Cartography, Others, Publisher}, sepc);&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
	elseif &#039;episode&#039; == config.CitationClass then								-- special case for cite episode&lt;br /&gt;
		tcommon = safe_join ({Title, TitleNote, TitleType, Series, Language, Edition, Publisher}, sepc);&lt;br /&gt;
&lt;br /&gt;
	else																		-- all other CS1 templates&lt;br /&gt;
		tcommon = safe_join ({Title, TitleNote, Conference, Periodical, TitleType, Series, Language, Volume, Others, Edition, Publisher, Agency}, sepc);&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if #ID_list &amp;gt; 0 then&lt;br /&gt;
		ID_list = safe_join( { sepc .. &amp;quot; &amp;quot;,  table.concat( ID_list, sepc .. &amp;quot; &amp;quot; ), ID }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		ID_list = ID;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local Via = A[&#039;Via&#039;];&lt;br /&gt;
	Via = utilities.is_set (Via) and  wrap_msg (&#039;via&#039;, Via) or &#039;&#039;;&lt;br /&gt;
	local idcommon;&lt;br /&gt;
	if &#039;audio-visual&#039; == config.CitationClass or &#039;episode&#039; == config.CitationClass then	-- special case for cite AV media &amp;amp; cite episode position transcript&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, Transcript, AccessDate, Via, Quote }, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		idcommon = safe_join( { ID_list, URL, Archived, AccessDate, Via, Quote }, sepc );&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local text;&lt;br /&gt;
--	local pgtext = Position .. Sheet .. Sheets .. Page .. Pages .. At;&lt;br /&gt;
&lt;br /&gt;
	local OrigDate = A[&#039;OrigDate&#039;];&lt;br /&gt;
	OrigDate = utilities.is_set (OrigDate) and wrap_msg (&#039;origdate&#039;, OrigDate) or &#039;&#039;;&lt;br /&gt;
	if utilities.is_set (Date) then&lt;br /&gt;
		if utilities.is_set (Authors) or utilities.is_set (Editors) then		-- date follows authors or editors when authors not set&lt;br /&gt;
			Date = &amp;quot; (&amp;quot; .. Date .. &amp;quot;)&amp;quot; .. OrigDate .. sepc .. &amp;quot; &amp;quot;;				-- in parentheses&lt;br /&gt;
		else																	-- neither of authors and editors set&lt;br /&gt;
			if (string.sub(tcommon, -1, -1) == sepc) then						-- if the last character of tcommon is sepc&lt;br /&gt;
				Date = &amp;quot; &amp;quot; .. Date .. OrigDate;									-- Date does not begin with sepc&lt;br /&gt;
			else&lt;br /&gt;
				Date = sepc .. &amp;quot; &amp;quot; .. Date .. OrigDate;							-- Date begins with sepc&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
	if utilities.is_set (Authors) then&lt;br /&gt;
		if (not utilities.is_set (Date)) then									-- when date is set it&#039;s in parentheses; no Authors termination&lt;br /&gt;
			Authors = terminate_name_list (Authors, sepc);						-- when no date, terminate with 0 or 1 sepc and a space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Editors) then&lt;br /&gt;
			local in_text = &#039;&#039;;&lt;br /&gt;
			local post_text = &#039;&#039;;&lt;br /&gt;
			if utilities.is_set (Chapter) and 0 == #c then&lt;br /&gt;
				in_text = cfg.messages[&#039;in&#039;] .. &#039; &#039;;&lt;br /&gt;
				in_text = cs2_lower(in_text);									-- lowercase for cs2&lt;br /&gt;
			end&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				post_text = &#039; (&#039; .. cfg.messages[&#039;editor&#039;] .. &#039;)&#039;;				-- be consistent with no-author, no-date case&lt;br /&gt;
			else&lt;br /&gt;
				post_text = &#039; (&#039; .. cfg.messages[&#039;editors&#039;] .. &#039;)&#039;;&lt;br /&gt;
			end&lt;br /&gt;
			Editors = terminate_name_list (in_text .. Editors .. post_text, sepc);	-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
		end&lt;br /&gt;
		if utilities.is_set (Contributors) then									-- book cite and we&#039;re citing the intro, preface, etc.&lt;br /&gt;
			local by_text = sepc .. &#039; &#039; .. cfg.messages[&#039;by&#039;] .. &#039; &#039;;&lt;br /&gt;
			by_text = cs2_lower(by_text);										-- lowercase for cs2&lt;br /&gt;
			Authors = by_text .. Authors;										-- author follows title so tweak it here&lt;br /&gt;
			if utilities.is_set (Editors) and utilities.is_set (Date) then		-- when Editors make sure that Authors gets terminated&lt;br /&gt;
				Authors = terminate_name_list (Authors, sepc);					-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
			end&lt;br /&gt;
			if (not utilities.is_set (Date)) then								-- when date is set it&#039;s in parentheses; no Contributors termination&lt;br /&gt;
				Contributors = terminate_name_list (Contributors, sepc);		-- terminate with 0 or 1 sepc and a space&lt;br /&gt;
			end&lt;br /&gt;
			text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, pgtext, idcommon }, sepc );&lt;br /&gt;
--			text = safe_join( {Contributors, Date, Chapter, tcommon, Authors, Place, Editors, tcommon2, idcommon }, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, pgtext, idcommon }, sepc );&lt;br /&gt;
--			text = safe_join( {Authors, Date, Chapter, Place, Editors, tcommon, idcommon }, sepc );&lt;br /&gt;
		end&lt;br /&gt;
	elseif utilities.is_set (Editors) then&lt;br /&gt;
		if utilities.is_set (Date) then&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				Editors = Editors .. cfg.presentation[&#039;sep_name&#039;] .. cfg.messages[&#039;editor&#039;];&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. cfg.presentation[&#039;sep_name&#039;] .. cfg.messages[&#039;editors&#039;];&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			if EditorCount &amp;lt;= 1 then&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages[&#039;editor&#039;] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			else&lt;br /&gt;
				Editors = Editors .. &amp;quot; (&amp;quot; .. cfg.messages[&#039;editors&#039;] .. &amp;quot;)&amp;quot; .. sepc .. &amp;quot; &amp;quot;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		text = safe_join( {Editors, Date, Chapter, Place, tcommon, pgtext, idcommon}, sepc );&lt;br /&gt;
--		text = safe_join( {Editors, Date, Chapter, Place, tcommon, idcommon}, sepc );&lt;br /&gt;
	else&lt;br /&gt;
		if utilities.in_array (config.CitationClass, {&amp;quot;journal&amp;quot;, &amp;quot;citation&amp;quot;}) and utilities.is_set (Periodical) then&lt;br /&gt;
			text = safe_join( {Chapter, Place, tcommon, pgtext, Date, idcommon}, sepc );&lt;br /&gt;
--			text = safe_join( {Chapter, Place, tcommon, Date, idcommon}, sepc );&lt;br /&gt;
		else&lt;br /&gt;
			text = safe_join( {Chapter, Place, tcommon, Date, pgtext, idcommon}, sepc );&lt;br /&gt;
--			text = safe_join( {Chapter, Place, tcommon, Date, idcommon}, sepc );&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (PostScript) and PostScript ~= sepc then&lt;br /&gt;
		text = safe_join( {text, sepc}, sepc ); 								-- Deals with italics, spaces, etc.&lt;br /&gt;
		if &#039;.&#039; == sepc then														-- remove final seperator if present&lt;br /&gt;
			text = text:gsub (&#039;%&#039; .. sepc .. &#039;$&#039;, &#039;&#039;);							-- dot must be escaped here&lt;br /&gt;
		else&lt;br /&gt;
			text = mw.ustring.gsub (text, sepc .. &#039;$&#039;, &#039;&#039;);						-- using ustring for non-dot sepc (likely a non-Latin character)&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
	&lt;br /&gt;
	text = safe_join( {text, PostScript}, sepc );&lt;br /&gt;
&lt;br /&gt;
	-- Now enclose the whole thing in a &amp;lt;cite&amp;gt; element&lt;br /&gt;
	local options_t = {};&lt;br /&gt;
	options_t.class = cite_class_attribute_make (config.CitationClass, Mode);&lt;br /&gt;
&lt;br /&gt;
	local Ref = is_valid_parameter_value (A[&#039;Ref&#039;], A:ORIGIN(&#039;Ref&#039;), cfg.keywords_lists[&#039;ref&#039;], nil, true);	-- nil when |ref=harv; A[&#039;Ref&#039;] else&lt;br /&gt;
&lt;br /&gt;
	if &#039;none&#039; ~= cfg.keywords_xlate[(Ref and Ref:lower()) or &#039;&#039;] then&lt;br /&gt;
		local namelist_t = {};													-- holds selected contributor, author, editor name list&lt;br /&gt;
		local year = first_set ({Year, anchor_year}, 2);						-- Year first for legacy citations and for YMD dates that require disambiguation&lt;br /&gt;
&lt;br /&gt;
		if #c &amp;gt; 0 then															-- if there is a contributor list&lt;br /&gt;
			namelist_t = c;														-- select it&lt;br /&gt;
		elseif #a &amp;gt; 0 then														-- or an author list&lt;br /&gt;
			namelist_t = a;&lt;br /&gt;
		elseif #e &amp;gt; 0 then														-- or an editor list&lt;br /&gt;
			namelist_t = e;&lt;br /&gt;
		end&lt;br /&gt;
		local citeref_id;&lt;br /&gt;
		if #namelist_t &amp;gt; 0 then													-- if there are names in namelist_t&lt;br /&gt;
			citeref_id = make_citeref_id (namelist_t, year);					-- go make the CITEREF anchor&lt;br /&gt;
			if mw.uri.anchorEncode (citeref_id) == ((Ref and mw.uri.anchorEncode (Ref)) or &#039;&#039;) then	-- Ref may already be encoded (by {{sfnref}}) so citeref_id must be encoded before comparison&lt;br /&gt;
				utilities.set_message (&#039;maint_ref_duplicates_default&#039;);&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			citeref_id = &#039;&#039;;													-- unset&lt;br /&gt;
		end&lt;br /&gt;
		options_t.id = Ref or citeref_id;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if string.len (text:gsub(&#039;%b&amp;lt;&amp;gt;&#039;, &#039;&#039;)) &amp;lt;= 2 then								-- remove html and html-like tags; then get length of what remains; &lt;br /&gt;
		z.error_cats_t = {};													-- blank the categories list&lt;br /&gt;
		z.error_msgs_t = {};													-- blank the error messages list&lt;br /&gt;
		OCinSoutput = nil;														-- blank the metadata string&lt;br /&gt;
		text = &#039;&#039;;																-- blank the the citation&lt;br /&gt;
		utilities.set_message (&#039;err_empty_citation&#039;);							-- set empty citation message and category&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local render_t = {};														-- here we collect the final bits for concatenation into the rendered citation&lt;br /&gt;
&lt;br /&gt;
	if is_preview_mode and (0 ~= #z.error_msgs_t or 0 ~= #z.maint_cats_t) then	-- when in preview mode&lt;br /&gt;
		if not utilities.is_set (options_t.id) then								-- and when this template has not created an anchor ID&lt;br /&gt;
            math.randomseed (tonumber (mw.getLanguage (&#039;en&#039;):formatDate (&#039;U&#039;)) * 10000 + os.clock() * 10000);&lt;br /&gt;
			options_t.id = &#039;CITEREF_temp_preview_id_&#039; .. math.random (100000, 999999);	-- create temporary anchor ID for preview mode&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.is_set (options_t.id) then										-- here we wrap the rendered citation in &amp;lt;cite ...&amp;gt;...&amp;lt;/cite&amp;gt; tags&lt;br /&gt;
		options_t.id = mw.uri.anchorEncode(options_t.id);						-- do this here; also used when adding preview warning messages&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;cite-id&#039;], {options_t.id, mw.text.nowiki(options_t.class), text}));	-- when |ref= is set or when there is a namelist&lt;br /&gt;
	else&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;cite&#039;], {mw.text.nowiki(options_t.class), text}));	-- when |ref=none or when namelist_t empty and |ref= is missing or is empty&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if OCinSoutput then															-- blanked when citation is &#039;empty&#039; so don&#039;t bother to add boilerplate metadata span&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;ocins&#039;], OCinSoutput));	-- format and append metadata to the citation&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local template_name = cfg.citation_class_map_t[config.CitationClass];&lt;br /&gt;
	local template_link = &#039;[[Template:&#039; .. template_name .. &#039;|&#039; .. template_name .. &#039;]]&#039;;&lt;br /&gt;
	local msg_prefix = &#039;&amp;lt;code class=&amp;quot;cs1-code&amp;quot;&amp;gt;{{&#039; .. template_link .. &#039;}}&amp;lt;/code&amp;gt;: &#039;;&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #z.error_msgs_t then&lt;br /&gt;
		mw.addWarning (utilities.substitute (cfg.messages.warning_msg_e, {template_link, options_t.id}));&lt;br /&gt;
&lt;br /&gt;
		table.insert (render_t, &#039; &#039;);											-- insert a space between citation and its error messages&lt;br /&gt;
		table.sort (z.error_msgs_t);											-- sort the error messages list; sorting includes wrapping &amp;lt;span&amp;gt; and &amp;lt;code&amp;gt; tags; hidden-error sorts ahead of visible-error&lt;br /&gt;
&lt;br /&gt;
		local hidden = true;													-- presume that the only error messages emited by this template are hidden&lt;br /&gt;
		for _, v in ipairs (z.error_msgs_t) do									-- spin through the list of error messages&lt;br /&gt;
			if v:find (&#039;cs1-visible-error&#039;, 1, true) then						-- look for the visible error class name&lt;br /&gt;
				hidden = false;													-- found one; so don&#039;t hide the error message prefix&lt;br /&gt;
				break;															-- and done because no need to look further&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		z.error_msgs_t[1] = table.concat ({utilities.error_comment (msg_prefix, hidden), z.error_msgs_t[1]});	-- add error message prefix to first error message to prevent extraneous punctuation&lt;br /&gt;
		table.insert (render_t, table.concat (z.error_msgs_t, &#039;; &#039;));			-- make a big string of error messages and add it to the rendering&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #z.maint_cats_t then&lt;br /&gt;
		mw.addWarning (utilities.substitute (cfg.messages.warning_msg_m, {template_link, options_t.id}));&lt;br /&gt;
&lt;br /&gt;
		table.sort (z.maint_cats_t);											-- sort the maintenance messages list&lt;br /&gt;
&lt;br /&gt;
		local maint_msgs_t = {};												-- here we collect all of the maint messages&lt;br /&gt;
&lt;br /&gt;
		if 0 == #z.error_msgs_t then											-- if no error messages&lt;br /&gt;
			table.insert (maint_msgs_t, msg_prefix);							-- insert message prefix in maint message livery&lt;br /&gt;
		end&lt;br /&gt;
		&lt;br /&gt;
		for _, v in ipairs( z.maint_cats_t ) do									-- append maintenance categories&lt;br /&gt;
			table.insert (maint_msgs_t, 										-- assemble new maint message and add it to the maint_msgs_t table&lt;br /&gt;
				table.concat ({v, &#039; (&#039;, utilities.substitute (cfg.messages[&#039;:cat wikilink&#039;], v), &#039;)&#039;})&lt;br /&gt;
				);&lt;br /&gt;
		end&lt;br /&gt;
		table.insert (render_t, utilities.substitute (cfg.presentation[&#039;hidden-maint&#039;], table.concat (maint_msgs_t, &#039; &#039;)));	-- wrap the group of maint messages with proper presentation and save&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if not no_tracking_cats then&lt;br /&gt;
		local sort_key;&lt;br /&gt;
		local cat_wikilink = &#039;cat wikilink&#039;;&lt;br /&gt;
		if cfg.enable_sort_keys then											-- when namespace sort keys enabled&lt;br /&gt;
			local namespace_number = mw.title.getCurrentTitle().namespace;		-- get namespace number for this wikitext&lt;br /&gt;
			sort_key = (0 ~= namespace_number and (cfg.name_space_sort_keys[namespace_number] or cfg.name_space_sort_keys.other)) or nil;	-- get sort key character; nil for mainspace&lt;br /&gt;
			cat_wikilink = (not sort_key and &#039;cat wikilink&#039;) or &#039;cat wikilink sk&#039;;	-- make &amp;lt;cfg.messages&amp;gt; key&lt;br /&gt;
		end				&lt;br /&gt;
&lt;br /&gt;
		for _, v in ipairs (z.error_cats_t) do									-- append error categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));&lt;br /&gt;
		end&lt;br /&gt;
		if cfg.id_limits_data_load_fail then									-- boolean true when load failed&lt;br /&gt;
			utilities.set_message (&#039;maint_id_limit_load_fail&#039;);					-- done here because this maint cat emits no message&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (z.maint_cats_t) do									-- append maintenance categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[cat_wikilink], {v, sort_key}));&lt;br /&gt;
		end&lt;br /&gt;
		for _, v in ipairs (z.prop_cats_t) do									-- append properties categories&lt;br /&gt;
			table.insert (render_t, utilities.substitute (cfg.messages[&#039;cat wikilink&#039;], v));	-- no sort keys&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return table.concat (render_t);												-- make a big string and done&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; V A L I D A T E &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Looks for a parameter&#039;s name in one of several whitelists.&lt;br /&gt;
&lt;br /&gt;
Parameters in the whitelist can have three values:&lt;br /&gt;
	true - active, supported parameters&lt;br /&gt;
	false - deprecated, supported parameters&lt;br /&gt;
	nil - unsupported parameters&lt;br /&gt;
	&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function validate (name, cite_class, empty)&lt;br /&gt;
	local name = tostring (name);&lt;br /&gt;
	local enum_name;															-- parameter name with enumerator (if any) replaced with &#039;#&#039;&lt;br /&gt;
	local state;&lt;br /&gt;
	local function state_test (state, name)										-- local function to do testing of state values&lt;br /&gt;
		if true == state then return true; end									-- valid actively supported parameter&lt;br /&gt;
		if false == state then&lt;br /&gt;
			if empty then return nil; end										-- empty deprecated parameters are treated as unknowns&lt;br /&gt;
			deprecated_parameter (name);										-- parameter is deprecated but still supported&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
		if &#039;tracked&#039; == state then&lt;br /&gt;
			local base_name = name:gsub (&#039;%d&#039;, &#039;&#039;);								-- strip enumerators from parameter names that have them to get the base name&lt;br /&gt;
			utilities.add_prop_cat (&#039;tracked-param&#039;, {base_name}, base_name);	-- add a properties category; &amp;lt;base_name&amp;gt; modifies &amp;lt;key&amp;gt;&lt;br /&gt;
			return true;&lt;br /&gt;
		end&lt;br /&gt;
		return nil;&lt;br /&gt;
	end		&lt;br /&gt;
&lt;br /&gt;
	if name:find (&#039;#&#039;) then														-- # is a cs1|2 reserved character so parameters with # not permitted&lt;br /&gt;
		return nil;&lt;br /&gt;
	end&lt;br /&gt;
																				-- replace enumerator digit(s) with # (|last25= becomes |last#=) (mw.ustring because non-Western &#039;local&#039; digits)&lt;br /&gt;
	enum_name = mw.ustring.gsub (name, &#039;%d+$&#039;, &#039;#&#039;);							-- where enumerator is last charaters in parameter name (these to protect |s2cid=)&lt;br /&gt;
	enum_name = mw.ustring.gsub (enum_name, &#039;%d+([%-l])&#039;, &#039;#%1&#039;);				-- where enumerator is in the middle of the parameter name; |author#link= is the oddity&lt;br /&gt;
&lt;br /&gt;
	if &#039;document&#039; == cite_class then											-- special case for {{cite document}}&lt;br /&gt;
		state = whitelist.document_parameters_t[enum_name];						-- this list holds enumerated and nonenumerated parameters&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
		&lt;br /&gt;
		return false;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.preprint_template_list_t) then	-- limited parameter sets allowed for these templates&lt;br /&gt;
		state = whitelist.limited_parameters_t[enum_name];						-- this list holds enumerated and nonenumerated parameters&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		state = whitelist.preprint_arguments_t[cite_class][name];				-- look in the parameter-list for the template identified by cite_class&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
		return false;															-- not supported because not found or name is set to nil&lt;br /&gt;
	end																			-- end limited parameter-set templates&lt;br /&gt;
&lt;br /&gt;
	if utilities.in_array (cite_class, whitelist.unique_param_template_list_t) then 	-- template-specific parameters for templates that accept parameters from the basic argument list&lt;br /&gt;
		state = whitelist.unique_arguments_t[cite_class][name];					-- look in the template-specific parameter-lists for the template identified by cite_class&lt;br /&gt;
		if true == state_test (state, name) then return true; end&lt;br /&gt;
	end																			-- if here, fall into general validation&lt;br /&gt;
&lt;br /&gt;
	state = whitelist.common_parameters_t[enum_name];							-- all other templates; all normal parameters allowed; this list holds enumerated and nonenumerated parameters&lt;br /&gt;
	if true == state_test (state, name) then return true; end&lt;br /&gt;
&lt;br /&gt;
	return false;																-- not supported because not found or name is set to nil&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[-------------------------&amp;lt; I N T E R _ W I K I _ C H E C K &amp;gt;----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
check &amp;lt;value&amp;gt; for inter-language interwiki-link markup.  &amp;lt;prefix&amp;gt; must be a MediaWiki-recognized language&lt;br /&gt;
code.  when these values have the form (without leading colon):&lt;br /&gt;
	[[&amp;lt;prefix&amp;gt;:link|label]] return label as plain-text&lt;br /&gt;
	[[&amp;lt;prefix&amp;gt;:link]] return &amp;lt;prefix&amp;gt;:link as plain-text&lt;br /&gt;
&lt;br /&gt;
return value as is else&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function inter_wiki_check (parameter, value)&lt;br /&gt;
	local prefix = value:match (&#039;%[%[(%a+):&#039;);									-- get an interwiki prefix if one exists&lt;br /&gt;
	local _;&lt;br /&gt;
	&lt;br /&gt;
	if prefix and cfg.inter_wiki_map[prefix:lower()] then						-- if prefix is in the map, needs preceding colon so&lt;br /&gt;
		utilities.set_message (&#039;err_bad_paramlink&#039;, parameter);					-- emit an error message&lt;br /&gt;
		_, value, _ = utilities.is_wikilink (value);							-- extract label portion from wikilink&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return value;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; M I S S I N G _ P I P E _ C H E C K &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Look at the contents of a parameter. If the content has a string of characters and digits followed by an equal&lt;br /&gt;
sign, compare the alphanumeric string to the list of cs1|2 parameters.  If found, then the string is possibly a&lt;br /&gt;
parameter that is missing its pipe.  There are two tests made:&lt;br /&gt;
	{{cite ... |title=Title access-date=2016-03-17}}	-- the first parameter has a value and whitespace separates that value from the missing pipe parameter name&lt;br /&gt;
	{{cite ... |title=access-date=2016-03-17}}			-- the first parameter has no value (whitespace after the first = is trimmed by MediaWiki)&lt;br /&gt;
cs1|2 shares some parameter names with XML/HTML attributes: class=, title=, etc.  To prevent false positives XML/HTML&lt;br /&gt;
tags are removed before the search.&lt;br /&gt;
&lt;br /&gt;
If a missing pipe is detected, this function adds the missing pipe maintenance category.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function missing_pipe_check (parameter, value)&lt;br /&gt;
	local capture;&lt;br /&gt;
	value = value:gsub (&#039;%b&amp;lt;&amp;gt;&#039;, &#039;&#039;);											-- remove XML/HTML tags because attributes: class=, title=, etc.&lt;br /&gt;
&lt;br /&gt;
	capture = value:match (&#039;%s+(%a[%w%-]+)%s*=&#039;) or value:match (&#039;^(%a[%w%-]+)%s*=&#039;);	-- find and categorize parameters with possible missing pipes&lt;br /&gt;
	if capture and validate (capture) then										-- if the capture is a valid parameter name&lt;br /&gt;
		utilities.set_message (&#039;err_missing_pipe&#039;, parameter);&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ E X T R A N E O U S _ P U N C T &amp;gt;--------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for extraneous terminal punctuation in most parameter values; parameters listed in skip table are not checked&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_extraneous_punc (param, value)&lt;br /&gt;
	if &#039;number&#039; == type (param) then&lt;br /&gt;
		return;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	param = param:gsub (&#039;%d+&#039;, &#039;#&#039;);											-- enumerated name-list mask params allow terminal punct; normalize &lt;br /&gt;
	if cfg.punct_skip[param] then&lt;br /&gt;
		return;																	-- parameter name found in the skip table so done&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	if value:match (&#039;[,;:]$&#039;) then&lt;br /&gt;
		utilities.set_message (&#039;maint_extra_punct&#039;);							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
	if value:match (&#039;^=&#039;) then													-- sometimes an extraneous &#039;=&#039; character appears ...&lt;br /&gt;
		utilities.set_message (&#039;maint_extra_punct&#039;);							-- has extraneous punctuation; add maint cat&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ T W L _ U R L &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for The Wikipedia Library urls in url-holding parameters.  TWL urls are accessible only for readers who are&lt;br /&gt;
active extended confirmed Wikipedia editors.  This function sets an error message when such urls are discovered&lt;br /&gt;
and when appropriate, sets the |&amp;lt;param&amp;gt;-url-access=subscription.  returns nothing.&lt;br /&gt;
&lt;br /&gt;
looks for: &#039;.wikipedialibrary.idm.oclc.org&#039;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_twl_url (url_params_t, cite_args_t)&lt;br /&gt;
	local url_error_t = {};														-- sequence of url-holding parameters that have a TWL url&lt;br /&gt;
	&lt;br /&gt;
	for param, value in pairs (url_params_t) do&lt;br /&gt;
		if value:find (&#039;%.wikipedialibrary%.idm%.oclc%.org&#039;) then				-- has the TWL base url?&lt;br /&gt;
			table.insert (url_error_t, param);									-- add parameter name to the error list&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if 0 ~= #url_error_t then													-- non-zero when there are errors&lt;br /&gt;
		table.sort (url_error_t);												-- sor for error messaging&lt;br /&gt;
		for i, param in ipairs (url_error_t) do&lt;br /&gt;
			if cfg.url_access_map_t[param] then									-- if &amp;lt;param&amp;gt; has a matching -access parameter&lt;br /&gt;
				cite_args_t[cfg.url_access_map_t[param]] = cfg.keywords_xlate.subscription;	-- set |&amp;lt;param&amp;gt;-url-access=subscription&lt;br /&gt;
			end&lt;br /&gt;
			url_error_t[i] = utilities.wrap_style (&#039;parameter&#039;, param);			-- make the parameter pretty for error message&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		utilities.set_message (&#039;err_param_has_twl_url&#039;, {utilities.make_sep_list (#url_error_t, url_error_t)});	-- add this error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; H A S _ E X T R A N E O U S _ U R L &amp;gt;------------------------------------------&lt;br /&gt;
&lt;br /&gt;
look for extraneous url parameter values; parameters listed in skip table are not checked&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function has_extraneous_url (non_url_param_t)&lt;br /&gt;
	local url_error_t = {};&lt;br /&gt;
	&lt;br /&gt;
	check_for_url (non_url_param_t, url_error_t);								-- extraneous url check&lt;br /&gt;
	if 0 ~= #url_error_t then													-- non-zero when there are errors&lt;br /&gt;
		table.sort (url_error_t);&lt;br /&gt;
		utilities.set_message (&#039;err_param_has_ext_link&#039;, {utilities.make_sep_list (#url_error_t, url_error_t)});	-- add this error message&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; _ C I T A T I O N &amp;gt;------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Module entry point&lt;br /&gt;
&lt;br /&gt;
	frame – from template call (citation()); may be nil when called from another module&lt;br /&gt;
	args_t – table of all cs1|2 parameters in the template (the parent frame)&lt;br /&gt;
	config_t – table of template-supplied parameter (the #invoke frame)&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function _citation (frame, args_t, config_t)								-- save a copy in case we need to display an error message in preview mode&lt;br /&gt;
	if not frame then&lt;br /&gt;
		frame = mw.getCurrentFrame();											-- if called from another module, get a frame for frame-provided functions&lt;br /&gt;
	end&lt;br /&gt;
																				-- i18n: set the name that your wiki uses to identify sandbox subpages from sandbox template invoke (or can be set here)&lt;br /&gt;
	local sandbox = ((config_t.SandboxPath and &#039;&#039; ~= config_t.SandboxPath) and config_t.SandboxPath) or &#039;/sandbox&#039;;	-- sandbox path from {{#invoke:Citation/CS1/sandbox|citation|SandboxPath=/...}}&lt;br /&gt;
	is_sandbox = nil ~= string.find (frame:getTitle(), sandbox, 1, true);		-- is this invoke the sandbox module?&lt;br /&gt;
	sandbox = is_sandbox and sandbox or &#039;&#039;;										-- use i18n sandbox to load sandbox modules when this module is the sandox; live modules else&lt;br /&gt;
&lt;br /&gt;
	cfg = mw.loadData (&#039;Module:Citation/CS1/Configuration&#039; .. sandbox);			-- load sandbox versions of support modules when {{#invoke:Citation/CS1/sandbox|...}}; live modules else&lt;br /&gt;
	whitelist = mw.loadData (&#039;Module:Citation/CS1/Whitelist&#039; .. sandbox);&lt;br /&gt;
	utilities = require (&#039;Module:Citation/CS1/Utilities&#039; .. sandbox);&lt;br /&gt;
	validation = require (&#039;Module:Citation/CS1/Date_validation&#039; .. sandbox);&lt;br /&gt;
	identifiers = require (&#039;Module:Citation/CS1/Identifiers&#039; .. sandbox);&lt;br /&gt;
	metadata = require (&#039;Module:Citation/CS1/COinS&#039; .. sandbox);&lt;br /&gt;
&lt;br /&gt;
	utilities.set_selected_modules (cfg);										-- so that functions in Utilities can see the selected cfg tables&lt;br /&gt;
	identifiers.set_selected_modules (cfg, utilities);							-- so that functions in Identifiers can see the selected cfg tables and selected Utilities module&lt;br /&gt;
	validation.set_selected_modules (cfg, utilities);							-- so that functions in Date validataion can see selected cfg tables and the selected Utilities module&lt;br /&gt;
	metadata.set_selected_modules (cfg, utilities);								-- so that functions in COinS can see the selected cfg tables and selected Utilities module&lt;br /&gt;
&lt;br /&gt;
	z = utilities.z;															-- table of error and category tables in Module:Citation/CS1/Utilities&lt;br /&gt;
	local cite_args_t = {};														-- because args_t is the parent (template) frame args (which cannot be modified); params and their values will be placed here&lt;br /&gt;
&lt;br /&gt;
	is_preview_mode = not utilities.is_set (frame:preprocess (&#039;{{REVISIONID}}&#039;));&lt;br /&gt;
&lt;br /&gt;
	local suggestions = {};														-- table where we store suggestions if we need to loadData them&lt;br /&gt;
	local error_text;															-- used as a flag&lt;br /&gt;
&lt;br /&gt;
	local capture;																-- the single supported capture when matching unknown parameters using patterns&lt;br /&gt;
	local empty_unknowns = {};													-- sequence table to hold empty unknown params for error message listing&lt;br /&gt;
	for k, v in pairs (args_t) do												-- get parameters from the parent (template) frame&lt;br /&gt;
		v = mw.ustring.gsub (v, &#039;^%s*(.-)%s*$&#039;, &#039;%1&#039;);							-- trim leading/trailing whitespace; when v is only whitespace, becomes empty string&lt;br /&gt;
		if v ~= &#039;&#039; then&lt;br /&gt;
			if cfg.enum_needs_xlation and &#039;string&#039; == type (k) then				-- for wikis that set date_names[&#039;local_digits&#039;] to non-western digits&lt;br /&gt;
			    k = mw.ustring.gsub (k, &#039;%d&#039;, cfg.date_names.local_digits);		-- translate &#039;local&#039; digits enumerators to Western 0-9&lt;br /&gt;
			end&lt;br /&gt;
			if not validate( k, config_t.CitationClass ) then			&lt;br /&gt;
				if type (k) ~= &#039;string&#039; then									-- exclude empty numbered parameters&lt;br /&gt;
					if v:match(&amp;quot;%S+&amp;quot;) ~= nil then&lt;br /&gt;
						error_text = utilities.set_message (&#039;err_text_ignored&#039;, {v});&lt;br /&gt;
					end&lt;br /&gt;
				elseif validate (k:lower(), config_t.CitationClass) then &lt;br /&gt;
					error_text = utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, k:lower()});	-- suggest the lowercase version of the parameter&lt;br /&gt;
				else&lt;br /&gt;
					if nil == suggestions.suggestions then						-- if this table is nil then we need to load it&lt;br /&gt;
						suggestions = mw.loadData (&#039;Module:Citation/CS1/Suggestions&#039; .. sandbox);	--load sandbox version of suggestion module when {{#invoke:Citation/CS1/sandbox|...}}; live module else&lt;br /&gt;
					end&lt;br /&gt;
					for pattern, param in pairs (suggestions.patterns) do		-- loop through the patterns to see if we can suggest a proper parameter&lt;br /&gt;
						capture = k:match (pattern);							-- the whole match if no capture in pattern else the capture if a match&lt;br /&gt;
						if capture then											-- if the pattern matches &lt;br /&gt;
							param = utilities.substitute (param, capture);		-- add the capture to the suggested parameter (typically the enumerator)&lt;br /&gt;
							if validate (param, config_t.CitationClass) then		-- validate the suggestion to make sure that the suggestion is supported by this template (necessary for limited parameter lists)&lt;br /&gt;
								error_text = utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, param});	-- set the suggestion error message&lt;br /&gt;
							else&lt;br /&gt;
								error_text = utilities.set_message (&#039;err_parameter_ignored&#039;, {k});	-- suggested param not supported by this template&lt;br /&gt;
								v = &#039;&#039;;											-- unset&lt;br /&gt;
							end&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
					if not utilities.is_set (error_text) then					-- couldn&#039;t match with a pattern, is there an explicit suggestion?						&lt;br /&gt;
						if (suggestions.suggestions[ k:lower() ] ~= nil) and validate (suggestions.suggestions[ k:lower() ], config_t.CitationClass) then&lt;br /&gt;
							utilities.set_message (&#039;err_parameter_ignored_suggest&#039;, {k, suggestions.suggestions[ k:lower() ]});&lt;br /&gt;
						else&lt;br /&gt;
							utilities.set_message (&#039;err_parameter_ignored&#039;, {k});&lt;br /&gt;
							v = &#039;&#039;;												-- unset value assigned to unrecognized parameters (this for the limited parameter lists)&lt;br /&gt;
						end&lt;br /&gt;
					end&lt;br /&gt;
				end				  &lt;br /&gt;
			end&lt;br /&gt;
&lt;br /&gt;
			cite_args_t[k] = v;													-- save this parameter and its value&lt;br /&gt;
&lt;br /&gt;
		elseif not utilities.is_set (v) then									-- for empty parameters&lt;br /&gt;
			if not validate (k, config_t.CitationClass, true) then				-- is this empty parameter a valid parameter&lt;br /&gt;
				k = (&#039;&#039; == k) and cfg.err_msg_supl.empty_str or k;				-- when k is empty string (or was space(s) trimmed to empty string), replace with descriptive text&lt;br /&gt;
				table.insert (empty_unknowns, utilities.wrap_style (&#039;parameter&#039;, k));	-- format for error message and add to the list&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end	&lt;br /&gt;
&lt;br /&gt;
	if 0 ~= #empty_unknowns then												-- create empty unknown error message&lt;br /&gt;
		utilities.set_message (&#039;err_param_unknown_empty&#039;, {&lt;br /&gt;
			1 == #empty_unknowns and &#039;&#039; or &#039;s&#039;,&lt;br /&gt;
			utilities.make_sep_list (#empty_unknowns, empty_unknowns)&lt;br /&gt;
			});&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	local non_url_param_t = {};													-- table of parameters and values that are not url-holding parameters&lt;br /&gt;
	local url_param_t = {};														-- table of url-holding paramters and their values&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (cite_args_t) do&lt;br /&gt;
&lt;br /&gt;
		if &#039;string&#039; == type (k) then											-- don&#039;t evaluate positional parameters&lt;br /&gt;
			has_invisible_chars (k, v);											-- look for invisible characters&lt;br /&gt;
		end&lt;br /&gt;
		has_extraneous_punc (k, v);												-- look for extraneous terminal punctuation in parameter values&lt;br /&gt;
		missing_pipe_check (k, v);												-- do we think that there is a parameter that is missing a pipe?&lt;br /&gt;
		cite_args_t[k] = inter_wiki_check (k, v);								-- when language interwiki-linked parameter missing leading colon replace with wiki-link label&lt;br /&gt;
&lt;br /&gt;
		if &#039;string&#039; == type (k) then											-- when parameter k is not positional&lt;br /&gt;
			if not cfg.url_skip[k] then											-- and not in url skip table&lt;br /&gt;
				non_url_param_t[k] = v;											-- make a parameter/value list for extraneous url check&lt;br /&gt;
			else																-- and is in url skip table (a url-holding parameter)&lt;br /&gt;
				url_param_t[k] = v;												-- make a parameter/value list to check for values that are The Wikipedia Library url&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if cfg.suppress_archive_today_urls then&lt;br /&gt;
		has_archive_today_url (cite_args_t);									-- look for and suppress archive.today urls and dependent parameters for all templates&lt;br /&gt;
	end&lt;br /&gt;
	has_extraneous_url (non_url_param_t);										-- look for url in parameter values where a url does not belong&lt;br /&gt;
	has_twl_url (url_param_t, cite_args_t);										-- look for url-holding parameters that hold a The Wikipedia Library url&lt;br /&gt;
&lt;br /&gt;
	return table.concat ({&lt;br /&gt;
		frame:extensionTag (&#039;templatestyles&#039;, &#039;&#039;, {src=&#039;Module:Citation/CS1&#039; .. sandbox .. &#039;/styles.css&#039;}),&lt;br /&gt;
		citation0 (config_t, cite_args_t)&lt;br /&gt;
	});&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; C I T A T I O N &amp;gt;--------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template entry point&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function citation (frame)&lt;br /&gt;
	local config_t = {};														-- table to store parameters from the module {{#invoke:}}&lt;br /&gt;
	local args_t = frame:getParent().args;										-- get template&#039;s preset parameters&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame.args) do											-- get parameters from the {{#invoke}} frame&lt;br /&gt;
		config_t[k] = v;&lt;br /&gt;
	--	args_t[k] = v;															-- crude debug support that allows us to render a citation from module {{#invoke:}}; skips parameter validation; TODO: keep?&lt;br /&gt;
	end	&lt;br /&gt;
	return _citation (frame, args_t, config_t)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	citation = citation,														-- template entry point&lt;br /&gt;
	&lt;br /&gt;
	_citation = _citation,														-- module entry point&lt;br /&gt;
	}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Encodefirst&amp;diff=602</id>
		<title>Template:Encodefirst</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Encodefirst&amp;diff=602"/>
		<updated>2026-06-06T21:26:58Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;{{#invoke:MultiReplace|main|1={{{1}}}|2=^:|3=&amp;amp;#58;|4=^;|5=&amp;amp;#59;|6=^*|7=&amp;amp;#42;|8=^#|9=&amp;amp;#35;}}&amp;lt;noinclude&amp;gt; {{Documentation}} &amp;lt;/noinclude&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{#invoke:MultiReplace|main|1={{{1}}}|2=^:|3=&amp;amp;#58;|4=^;|5=&amp;amp;#59;|6=^*|7=&amp;amp;#42;|8=^#|9=&amp;amp;#35;}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:MultiReplace&amp;diff=601</id>
		<title>Module:MultiReplace</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:MultiReplace&amp;diff=601"/>
		<updated>2026-06-06T21:26:49Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;local p = {}  local function MultiReplace(args) 	local input = args[1] or &amp;quot;{{{1}}}&amp;quot; 	local plain = args.plain == &amp;quot;yes&amp;quot;  	local i = 1 	local changeList = {} 	while args[i * 2] do 		local change = {pattern = args[i * 2], repl = args[i * 2 + 1]} 		if not change.repl then 			return require(&amp;#039;Module:Error&amp;#039;).error{ 				&amp;#039;MultiReplace: Unpaired argument: &amp;lt;code&amp;gt;&amp;#039; .. (i * 2) .. &amp;#039; = &amp;#039; .. mw.text.nowiki(change.pattern) .. &amp;#039;&amp;lt;/code&amp;gt;&amp;#039; 			} 		end 		changeList[i] = change 		i = i + 1 	end...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;local p = {}&lt;br /&gt;
&lt;br /&gt;
local function MultiReplace(args)&lt;br /&gt;
	local input = args[1] or &amp;quot;{{{1}}}&amp;quot;&lt;br /&gt;
	local plain = args.plain == &amp;quot;yes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
	local i = 1&lt;br /&gt;
	local changeList = {}&lt;br /&gt;
	while args[i * 2] do&lt;br /&gt;
		local change = {pattern = args[i * 2], repl = args[i * 2 + 1]}&lt;br /&gt;
		if not change.repl then&lt;br /&gt;
			return require(&#039;Module:Error&#039;).error{&lt;br /&gt;
				&#039;MultiReplace: Unpaired argument: &amp;lt;code&amp;gt;&#039; .. (i * 2) .. &#039; = &#039; .. mw.text.nowiki(change.pattern) .. &#039;&amp;lt;/code&amp;gt;&#039;&lt;br /&gt;
			}&lt;br /&gt;
		end&lt;br /&gt;
		changeList[i] = change&lt;br /&gt;
		i = i + 1&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local matchList = {}&lt;br /&gt;
	local pos = 1&lt;br /&gt;
	local len = mw.ustring.len(input)&lt;br /&gt;
	local result = &amp;quot;&amp;quot;&lt;br /&gt;
	while pos &amp;lt;= len do&lt;br /&gt;
		local bestStart = len + 1&lt;br /&gt;
		local bestStop = len&lt;br /&gt;
		local bestChange&lt;br /&gt;
		for _, change in ipairs(changeList) do&lt;br /&gt;
			local start, stop = mw.ustring.find(input, change.pattern, pos, plain)&lt;br /&gt;
			if start and (start &amp;lt; bestStart) then&lt;br /&gt;
				bestStart = start&lt;br /&gt;
				bestStop = stop&lt;br /&gt;
				bestChange = change&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		result = result .. mw.ustring.sub(input, pos, bestStart - 1)&lt;br /&gt;
		if bestChange then&lt;br /&gt;
			local fragment = mw.ustring.sub(input, bestStart, bestStop)&lt;br /&gt;
			result = result .. (plain and bestChange.repl or&lt;br /&gt;
				mw.ustring.gsub(fragment, bestChange.pattern, bestChange.repl, 1))&lt;br /&gt;
		end&lt;br /&gt;
		pos = bestStop + 1&lt;br /&gt;
	end&lt;br /&gt;
	return result&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function p.main(frame, ...)&lt;br /&gt;
	local args =&lt;br /&gt;
		type(frame) ~= &#039;table&#039; and {frame, ...} or&lt;br /&gt;
		type(frame.args) ~= &#039;table&#039; and frame or&lt;br /&gt;
		frame.args[1] and frame.args or&lt;br /&gt;
		frame:getParent().args&lt;br /&gt;
	return MultiReplace(args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Tooltip/styles.css&amp;diff=600</id>
		<title>Template:Tooltip/styles.css</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Tooltip/styles.css&amp;diff=600"/>
		<updated>2026-06-06T21:26:14Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;/* {{pp-template}} */ .tooltip-dotted { 	border-bottom: 1px dotted; 	cursor: help; }&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;/* {{pp-template}} */&lt;br /&gt;
.tooltip-dotted {&lt;br /&gt;
	border-bottom: 1px dotted;&lt;br /&gt;
	cursor: help;&lt;br /&gt;
}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Tooltip&amp;diff=599</id>
		<title>Template:Tooltip</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Tooltip&amp;diff=599"/>
		<updated>2026-06-06T21:26:00Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;&amp;lt;templatestyles src=&amp;quot;Template:Tooltip/styles.css&amp;quot; /&amp;gt;{{#ifeq:{{yesno-no|{{{link}}}}}|yes  |}}}&amp;lt;/span&amp;gt;  |&amp;lt;span class=&amp;quot;rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;templatestyles src=&amp;quot;Template:Tooltip/styles.css&amp;quot; /&amp;gt;{{#ifeq:{{yesno-no|{{{link}}}}}|yes&lt;br /&gt;
 |[[{{{1}}}|&amp;lt;span class=&amp;quot;rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}}&amp;quot; {{#if:{{{id|}}}|id=&amp;quot;{{{id}}}&amp;quot;}} {{#if:{{{style|}}}|style=&amp;quot;{{{style}}}&amp;quot;}} title=&amp;quot;{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|&amp;quot;|&amp;amp;quot;}}}}&amp;quot;&amp;gt;{{{1|}}}&amp;lt;/span&amp;gt;]]&lt;br /&gt;
 |&amp;lt;span class=&amp;quot;rt-commentedText tooltip {{#ifeq:{{yesno-yes|{{{dotted}}}}}|no||tooltip-dotted}} {{{class|}}}&amp;quot; {{#if:{{{id|}}}|id=&amp;quot;{{{id}}}&amp;quot;}} {{#if:{{{style|}}}|style=&amp;quot;{{{style}}}&amp;quot;}} title=&amp;quot;{{#tag:nowiki|{{#invoke:String|replace|{{{2|}}}|&amp;quot;|&amp;amp;quot;}}}}&amp;quot;&amp;gt;{{Encodefirst|{{trim|1={{{1|}}}}}}}&amp;lt;/span&amp;gt;&lt;br /&gt;
}}{{#invoke:Check for unknown parameters|check|unknown={{main other|[[Category:Pages using tooltip with unknown parameters|_VALUE_{{PAGENAME}}]]}}|preview=Page using [[Template:Tooltip]] with unknown parameter &amp;quot;_VALUE_&amp;quot;|ignoreblank=y| 1 | 2 | class | dotted | id | link | style }}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/usage&amp;diff=598</id>
		<title>Template:Citation Style documentation/usage</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/usage&amp;diff=598"/>
		<updated>2026-06-06T21:25:25Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;Copy a blank version to use. Almost all parameter names are supported only in lower case (some initialisms, such as {{para|isbn}} have upper-case aliases like {{para|ISBN}}, which are acceptable for use). Use the &amp;quot;|&amp;quot; (pipe) character between each parameter. Unused parameters may be deleted to avoid clutter in the edit window. Some samples on this documentation page may include the current date. If the date is not current, then {{purge|purge}} the page.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Copy a blank version to use. Almost all parameter names are supported only in lower case (some initialisms, such as {{para|isbn}} have upper-case aliases like {{para|ISBN}}, which are acceptable for use). Use the &amp;quot;|&amp;quot; (pipe) character between each parameter. Unused parameters may be deleted to avoid clutter in the edit window. Some samples on this documentation page may include the current date. If the date is not current, then {{purge|purge}} the page.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/lead&amp;diff=597</id>
		<title>Template:Citation Style documentation/lead</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/lead&amp;diff=597"/>
		<updated>2026-06-06T21:24:58Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;This {{cs1}} template is used to create citations for {{{2|}}}.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This {{cs1}} template is used to create [[WP:CITE|citations]] for {{{2|}}}.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_1&amp;diff=596</id>
		<title>Template:Citation Style 1</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_1&amp;diff=596"/>
		<updated>2026-06-06T21:24:04Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;{{Navbox | name      = Citation Style 1 | title     = Citation Style 1  | below     = Citation Style 1 noticeboard  | state     = {{{state|autocollapse}}} | listclass = hlist | selected  = {{{1|}}}  | group1 = General &amp;lt;br /&amp;gt;templates | list1  = ; {{tl|Cite book}} : books ; {{tl|Cite conference}} : conference papers ; {{tl|Cite document}} : short, stand-alone, offline documents ; {{tl|Cite encyclopedia}} : edited co...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Navbox&lt;br /&gt;
| name      = Citation Style 1&lt;br /&gt;
| title     = [[Help:Citation Style 1|Citation Style 1]]&lt;br /&gt;
&lt;br /&gt;
| below     = [[Help talk:Citation Style 1|Citation Style 1 noticeboard]]&lt;br /&gt;
&lt;br /&gt;
| state     = {{{state|autocollapse}}}&lt;br /&gt;
| listclass = hlist&lt;br /&gt;
| selected  = {{{1|}}}&lt;br /&gt;
&lt;br /&gt;
| group1 = General &amp;lt;br /&amp;gt;templates&lt;br /&gt;
| list1  =&lt;br /&gt;
; {{tl|Cite book}}&lt;br /&gt;
: books&lt;br /&gt;
; {{tl|Cite conference}}&lt;br /&gt;
: conference papers&lt;br /&gt;
; {{tl|Cite document}}&lt;br /&gt;
: short, stand-alone, offline documents&lt;br /&gt;
; {{tl|Cite encyclopedia}}&lt;br /&gt;
: edited collections&lt;br /&gt;
; {{tl|Cite interview}}&lt;br /&gt;
: interviews&lt;br /&gt;
; {{tl|Cite journal}}&lt;br /&gt;
: academic journals&lt;br /&gt;
; {{tl|Cite magazine}}&lt;br /&gt;
: magazines&lt;br /&gt;
; {{tl|Cite mailing list}}&lt;br /&gt;
: public mailing lists&lt;br /&gt;
; {{tl|Cite map}}&lt;br /&gt;
: maps&lt;br /&gt;
; {{tl|Cite news}}&lt;br /&gt;
: news articles&lt;br /&gt;
; {{tl|Cite newsgroup}}&lt;br /&gt;
: online newsgroups&lt;br /&gt;
; {{tl|Cite press release}}&lt;br /&gt;
: press releases&lt;br /&gt;
; {{tl|Cite report}}&lt;br /&gt;
: unpublished reports&lt;br /&gt;
; {{tl|Cite sign}}&lt;br /&gt;
: signs, plaques&lt;br /&gt;
; {{tl|Cite speech}}&lt;br /&gt;
: speeches&lt;br /&gt;
; {{tl|Cite tech report}}&lt;br /&gt;
: technical reports&lt;br /&gt;
; {{tl|Cite thesis}}&lt;br /&gt;
: theses&lt;br /&gt;
; {{tl|Cite web}}&lt;br /&gt;
: web sources&lt;br /&gt;
&lt;br /&gt;
| group2 = Preprint templates&lt;br /&gt;
| list2  =&lt;br /&gt;
* {{tl|Cite arXiv}}&lt;br /&gt;
* {{tl|Cite bioRxiv}}&lt;br /&gt;
* {{tl|Cite CiteSeerX}}&lt;br /&gt;
* {{tl|Cite medRxiv}}&lt;br /&gt;
* {{tl|Cite SSRN}}&lt;br /&gt;
&lt;br /&gt;
| group3 = Audiovisual-related&lt;br /&gt;
| list3  =&lt;br /&gt;
* {{tl|Cite AV media}}&lt;br /&gt;
* {{tl|Cite AV media notes}}&lt;br /&gt;
* {{tl|Cite episode}}&lt;br /&gt;
* {{tl|Cite podcast}}&lt;br /&gt;
* {{tl|Cite serial}}&lt;br /&gt;
&lt;br /&gt;
| group4 = Categories&lt;br /&gt;
| list4  =&lt;br /&gt;
* [[:Category:Citation Style 1 templates|Citation Style 1 templates]]&lt;br /&gt;
* [[:Category:Citation Style 1 specific-source templates|Citation Style 1 specific-source templates]]&lt;br /&gt;
&lt;br /&gt;
| group5 = Documentation&lt;br /&gt;
| list5  =&lt;br /&gt;
* {{tl|Citation Style documentation}}&lt;br /&gt;
&lt;br /&gt;
}}&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{Documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Cs1&amp;diff=595</id>
		<title>Template:Cs1</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Cs1&amp;diff=595"/>
		<updated>2026-06-06T21:23:20Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;Citation Style 1&amp;lt;noinclude&amp;gt; Category:Documentation assistance templates &amp;lt;/noinclude&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Help:Citation Style 1|Citation Style 1]]&amp;lt;noinclude&amp;gt;&lt;br /&gt;
[[Category:Documentation assistance templates]]&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/cs1&amp;diff=594</id>
		<title>Template:Citation Style documentation/cs1</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/cs1&amp;diff=594"/>
		<updated>2026-06-06T21:23:02Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;{{Infobox |bodystyle   =  |name        = Citation Style documentation/cs1 |title       = {{cs1}} templates  |titlestyle  =  |headerstyle =  |labelstyle  = width:50%; font-size:85% |label10  = {{tl|Cite arXiv}} |data10   = arXiv preprints |label20  = {{tl|Cite AV media}} |data20   = audio and visual media |label30  = {{tl|Cite AV media notes}} |data30   = AV media liner notes |label40  = {{tl|Cite bioRxiv}} |data40   = bioRxiv preprints |label50  = {{tl|Cite book}...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox&lt;br /&gt;
|bodystyle   = &lt;br /&gt;
|name        = Citation Style documentation/cs1&lt;br /&gt;
|title       = {{cs1}} templates &lt;br /&gt;
|titlestyle  = &lt;br /&gt;
|headerstyle = &lt;br /&gt;
|labelstyle  = width:50%; font-size:85%&lt;br /&gt;
|label10  = {{tl|Cite arXiv}}&lt;br /&gt;
|data10   = [[arXiv]] preprints&lt;br /&gt;
|label20  = {{tl|Cite AV media}}&lt;br /&gt;
|data20   = audio and visual media&lt;br /&gt;
|label30  = {{tl|Cite AV media notes}}&lt;br /&gt;
|data30   = AV media liner notes&lt;br /&gt;
|label40  = {{tl|Cite bioRxiv}}&lt;br /&gt;
|data40   = [[bioRxiv]] preprints&lt;br /&gt;
|label50  = {{tl|Cite book}}&lt;br /&gt;
|data50   = books and chapters&lt;br /&gt;
|label60  = {{tl|Cite CiteSeerX}}&lt;br /&gt;
|data60   = [[CiteSeerX]] papers&lt;br /&gt;
|label70  = {{tl|Cite conference}}&lt;br /&gt;
|data70   = conference papers&lt;br /&gt;
|label75  = {{tl|Cite document}}&lt;br /&gt;
|data75   = short, stand-alone, offline documents&lt;br /&gt;
|label80  = {{tl|Cite encyclopedia}}&lt;br /&gt;
|data80   = edited collections&lt;br /&gt;
|label90  = {{tl|Cite episode}}&lt;br /&gt;
|data90   = radio or TV episodes&lt;br /&gt;
|label100 = {{tl|Cite interview}}&lt;br /&gt;
|data100  = interviews&lt;br /&gt;
|label110 = {{tl|Cite journal}}&lt;br /&gt;
|data110  = academic journals&lt;br /&gt;
|label120 = {{tl|Cite magazine}}&lt;br /&gt;
|data120  = magazines, periodicals&lt;br /&gt;
|label130 = {{tl|Cite mailing list}}&lt;br /&gt;
|data130  = public mailing lists&lt;br /&gt;
|label140 = {{tl|Cite map}}&lt;br /&gt;
|data140  = maps&lt;br /&gt;
|label145 = {{tl|Cite medRxiv}}&lt;br /&gt;
|data145  = [[medRxiv]] preprints&lt;br /&gt;
|label150 = {{tl|Cite news}}&lt;br /&gt;
|data150  = news articles&lt;br /&gt;
|label160 = {{tl|Cite newsgroup}}&lt;br /&gt;
|data160  = online newsgroups&lt;br /&gt;
|label170 = {{tl|Cite podcast}}&lt;br /&gt;
|data170  = podcasts&lt;br /&gt;
|label180 = {{tl|Cite press release}}&lt;br /&gt;
|data180  = press releases&lt;br /&gt;
|label190 = {{tl|Cite report}}&lt;br /&gt;
|data190  = reports&lt;br /&gt;
|label200 = {{tl|Cite serial}}&lt;br /&gt;
|data200  = audio or video serials&lt;br /&gt;
|label210 = {{tl|Cite sign}}&lt;br /&gt;
|data210  = signs, plaques&lt;br /&gt;
|label220 = {{tl|Cite speech}}&lt;br /&gt;
|data220  = speeches&lt;br /&gt;
|label230 = {{tl|Cite SSRN}}&lt;br /&gt;
|data230  = [[Social Science Research Network|SSRN]] papers&lt;br /&gt;
|label240 = {{tl|Cite tech report}}&lt;br /&gt;
|data240  = technical reports&lt;br /&gt;
|label250 = {{tl|Cite thesis}}&lt;br /&gt;
|data250  = theses&lt;br /&gt;
|label260 = {{tl|Cite web}}&lt;br /&gt;
|data260  = web sources not covered by the above&lt;br /&gt;
|label270 = See also&lt;br /&gt;
|data270  = &lt;br /&gt;
{{nowrap|&#039;&#039;[[:Category:Specific-source templates|Specific-source templates]]&#039;&#039;}}&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;[[:Category:Citation templates that wrap CS1 templates|Citation Style 1 wrapper templates]]&#039;&#039;&lt;br /&gt;
}}&amp;lt;noinclude&amp;gt;{{documentation|content=&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|Citation Style 1}}&lt;br /&gt;
}}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/lua&amp;diff=593</id>
		<title>Template:Citation Style documentation/lua</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation/lua&amp;diff=593"/>
		<updated>2026-06-06T21:22:44Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;{{lua|Module:Citation/CS1&amp;lt;noinclude&amp;gt;|nocat=true&amp;lt;/noinclude&amp;gt;}}&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{lua|Module:Citation/CS1&amp;lt;noinclude&amp;gt;|nocat=true&amp;lt;/noinclude&amp;gt;}}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Module:Template_wrapper&amp;diff=592</id>
		<title>Module:Template wrapper</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Module:Template_wrapper&amp;diff=592"/>
		<updated>2026-06-06T21:22:03Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;require(&amp;#039;strict&amp;#039;);  local error_msg = &amp;#039;&amp;lt;span style=\&amp;quot;font-size:100%\&amp;quot; class=\&amp;quot;error\&amp;quot;&amp;gt;&amp;lt;code style=\&amp;quot;color:inherit; border:inherit; padding:inherit;\&amp;quot;&amp;gt;&amp;amp;#124;_template=&amp;lt;/code&amp;gt; missing or empty&amp;lt;/span&amp;gt;&amp;#039;;   ----------------------------&amp;lt; I S _ I N _ T A B L E &amp;gt;--------------------------------------------------------  scan through tbl looking for value; return true if found, false else    local function is_in_table (tbl, value)     for k, v in pairs (tbl) do         if v ==...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;require(&#039;strict&#039;);&lt;br /&gt;
&lt;br /&gt;
local error_msg = &#039;&amp;lt;span style=\&amp;quot;font-size:100%\&amp;quot; class=\&amp;quot;error\&amp;quot;&amp;gt;&amp;lt;code style=\&amp;quot;color:inherit; border:inherit; padding:inherit;\&amp;quot;&amp;gt;&amp;amp;#124;_template=&amp;lt;/code&amp;gt; missing or empty&amp;lt;/span&amp;gt;&#039;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; I S _ I N _ T A B L E &amp;gt;--------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
scan through tbl looking for value; return true if found, false else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function is_in_table (tbl, value)&lt;br /&gt;
    for k, v in pairs (tbl) do&lt;br /&gt;
        if v == value then return true end&lt;br /&gt;
    end&lt;br /&gt;
    return false;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A D D _ P A R A M E T E R &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
adds parameter name and its value to args table according to the state of boolean list argument; kv pair for&lt;br /&gt;
template execution; k=v string for template listing.&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function add_parameter (k, v, args, list)&lt;br /&gt;
	if list then&lt;br /&gt;
		table.insert( args, table.concat ({k, &#039;=&#039;, v}));						-- write parameter names and values to args table as string&lt;br /&gt;
	else&lt;br /&gt;
		args[k] = v;															-- copy parameters to args table&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; A L I A S _ M A P _ G E T &amp;gt;----------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
returns a table of local template (parent frame) parameter names and the target template names that match where&lt;br /&gt;
in [key]=&amp;lt;value&amp;gt; pairs where:&lt;br /&gt;
	[key] is local template parameter name (an alias)&lt;br /&gt;
	&amp;lt;value&amp;gt; is target template parameter name (the canonical parameter name used in the working template)&lt;br /&gt;
&lt;br /&gt;
The parameter |_alias-map= has the form:&lt;br /&gt;
	|_alias-map=&amp;lt;list&amp;gt;&lt;br /&gt;
where &amp;lt;list&amp;gt; is a comma-separated list of alias / canonical parameter name pairs in the form&lt;br /&gt;
	&amp;lt;from&amp;gt; : &amp;lt;to&amp;gt;&lt;br /&gt;
where:&lt;br /&gt;
	&amp;lt;from&amp;gt; is the local template&#039;s parameter name (alias)&lt;br /&gt;
	&amp;lt;to&amp;gt; is the target template&#039;s parameter name (canonical)&lt;br /&gt;
	for enumerated parameters place an octothorp (#) where the enumerator digits are placed in the parameter names:&lt;br /&gt;
		&amp;lt;from#&amp;gt; : &amp;lt;to#&amp;gt;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function alias_map_get (_alias_map)&lt;br /&gt;
	local T = mw.text.split (_alias_map, &#039;%s*,%s*&#039;);							-- convert the comma-separated list into a table of alias pairs&lt;br /&gt;
	local mapped_aliases = {};													-- mapped aliases will go here&lt;br /&gt;
	local l_name, t_name;														-- parameter names&lt;br /&gt;
	&lt;br /&gt;
	for _, alias_pair in ipairs (T) do											-- loop through the table of alias pairs&lt;br /&gt;
		l_name, t_name = alias_pair:match (&#039;(.-)%s*:%s*(.+)&#039;);					-- from each pair, get local and target parameter names&lt;br /&gt;
		if l_name and t_name then												-- if both are set&lt;br /&gt;
			if tonumber (l_name) then&lt;br /&gt;
				l_name = tonumber (l_name);										-- convert number-as-text to a number&lt;br /&gt;
			end&lt;br /&gt;
			mapped_aliases[l_name] = t_name;									-- add them to the map table&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return mapped_aliases;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; F R A M E _ A R G S _ G E T &amp;gt;--------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Fetch the wrapper template&#039;s &#039;default&#039; and control parameters; adds default parameters to args&lt;br /&gt;
&lt;br /&gt;
returns content of |_template= parameter (name of the working template); nil else&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function frame_args_get (frame_args, args, list)&lt;br /&gt;
	local template;&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (frame_args) do											-- here we get the wrapper template&#039;s &#039;default&#039; parameters&lt;br /&gt;
		if &#039;string&#039; == type (k) and (v and (&#039;&#039; ~= v)) then						-- do not pass along positional or empty parameters&lt;br /&gt;
			if &#039;_template&#039; == k then&lt;br /&gt;
				template = v;													-- save the name of template that we are wrapping&lt;br /&gt;
			elseif &#039;_exclude&#039; ~= k and &#039;_reuse&#039; ~= k and &#039;_include-positional&#039; ~= k  and &#039;_alias-map&#039; ~= k then	-- these already handled so ignore here; &lt;br /&gt;
				add_parameter (k, v, args, list);								-- add all other parameters to args in the style dictated by list&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return template;															-- return contents of |_template= parameter&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[=[--------------------------&amp;lt; P F R A M E _ A R G S _ G E T &amp;gt;------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Fetches the wrapper template&#039;s &#039;live&#039; parameters; adds live parameters that aren&#039;t members of the exclude table to&lt;br /&gt;
args table; positional parameters may not be excluded&lt;br /&gt;
&lt;br /&gt;
no return value&lt;br /&gt;
&lt;br /&gt;
]=]&lt;br /&gt;
&lt;br /&gt;
local function pframe_args_get (pframe_args, args, exclude, _include_positional, list)&lt;br /&gt;
	for k, v in pairs (pframe_args) do&lt;br /&gt;
		if &#039;string&#039; == type (k) and not is_in_table (exclude, k) then			-- do not pass along excluded parameters&lt;br /&gt;
			if v and (&#039;&#039; ~= v) then												-- pass along only those parameters that have assigned values&lt;br /&gt;
				if &#039;unset&#039; == v:lower() then									-- special keyword to unset &#039;default&#039; parameters set in the wrapper template&lt;br /&gt;
					v = &#039;&#039;;														-- unset the value in the args table&lt;br /&gt;
				end&lt;br /&gt;
				add_parameter (k, v, args, list)								-- add all other parameters to args in the style dictated by list; alias map only supported for local-template parameters&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if _include_positional then&lt;br /&gt;
		for i, v in ipairs (pframe_args) do										-- pass along positional parameters&lt;br /&gt;
			if &#039;unset&#039; == v:lower() then										-- special keyword to unset &#039;default&#039; parameters set in the wrapper template&lt;br /&gt;
				v = &#039;&#039;;															-- unset the value in the args table&lt;br /&gt;
			end&lt;br /&gt;
			add_parameter (i, v, args, list);&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; _ M A I N &amp;gt;--------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Collect the various default and live parameters into args styled according to boolean list.&lt;br /&gt;
&lt;br /&gt;
returns name of the working or listed template or nil for an error message&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function _main (frame, args, list)&lt;br /&gt;
	local template;&lt;br /&gt;
	local exclude = {};															-- table of parameter names for parameters that are not passed to the working template&lt;br /&gt;
	local reuse_list = {};														-- table of pframe parameter names whose values are modified before they are passed to the working template as the same name&lt;br /&gt;
	local alias_map = {};														-- table that maps parameter aliases to working template canonical parameter names&lt;br /&gt;
	local _include_positional;&lt;br /&gt;
	&lt;br /&gt;
	if frame.args._exclude and (&#039;&#039; ~= frame.args._exclude) then					-- if there is |_exclude= and it&#039;s not empty&lt;br /&gt;
		exclude = mw.text.split (frame.args._exclude, &amp;quot;%s*,%s*&amp;quot;);				-- make a table from its contents&lt;br /&gt;
	end&lt;br /&gt;
																				-- TODO: |_reuse= needs a better name (|_reuse=)&lt;br /&gt;
	if frame.args._reuse and (&#039;&#039; ~= frame.args._reuse) then					-- if there is |_reuse= and it&#039;s not empty&lt;br /&gt;
		reuse_list = mw.text.split (frame.args._reuse, &amp;quot;%s*,%s*&amp;quot;);				-- make a table from its contents&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if frame.args[&#039;_alias-map&#039;] and (&#039;&#039; ~= frame.args[&#039;_alias-map&#039;]) then		-- if there is |_alias-map= and it&#039;s not empty&lt;br /&gt;
		alias_map = alias_map_get (frame.args[&#039;_alias-map&#039;]);					-- make a table from its contents&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	template = frame_args_get (frame.args, args, list);							-- get parameters provided in the {{#invoke:template wrapper|...|...}}&lt;br /&gt;
	if nil == template or &#039;&#039; == template then									-- this is the one parameter that is required by this module&lt;br /&gt;
		return nil;																-- not present, tell calling function to emit an error message&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	_include_positional = &#039;yes&#039; == frame.args[&#039;_include-positional&#039;];			-- when true pass all positional parameters along with non-excluded named parameters to ...&lt;br /&gt;
																				-- ... the working template; positional parameters are not excludable&lt;br /&gt;
																				&lt;br /&gt;
	local _pframe_args = frame:getParent().args;								-- here we get the wrapper template&#039;s &#039;live&#039; parameters from pframe.args&lt;br /&gt;
	local pframe_args = {};														-- a local table that we can modify&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (_pframe_args) do											-- make a copy that we can modify&lt;br /&gt;
		pframe_args[k] = v;&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
-- here we look for pframe parameters that are aliases of canonical parameter names; when found&lt;br /&gt;
-- we replace the alias with the canonical.  We do this here because the reuse_list works on&lt;br /&gt;
-- canonical parameter names so first we convert alias parameter names to canonical names and then&lt;br /&gt;
-- we remove those canonical names from the pframe table that are reused (provided to the working&lt;br /&gt;
-- template through the frame args table)&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (alias_map) do											-- k is alias name, v is canonical name&lt;br /&gt;
		if pframe_args[k] then													-- if pframe_args has parameter with alias name&lt;br /&gt;
			pframe_args[v] = _pframe_args[k];									-- create new canonical name with alias&#039; value&lt;br /&gt;
			pframe_args[k] = nil;												-- unset the alias&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	for k, v in pairs (pframe_args) do											-- do enumerated parameter alias -&amp;gt; canonical translation&lt;br /&gt;
		if &#039;string&#039; == type (k) then											-- only named parameters can be enumerated&lt;br /&gt;
			if alias_map[k..&#039;#&#039;] then											-- non-enumerated alias matches enumerated parameter pattern? enumerator at end only&lt;br /&gt;
				pframe_args[alias_map[k..&#039;#&#039;]:gsub(&#039;#&#039;, &#039;&#039;)] = v;				-- remove &#039;#&#039; and copy parameter to pframe_args table&lt;br /&gt;
				pframe_args[k] = nil;											-- unset the alias&lt;br /&gt;
			elseif k:match (&#039;%d+&#039;) then											-- if this parameter name contains digits&lt;br /&gt;
				local temp = k:gsub (&#039;%d+&#039;, &#039;#&#039;);								-- make a copy; digits replaced with single &#039;#&#039;&lt;br /&gt;
				local enum = k:match (&#039;%d+&#039;);									-- get the enumerator&lt;br /&gt;
				&lt;br /&gt;
				if alias_map[temp] then											-- if this parameter is a recognized enumerated alias&lt;br /&gt;
					pframe_args[alias_map[temp]:gsub(&#039;#&#039;, enum)] = v;			-- use canonical name and replace &#039;#&#039; with enumerator and add to pframe_args&lt;br /&gt;
					pframe_args[k] = nil;										-- unset the alias&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
-- pframe parameters that are _reused are &#039;reused&#039; have the form something like this:&lt;br /&gt;
--	|chapter=[[wikisource:{{{chapter}}}|{{{chapter}}}]]&lt;br /&gt;
-- where a parameter in the wrapping template is modified and then passed to the working template&lt;br /&gt;
-- using the same parameter name (in this example |chapter=)&lt;br /&gt;
&lt;br /&gt;
																				-- remove parameters that will be reused&lt;br /&gt;
	for k, v in ipairs (reuse_list) do											-- k is numerical index, v is canonical parameter name to ignore&lt;br /&gt;
		if pframe_args[v] then													-- if pframe_args has parameter that should be ignored&lt;br /&gt;
			pframe_args[v] = nil;												-- unset the ignored parameter&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	pframe_args_get (pframe_args, args, exclude, _include_positional, list);	-- add parameters and values to args that are not listed in the exclude table&lt;br /&gt;
&lt;br /&gt;
	return template;															-- args now has all default and live parameters, return working template name&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; W R A P &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template entry point.  Call this function to &#039;execute&#039; the working template&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function wrap (frame)&lt;br /&gt;
	local args = {};															-- table of default and live parameters and their values to be passed to the wrapped template&lt;br /&gt;
	local template;																-- the name of the working template&lt;br /&gt;
&lt;br /&gt;
	template = _main (frame, args, false);										-- get default and live parameters and the name of the working template&lt;br /&gt;
	if not template then														-- template name is required&lt;br /&gt;
		return error_msg;														-- emit error message and abandon if template name not present&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	return frame:expandTemplate {title=template, args=args};					-- render the working template&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; L I S T &amp;gt;----------------------------------------------------------------------&lt;br /&gt;
&lt;br /&gt;
Template entry point.  Call this function to &#039;display&#039; the source for the working template.  This function added&lt;br /&gt;
as a result of a TfD here: Wikipedia:Templates_for_discussion/Log/2018_April_28#Module:PassArguments&lt;br /&gt;
&lt;br /&gt;
This function replaces a similarly named function which was used in {{cite compare}} and {{cite compare2}}&lt;br /&gt;
&lt;br /&gt;
Values in the args table are numerically indexed strings in the form &#039;name=value&#039;&lt;br /&gt;
&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
local function list(frame, do_link)&lt;br /&gt;
	local args = {};						-- table of default and live parameters and their values to be passed to the listed template&lt;br /&gt;
	local template;							-- the name of the listed template&lt;br /&gt;
&lt;br /&gt;
	template = _main (frame, args, true);	-- get default and live parameters and the name of the listed template&lt;br /&gt;
	if not template then					-- template name is required&lt;br /&gt;
		return error_msg;					-- emit error message and abandon if template name not present&lt;br /&gt;
	end&lt;br /&gt;
	if do_link then&lt;br /&gt;
		template = (&#039;[[%s|%s]]&#039;):format(frame:expandTemplate{ title=&#039;Transclude&#039;, args = {template} }, template)&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(args)&lt;br /&gt;
	for i = 1, #args do&lt;br /&gt;
		local stripped = args[i]:match(&#039;^&#039; .. i .. &#039;=([^=]*)$&#039;)&lt;br /&gt;
		if stripped then args[i] = stripped else break end&lt;br /&gt;
	end&lt;br /&gt;
	return frame:preprocess(table.concat({&lt;br /&gt;
		&#039;&amp;lt;code style=&amp;quot;color:inherit; background:inherit; border:none;&amp;quot;&amp;gt;&amp;amp;#123;&amp;amp;#123;&#039;,&lt;br /&gt;
		template,&lt;br /&gt;
		(&#039;&amp;lt;wbr&amp;gt;&amp;lt;nowiki&amp;gt;|%s&amp;lt;/nowiki&amp;gt;&#039;):rep(#args):format(unpack(args)), &#039;&amp;amp;#125;&amp;amp;#125;&amp;lt;/code&amp;gt;&#039;}));	-- render the template&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function link (frame)&lt;br /&gt;
	return list(frame, true)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
--[[--------------------------&amp;lt; E X P O R T E D   F U N C T I O N S &amp;gt;------------------------------------------&lt;br /&gt;
]]&lt;br /&gt;
&lt;br /&gt;
return {&lt;br /&gt;
	link = link,&lt;br /&gt;
	list = list,&lt;br /&gt;
	wrap = wrap,&lt;br /&gt;
	};&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation&amp;diff=591</id>
		<title>Template:Citation Style documentation</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Citation_Style_documentation&amp;diff=591"/>
		<updated>2026-06-06T21:21:21Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;&amp;lt;includeonly&amp;gt;{{#invoke:Template wrapper|wrap|_template=Citation Style documentation/{{{1|}}}|_include-positional=yes}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt; {{documentation}}&amp;lt;!-- Please add documentation and categories to the /doc subpage, interwikis to Wikidata, thank you --&amp;gt; &amp;lt;/noinclude&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:Template wrapper|wrap|_template=Citation Style documentation/{{{1|}}}|_include-positional=yes}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&amp;lt;!-- Please add documentation and categories to the /doc subpage, interwikis to Wikidata, thank you --&amp;gt;&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Csdoc&amp;diff=590</id>
		<title>Template:Csdoc</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Csdoc&amp;diff=590"/>
		<updated>2026-06-06T21:21:06Z</updated>

		<summary type="html">&lt;p&gt;Inari: Redirected page to Template:Citation Style documentation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Template:Citation Style documentation]]{{R from template shortcut}}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Cite_web/doc&amp;diff=589</id>
		<title>Template:Cite web/doc</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Cite_web/doc&amp;diff=589"/>
		<updated>2026-06-06T21:20:43Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;&amp;lt;noinclude&amp;gt;{{pp-template}}&amp;lt;/noinclude&amp;gt; {{Documentation subpage}} {{cascade-protected template}} {{AWB standard installation}} {{csdoc|lua}} {{csdoc|cs1}} {{csdoc|lead|web sources that are not characterized by another CS1 template. Do not use this template in the &amp;quot;External links&amp;quot; section of articles}}  ==Usage== {{csdoc|usage}} {{csdoc|usage common}} ;To cite a web page with a credited author &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;noinclude&amp;gt;{{pp-template}}&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
{{Documentation subpage}}&lt;br /&gt;
{{cascade-protected template}}&lt;br /&gt;
{{AWB standard installation}}&lt;br /&gt;
{{csdoc|lua}}&lt;br /&gt;
{{csdoc|cs1}}&lt;br /&gt;
{{csdoc|lead|web sources that are not characterized by another [[Help:Citation Style 1|CS1]] template. Do not use this template in the &amp;quot;[[WP:ELCITE|External links]]&amp;quot; section of articles}}&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
{{csdoc|usage}}&lt;br /&gt;
{{csdoc|usage common}}&lt;br /&gt;
;To cite a web page with a credited author&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |last= |first= |date= |title= |url= |website= |location= |publisher= |access-date=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite a web page with no credited author&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |author=&amp;lt;!-- not stated --&amp;gt; |date= |title= |url= |website= |location= |publisher= |access-date=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite an online web page that has been archived&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |last= |first= |date= |title= |url= |website= |location= |publisher= |url-status= |archive-url= |archive-date= |access-date=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite a web page written in a foreign language&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |last= |first= |date= |title= |url= |trans-title= |website= |language= |location= |publisher= |access-date=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite and quote an archived, two-author, foreign-language web page re-published as a PDF on an information aggregation service requiring a subscription&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |last1= |first1= |last2= |first2= |date= |title= |url= |url-access= |trans-title= |format= |website= |language= |location= |publisher= |url-status= |archive-url= |archive-date= |access-date= |via= |quote=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{end}}&lt;br /&gt;
&lt;br /&gt;
{{csdoc|usage full}}&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;{{cite web |last1= |first1= |author-link1= |last2= |first2= |author-link2= |display-authors= |author-mask1= |author-mask2= |collaboration= |df= |date= |year= |orig-date= |orig-year= |location= |editor-last1= |editor-first1= |editor-link1= |editor-last2= |editor-first2= |editor-link2= |display-editors= |editor-mask1= |editor-mask2= |title= |script-title= |title-link= |url= |url-access= |trans-title= |format= |department= |website= |script-website= |trans-website= |type= |series= |language= |interviewer-last1= |interviewer-first1= |interviewer-link1= |interviewer-last2= |interviewer-first2= |interviewer-link2= |display-interviewers= |interviewer-mask1= |interviewer-mask2= |translator-last1= |translator-first1= |translator-link1= |translator-last2= |translator-first2= |translator-link2= |display-translators= |translator-mask1= |translator-mask2= |others= |name-list-style= |edition= |publication-place= |publisher= |publication-date= |agency= |minutes= |time-caption= |time= |page= |pages= |at= |no-pp= |arxiv= |asin= |asin-tld= |bibcode= |bibcode-access= |biorxiv= |citeseerx= |doi= |doi-access= |doi-broken-date= |eissn= |hdl= |hdl-access= |isbn= |ismn= |issn= |jfm= |jstor= |jstor-access= |lccn= |medrxiv= |mr= |oclc= |ol= |ol-access= |osti= |osti-access= |pmc= |pmc-embargo-date= |pmid= |rfc= |sbn= |ssrn= |s2cid= |s2cid-access= |zbl= |id= |url-status= |archive-url= |archive-format= |archive-date= |access-date= |via= |quote-page= |quote-pages= |quote= |script-quote= |trans-quote= |mode= |ref= |postscript=}}&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{end}}&lt;br /&gt;
&lt;br /&gt;
{{csdoc|usage vertical common}}&lt;br /&gt;
&amp;lt;!-- Please synchronize this list with the corresponding one at the overview page [[Wikipedia:Citation templates#Examples]] --&amp;gt;&lt;br /&gt;
;To cite a web page with a credited author&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|last        = &lt;br /&gt;
|first       = &lt;br /&gt;
|date        = &lt;br /&gt;
|title       = &lt;br /&gt;
|url         = &lt;br /&gt;
|website     = &lt;br /&gt;
|location    = &lt;br /&gt;
|publisher   = &lt;br /&gt;
|access-date = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite a web page with no credited author&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|author      = &amp;lt;!-- not stated --&amp;gt;&lt;br /&gt;
|date        = &lt;br /&gt;
|title       = &lt;br /&gt;
|url         = &lt;br /&gt;
|website     = &lt;br /&gt;
|location    = &lt;br /&gt;
|publisher   = &lt;br /&gt;
|access-date = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite a web page article that has been archived&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|last         = &lt;br /&gt;
|first        = &lt;br /&gt;
|date         = &lt;br /&gt;
|title        = &lt;br /&gt;
|url          = &lt;br /&gt;
|website      = &lt;br /&gt;
|location     = &lt;br /&gt;
|publisher    = &lt;br /&gt;
|url-status   = &lt;br /&gt;
|archive-url  = &lt;br /&gt;
|archive-date = &lt;br /&gt;
|access-date  = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite a web page written in a foreign language&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|last        = &lt;br /&gt;
|first       = &lt;br /&gt;
|date        = &lt;br /&gt;
|title       = &lt;br /&gt;
|url         = &lt;br /&gt;
|trans-title = &lt;br /&gt;
|website     = &lt;br /&gt;
|language    = &lt;br /&gt;
|location    = &lt;br /&gt;
|publisher   = &lt;br /&gt;
|access-date = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
;To cite and quote an archived, two-author, foreign-language web page re-published as a PDF on an information aggregation service requiring a subscription&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|last1        = &lt;br /&gt;
|first1       = &lt;br /&gt;
|last2        = &lt;br /&gt;
|first2       = &lt;br /&gt;
|date         = &lt;br /&gt;
|title        = &lt;br /&gt;
|url          = &lt;br /&gt;
|url-access   = &lt;br /&gt;
|trans-title  = &lt;br /&gt;
|format       = &lt;br /&gt;
|website      = &lt;br /&gt;
|language     = &lt;br /&gt;
|location     = &lt;br /&gt;
|publisher    = &lt;br /&gt;
|url-status   = &lt;br /&gt;
|archive-url  = &lt;br /&gt;
|archive-date = &lt;br /&gt;
|access-date  = &lt;br /&gt;
|via          = &lt;br /&gt;
|quote        = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
{{end}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+ Full parameter set in vertical format&lt;br /&gt;
! Parameters !! Prerequisites !! Brief instructions / notes !! Vertical list&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; subject; host1; and host}}&lt;br /&gt;
|&lt;br /&gt;
| Author&#039;s last name or single name author. Don&#039;t link.&lt;br /&gt;
| rowspan=&amp;quot;121&amp;quot; style=&amp;quot;vertical-align:top;&amp;quot; | &amp;lt;syntaxhighlight lang=&amp;quot;wikitext&amp;quot; copy=&amp;quot;1&amp;quot;&amp;gt;&lt;br /&gt;
{{cite web&lt;br /&gt;
|last1                = &lt;br /&gt;
|first1               = &lt;br /&gt;
|author-link1         = &lt;br /&gt;
|last2                = &lt;br /&gt;
|first2               = &lt;br /&gt;
|author-link2         = &lt;br /&gt;
|display-authors      = &lt;br /&gt;
|author-mask1         = &lt;br /&gt;
|author-mask2         = &lt;br /&gt;
|collaboration        = &lt;br /&gt;
|df                   = &lt;br /&gt;
|date                 = &lt;br /&gt;
|year                 = &lt;br /&gt;
|orig-date            = &lt;br /&gt;
|orig-year            = &lt;br /&gt;
|location             = &lt;br /&gt;
|editor-last1         = &lt;br /&gt;
|editor-first1        = &lt;br /&gt;
|editor-link1         = &lt;br /&gt;
|editor-last2         = &lt;br /&gt;
|editor-first2        = &lt;br /&gt;
|editor-link2         = &lt;br /&gt;
|display-editors      = &lt;br /&gt;
|editor-mask1         = &lt;br /&gt;
|editor-mask2         = &lt;br /&gt;
|title                = &lt;br /&gt;
|script-title         = &lt;br /&gt;
|title-link           = &lt;br /&gt;
|url                  = &lt;br /&gt;
|url-access           = &lt;br /&gt;
|trans-title          = &lt;br /&gt;
|format               = &lt;br /&gt;
|department           = &lt;br /&gt;
|website              = &lt;br /&gt;
|script-website       = &lt;br /&gt;
|trans-website        = &lt;br /&gt;
|type                 = &lt;br /&gt;
|series               = &lt;br /&gt;
|language             = &lt;br /&gt;
|interviewer-last1    = &lt;br /&gt;
|interviewer-first1   = &lt;br /&gt;
|interviewer-link1    = &lt;br /&gt;
|interviewer-last2    = &lt;br /&gt;
|interviewer-first2   = &lt;br /&gt;
|interviewer-link2    = &lt;br /&gt;
|display-interviewers = &lt;br /&gt;
|interviewer-mask1    = &lt;br /&gt;
|interviewer-mask2    = &lt;br /&gt;
|translator-last1     = &lt;br /&gt;
|translator-first1    = &lt;br /&gt;
|translator-link1     = &lt;br /&gt;
|translator-last2     = &lt;br /&gt;
|translator-first2    = &lt;br /&gt;
|translator-link2     = &lt;br /&gt;
|display-translators  = &lt;br /&gt;
|translator-mask1     = &lt;br /&gt;
|translator-mask2     = &lt;br /&gt;
|others               = &lt;br /&gt;
|name-list-style      = &lt;br /&gt;
|edition              = &lt;br /&gt;
|publication-place    = &lt;br /&gt;
|publisher            = &lt;br /&gt;
|publication-date     = &lt;br /&gt;
|agency               = &lt;br /&gt;
|minutes              = &lt;br /&gt;
|time-caption         = &lt;br /&gt;
|time                 = &lt;br /&gt;
|page                 = &lt;br /&gt;
|pages                = &lt;br /&gt;
|at                   = &lt;br /&gt;
|no-pp                = &lt;br /&gt;
|arxiv                = &lt;br /&gt;
|asin                 = &lt;br /&gt;
|asin-tld             = &lt;br /&gt;
|bibcode              = &lt;br /&gt;
|bibcode-access       = &lt;br /&gt;
|biorxiv              = &lt;br /&gt;
|citeseerx            = &lt;br /&gt;
|doi                  = &lt;br /&gt;
|doi-access           = &lt;br /&gt;
|doi-broken-date      = &lt;br /&gt;
|eissn                = &lt;br /&gt;
|hdl                  = &lt;br /&gt;
|hdl-access           = &lt;br /&gt;
|isbn                 = &lt;br /&gt;
|ismn                 = &lt;br /&gt;
|issn                 = &lt;br /&gt;
|jfm                  = &lt;br /&gt;
|jstor                = &lt;br /&gt;
|jstor-access         = &lt;br /&gt;
|lccn                 = &lt;br /&gt;
|medrxiv              = &lt;br /&gt;
|mr                   = &lt;br /&gt;
|oclc                 = &lt;br /&gt;
|ol                   = &lt;br /&gt;
|ol-access            = &lt;br /&gt;
|osti                 = &lt;br /&gt;
|osti-access          = &lt;br /&gt;
|pmc                  = &lt;br /&gt;
|pmc-embargo-date     = &lt;br /&gt;
|pmid                 = &lt;br /&gt;
|rfc                  = &lt;br /&gt;
|sbn                  = &lt;br /&gt;
|ssrn                 = &lt;br /&gt;
|s2cid                = &lt;br /&gt;
|s2cid-access         = &lt;br /&gt;
|zbl                  = &lt;br /&gt;
|id                   = &lt;br /&gt;
|url-status           = &lt;br /&gt;
|archive-url          = &lt;br /&gt;
|archive-format       = &lt;br /&gt;
|archive-date         = &lt;br /&gt;
|access-date          = &lt;br /&gt;
|via                  = &lt;br /&gt;
|quote-page           = &lt;br /&gt;
|quote-pages          = &lt;br /&gt;
|quote                = &lt;br /&gt;
|script-quote         = &lt;br /&gt;
|trans-quote          = &lt;br /&gt;
|mode                 = &lt;br /&gt;
|ref                  = &lt;br /&gt;
|postscript           = &lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|first1}}|or any of its aliases, including: first; given1; given; author-first1; author1-first; author-first; author-given1; author1-given; author-given; subject-first1; subject1-first; subject-first; subject-given1; subject1-given; and subject-given}}&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
| Author&#039;s first name. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|author-link1}}|or any of its aliases, including: author1-link; author-link; authorlink1; author1link; authorlink; subject-link1; subject1-link; and subject-link}}&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
| Title of Wikipedia article about the first author. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|last2}}|or any of its aliases, including: surname2; author-last2; author2-last; author-surname2; author2-surname; author2; subject-last2; subject2-last; subject-surname2; subject2-surname; subject2; and host2}}&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for 2nd author. Don&#039;t link. Similar: &amp;lt;code&amp;gt;last3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|first2}}|or any of its aliases, including: given2; author-first2; author2-first; author-given2; author2-given; subject-first2; subject2-first; subject-given2 and subject2-given}}&lt;br /&gt;
| {{tooltip|{{codett|last2}}|or any of its aliases, including: surname2; author-last2; author2-last; author-surname2; author2-surname; author2; subject-last2; subject2-last; subject-surname2; subject2-surname; and subject2}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for 2nd author. Don&#039;t link. Similar: &amp;lt;code&amp;gt;first3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|author-link2}}|or any of its aliases, including: author2-link; authorlink2; author2link; subject-link2; and subject2-link}}&lt;br /&gt;
| {{tooltip|{{codett|last2}}|or any of its aliases, including: surname2; author-last2; author2-last; author-surname2; author2-surname; author2; subject-last2; subject2-last; subject-surname2; subject2-surname; and subject2}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for 2nd author. Don&#039;t link. Similar: &amp;lt;code&amp;gt;author-link3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|display-authors}}|or alias display-subjects}}&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
| Number (number of authors displayed) or &amp;lt;code&amp;gt;etal&amp;lt;/code&amp;gt; (more authors)&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|author-mask1}}|or any of its aliases, including: author1-mask; author-mask; subject-mask1; subject1-mask; and subject-mask}}&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | See [[#Display options|Display options]] below; not for lists of cited works&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|author-mask2}}|or any of its aliases, including: author2-mask; subject-mask2; and subject2-mask}}&lt;br /&gt;
| {{tooltip|{{codett|last2}}|or any of its aliases, including: surname2; author-last2; author2-last; author-surname2; author2-surname; author2; subject-last2; subject2-last; subject-surname2; subject2-surname; and subject2}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;collaboration&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{tooltip|{{codett|last1}}|or any of its aliases, including: last; surname1; surname; author-last1; author1-last; author-last; author-surname1; author1-surname; author-surname; author1; author; subject-last1; subject1-last; subject-last; subject-surname1; subject1-surname; subject-surname; subject1; and subject}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;year&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;orig-date&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;year&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;orig-year&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;year&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|location}}|or alias place}} || {{tooltip|{{codett|publisher}}|or alias institution}} || can be used for written-at location when &amp;lt;code&amp;gt;publication-place&amp;lt;/code&amp;gt; is used for publication place&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
|&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for editor. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-first1}}|or any of its aliases, including: editor1-first; editor-first; editor-given1; editor1-given; and editor-given}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for editor. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-link1}}|or any of its aliases, including: editor1-link; and editor-link}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for editor. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-last2}}|or any of its aliases, including: editor2-last; editor2; editor-surname2; and editor2-surname}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for 2nd editor. Don&#039;t link. Similar: &amp;lt;code&amp;gt;editor-last3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-first2}}|or any of its aliases, including: editor2-first; editor-given2; and editor2-given}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last2}}|or any of its aliases, including: editor2-last; editor2; editor-surname2; and editor2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for 2nd editor. Don&#039;t link. Similar: &amp;lt;code&amp;gt;editor-first3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-link2}}|or alias editor2-link}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last2}}|or any of its aliases, including: editor2-last; editor2; editor-surname2; and editor2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for 2nd editor. Don&#039;t link. Similar: &amp;lt;code&amp;gt;editor-link3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;display-editors&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;display-authors&amp;lt;/code&amp;gt;, but for editors&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-mask1}}|or any of its aliases, including: editor1-mask; and editor-mask}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last1}}|or any of its aliases, including: editor1-last; editor-last; editor1; editor; editor-surname1; editor1-surname; and editor-surname}}&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | See [[#Display options|Display options]] below; not for lists of cited works&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|editor-mask2}}|or alias editor2-mask}}&lt;br /&gt;
| {{tooltip|{{codett|editor-last2}}|or any of its aliases, including: editor2-last; editor2; editor-surname2; and editor2-surname}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; || || This parameter is required.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;script-title&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;title-link&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;script-title&amp;lt;/code&amp;gt; || Name of a Wikipedia article about the work. Do not use if &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; is provided&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;script-title&amp;lt;/code&amp;gt; || This parameter is required. Do not use if &amp;lt;code&amp;gt;title-link&amp;lt;/code&amp;gt; is provided&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;url-access&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;trans-title&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;title&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;script-title&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;format&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;department&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|website}}|or any of its aliases, including: journal; magazine; newspaper; periodical; and work}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|script-website}}|or any of its aliases, including: script-journal; script-magazine; script-newspaper; script-periodical; and script-work}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|trans-website}}|or any of its aliases, including: trans-journal; trans-magazine; trans-newspaper; trans-periodical; and trans-work}} || {{tooltip|{{codett|website}}|or any of its aliases, including: journal; magazine; newspaper; periodical; and work}} or {{tooltip|{{codett|script-website}}|or any of its aliases, including: script-journal; script-magazine; script-newspaper; script-periodical; and script-work}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|type}}|or alias medium}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;series&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|language}}|or alias lang}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
|&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for interviewer. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-first1}}|or any of its aliases, including: interviewer1-first; interviewer-first; interviewer-given1; interviewer1-given; and interviewer-given}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for interviewer. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-link1}}|or any of its aliases, including: interviewer1-link; and interviewer-link}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for interviewer. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last2}}|or any of its aliases, including: interviewer2-last; interviewer2; interviewer-surname2; and interviewer2-surname}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for 2nd interviewer. Don&#039;t link. Similar: &amp;lt;code&amp;gt;interviewer-last3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-first2}}|or any of its aliases, including: interviewer2-first; interviewer-given2; and interviewer2-given}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last2}}|or any of its aliases, including: interviewer2-last; interviewer2; interviewer-surname2; and interviewer2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for 2nd interviewer. Don&#039;t link. Similar: &amp;lt;code&amp;gt;interviewer-first3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-link2}}|or alias interviewer2-link}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last2}}|or any of its aliases, including: interviewer2-last; interviewer2; interviewer-surname2; and interviewer2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for 2nd interviewer. Don&#039;t link. Similar: &amp;lt;code&amp;gt;interviewer-link3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;display-interviewers&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;display-authors&amp;lt;/code&amp;gt;, but for interviewers&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-mask1}}|or any of its aliases, including: interviewer1-mask; and interviewer-mask}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last1}}|or any of its aliases, including: interviewer1-last; interviewer-last; interviewer1; interviewer; interviewer-surname1; interviewer1-surname; and interviewer-surname}}&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | See [[#Display options|Display options]] below; not for lists of cited works&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|interviewer-mask2}}|or alias interviewer2-mask}}&lt;br /&gt;
| {{tooltip|{{codett|interviewer-last2}}|or any of its aliases, including: interviewer2-last; interviewer2; interviewer-surname2; and interviewer2-surname}}&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
|&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for translator. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-first1}}|or any of its aliases, including: translator1-first; translator-first; translator-given1; translator1-given; and translator-given}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for translator. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-link1}}|or any of its aliases, including: translator1-link; and translator-link}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for translator. Don&#039;t link.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-last2}}|or any of its aliases, including: translator2-last; translator2; translator-surname2; and translator2-surname}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;last1&amp;lt;/code&amp;gt;, but for 2nd translator. Don&#039;t link. Similar: &amp;lt;code&amp;gt;translator-last3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-first2}}|or any of its aliases, including: translator2-first; translator-given2; and translator2-given}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last2}}|or any of its aliases, including: translator2-last; translator2; translator-surname2; and translator2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;first1&amp;lt;/code&amp;gt;, but for 2nd translator. Don&#039;t link. Similar: &amp;lt;code&amp;gt;translator-first3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-link2}}|or alias translator2-link}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last2}}|or any of its aliases, including: translator2-last; translator2; translator-surname2; and translator2-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;author-link1&amp;lt;/code&amp;gt;, but for 2nd translator. Don&#039;t link. Similar: &amp;lt;code&amp;gt;translator-link3&amp;lt;/code&amp;gt;, etc.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;display-translators&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
| Like &amp;lt;code&amp;gt;display-authors&amp;lt;/code&amp;gt;, but for translators&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-mask1}}|or any of its aliases, including: translator1-mask; and translator-mask}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last1}}|or any of its aliases, including: translator1-last; translator-last; translator1; translator; translator-surname1; translator1-surname; and translator-surname}}&lt;br /&gt;
| rowspan=&amp;quot;2&amp;quot; | See [[#Display options|Display options]] below; not for lists of cited works&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|translator-mask2}}|or alias translator2-mask}}&lt;br /&gt;
| {{tooltip|{{codett|translator-last2}}|or any of its aliases, including: translator2-last; translator2; translator-surname2; and translator2-surname}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;others&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;name-list-style&amp;lt;/code&amp;gt;&lt;br /&gt;
| {{tooltip|{{codett|last2}}|or any of its aliases, including: surname2; author-last2; author2-last; author-surname2; author2-surname; author2; subject-last2; subject2-last; subject-surname2; subject2-surname; and subject2}}&lt;br /&gt;
| Set to &amp;lt;code&amp;gt;amp&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;ampersand&amp;lt;/code&amp;gt; to separate the last author with {{nowrap|&amp;quot;&amp;lt;code&amp;gt; &amp;amp; &amp;lt;/code&amp;gt;&amp;quot;}}; set to &amp;lt;code&amp;gt;and&amp;lt;/code&amp;gt; to separate with {{nowrap|&amp;quot;&amp;lt;code&amp;gt; and &amp;lt;/code&amp;gt;&amp;quot;}}&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;edition&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;publication-place&amp;lt;/code&amp;gt; || {{tooltip|{{codett|publisher}}|or alias institution}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|publisher}}|or alias institution}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;publication-date&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;agency&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;minutes&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;time-caption&amp;lt;/code&amp;gt; || &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;time&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|page}}|or alias p}} || || choose one: &amp;lt;code&amp;gt;page&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pages&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;at&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|pages}}|or alias pp}} || || choose one: &amp;lt;code&amp;gt;page&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pages&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;at&amp;lt;/code&amp;gt;. Use when content on multiple pages supports the article text.&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;at&amp;lt;/code&amp;gt; || || choose one: &amp;lt;code&amp;gt;page&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;pages&amp;lt;/code&amp;gt;, or &amp;lt;code&amp;gt;at&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;no-pp&amp;lt;/code&amp;gt; || {{tooltip|{{codett|page}}|or alias p}} or {{tooltip|{{codett|pages}}|or alias pp}} || set to &amp;quot;yes&amp;quot; to suppress the &amp;quot;p.&amp;quot; or &amp;quot;pp.&amp;quot; before page numbers&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|arxiv}}|or alias eprint}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|asin}}|or alias ASIN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;asin-tld&amp;lt;/code&amp;gt; || {{tooltip|{{codett|asin}}|or alias ASIN}} ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;bibcode&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;biorxiv&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;citeseerx&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|doi}}|or alias DOI}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;doi-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|doi}}|or alias DOI}} ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;doi-broken-date&amp;lt;/code&amp;gt; || {{tooltip|{{codett|doi}}|or alias DOI}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|eissn}}|or alias EISSN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|hdl}}|or alias HDL}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;hdl-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|hdl}}|or alias HDL}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|isbn}}|or alias ISBN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|ismn}}|or alias ISMN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|issn}}|or alias ISSN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|jfm}}|or alias JFM}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|jstor}}|or alias JSTOR}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;jstor-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|jstor}}|or alias JSTOR}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|lccn}}|or alias LCCN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;medrxiv&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|mr}}|or alias MR}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|oclc}}|or alias OCLC}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|ol}}|or alias OL}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ol-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|ol}}|or alias OL}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|osti}}|or alias OSTI}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;osti-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|osti}}|or alias OSTI}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|pmc}}|or alias PMC}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;pmc-embargo-date&amp;lt;/code&amp;gt; || {{tooltip|{{codett|pmc}}|or alias PMC}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|pmid}}|or alias PMID}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|rfc}}|or alias RFC}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|sbn}}|or alias SBN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|ssrn}}|or alias SSRN}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|s2cid}}|or alias S2CID}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;s2cid-access&amp;lt;/code&amp;gt; || {{tooltip|{{codett|s2cid}}|or alias S2CID}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|zbl}}|or alias ZBL}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|id}}|or alias ID}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;url-status&amp;lt;/code&amp;gt; || {{tooltip|{{codett|archive-url}}|or alias archiveurl}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|archive-url}}|or alias archiveurl}} || {{tooltip|{{codett|archive-date}}|or alias archiveurl}}, &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;archive-format&amp;lt;/code&amp;gt; || {{tooltip|{{codett|archive-url}}|or alias archiveurl}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|archive-date}}|or alias archivedate}} || {{tooltip|{{codett|archive-url}}|or alias archiveurl}} ||&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|access-date}}|or alias accessdate}} || &amp;lt;code&amp;gt;url&amp;lt;/code&amp;gt; ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;via&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;quote-page&amp;lt;/code&amp;gt; || || choose one: &amp;lt;code&amp;gt;quote-page&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;quote-pages&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;quote-pages&amp;lt;/code&amp;gt; || || choose one: &amp;lt;code&amp;gt;quote-page&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;quote-pages&amp;lt;/code&amp;gt;. Use when quote contains contents from multiple pages.&lt;br /&gt;
|-&lt;br /&gt;
| {{tooltip|{{codett|quote}}|or alias quotation}} || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;script-quote&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;trans-quote&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;mode&amp;lt;/code&amp;gt; || || &amp;lt;code&amp;gt;cs1&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cs2&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;ref&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;postscript&amp;lt;/code&amp;gt; || ||&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; style=&amp;quot;text-align: center&amp;quot; | If a field name is listed in the &#039;&#039;&#039;Prerequisites&#039;&#039;&#039; column, it is a prerequisite for the field to the left.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Choosing between [[Template:cite web]] and [[Template:cite news]]&amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;Consistency&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;===&lt;br /&gt;
Previously, editors had to decide whether to use {{tl|cite web}} or {{tlf|cite news}} based on these templates&#039; features. In 2014, however, &#039;&#039;most of&#039;&#039; the differences between the two templates were eliminated.&lt;br /&gt;
&lt;br /&gt;
As of {{diff|Module:Citation/CS1|732205428|723907342|29 July 2016}}, {{tlf|cite web}} and {{tlf|cite news}} have the following differences:&lt;br /&gt;
* {{tlf|Cite news}} can be used for [[WP:OFFLINE|offline]] (paper) sources whereas {{tlf|cite web}} generates a missing URL error when no URL is provided&lt;br /&gt;
* {{tlf|Cite news}} accepts {{para|issue}} and {{para|volume}} parameters while {{tlf|cite web}} does not (see {{section link|Help:Citation Style 1#Pages}}, {{section link|1=Help talk:Citation Style 1/Archive 10|2=&amp;amp;#x7C;volume=, &amp;amp;#x7C;issue=, &amp;amp;#x7C;page(s)= and cite magazine}} and {{tl|cite magazine}}.)&lt;br /&gt;
But, given the same set of valid parameters, their output is exactly the same:&lt;br /&gt;
&amp;lt;!-- ATTENTION!&lt;br /&gt;
The following example only serves to demonstrate parameter rending results.&lt;br /&gt;
&lt;br /&gt;
Whether you must include all these parameters in actual articles is not a concern here.&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
{|&lt;br /&gt;
| &#039;&#039;&#039;Cite web&#039;&#039;&#039;: || {{cite web |url=https://blog.chron.com/techblog/2011/07/microsoft-envisions-a-universal-os-but-it-might-not-be-called-windows/ |title=Microsoft envisions a universal OS, but it might not be called Windows |last=Silverman |first=Dwight |date=July 15, 2011 |work=Houston Chronicle |publisher=Hearst Corporation |access-date=May 26, 2015|ref=none}}&lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;Cite news&#039;&#039;&#039;: || {{cite news |url=https://blog.chron.com/techblog/2011/07/microsoft-envisions-a-universal-os-but-it-might-not-be-called-windows/ |title=Microsoft envisions a universal OS, but it might not be called Windows |last=Silverman |first=Dwight |date=July 15, 2011 |work=Houston Chronicle |publisher=Hearst Corporation |access-date=May 26, 2015|ref=none}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Examples==&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|mdy}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date={{date|{{date}}|mdy}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|iso}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|access-date={{date|{{date}}|iso}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|iso}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|access-date={{date|{{date}}|iso}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://operations.nfl.com/the-rules/nfl-rules-digest/&lt;br /&gt;
|title=NFL Rules Digest&lt;br /&gt;
|website=NFL Football Operations&lt;br /&gt;
|publisher=[[National Football League]]&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|mdy}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://operations.nfl.com/the-rules/nfl-rules-digest/&lt;br /&gt;
|title=NFL Rules Digest&lt;br /&gt;
|website=NFL Football Operations&lt;br /&gt;
|publisher=[[National Football League]]&lt;br /&gt;
|access-date={{date|{{date}}|mdy}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Using &amp;quot;format=&amp;quot;===&lt;br /&gt;
When this template detects a link whose URL includes an [[filename extension|extension]] of &amp;quot;.pdf&amp;quot; or &amp;quot;.PDF&amp;quot;, typical of [[PDF]] files, it automatically displays a PDF icon after the link (regardless of whether the link goes to a PDF file or to an HTML landing page, typical of paysites). It also internally acts as if {{para|format|PDF}} had been specified, which displays &amp;quot; (PDF)&amp;quot; after the icon. (In this case, an explicit {{para|format|PDF}} parameter would be redundant, so it &#039;&#039;is not&#039;&#039; recommended to add it. Users may remove it. Citation bot, when invoked, will remove it. ([[User talk:Citation bot/Archive 13#Remove format=pdf and variants when URLs end in .pdf|ref]]))&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.indiapost.gov.in/MBE/DOP_PDFFiles/List_of_Psychotropic_Substances.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|publisher=International Narcotics Control Board&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.indiapost.gov.in/MBE/DOP_PDFFiles/List_of_Psychotropic_Substances.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|publisher=International Narcotics Control Board&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the link is to a PDF file that &#039;&#039;is not&#039;&#039; automatically recognizable by its extension, this template does not display the PDF icon. You may add the parameter {{para|format|PDF}}, which displays &amp;quot; (PDF)&amp;quot; after the link (but no PDF icon).&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.sample.com/somePDFdocument.000&lt;br /&gt;
|title=Some PDF Document&lt;br /&gt;
|publisher=Sample Int&#039;l&lt;br /&gt;
|format=PDF&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.sample.com/somePDFdocument.000&lt;br /&gt;
|title=Some PDF Document&lt;br /&gt;
|publisher=Sample Int&#039;l&lt;br /&gt;
|format=PDF&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For links to files in other formats, no icon is displayed. For example, for an [[.odt]] file, you may add the parameter {{para|format|ODT}}, which displays &amp;quot; (ODT)&amp;quot; after the link.&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.sample.com/someODTdocument.odt&lt;br /&gt;
|title=Some ODT Document&lt;br /&gt;
|publisher=Sample Int&#039;l&lt;br /&gt;
|format=ODT&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.sample.com/someODTdocument.odt&lt;br /&gt;
|title=Some ODT Document&lt;br /&gt;
|publisher=Sample Int&#039;l&lt;br /&gt;
|format=ODT&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Foreign-language and translated title===&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Honi soit qui mal y pense&lt;br /&gt;
|last=Joliet&lt;br /&gt;
|first=François&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
|language=fr&lt;br /&gt;
|trans-title=Shame on those who think evil of it}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Honi soit qui mal y pense&lt;br /&gt;
|last=Joliet&lt;br /&gt;
|first=François&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|access-date={{date}}&lt;br /&gt;
|language=fr&lt;br /&gt;
|trans-title=Shame on those who think evil of it}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Using author-link===&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|author-link=John Doe&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|mdy}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=My Favorite Things, Part II&lt;br /&gt;
|last=Doe&lt;br /&gt;
|first=John&lt;br /&gt;
|author-link=John Doe&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date={{date|{{date}}|mdy}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Multiple authors===&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Our Favourite Things&lt;br /&gt;
|last1=Doe&lt;br /&gt;
|first1=John&lt;br /&gt;
|last2=Smith&lt;br /&gt;
|first2=Peter&lt;br /&gt;
|last3=Smythe&lt;br /&gt;
|first3=Jim&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopaedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Our Favourite Things&lt;br /&gt;
|last1=Doe&lt;br /&gt;
|first1=John&lt;br /&gt;
|last2=Smith&lt;br /&gt;
|first2=Peter&lt;br /&gt;
|last3=Smythe&lt;br /&gt;
|first3=Jim&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopaedia of Things&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===No author===&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|iso}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|publisher=Open Publishing&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date={{date|{{date}}|iso}}}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===No author, no publisher===&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|date=30 April 2005&lt;br /&gt;
|website=Encyclopedia of Things&lt;br /&gt;
|access-date={{date}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|mdy}}&amp;lt;nowiki&amp;gt;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.example.org/&lt;br /&gt;
|title=Index of Sharp Things&lt;br /&gt;
|date=April 30, 2005&lt;br /&gt;
|access-date={{date|{{date}}|mdy}}}}&lt;br /&gt;
}}&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.incb.org/documents/Psychotropics/forms/greenlist/2024/2311984R.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|date=December 2023&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|iso}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
|language=ru}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.incb.org/documents/Psychotropics/forms/greenlist/2024/2311984R.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|date=December 2023&lt;br /&gt;
|access-date={{date|{{date}}|iso}}&lt;br /&gt;
|language=ru}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Using &amp;quot;archive-url&amp;quot; and &amp;quot;archive-date&amp;quot; (and optionally &amp;quot;url-status&amp;quot;) for webpages that have been archived&amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;archive-url&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;===&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;By default, if &amp;quot;archive-url&amp;quot; is used, the parameter {{para|url-status|dead}} is assumed and the resulting main link is to the archived version:&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.incb.org/pdf/e/list/green.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|publisher=International Narcotics Control Board&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date|{{date}}|iso}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
|archive-url=https://web.archive.org/web/20050907150136/https://www.incb.org/pdf/e/list/green.pdf&lt;br /&gt;
|archive-date=2005-09-07}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.incb.org/pdf/e/list/green.pdf&lt;br /&gt;
|title=List of psychotropic substances under international control&lt;br /&gt;
|date=2005-04-30&lt;br /&gt;
|publisher=International Narcotics Control Board&lt;br /&gt;
|access-date={{date|{{date}}|iso}}&lt;br /&gt;
|archive-url=https://web.archive.org/web/20050907150136/https://www.incb.org/pdf/e/list/green.pdf&lt;br /&gt;
|archive-date=2005-09-07}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;When {{para|url-status|live}} is specified, the resulting main link is to the original page:&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.hollywoodreporter.com/heat-vision/dc-entertainment-give-classic-batman-824572&lt;br /&gt;
|title=DC Entertainment To Give Classic Batman Writer Credit in &#039;Gotham&#039; and &#039;Batman v Superman&#039; (Exclusive)&lt;br /&gt;
|website=The Hollywood Reporter&lt;br /&gt;
|date=September 18, 2015&lt;br /&gt;
|access-date=September 21, 2015&lt;br /&gt;
|url-status=live&lt;br /&gt;
|archive-url=https://web.archive.org/web/20151022181821/https://www.hollywoodreporter.com/heat-vision/dc-entertainment-give-classic-batman-824572&lt;br /&gt;
|archive-date=October 22, 2015}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.hollywoodreporter.com/heat-vision/dc-entertainment-give-classic-batman-824572&lt;br /&gt;
|title=DC Entertainment To Give Classic Batman Writer Credit in &#039;Gotham&#039; and &#039;Batman v Superman&#039; (Exclusive)&lt;br /&gt;
|website=The Hollywood Reporter&lt;br /&gt;
|date=September 18, 2015&lt;br /&gt;
|access-date=September 21, 2015&lt;br /&gt;
|url-status=live&lt;br /&gt;
|archive-url=https://web.archive.org/web/20151022181821/https://www.hollywoodreporter.com/heat-vision/dc-entertainment-give-classic-batman-824572&lt;br /&gt;
|archive-date=October 22, 2015}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;With {{para|url-status|unfit}} or {{code|usurped}}, the original is not linked at all:&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.wunderground.com/global/stations/03772.html&lt;br /&gt;
|title=London, United Kingdom Forecast: Weather Underground (weather and elevation at Heathrow Airport)&lt;br /&gt;
|publisher=The Weather Underground&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
|url-status=unfit |archive-url=https://web.archive.org/web/20110522171657/https://www.wunderground.com/global/stations/03772.html |archive-date=22 May 2011}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.wunderground.com/global/stations/03772.html&lt;br /&gt;
|title=London, United Kingdom Forecast: Weather Underground (weather and elevation at Heathrow Airport)&lt;br /&gt;
|publisher=The Weather Underground&lt;br /&gt;
|access-date={{date}}&lt;br /&gt;
|url-status=unfit |archive-url=https://web.archive.org/web/20110522171657/https://www.wunderground.com/global/stations/03772.html |archive-date=22 May 2011}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Using &amp;quot;quote&amp;quot;===&lt;br /&gt;
&amp;lt;div style=&amp;quot;width:auto; overflow:scroll&amp;quot;&amp;gt;&lt;br /&gt;
{{markup2|&lt;br /&gt;
|m=&amp;lt;nowiki&amp;gt;{{cite web&lt;br /&gt;
|url=https://www.webexhibits.org/daylightsaving/c.html&lt;br /&gt;
|title=Daylight saving time: rationale and original idea&lt;br /&gt;
|website=WebExhibits&lt;br /&gt;
|date=2008&lt;br /&gt;
|access-date=&amp;lt;/nowiki&amp;gt;{{date}}&amp;lt;nowiki&amp;gt;&lt;br /&gt;
|quote=...&amp;amp;amp;nbsp;Lord Balfour came forward with a unique concern: &#039;Supposing some unfortunate lady was confined with twins&amp;amp;amp;nbsp;...&#039;}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|r={{cite web&lt;br /&gt;
|url=https://www.webexhibits.org/daylightsaving/c.html&lt;br /&gt;
|title=Daylight saving time: rationale and original idea&lt;br /&gt;
|website=WebExhibits&lt;br /&gt;
|date=2008&lt;br /&gt;
|access-date={{date}}&lt;br /&gt;
|quote=...&amp;amp;nbsp;Lord Balfour came forward with a unique concern: &#039;Supposing some unfortunate lady was confined with twins&amp;amp;nbsp;...&#039;}}&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===Syntax===&lt;br /&gt;
{{csdoc|syntax}}&lt;br /&gt;
{{csdoc|sep_period}}&lt;br /&gt;
&lt;br /&gt;
===COinS===&lt;br /&gt;
{{csdoc|coins}}&lt;br /&gt;
&lt;br /&gt;
===What&#039;s new===&lt;br /&gt;
{{csdoc|whats new}}&lt;br /&gt;
&lt;br /&gt;
===Deprecated===&lt;br /&gt;
{{csdoc|deprecated}}&lt;br /&gt;
&lt;br /&gt;
===Description===&lt;br /&gt;
====Authors====&lt;br /&gt;
{{csdoc|author|others=yes}}&lt;br /&gt;
&lt;br /&gt;
====Date====&lt;br /&gt;
{{csdoc|date}}&lt;br /&gt;
&lt;br /&gt;
====Editors====&lt;br /&gt;
{{csdoc|editor}}&lt;br /&gt;
&lt;br /&gt;
====Title====&lt;br /&gt;
{{csdoc|web}}&lt;br /&gt;
{{csdoc|type}}&lt;br /&gt;
{{csdoc|language}}&lt;br /&gt;
&lt;br /&gt;
====&amp;lt;span class=&amp;quot;anchor&amp;quot; id=&amp;quot;url&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;URL====&lt;br /&gt;
{{csdoc|url}}&lt;br /&gt;
&lt;br /&gt;
====Website====&lt;br /&gt;
{{csdoc|journal|issue=no|department=yes}}&lt;br /&gt;
&lt;br /&gt;
====Edition, series====&lt;br /&gt;
{{csdoc|edition}}&lt;br /&gt;
{{csdoc|series}}&lt;br /&gt;
&lt;br /&gt;
====Publisher====&lt;br /&gt;
{{csdoc|publisher}}&lt;br /&gt;
{{csdoc|agency}}&lt;br /&gt;
&lt;br /&gt;
====In-source locations====&lt;br /&gt;
{{csdoc|time}}&lt;br /&gt;
{{csdoc|pages}}&lt;br /&gt;
&lt;br /&gt;
====Identifiers====&lt;br /&gt;
{{distinguish|#Anchor}}&lt;br /&gt;
{{csdoc|id1}}&lt;br /&gt;
{{csdoc|id2}}&lt;br /&gt;
&lt;br /&gt;
====Subscription or registration required====&lt;br /&gt;
{{csdoc|registration}}&lt;br /&gt;
&lt;br /&gt;
====Quote====&lt;br /&gt;
{{csdoc|quote}}&lt;br /&gt;
&lt;br /&gt;
====Anchor====&lt;br /&gt;
{{distinguish|#Identifiers}}&lt;br /&gt;
{{csdoc|ref}}&lt;br /&gt;
&lt;br /&gt;
====Display options====&lt;br /&gt;
{{csdoc|display}}&lt;br /&gt;
&lt;br /&gt;
==TemplateData==&lt;br /&gt;
{{Warning |image=Stop hand nuvola.svg |This section contains configuration data used by editing tools and automated bots. Changes to this data can result in widespread and unintended effects. For more information see [[Help:Citation Style 1#TemplateData]]}}&lt;br /&gt;
{{TemplateData header}}&lt;br /&gt;
{{#invoke:cs1 documentation support|template_data_validate|{{ROOTPAGENAME}}}}&lt;br /&gt;
&amp;lt;templatedata&amp;gt;&lt;br /&gt;
{&lt;br /&gt;
	&amp;quot;description&amp;quot;: &amp;quot;Formats a citation to a website using the provided information such as URL and title. Used only for sources that are not correctly described by the specific citation templates for books, journals, news sources, etc.&amp;quot;,&lt;br /&gt;
	&amp;quot;params&amp;quot;: {&lt;br /&gt;
		&amp;quot;url&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;URL&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The URL of the online location where the text of the publication can be found. Requires schemes of the type \&amp;quot;https://...\&amp;quot; or maybe even the protocol relative scheme \&amp;quot;//...\&amp;quot;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;url&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;URL&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;required&amp;quot;: true,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;https://www.metacritic.com/...&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;title&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Title&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The title of the source page on the website; will display with quotation marks added. Usually found at the top of your web browser. Not the name of the website.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;required&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Source date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Full date when the source was published; if unknown, use access-date instead; do not wikilink&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;access-date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;URL access date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The full date when the original URL was accessed; do not wikilink&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;accessdate&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;website&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Name of the website&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title (name) of the website (or its short URL if no plain-language title is discernible); may be wikilinked; will display in italics. Having both &#039;publisher&#039; and &#039;website&#039; is redundant in many cases.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;work&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;[[Rotten Tomatoes]]&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;publisher&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Publisher&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Name of the publisher; may be wikilinked. Having both &#039;publisher&#039; and &#039;website&#039; (a.k.a. &#039;work&#039;) is redundant in many cases.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;[[Fandom, Inc.]] (which owns \&amp;quot;Metacritic.com\&amp;quot;)&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the author; don&#039;t wikilink, use &#039;author-link&#039;; can suffix with a numeral to add additional authors&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;last1&amp;quot;,&lt;br /&gt;
				&amp;quot;author&amp;quot;,&lt;br /&gt;
				&amp;quot;author1&amp;quot;,&lt;br /&gt;
				&amp;quot;author1-last&amp;quot;,&lt;br /&gt;
				&amp;quot;author-last&amp;quot;,&lt;br /&gt;
				&amp;quot;surname1&amp;quot;,&lt;br /&gt;
				&amp;quot;author-last1&amp;quot;,&lt;br /&gt;
				&amp;quot;subject1&amp;quot;,&lt;br /&gt;
				&amp;quot;surname&amp;quot;,&lt;br /&gt;
				&amp;quot;subject&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the author; don&#039;t wikilink, use &#039;author-link&#039;; can suffix with a numeral to add additional authors&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;given&amp;quot;,&lt;br /&gt;
				&amp;quot;author-first&amp;quot;,&lt;br /&gt;
				&amp;quot;first1&amp;quot;,&lt;br /&gt;
				&amp;quot;given1&amp;quot;,&lt;br /&gt;
				&amp;quot;author-first1&amp;quot;,&lt;br /&gt;
				&amp;quot;author1-first&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the author; can suffix with a numeral to add additional authors&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author-link1&amp;quot;,&lt;br /&gt;
				&amp;quot;author1-link&amp;quot;,&lt;br /&gt;
				&amp;quot;subject-link&amp;quot;,&lt;br /&gt;
				&amp;quot;subject-link1&amp;quot;,&lt;br /&gt;
				&amp;quot;subject1-link&amp;quot;,&lt;br /&gt;
				&amp;quot;authorlink&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 2&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the second author; don&#039;t wikilink, use &#039;author-link2&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author2&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 2&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the second author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link2&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 2&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the second author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author2-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;others&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Others&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Used to record other (non-author) contributions to the work, such as &#039;Illustrated by John Smith&#039; or &#039;Translated by John Smith&#039;. Only one &#039;&#039;others&#039;&#039; parameter is allowed: e.g., &#039;Illustrated by Jane Doe; Translated by John Smith&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;year&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Year of publication&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Year of the source being referenced; deprecated in favor of &#039;date&#039;, except for the special case of ISO dates with disambiguating letter&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;orig-date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Original date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Original date of publication; provide specifics&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the editor; don&#039;t wikilink, use &#039;editor-link&#039;; can suffix with a numeral to add additional editors.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor1-last&amp;quot;,&lt;br /&gt;
				&amp;quot;editor&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the editor; don&#039;t wikilink, use &#039;editor-link&#039;; can suffix with a numeral to add additional editors; alias of &#039;editor1-first&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor1-first&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the editor; can suffix with a numeral to add additional editors&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor1-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;series&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Series identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Series identifier when the source is part of a series, such as a book series or a journal&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;publication-place&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Place of publication&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Publication place shows after title; if &#039;place&#039; or &#039;location&#039; are also given, they are displayed before the title prefixed with &#039;written at&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;publication-date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Publication date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Date of publication when different from the date the work was written; do not wikilink&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;page&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Page&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Page in the source that supports the content; displays after &#039;p.&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;pages&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Pages&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Pages in the source that support the content (not an indication of the number of pages in the source); displays after &#039;pp.&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;no-pp&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;No pp&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Set to &#039;y&#039; to suppress the &#039;p.&#039; or &#039;pp.&#039; display with &#039;page&#039; or &#039;pages&#039; when inappropriate (such as &#039;Front cover&#039;)&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;boolean&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;y&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;at&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;At&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;May be used instead of &#039;page&#039; or &#039;pages&#039; where a page number is inappropriate or insufficient&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;language&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Language&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The language in which the source is written, if not English; use a two-letter language code or the full language name. Do not use icons or templates. Separate multiple languages with commas&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;lang&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;de, fr, es&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;script-title&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Script title&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;For titles in languages that do not use a Latin-based alphabet (Arabic, Chinese, Cyrillic, Greek, Hebrew, Japanese, Korean, etc.). Prefix with two-character ISO639-1 language code followed by a colon.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;For Japanese use: |script-title=ja:...&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;trans-title&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Translated title&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;An English language title, if the source cited is in a foreign language; &#039;language&#039; is recommended&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;type&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Type&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Additional information about the media type of the source; format in sentence case&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;format&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Format&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Format of the work referred to by &#039;url&#039;; examples: PDF, DOC, XLS; do not specify HTML&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;arxiv&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;arXiv identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;An identifier for arXive electronic preprints of scientific papers&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;asin&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;ASIN&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Amazon Standard Identification Number; 10 characters&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;asin-tld&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;ASIN TLD&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;ASIN top-level domain for Amazon sites other than the US&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;bibcode&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Bibcode&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Bibliographic Reference Code (REFCODE); 19 characters&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;biorxiv&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;biorXiv&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;biorXiv identifier; 6 digits&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;citeseerx&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;CiteSeerX&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;CiteSeerX identifier; found after the &#039;doi=&#039; query parameter&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;doi&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;DOI&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Digital Object Identifier; begins with &#039;10.&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;doi-broken-date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;DOI broken date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The date that the DOI was determined to be broken&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;isbn&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;ISBN&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;International Standard Book Number; use the 13-digit ISBN where possible&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;issn&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;ISSN&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;International Standard Serial Number; 8 characters; may be split into two groups of four using a hyphen&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;jfm&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;jfm code&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Jahrbuch über die Fortschritte der Mathematik classification code&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;jstor&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;JSTOR&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;JSTOR identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;lccn&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;LCCN&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Library of Congress Control Number&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;mr&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;MR&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Mathematical Reviews identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;oclc&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;OCLC&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Online Computer Library Center number&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;ol&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;OL&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Open Library identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;osti&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;OSTI&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Office of Scientific and Technical Information identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;pmc&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;PMC&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;PubMed Center article number&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;pmid&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;PMID&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;PubMed Unique Identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;rfc&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;RFC&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Request for Comments number&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;ssrn&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;SSRN&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Social Science Research Network&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;zbl&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Zbl&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Zentralblatt MATH journal identifier&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;id&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;id&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;A unique identifier used where none of the specialized ones are applicable&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;archive-url&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Archive URL&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The URL of an archived copy of a web page, if or in case the URL becomes unavailable; requires &#039;archive-date&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;url&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;archiveurl&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;archive-date&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Archive date&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Date when the original URL was archived; do not wikilink&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;date&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;archivedate&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;archive-format&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Archive format&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Format of the archived copy; do not specify HTML&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;PDF, DOC, XLS&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;quote&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Quote&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Relevant text quoted from the source; displays last, enclosed in quotes; must include terminating punctuation&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;trans-quote&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Translated quote&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;English translation of the quotation if the source quoted is in a foreign language. Displays in square brackets.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;ref&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Ref&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;An anchor identifier; can be made the target of wikilinks to full references&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;postscript&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Postscript&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The closing punctuation for the citation; ignored if &#039;quote&#039; is defined&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;default&amp;quot;: &amp;quot;.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-mask&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author mask&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Replaces the name of the first author with em dashes or text; set to a numeric value &#039;n&#039; to set the dash &#039;n&#039; em spaces wide; set to a text value to display the text without a trailing author separator; for example, &#039;with&#039; instead&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 3&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the third author; don&#039;t wikilink, use &#039;author-link3&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author3&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 3&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the third author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link3&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 3&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the third author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author3-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last4&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 4&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fourth author; don&#039;t wikilink, use &#039;author-link4&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author4&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first4&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 4&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fourth author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link4&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 4&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fourth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author4-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last5&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 5&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fifth author; don&#039;t wikilink, use &#039;author-link5&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author5&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first5&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 5&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fifth author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link5&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 5&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fifth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author5-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last6&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the sixth author; don&#039;t wikilink, use &#039;author-link6&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author6&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first6&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the sixth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link6&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the sixth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author6-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last7&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 7&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the seventh author; don&#039;t wikilink, use &#039;author-link7&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author7&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first7&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 7&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the seventh author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link7&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 7&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the seventh author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author7-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last8&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 8&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the eighth author; don&#039;t wikilink, use &#039;author-link8&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author8&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first8&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 8&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the eighth author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link8&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 8&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the eighth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author8-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last9&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 9&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the ninth author; don&#039;t wikilink, use &#039;author-link9&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author9&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first9&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 9&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the ninth author; don&#039;t wikilink.&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link9&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 9&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the ninth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author9-link&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;display-authors&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Display authors&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Number of authors to display before &#039;et al.&#039; is used. By default, all authors are displayed. Examples: |display-authors=2 will display only the first two authors in a citation followed by et al. |display-authors=etal displays all authors in the list followed by et al.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;name-list-style&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Name list style&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Set to &#039;amp&#039; or &#039;and&#039; to change the separator between the last two names of the name list to &#039; &amp;amp; &#039; or &#039; and &#039;, respectively. Set to &#039;vanc&#039; to display name lists in Vancouver style.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;suggestedvalues&amp;quot;: [&lt;br /&gt;
				&amp;quot;amp&amp;quot;,&lt;br /&gt;
				&amp;quot;and&amp;quot;,&lt;br /&gt;
				&amp;quot;vanc&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor2-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 2&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the second editor; don&#039;t wikilink, use &#039;editor2-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor2&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor2-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 2&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the second editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor3-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 3&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the third editor; don&#039;t wikilink, use &#039;editor3-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor3&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor3-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 3&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the third editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor4-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 4&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fourth editor; don&#039;t wikilink, use &#039;editor4-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor4&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor4-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 4&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fourth editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor5-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 5&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fifth editor; don&#039;t wikilink, use &#039;editor5-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor5&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor5-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 5&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fifth editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor6-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the sixth editor; don&#039;t wikilink, use &#039;editor6-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor6&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor6-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the sixth editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor7-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 7&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the seventh editor; don&#039;t wikilink, use &#039;editor7-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor7&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor7-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 7&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the seventh editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor8-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 8&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the eighth editor; don&#039;t wikilink, use &#039;editor8-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor8&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor8-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 8&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the eighth editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor9-last&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor last name 9&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the ninth editor; don&#039;t wikilink, use &#039;editor9-link&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;editor9&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor9-first&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor first name 9&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the ninth editor; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor2-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 2&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the second editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor3-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 3&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the third editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor4-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 4&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fourth editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor5-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 5&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fifth editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor6-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 6&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the sixth editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor7-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 7&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the seventh editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor8-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 8&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the eighth editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;editor9-link&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Editor link 9&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the ninth editor.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;edition&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Edition&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Specify the edition or revision of the source, when applicable. For example: &#039;2nd&#039; or &#039;5.1&#039;. What you supply here is suffixed by &#039; ed.&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;2nd&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;url-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;URL access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Classification of the access restrictions on the URL&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;suggestedvalues&amp;quot;: [&lt;br /&gt;
				&amp;quot;registration&amp;quot;,&lt;br /&gt;
				&amp;quot;subscription&amp;quot;,&lt;br /&gt;
				&amp;quot;limited&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;&#039;registration&#039;, &#039;subscription&#039; or &#039;limited&#039;&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;bibcode-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Bibcode access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is available from ADS via this Bibcode, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;doi-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;DOI access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is free to read via the DOI, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;hdl-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;HDL access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is free to read via the HDL, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;jstor-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Jstor access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is free to read on Jstor, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;ol-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;OpenLibrary access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is free to read on OpenLibrary, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;osti-access&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;OSTI access level&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If the full text is free to read on OSTI, type &#039;free&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;autovalue&amp;quot;: &amp;quot;free&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;via&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Published via&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Name of the entity hosting the original copy of the work, if different from the publisher. This entity is committed not to alter the work.&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;[[GitHub]], [[SourceForge]], [[CodePlex]], [[YouTube]], [[Vimeo]], [[Dailymotion]], [[Netflix]], [[Archive.org]], [[Wikimedia Commons]], [[grc.com]]&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;url-status&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;URL status&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;If set to &#039;live&#039;, the title display is adjusted; useful for when the URL is archived preemptively but still live. Set to \&amp;quot;dead\&amp;quot; or &#039;usurped&#039; for broken links. Entering &#039;unfit&#039; or &#039;usurped&#039; makes the original link not appear at all.&amp;quot;,&lt;br /&gt;
			&amp;quot;example&amp;quot;: &amp;quot;&#039;dead&#039; or &#039;live&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;,&lt;br /&gt;
			&amp;quot;default&amp;quot;: &amp;quot;&#039;dead&#039; if an Archive URL is entered&amp;quot;,&lt;br /&gt;
			&amp;quot;suggested&amp;quot;: true,&lt;br /&gt;
			&amp;quot;suggestedvalues&amp;quot;: [&lt;br /&gt;
				&amp;quot;dead&amp;quot;,&lt;br /&gt;
				&amp;quot;live&amp;quot;,&lt;br /&gt;
				&amp;quot;usurped&amp;quot;,&lt;br /&gt;
				&amp;quot;unfit&amp;quot;,&lt;br /&gt;
				&amp;quot;deviated&amp;quot;&lt;br /&gt;
			]&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;agency&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Agency&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The news agency (wire service) that provided the content; examples: Associated Press, Reuters, Agence France-Presse&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;place&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Place&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;For news stories with a dateline, the location where the story was written; will be treated as the publication place if publication place is absent; alias of &#039;location&#039;&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link10&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author10-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 10&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the tenth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link11&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author11-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 11&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the eleventh author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last10&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author10&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 10&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the tenth author; don&#039;t wikilink, use &#039;author-link10&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first10&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 10&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the tenth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first11&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 11&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the eleventh author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last11&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author11&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 11&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the eleventh author; don&#039;t wikilink, use &#039;author-link11&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last12&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author12&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 12&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the twelfth author; don&#039;t wikilink, use &#039;author-link12&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first12&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 12&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the twelfth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link12&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author12-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 12&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the twelfth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last13&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author13&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 13&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the thirteenth author; don&#039;t wikilink, use &#039;author-link13&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first13&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 13&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the thirteenth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link13&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author13-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 13&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the thirteenth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last14&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author14&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 14&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fourteenth author; don&#039;t wikilink, use &#039;author-link14&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first14&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 14&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fourteenth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link14&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author14-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 14&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fourteenth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;last15&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author15&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Last name 15&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the fifteenth author; don&#039;t wikilink, use &#039;author-link15&#039;.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;first15&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;First name 15&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the fifteenth author; don&#039;t wikilink.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;author-link15&amp;quot;: {&lt;br /&gt;
			&amp;quot;aliases&amp;quot;: [&lt;br /&gt;
				&amp;quot;author15-link&amp;quot;&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Author link 15&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the fifteenth author.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;df&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Date format&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Sets rendered dates to the specified format&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;string&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;translator-last1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Translator last name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;The surname of the translator; don&#039;t wikilink, use &#039;translator-link&#039;; can suffix with a numeral to add additional translators.&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;translator-first1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Translator first name&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Given or first name, middle names, or initials of the translator; don&#039;t wikilink, use &#039;translator-link1&#039;; can suffix with a numeral to add additional editors&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;line&amp;quot;&lt;br /&gt;
		},&lt;br /&gt;
		&amp;quot;translator-link1&amp;quot;: {&lt;br /&gt;
			&amp;quot;label&amp;quot;: &amp;quot;Translator link&amp;quot;,&lt;br /&gt;
			&amp;quot;description&amp;quot;: &amp;quot;Title of existing Wikipedia article about the translator; can suffix with a numeral to add additional translators&amp;quot;,&lt;br /&gt;
			&amp;quot;type&amp;quot;: &amp;quot;wiki-page-name&amp;quot;&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;maps&amp;quot;: {&lt;br /&gt;
		&amp;quot;citoid&amp;quot;: {&lt;br /&gt;
			&amp;quot;title&amp;quot;: &amp;quot;title&amp;quot;,&lt;br /&gt;
			&amp;quot;url&amp;quot;: &amp;quot;url&amp;quot;,&lt;br /&gt;
			&amp;quot;subject&amp;quot;: &amp;quot;title&amp;quot;,&lt;br /&gt;
			&amp;quot;publicationTitle&amp;quot;: &amp;quot;website&amp;quot;,&lt;br /&gt;
			&amp;quot;blogTitle&amp;quot;: &amp;quot;website&amp;quot;,&lt;br /&gt;
			&amp;quot;forumTitle&amp;quot;: &amp;quot;website&amp;quot;,&lt;br /&gt;
			&amp;quot;seriesTitle&amp;quot;: &amp;quot;website&amp;quot;,&lt;br /&gt;
			&amp;quot;websiteTitle&amp;quot;: &amp;quot;website&amp;quot;,&lt;br /&gt;
			&amp;quot;publisher&amp;quot;: &amp;quot;publisher&amp;quot;,&lt;br /&gt;
			&amp;quot;date&amp;quot;: &amp;quot;date&amp;quot;,&lt;br /&gt;
			&amp;quot;PMCID&amp;quot;: &amp;quot;pmc&amp;quot;,&lt;br /&gt;
			&amp;quot;PMID&amp;quot;: &amp;quot;pmid&amp;quot;,&lt;br /&gt;
			&amp;quot;oclc&amp;quot;: &amp;quot;oclc&amp;quot;,&lt;br /&gt;
			&amp;quot;pages&amp;quot;: &amp;quot;pages&amp;quot;,&lt;br /&gt;
			&amp;quot;series&amp;quot;: &amp;quot;series&amp;quot;,&lt;br /&gt;
			&amp;quot;accessDate&amp;quot;: &amp;quot;access-date&amp;quot;,&lt;br /&gt;
			&amp;quot;archiveUrl&amp;quot;: &amp;quot;archive-url&amp;quot;,&lt;br /&gt;
			&amp;quot;archiveDate&amp;quot;: &amp;quot;archive-date&amp;quot;,&lt;br /&gt;
			&amp;quot;DOI&amp;quot;: &amp;quot;doi&amp;quot;,&lt;br /&gt;
			&amp;quot;language&amp;quot;: &amp;quot;language&amp;quot;,&lt;br /&gt;
			&amp;quot;contributor&amp;quot;: &amp;quot;others&amp;quot;,&lt;br /&gt;
			&amp;quot;author&amp;quot;: [&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first&amp;quot;,&lt;br /&gt;
					&amp;quot;last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first2&amp;quot;,&lt;br /&gt;
					&amp;quot;last2&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first3&amp;quot;,&lt;br /&gt;
					&amp;quot;last3&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first4&amp;quot;,&lt;br /&gt;
					&amp;quot;last4&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first5&amp;quot;,&lt;br /&gt;
					&amp;quot;last5&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first6&amp;quot;,&lt;br /&gt;
					&amp;quot;last6&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first7&amp;quot;,&lt;br /&gt;
					&amp;quot;last7&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first8&amp;quot;,&lt;br /&gt;
					&amp;quot;last8&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;first9&amp;quot;,&lt;br /&gt;
					&amp;quot;last9&amp;quot;&lt;br /&gt;
				]&lt;br /&gt;
			],&lt;br /&gt;
			&amp;quot;editor&amp;quot;: [&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor2-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor2-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor3-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor3-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor4-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor4-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor5-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor5-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor6-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor6-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor7-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor7-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor8-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor8-last&amp;quot;&lt;br /&gt;
				],&lt;br /&gt;
				[&lt;br /&gt;
					&amp;quot;editor9-first&amp;quot;,&lt;br /&gt;
					&amp;quot;editor9-last&amp;quot;&lt;br /&gt;
				]&lt;br /&gt;
			]&lt;br /&gt;
		}&lt;br /&gt;
	},&lt;br /&gt;
	&amp;quot;paramOrder&amp;quot;: [&lt;br /&gt;
		&amp;quot;last&amp;quot;,&lt;br /&gt;
		&amp;quot;first&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link&amp;quot;,&lt;br /&gt;
		&amp;quot;last2&amp;quot;,&lt;br /&gt;
		&amp;quot;first2&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link2&amp;quot;,&lt;br /&gt;
		&amp;quot;last3&amp;quot;,&lt;br /&gt;
		&amp;quot;first3&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link3&amp;quot;,&lt;br /&gt;
		&amp;quot;last4&amp;quot;,&lt;br /&gt;
		&amp;quot;first4&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link4&amp;quot;,&lt;br /&gt;
		&amp;quot;last5&amp;quot;,&lt;br /&gt;
		&amp;quot;first5&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link5&amp;quot;,&lt;br /&gt;
		&amp;quot;last6&amp;quot;,&lt;br /&gt;
		&amp;quot;first6&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link6&amp;quot;,&lt;br /&gt;
		&amp;quot;last7&amp;quot;,&lt;br /&gt;
		&amp;quot;first7&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link7&amp;quot;,&lt;br /&gt;
		&amp;quot;last8&amp;quot;,&lt;br /&gt;
		&amp;quot;first8&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link8&amp;quot;,&lt;br /&gt;
		&amp;quot;last9&amp;quot;,&lt;br /&gt;
		&amp;quot;first9&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link9&amp;quot;,&lt;br /&gt;
		&amp;quot;last10&amp;quot;,&lt;br /&gt;
		&amp;quot;first10&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link10&amp;quot;,&lt;br /&gt;
		&amp;quot;last11&amp;quot;,&lt;br /&gt;
		&amp;quot;first11&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link11&amp;quot;,&lt;br /&gt;
		&amp;quot;last12&amp;quot;,&lt;br /&gt;
		&amp;quot;first12&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link12&amp;quot;,&lt;br /&gt;
		&amp;quot;last13&amp;quot;,&lt;br /&gt;
		&amp;quot;first13&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link13&amp;quot;,&lt;br /&gt;
		&amp;quot;last14&amp;quot;,&lt;br /&gt;
		&amp;quot;first14&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link14&amp;quot;,&lt;br /&gt;
		&amp;quot;last15&amp;quot;,&lt;br /&gt;
		&amp;quot;first15&amp;quot;,&lt;br /&gt;
		&amp;quot;author-link15&amp;quot;,&lt;br /&gt;
		&amp;quot;author-mask&amp;quot;,&lt;br /&gt;
		&amp;quot;display-authors&amp;quot;,&lt;br /&gt;
		&amp;quot;name-list-style&amp;quot;,&lt;br /&gt;
		&amp;quot;date&amp;quot;,&lt;br /&gt;
		&amp;quot;year&amp;quot;,&lt;br /&gt;
		&amp;quot;orig-date&amp;quot;,&lt;br /&gt;
		&amp;quot;editor-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor2-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor2-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor2-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor3-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor3-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor3-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor4-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor4-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor4-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor5-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor5-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor5-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor6-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor6-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor6-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor7-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor7-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor7-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor8-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor8-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor8-link&amp;quot;,&lt;br /&gt;
		&amp;quot;editor9-last&amp;quot;,&lt;br /&gt;
		&amp;quot;editor9-first&amp;quot;,&lt;br /&gt;
		&amp;quot;editor9-link&amp;quot;,&lt;br /&gt;
		&amp;quot;others&amp;quot;,&lt;br /&gt;
		&amp;quot;title&amp;quot;,&lt;br /&gt;
		&amp;quot;script-title&amp;quot;,&lt;br /&gt;
		&amp;quot;trans-title&amp;quot;,&lt;br /&gt;
		&amp;quot;url&amp;quot;,&lt;br /&gt;
		&amp;quot;url-access&amp;quot;,&lt;br /&gt;
		&amp;quot;url-status&amp;quot;,&lt;br /&gt;
		&amp;quot;archive-url&amp;quot;,&lt;br /&gt;
		&amp;quot;archive-date&amp;quot;,&lt;br /&gt;
		&amp;quot;archive-format&amp;quot;,&lt;br /&gt;
		&amp;quot;access-date&amp;quot;,&lt;br /&gt;
		&amp;quot;website&amp;quot;,&lt;br /&gt;
		&amp;quot;series&amp;quot;,&lt;br /&gt;
		&amp;quot;publisher&amp;quot;,&lt;br /&gt;
		&amp;quot;place&amp;quot;,&lt;br /&gt;
		&amp;quot;page&amp;quot;,&lt;br /&gt;
		&amp;quot;pages&amp;quot;,&lt;br /&gt;
		&amp;quot;at&amp;quot;,&lt;br /&gt;
		&amp;quot;language&amp;quot;,&lt;br /&gt;
		&amp;quot;type&amp;quot;,&lt;br /&gt;
		&amp;quot;format&amp;quot;,&lt;br /&gt;
		&amp;quot;publication-place&amp;quot;,&lt;br /&gt;
		&amp;quot;publication-date&amp;quot;,&lt;br /&gt;
		&amp;quot;df&amp;quot;,&lt;br /&gt;
		&amp;quot;via&amp;quot;,&lt;br /&gt;
		&amp;quot;no-pp&amp;quot;,&lt;br /&gt;
		&amp;quot;arxiv&amp;quot;,&lt;br /&gt;
		&amp;quot;asin&amp;quot;,&lt;br /&gt;
		&amp;quot;asin-tld&amp;quot;,&lt;br /&gt;
		&amp;quot;bibcode&amp;quot;,&lt;br /&gt;
		&amp;quot;biorxiv&amp;quot;,&lt;br /&gt;
		&amp;quot;citeseerx&amp;quot;,&lt;br /&gt;
		&amp;quot;doi&amp;quot;,&lt;br /&gt;
		&amp;quot;doi-broken-date&amp;quot;,&lt;br /&gt;
		&amp;quot;isbn&amp;quot;,&lt;br /&gt;
		&amp;quot;issn&amp;quot;,&lt;br /&gt;
		&amp;quot;jfm&amp;quot;,&lt;br /&gt;
		&amp;quot;jstor&amp;quot;,&lt;br /&gt;
		&amp;quot;lccn&amp;quot;,&lt;br /&gt;
		&amp;quot;mr&amp;quot;,&lt;br /&gt;
		&amp;quot;oclc&amp;quot;,&lt;br /&gt;
		&amp;quot;ol&amp;quot;,&lt;br /&gt;
		&amp;quot;osti&amp;quot;,&lt;br /&gt;
		&amp;quot;pmc&amp;quot;,&lt;br /&gt;
		&amp;quot;pmid&amp;quot;,&lt;br /&gt;
		&amp;quot;rfc&amp;quot;,&lt;br /&gt;
		&amp;quot;ssrn&amp;quot;,&lt;br /&gt;
		&amp;quot;zbl&amp;quot;,&lt;br /&gt;
		&amp;quot;id&amp;quot;,&lt;br /&gt;
		&amp;quot;quote&amp;quot;,&lt;br /&gt;
		&amp;quot;trans-quote&amp;quot;,&lt;br /&gt;
		&amp;quot;ref&amp;quot;,&lt;br /&gt;
		&amp;quot;postscript&amp;quot;,&lt;br /&gt;
		&amp;quot;edition&amp;quot;,&lt;br /&gt;
		&amp;quot;bibcode-access&amp;quot;,&lt;br /&gt;
		&amp;quot;doi-access&amp;quot;,&lt;br /&gt;
		&amp;quot;hdl-access&amp;quot;,&lt;br /&gt;
		&amp;quot;jstor-access&amp;quot;,&lt;br /&gt;
		&amp;quot;ol-access&amp;quot;,&lt;br /&gt;
		&amp;quot;osti-access&amp;quot;,&lt;br /&gt;
		&amp;quot;agency&amp;quot;,&lt;br /&gt;
		&amp;quot;translator-last1&amp;quot;,&lt;br /&gt;
		&amp;quot;translator-first1&amp;quot;,&lt;br /&gt;
		&amp;quot;translator-link1&amp;quot;&lt;br /&gt;
	],&lt;br /&gt;
	&amp;quot;format&amp;quot;: &amp;quot;{{_ |_=_}}&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/templatedata&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
{{Citation Style 1}}&lt;br /&gt;
{{Wikipedia referencing}}&lt;br /&gt;
{{UF-COinS}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;{{Sandbox other||&lt;br /&gt;
[[Category:Citation Style 1 templates|W]]&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Template:Cite_web&amp;diff=588</id>
		<title>Template:Cite web</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Template:Cite_web&amp;diff=588"/>
		<updated>2026-06-06T21:20:02Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;&amp;lt;includeonly&amp;gt;{{#invoke:citation/CS1|citation |CitationClass=web }}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt; {{documentation}} &amp;lt;/noinclude&amp;gt;&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;includeonly&amp;gt;{{#invoke:citation/CS1|citation&lt;br /&gt;
|CitationClass=web&lt;br /&gt;
}}&amp;lt;/includeonly&amp;gt;&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{{documentation}}&lt;br /&gt;
&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=587</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=587"/>
		<updated>2026-06-06T21:19:39Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
&lt;br /&gt;
{{#invoke:navbox|navbox&lt;br /&gt;
| name = Zilog Z80 Instruction Set&lt;br /&gt;
| state = {{{state&amp;lt;includeonly&amp;gt;|{{{1|autocollapse}}}&amp;lt;/includeonly&amp;gt;}}}&lt;br /&gt;
| bodyclass = hlist&lt;br /&gt;
| titlestyle = {{{titlestyle|}}}&lt;br /&gt;
| title = Zilog Z80 Instruction Set&lt;br /&gt;
&lt;br /&gt;
|group1 = Load Instructions&lt;br /&gt;
|list1 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Load Group|8-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Load Group|16-bit Load Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Exchange and Block Transfer|Exchange and Block Transfer Group]]&lt;br /&gt;
&lt;br /&gt;
|group2 = Arithmetic Instructions&lt;br /&gt;
|list2 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 8-bit Arithmetic Group|8-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group|16-bit Arithmetic Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Rotate and Shift Group|Rotate and Shift Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Bit Operations Group|Bit Set, Reset and Test Group]]&lt;br /&gt;
&lt;br /&gt;
|group3 = I/O Operations&lt;br /&gt;
|list3 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Input and Output Group|Input and Output Group]]&lt;br /&gt;
&lt;br /&gt;
|group4 = Control Group&lt;br /&gt;
|list4 =&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Jump Group|Jump Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - Call and Return Group|Call and Return Group]]&lt;br /&gt;
* [[Zilog Z80 Instruction Set - CPU Control Group|CPU Control Group]]&lt;br /&gt;
}}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_Exchange_and_Block_Transfer&amp;diff=586</id>
		<title>Zilog Z80 Instruction Set - Exchange and Block Transfer</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_Exchange_and_Block_Transfer&amp;diff=586"/>
		<updated>2026-06-06T21:09:18Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Exchange, Block Transfer and Search Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for exchanging the value of registers, block transfers of data to and from I/O and value search.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=585</id>
		<title>Zilog Z80 Instruction Set - CPU Control Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_CPU_Control_Group&amp;diff=585"/>
		<updated>2026-06-06T21:08:28Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;General-Purpose and CPU Control Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for controlling the CPU&amp;#039;s state and miscellaneous instructions.  == NOP == &amp;#039;&amp;#039;&amp;#039;Operation&amp;#039;&amp;#039;&amp;#039;  &amp;amp;mdash;  &amp;#039;&amp;#039;&amp;#039;Op Code&amp;#039;&amp;#039;&amp;#039;  NOP  {|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot; |- ! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || |- | 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00  |} &amp;#039;&amp;#039;&amp;#039;Operands&amp;#039;&amp;#039;&amp;#039;  None.  &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;  The CPU performs no operation during the machine cycle.  &amp;#039;&amp;#039;&amp;#039;Con...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;General-Purpose and CPU Control Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for controlling the CPU&#039;s state and miscellaneous instructions.&lt;br /&gt;
&lt;br /&gt;
== NOP ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_Exchange_and_Block_Transfer&amp;diff=584</id>
		<title>Zilog Z80 Instruction Set - Exchange and Block Transfer</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_Exchange_and_Block_Transfer&amp;diff=584"/>
		<updated>2026-06-06T21:06:05Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;Exchange, Block Transfer and Search Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for a wide variety of miscellaneous functions such as exchanging the value of registers to block transfers of data to and from I/O.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Exchange, Block Transfer and Search Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for a wide variety of miscellaneous functions such as exchanging the value of registers to block transfers of data to and from I/O.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=583</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=583"/>
		<updated>2026-06-06T21:05:39Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* Exchange, Block Transfer, Search Group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Arithmetic_Group&amp;diff=582</id>
		<title>Zilog Z80 Instruction Set - 16-bit Arithmetic Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Arithmetic_Group&amp;diff=582"/>
		<updated>2026-06-06T17:07:17Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;16-bit Arithmetic Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for basic arithmetic functions such as addition, subtraction, bitwise operations on 16-bit, or word, operands.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;16-bit Arithmetic Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for basic arithmetic functions such as addition, subtraction, [[bitwise operations]] on 16-bit, or [[word]], operands.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=581</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=581"/>
		<updated>2026-06-06T17:04:49Z</updated>

		<summary type="html">&lt;p&gt;Inari: Fixed links for 16-bit Load Group&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Load Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Load Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=580</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=580"/>
		<updated>2026-06-06T17:03:39Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD SP, HL|LD SP, HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD (nn), rr|LD (nn), rr]]|| align=&amp;quot;left&amp;quot; | (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set - 16-bit Arithmetic Group#LD rr, (nn)|LD rr, (nn)]]|| align=&amp;quot;left&amp;quot; | rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Arithmetic_Group&amp;diff=579</id>
		<title>Zilog Z80 Instruction Set - 8-bit Arithmetic Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Arithmetic_Group&amp;diff=579"/>
		<updated>2026-06-06T16:41:13Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;8-bit Arithmetic Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for basic arithmetic functions such as addition, subtraction, bitwise operations on 8-bit, or byte, operands. The Zilog Z180 does offer 8-bit multiplication operations which can be found in this document.  == ADD A, r == &amp;#039;&amp;#039;&amp;#039;Operation&amp;#039;&amp;#039;&amp;#039;  A ← A + r  &amp;#039;&amp;#039;&amp;#039;Op Code&amp;#039;&amp;#039;&amp;#039;  ADD {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot; |- ! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 |- | 1 || 0 |...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;8-bit Arithmetic Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for basic arithmetic functions such as addition, subtraction, [[bitwise operations]] on 8-bit, or [[byte]], operands. The [[Zilog Z180]] does offer 8-bit multiplication operations which can be found in this document.&lt;br /&gt;
&lt;br /&gt;
== ADD A, r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ADD A, n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== ADD A, (HL) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || 86&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
= Z180 Specific Operations =&lt;br /&gt;
&lt;br /&gt;
== MLT rr ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
rr ← r&amp;lt;sup&amp;gt;1&amp;lt;/sup&amp;gt;×r&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
MLT&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 || 1 || 0 || 1 || 1 || 0 || 1 || ED&lt;br /&gt;
|-&lt;br /&gt;
| 0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← rr →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
rr&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Unknown.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The MLT performs unsigned multiplication on two 8-bit numbers yielding a 16-bit result. MLT may specify BC, DE, HL, or SP registers. The 8-bit operands are loaded into each half of the 16-bit register and the 16-bit result is returned in that register.&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=578</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=578"/>
		<updated>2026-06-06T16:29:22Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* 8-bit Arithmetic Group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=577</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=577"/>
		<updated>2026-06-06T16:29:12Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* ADD A, r */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
==== ADD A, r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Load_Group&amp;diff=576</id>
		<title>Zilog Z80 Instruction Set - 16-bit Load Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Load_Group&amp;diff=576"/>
		<updated>2026-06-06T16:28:43Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;16-bit Load Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for moving 16-bit data, or [[Word|words]], between registers and memory locations.&lt;br /&gt;
&lt;br /&gt;
== LD ss, nn ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD HL, (nn) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (nn), HL ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PUSH qq ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== POP qq ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Load_Group&amp;diff=575</id>
		<title>Zilog Z80 Instruction Set - 8-bit Load Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Load_Group&amp;diff=575"/>
		<updated>2026-06-06T16:28:31Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;8-bit Load Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for moving 8-bit data, or [[Byte|bytes]], between registers and memory locations.&lt;br /&gt;
== LD r, r′ ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (HL) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (IX+d) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (IY+d) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (HL), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IX+d), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IY+d), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (HL), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IX+d), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IY+d), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (BC) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (DE) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (nn) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (BC), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (DE), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (nn), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, I ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, R ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD I, A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD R, A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Load_Group&amp;diff=574</id>
		<title>Zilog Z80 Instruction Set - 16-bit Load Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_16-bit_Load_Group&amp;diff=574"/>
		<updated>2026-06-06T16:28:13Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot;The &amp;#039;&amp;#039;&amp;#039;16-bit Load Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for moving 16-bit data, or words, between registers and memory locations.  == LD ss, nn == &amp;#039;&amp;#039;&amp;#039;Operation&amp;#039;&amp;#039;&amp;#039;  ss ← nn  &amp;#039;&amp;#039;&amp;#039;Op Code&amp;#039;&amp;#039;&amp;#039;  LD {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot; ! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 |- |0 |0 | colspan=&amp;quot;2&amp;quot; |← ss → |0 |0 |0 |1 |- | colspan=&amp;quot;8&amp;quot; |← n → |- | colspan=&amp;quot;8&amp;quot; |← n → |} &amp;#039;&amp;#039;&amp;#039;Operands&amp;#039;&amp;#039;&amp;#039;  dd, nn  &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;  The 2-byte intege...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;16-bit Load Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for moving 16-bit data, or words, between registers and memory locations.&lt;br /&gt;
&lt;br /&gt;
== LD ss, nn ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD HL, (nn) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (nn), HL ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== PUSH qq ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== POP qq ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=573</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=573"/>
		<updated>2026-06-06T16:26:55Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* 16-bit Load Group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=572</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=572"/>
		<updated>2026-06-06T16:25:33Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* Single-byte Instructions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set - 8-bit Load Group#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set - 8-bit Load Group#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=571</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=571"/>
		<updated>2026-06-06T16:22:31Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* 8-bit Load Group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Load_Group&amp;diff=570</id>
		<title>Zilog Z80 Instruction Set - 8-bit Load Group</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set_-_8-bit_Load_Group&amp;diff=570"/>
		<updated>2026-06-06T16:22:20Z</updated>

		<summary type="html">&lt;p&gt;Inari: Created page with &amp;quot; The &amp;#039;&amp;#039;&amp;#039;8-bit Load Group&amp;#039;&amp;#039;&amp;#039; for the Zilog Z80 Instruction Set provides operations for moving 8-bit data between registers and memory locations. == LD r, r′ == &amp;#039;&amp;#039;&amp;#039;Operation&amp;#039;&amp;#039;&amp;#039;  r, ← r′  &amp;#039;&amp;#039;&amp;#039;Op Code&amp;#039;&amp;#039;&amp;#039;  LD {| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot; ! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 |- | 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ →  |} &amp;#039;&amp;#039;&amp;#039;Operands&amp;#039;&amp;#039;&amp;#039;  r, r′  &amp;#039;&amp;#039;&amp;#039;Description&amp;#039;&amp;#039;&amp;#039;  The contents of any register r&amp;#039; are loaded to any other registe...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
The &#039;&#039;&#039;8-bit Load Group&#039;&#039;&#039; for the [[Zilog Z80 Instruction Set]] provides operations for moving 8-bit data between registers and memory locations.&lt;br /&gt;
== LD r, r′ ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (HL) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (IX+d) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD r, (IY+d) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (HL), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IX+d), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IY+d), r ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (HL), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IX+d), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (IY+d), n ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (BC) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (DE) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, (nn) ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (BC), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (DE), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD (nn), A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, I ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD A, R ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD I, A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== LD R, A ==&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=569</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=569"/>
		<updated>2026-06-05T02:18:34Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is the instruction set for the [[Zilog Z80]] microprocessor. It is made up of seven (7) pages of up-to 255 instructions (also known as an [[op code]] or operation code) each corresponding to a single byte; instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from a first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
{{anchor|LD r, r}}&lt;br /&gt;
==== LD r, r′ ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IX+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IY+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IX+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== D (IX+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (BC) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (DE) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (BC), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (DE), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, I ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, R ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD I, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD R, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=568</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=568"/>
		<updated>2026-06-05T02:06:04Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is made up of seven (7) pages of up-to 255 instructions each corresponding to a single byte which is also known as an [[op code]] or operation code, instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from the first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
The [[Zilog Z180|Z180]] and similar processors utilize this same instruction set, but include some additional instructions. Those instructions are also found in this document and are highlighted.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
{{anchor|LD r, r}}&lt;br /&gt;
==== LD r, r′ ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IX+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IY+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IX+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== D (IX+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (BC) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (DE) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (BC), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (DE), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, I ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, R ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD I, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD R, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=567</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=567"/>
		<updated>2026-06-05T02:04:07Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Z80 Instruction Set&#039;&#039;&#039; is made up of seven (7) pages of up-to 255 instructions each corresponding to a single byte which is also known as an [[op code]] or operation code, instructions found on every page other than the first (or 0) page requires a single byte prefix to distinguish it from the first page instruction. Most instructions take at least one operand, but some take two or none at all, operands follow the op-code in memory and in the case of a 16-bit word as an operand are arranged in memory in [[little-endian]] format meaning the [[least significant byte]] (LSB) is first.&lt;br /&gt;
&lt;br /&gt;
== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •  ∧  &amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +  ∨  &amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕  ⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬  ~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
{{anchor|LD r, r}}&lt;br /&gt;
==== LD r, r′ ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IX+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IY+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IX+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== D (IX+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (BC) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (DE) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (BC), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (DE), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, I ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, R ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD I, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD R, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=566</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=566"/>
		<updated>2026-06-05T01:49:31Z</updated>

		<summary type="html">&lt;p&gt;Inari: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •&lt;br /&gt;
∧&lt;br /&gt;
&amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +&lt;br /&gt;
∨&lt;br /&gt;
&amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕&lt;br /&gt;
⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬&lt;br /&gt;
~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), HL|LD (nn), HL]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
{{anchor|LD r, r}}&lt;br /&gt;
==== LD r, r′ ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IX+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IY+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IX+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== D (IX+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (BC) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (DE) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (BC), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (DE), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, I ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, R ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD I, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD R, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
	<entry>
		<id>http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=565</id>
		<title>Zilog Z80 Instruction Set</title>
		<link rel="alternate" type="text/html" href="http://docs.fox-labs.io/wiki/index.php?title=Zilog_Z80_Instruction_Set&amp;diff=565"/>
		<updated>2026-06-05T01:48:54Z</updated>

		<summary type="html">&lt;p&gt;Inari: /* 16-bit Load Group */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Instructions by Opcode ==&lt;br /&gt;
{{See also|#Instructions by Group}}&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+ Legend&lt;br /&gt;
! Mnemonic || Description&lt;br /&gt;
|-&lt;br /&gt;
|A&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Accumulator (A) register.&lt;br /&gt;
|-&lt;br /&gt;
| b ||align=&amp;quot;left&amp;quot;| Identifies a one-bit expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;7&#039;&#039;&#039;). The most-significant bit to the left is bit 7 and the least-significant bit to the right is bit 0.&lt;br /&gt;
|-&lt;br /&gt;
| cc ||align=&amp;quot;left&amp;quot;| Identifies the status of the Flag Register as any of (&#039;&#039;&#039;NZ&#039;&#039;&#039;, &#039;&#039;&#039;Z&#039;&#039;&#039;, &#039;&#039;&#039;NC&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;PO&#039;&#039;&#039;, &#039;&#039;&#039;PE&#039;&#039;&#039;, &#039;&#039;&#039;P&#039;&#039;&#039;, or &#039;&#039;&#039;M&#039;&#039;&#039;) for the conditional jumps, calls, and return instructions.&lt;br /&gt;
|-&lt;br /&gt;
|Cy&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the value of the Carry flag.&lt;br /&gt;
|-&lt;br /&gt;
| d ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range ( &#039;&#039;&#039;-128&#039;&#039;&#039; to &#039;&#039;&#039;+127&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| e ||align=&amp;quot;left&amp;quot;| Identifies a one-byte signed integer expression in the range (&#039;&#039;&#039;-126&#039;&#039;&#039; to &#039;&#039;&#039;+129&#039;&#039;&#039;) for relative jump offset from current location.&lt;br /&gt;
|-&lt;br /&gt;
|I&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Interrupt Vector register.&lt;br /&gt;
|-&lt;br /&gt;
|m&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies any one of &#039;&#039;&#039;r&#039;&#039;&#039;, &#039;&#039;&#039;(HL)&#039;&#039;&#039;, &#039;&#039;&#039;(IX+d)&#039;&#039;&#039; or &#039;&#039;&#039;(IY+d)&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| n || align=&amp;quot;left&amp;quot; | Identifies a one-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;255&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
| nn || align=&amp;quot;left&amp;quot; | Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;).&lt;br /&gt;
|-&lt;br /&gt;
|(nn)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a two-byte unsigned integer expression in the range (&#039;&#039;&#039;0&#039;&#039;&#039; to &#039;&#039;&#039;65535&#039;&#039;&#039;) which points to an address in memory.&lt;br /&gt;
|-&lt;br /&gt;
| pp || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IX&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| qq || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;AF&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|R&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the Refresh register.&lt;br /&gt;
|-&lt;br /&gt;
| r || align=&amp;quot;left&amp;quot; | Identifies any one of the 8-bit registers &#039;&#039;&#039;A&#039;&#039;&#039;, &#039;&#039;&#039;B&#039;&#039;&#039;, &#039;&#039;&#039;C&#039;&#039;&#039;, &#039;&#039;&#039;D&#039;&#039;&#039;, &#039;&#039;&#039;E&#039;&#039;&#039;, &#039;&#039;&#039;H&#039;&#039;&#039;, &#039;&#039;&#039;L&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| rr || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;IY&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(rr)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039; or &#039;&#039;&#039;DE&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
| ss || align=&amp;quot;left&amp;quot; | Identifies any one of the 16-bit registers &#039;&#039;&#039;BC&#039;&#039;&#039;, &#039;&#039;&#039;DE&#039;&#039;&#039;, &#039;&#039;&#039;HL&#039;&#039;&#039;, &#039;&#039;&#039;SP&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the register pair &#039;&#039;&#039;HL&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IX+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IX&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|(IY+d)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the contents of the memory location, whose address is specified by the contents of the &#039;&#039;&#039;IY&#039;&#039;&#039; Index Register plus the signed displacement &#039;&#039;&#039;d&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a single bit of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|x&amp;lt;sub&amp;gt;0-2&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a range of bits of the mnemonic.&lt;br /&gt;
|-&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the low-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|nhi&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the high-order byte of a 16-bit word.&lt;br /&gt;
|-&lt;br /&gt;
|A′&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies a shadow register, which are not directly accessible.&lt;br /&gt;
|-&lt;br /&gt;
|←&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies an assignment to a target such as a register or memory location.&lt;br /&gt;
|-&lt;br /&gt;
| •&lt;br /&gt;
∧&lt;br /&gt;
&amp;amp;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[AND Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| +&lt;br /&gt;
∨&lt;br /&gt;
&amp;lt;nowiki&amp;gt;||&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[OR Operation]]&lt;br /&gt;
|-&lt;br /&gt;
| ⊕&lt;br /&gt;
⊻&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Exclusive OR Operation|Exclusive OR (XOR) Operation]]&lt;br /&gt;
|-&lt;br /&gt;
|¬&lt;br /&gt;
~&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Negation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;&amp;lt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise left-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|&amp;gt;&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Bitwise shift|Bitwise right-shift operation]]&lt;br /&gt;
|-&lt;br /&gt;
|Port(y:x)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Identifies the operation of reading or writing to an I/O port, with &#039;&#039;&#039;y&#039;&#039;&#039; denoting the upper byte and &#039;&#039;&#039;x&#039;&#039;&#039; denoting the lower byte of the I/O address. The upper byte of the I/O address is never able to be directly provided, it either is the value of the &#039;&#039;&#039;A&#039;&#039;&#039; register or &#039;&#039;&#039;00h&#039;&#039;&#039; in the case of IN0/OUT0 on the Z180 processor.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+8-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|B&lt;br /&gt;
|000&lt;br /&gt;
|-&lt;br /&gt;
|C&lt;br /&gt;
|001&lt;br /&gt;
|-&lt;br /&gt;
|D&lt;br /&gt;
|010&lt;br /&gt;
|-&lt;br /&gt;
|E/&#039;&#039;(IX+d){{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;&lt;br /&gt;
|011&lt;br /&gt;
|-&lt;br /&gt;
|H&lt;br /&gt;
|100&lt;br /&gt;
|-&lt;br /&gt;
|L&lt;br /&gt;
|101&lt;br /&gt;
|-&lt;br /&gt;
|&#039;&#039;(HL){{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039;, then the register selected is (HL).}}&#039;&#039;&lt;br /&gt;
|110&lt;br /&gt;
|-&lt;br /&gt;
|A/&#039;&#039;(IY+d){{efn|name=d3|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|111&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable mw-collapsible&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|+16-bit Register Values&lt;br /&gt;
!Registers&lt;br /&gt;
!Value&lt;br /&gt;
|-&lt;br /&gt;
|BC&lt;br /&gt;
|00&lt;br /&gt;
|-&lt;br /&gt;
|DE&lt;br /&gt;
|01&lt;br /&gt;
|-&lt;br /&gt;
|HL/&#039;&#039;IX{{efn|name=d1|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IX+d).}}&#039;&#039;/&#039;&#039;IY{{efn|name=d2|Indicates when the mnemonic is &#039;&#039;&#039;&#039;&#039;m&#039;&#039;&#039;&#039;&#039; and the prefix is &#039;&#039;&#039;DD&#039;&#039;&#039;, then the register selected is (IY+d).}}&#039;&#039;&lt;br /&gt;
|10&lt;br /&gt;
|-&lt;br /&gt;
|SP&lt;br /&gt;
|11&lt;br /&gt;
|}&lt;br /&gt;
{{Notelist}}&lt;br /&gt;
&lt;br /&gt;
=== Single-byte Instructions ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#NOP|NOP]]|| align=&amp;quot;left&amp;quot; | No operation&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 0 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | [[Zilog Z80 Instruction Set#LD ss, nn|LD ss, nn]]|| align=&amp;quot;left&amp;quot; | ss ← nn&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| [[Zilog Z80 Instruction Set#LD (BC), A|LD (rr), A]]|| align=&amp;quot;left&amp;quot; | (rr) ← A [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 ||colspan=&amp;quot;2&amp;quot;| ss || 0 || 0 || 1 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| INC ss ||align=&amp;quot;left&amp;quot;| ss ← ss + 1 &lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |INC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r + 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, n|LD r, n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX AF,AF’&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AF ↔ AF’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD HL, rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← HL + rr&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (BC)|LD A, (rr)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (rr) [BC or DE only]&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DEC rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr - 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRCA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DJNZ d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |B = B - 1; if B ≠ 0 then PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RLA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-6,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;7,&amp;lt;/sub&amp;gt; A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← PC + d&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RRA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; Cy ← A&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, A&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|d&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JR cc, d&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc&amp;lt;sub&amp;gt;0-1&amp;lt;/sub&amp;gt; true, PC ← PC + d (Only 2 bits of cc used: NZ, Z, NC, C)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD (nn), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← HL&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DAA&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |@&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD HL, (nn)|LD HL, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HL ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CPL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← ¬A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (nn), A|LD (nn), A]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(nn) ← A&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), n|LD (HL), n]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← n&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← 1&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD A, (nn)|LD A, (nn)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← (nn)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CCF&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Cy ← ¬Cy&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|9&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, (HL)|LD r, (HL)]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← (HL)&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r’&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD r, r|LD r, r’]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |r ← r’&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |← r →&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#LD (HL), r|LD (HL), r]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(HL) ← r&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |HALT&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Halt CPU&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – r&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET cc&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#POP qq|POP qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |qq ← (SP), SP ← SP + 2&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |cc&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL cc, nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |If cc true, SP ← SP - 2, (SP) ← PC, PC ← nn&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |qq&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#PUSH qq|PUSH qq]]&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← qq&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADD n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |ADC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n + Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SUB n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SBC n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n – Cy&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |AND n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A • n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |XOR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A ⊕ n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OR n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A + n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CP n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← A – n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |n&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← n&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |RET&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← (SP), SP ← SP + 2&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot;|[[Zilog Z80 Instruction Set#CB Prefix|CB Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;&lt;br /&gt;
|n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |CALL nn&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← SP - 2, (SP) ← PC, PC ← nn &lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OUT n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PORT(A:n) ← A&lt;br /&gt;
|-&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EXX&lt;br /&gt;
|align=&amp;quot;left&amp;quot;|BC ↔ BC′, DE ↔ DE′, HL ↔ HL′&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|n&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IN n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A ← PORT(A:n)&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IX Prefix&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX (SP), HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |(SP) ↔ HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |JP (HL)&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |PC ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EX DE, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DE ↔ HL&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |[[Zilog Z80 Instruction Set#Miscellaneous Instructions (ED Prefix)|ED Prefix]]&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |DI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 0, disable interrupts&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |LD SP, HL&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SP ← HL&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |EI&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |IFF1 ← IFF2 ← 1, enable interrupts&lt;br /&gt;
|- style=&amp;quot;background-color: #D0E8E6;&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; align=&amp;quot;left&amp;quot; |IY Prefix&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|CB Prefix}}&lt;br /&gt;
=== Bit Function Instructions (CB Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode||rowspan=2| Mnemonic  ||rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 &lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 ||colspan=3|r ||align=left| RLC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 1 ||colspan=3|r ||align=left| RRC r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 0 ||colspan=3|r ||align=left| RL r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 1 || 1 ||colspan=3|r ||align=left| RR r || align=&amp;quot;left&amp;quot; | r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;, Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 0 ||colspan=3|r ||align=left| SLA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt;,  r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 0 || 1 ||colspan=3|r ||align=left| SRA r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0&amp;lt;/sub&amp;gt;, r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 1 || 1 || 1 ||colspan=3|r ||align=left| SRL r || align=&amp;quot;left&amp;quot; | Cy ← r&amp;lt;sub&amp;gt;0,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;0-6&amp;lt;/sub&amp;gt; ← r&amp;lt;sub&amp;gt;1-7,&amp;lt;/sub&amp;gt; r&amp;lt;sub&amp;gt;7&amp;lt;/sub&amp;gt; ← 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|b ||colspan=3|r ||align=left| BIT b,r || align=&amp;quot;left&amp;quot; | r ∧ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 ||colspan=3|b ||colspan=3|r ||align=left| RES b,r || align=&amp;quot;left&amp;quot; | r ← r ∧ ¬(1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 1 ||colspan=3|b ||colspan=3|r ||align=left| SET b,r || align=&amp;quot;left&amp;quot; | r ← r ∨ (1 &amp;lt;&amp;lt; b)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{anchor|ed prefix}}&lt;br /&gt;
=== Miscellaneous Instructions (ED Prefix) ===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
!colspan=8| Opcode ||colspan=2| Operands ||rowspan=2| Mnemonic || rowspan=2| Description&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 || b2 || b3&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| IN0 r, (n) ||align=&amp;quot;left&amp;quot;| r ← Port(00h:n){{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
| 0 || 0 || colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=&amp;quot;left&amp;quot;| OUT0 r, (n) ||align=&amp;quot;left&amp;quot;| Port(00h:n) ← r{{efn|name=b2|Excludes (HL) register.}}&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; |r&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST r&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • B{{Efn|Flags are modified when the operation executes, but the A register is not updated.|name=b1}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; |r || 0 || 0 || 0 || &amp;amp;mdash; || &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | IN r,(C){{efn|Byte input sets the flags unlike IN A, n.}} || align=&amp;quot;left&amp;quot; | r ← Port(BC) [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=3|r || 0 || 0 || 1 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| OUT (C), r ||align=left| Port(BC) ← r [Except (HL)] (Port number is 16 bits)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| SBC HL, rr ||align=left| HL ← HL – rr – Cy&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 0 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD (nn), rr ||align=left| (nn) ← rr&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| NEG ||align=left| A ← 0 - A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETN ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3|RETN and RETI are identical and restore IFF1. Z80 compatible interrupt devices watch for RETI by sniffing the data bus while M1- is asserted for 0xED followed by 0x4D.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 ||colspan=2|n || 1 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| IM n ||align=left| Interrupt mode 0, 1, 2 (encoded 0, 2, 3)&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD I, A|LD I, A]]|| align=&amp;quot;left&amp;quot; | interrupt control vector ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 0 || &amp;amp;mdash; || &amp;amp;mdash; ||align=left| ADC HL, rr ||align=left| HL ← HL + rr + CY&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=2|rr || 1 || 0 || 1 || 1 || n&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt;|| n&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;|| align=&amp;quot;left&amp;quot; | LD rr, (nn) ||align=left| rr ← (nn)&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |rr&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |MLT rr&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |rr ← rr&amp;lt;sub&amp;gt;0-7&amp;lt;/sub&amp;gt; × rr&amp;lt;sub&amp;gt;8-15&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RETI ||align=left| PC ← (SP), SP ← SP + 2, IFF1 ← IFF2{{efn|name=d3}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD R, A|LD R, A]]|| align=&amp;quot;left&amp;quot; | refresh ← A&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, I|LD A, I]]|| align=&amp;quot;left&amp;quot; | A ← interrupt control vector {{efn|name=dd|LD A, I and LD A, R are the only two LD instructions that set flags. Additionally, IFF2 is loaded into the P/V flag. C unaffected.}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 0 || 1 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| [[Zilog Z80 Instruction Set#LD A, R|LD A, R]]|| align=&amp;quot;left&amp;quot; | A ← refresh {{efn|name=dd}}&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 0 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RRD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 || 0 || 1 || 1 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; ||align=left| RLD ||align=left| A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt; ← A&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;, (HL)&amp;lt;sub&amp;gt;7-4&amp;lt;/sub&amp;gt; ← (HL)&amp;lt;sub&amp;gt;0-3&amp;lt;/sub&amp;gt;&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TST n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |A • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |TSTIO n&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) • n&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
|&amp;amp;mdash;&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |SLP&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Sleep&lt;br /&gt;
|- style=&amp;quot;background-color: #F3E6FA; color: #5D2E77&amp;quot;&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|R&lt;br /&gt;
|D&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|&lt;br /&gt;
|&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |OTIM OTDM OTIMR OTMDR&lt;br /&gt;
| align=&amp;quot;left&amp;quot; |Port(C) ← (HL), HL ← HL ± 1, C ← C ± 1, B ← B - 1&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | LDI LDIR LDD LDDR || align=&amp;quot;left&amp;quot; | (DE) ← (HL), HL ← HL ± 1, DE ← DE ± 1, BC ← BC - 1 {{efn|name=d2|When D {{=}} 1, pointers HL and DE decrement. When R {{=}} 1, operation repeats until BC or B {{=}} 0. All block IO instructions output BC, not just C, as the port address.}}{{efn|name=d4| LDI, LDD, CPI, and CPD set P/V if BC – 1 ≠ 0. This is useful for loop control when not using repeat.}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 0 || 1 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | CPI CPIR CPD CPDR || align=&amp;quot;left&amp;quot; | A - (HL), HL ← HL ± 1, BC ← BC - 1 {{efn|name=d2}}{{efn|name=d4}}{{efn|CPIR/CPDR terminate early if A {{=}} (HL).}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 0 || &amp;amp;mdash;|| &amp;amp;mdash;|| align=&amp;quot;left&amp;quot; | INI INIR IND INDR || align=&amp;quot;left&amp;quot; | (HL) ← Port(B:C), HL ← HL ± 1, B ← B – 1 {{efn|name=d2}}&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 1 || R || D || 0 || 1 || 1 || &amp;amp;mdash;|| &amp;amp;mdash; || align=&amp;quot;left&amp;quot; | OUTI OTIR OUTD OTDR || align=&amp;quot;left&amp;quot; |  B ← B – 1, Port(B:C) ← (HL), HL ← HL ± 1 {{efn|name=d2}}&amp;lt;ref&amp;gt;{{cite web |title=Z80 Documentation Errors |url=https://www.cpcwiki.eu/forum/programming/z80-documentation-errors/ |website=CPC Wiki |access-date=28 November 2025}} Unlike stated in Z80 documentation, OUTI OTIR OUTD OTDR decrement B before the IO access.&amp;lt;/ref&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
{{notelist}}&lt;br /&gt;
== Instructions by Group ==&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
{{anchor|LD r, r}}&lt;br /&gt;
==== LD r, r′ ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, ← r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 ||colspan=&amp;quot;3&amp;quot;| ← r → ||colspan=&amp;quot;3&amp;quot;| ← r’ → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, r′&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of any register r&#039; are loaded to any other register r. r, r&#039; identifies any of the registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the H Register contains the number 8Ah, and the E register contains 10h, the instruction LD H, E results in both registers containing 10h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit integer n is loaded to any register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD E, A5h instruction, Register E contains A5h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 8-bit contents of memory location (HL) are loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains the number 75A1h, and memory address 75A1h contains byte 58h, the execution of LD C, (HL) results in 58h in Register C.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IX+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (IX+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The (IX+d) operand (i.e., the contents of Index Register IX summed with two’s-complement displacement integer d) is loaded to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 25AFh, the instruction LD B, (IX+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD r, (IY+d) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r ← (IY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || colspan=&amp;quot;3&amp;quot; | ← r → || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
r, (lY+d)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The operand (lY+d) loads the contents of Index Register IY summed with two’s-complement displacement integer, d, to register r, in which r identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number 25AFh, the instruction LD B, (IY+19h) allows the calculation of the sum 25AFh + 19h, which points to memory location 25C8h. If this address contains byte 39h, the instruction results in Register B also containing 39h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory location specified by the contents of the HL register pair. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the contents of register pair HL specify memory location 2146h and Register B contains byte 29h, then upon the execution of an LD (HL), B instruction, memory address 2146h also contains 29h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IX+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are loaded to the memory address specified by the contents of Index Register IX summed with d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), r ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d) ← r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 1 || 1 &lt;br /&gt;
|1&lt;br /&gt;
|0|| colspan=&amp;quot;3&amp;quot; | ← r → &lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IY+d), r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of resister r are loaded to the memory address specified by the sum of the contents of Index Register IY and d, a two’s-complement displacement integer. The r symbol identifies registers A, B, C, D, E, H, or L.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the C register contains byte 1Ch, and Index Register IX contains 3100h, then the instruction LID (IX + 6h), C performs the sum 3100h + 6h and loads 1Ch to memory location 3106h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (HL), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(HL), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory address specified by the contents of the HL register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the HL register pair contains 4444h, the instruction LD (HL), 28h results in the memory location 4444h containing byte 28h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== D (IX+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|DD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(IX+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n operand is loaded to the memory address specified by the sum of Index Register IX and the two’s complement displacement operand d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IX contains the number 219Ah, then upon execution of an LD (IX+5h), 5Ah instruction, byte 5Ah is contained in memory address 219Fh.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (IY+d), n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d) ← n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|FD&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|36&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← d →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(lY+d), n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is loaded to the memory location specified by the contents of Index Register summed with the two’s-complement displacement integer, d.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If Index Register IY contains the number A940h, the instruction LD (IY+10h), 97h results in byte 97h in memory location A950h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 19 (4, 4, 3, 5, 3) || 4.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (BC) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (BC)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the contents of the BC register pair are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the BC register pair contains the number 4747h, and memory address 4747h contains byte 12h, then the instruction LD A, (BC) results in byte 12h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (DE) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1A&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (DE)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the register pair DE are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the DE register pair contains the number 30A2h and memory address 30A2h contains byte 22h, then the instruction LD A, (DE) results in byte 22h in Register A.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|3A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the memory location specified by the operands nn are loaded to the Accumulator. The first n operand after the op code is the low-order byte of a 2-byte memory address.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If nn contains 8832h and memory address 8832h contains byte 04h, then upon the execution of an LD A, (nn) instruction, the 04h byte is in the Accumulator.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (BC), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|02&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(BC), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the register pair BC.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 7Ah and the BC register pair contains 1212h the instruction LD (BC), A results in 7Ah in memory location 1212h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (DE), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|12&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(DE), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory location specified by the contents of the DE register pair.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair DE contains 1128h and the Accumulator contains byte A0h, then the execution of a LD (DE), A instruction results in A0h being stored in memory location 1128h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn) ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the memory address specified by the operand nn. The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains byte D7h, then executing an LD (3141h), AD7h instruction results in memory location 3141h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 4 || 13 (4, 3, 3, 3) || 3.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, I ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← 1&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|57&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, I&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Interrupt Vector Register I are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if the I Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the I Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the Parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD A, R ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|5F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, R&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of Memory Refresh Register R are loaded to the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if, R-Register is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if the R Register is 0; otherwise, it is reset.&lt;br /&gt;
* H is reset.&lt;br /&gt;
* P/V contains contents of IFF2.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is not affected.&lt;br /&gt;
* If an interrupt occurs during execution of this instruction, the parity flag contains a 0.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD I, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|47&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
I, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Interrupt Control Vector Register, I.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD R, A ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R ← A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|ED&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
|4F&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
R, A&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the Accumulator are loaded to the Memory Refresh register R.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 9 (4, 5) || 2.25&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Load Group ===&lt;br /&gt;
&lt;br /&gt;
==== LD ss, nn ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ss ← nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← ss →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
dd, nn&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The 2-byte integer nn is loaded to the dd register pair, in which ss defines the BC, DE, HL, or SP register pairs.&lt;br /&gt;
&lt;br /&gt;
The first n operand after the op code is the low-order byte.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Upon the execution of an LD HL, 5000h instruction, the HL register pair contains 5000h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD HL, (nn) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
H ← (nn + 1), L ← (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|2A&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
HL, (nn)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of memory address (nn) are loaded to the low-order portion of register pair HL (Register L), and the contents of the next highest memory address (nn + 1) are loaded to the high-order portion of HL (Register H). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If address 4545h contains 37h and address 4546h contains A1h, then upon the execution of an LD HL, (4545h) instruction, the HL register pair contains A137h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== LD (nn), HL ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn + 1) ← H, (nn) ← L&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
LD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
!&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|22&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; |← n →&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(nn), HL&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the low-order portion of register pair HL (Register L) are loaded to memory address (nn), and the contents of the high-order portion of HL (Register H) are loaded to the next highest memory address (nn + 1). The first n operand after the op code is the low-order byte of nn.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If register pair HL contains 483Ah, then upon the execution of an LD (B2291 – 1), HL instruction, address B229h contains 3Ah and address B22Ah contains 48h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 5 || 16 (4, 3, 3, 3, 3) || 4.00&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== PUSH qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
(SP – 2) ← qq&amp;lt;sub&amp;gt;l&amp;lt;/sub&amp;gt;&amp;lt;sub&amp;gt;o&amp;lt;/sub&amp;gt;, (SP – 1) ← qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
PUSH&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of the register pair qq are pushed to the external memory last-in, first-out (LIFO) stack. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first decrements SP and loads the high-order byte of register pair qq to the memory address specified by the SP. The SP is  decremented again and loads the low-order byte of qq to the memory location corresponding to this new address in the SP. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the AF Register pair contains 2233h and the Stack Pointer contains 1007h, then upon the execution of a PUSH AF instruction, memory address 1006h contains 22h, memory address 1005h contains 33h, and the Stack Pointer contains 1005h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 11 (5, 3, 3) || 2.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== POP qq ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&amp;lt;sub&amp;gt;hi&amp;lt;/sub&amp;gt; ← (SP+1), qq&amp;lt;sub&amp;gt;lo&amp;lt;/sub&amp;gt; ← (SP)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
POP&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|1&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; |← qq →&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operand&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
qq&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The top two bytes of the external memory last-in, first-out (LIFO) stack are popped to register pair qq. The Stack Pointer (SP) Register pair holds the 16-bit address of the current top of the Stack. This instruction first loads to the low-order portion of qq, the byte at the memory location corresponding to the contents of SP; then SP is incremented and the contents of the corresponding adjacent memory location are loaded to the high-order portion of qq and the SP is now incremented again. The operand qq identifies register pair BC, DE, HL, or AF.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Stack Pointer contains 1000h, memory location 1000h contains 55h, and location 1001h contains 33h, the instruction POP HL results in register pair HL containing 3355h, and the Stack Pointer containing 1002h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 3 || 10 (4, 3, 3) || 2.50&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Exchange, Block Transfer, Search Group ===&lt;br /&gt;
General Purpose Arithmetic and CPU Control Group&lt;br /&gt;
&lt;br /&gt;
==== NOP ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;amp;mdash;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
NOP&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 00 &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
None.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The CPU performs no operation during the machine cycle.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
* None.&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== 8-bit Arithmetic Group ===&lt;br /&gt;
&lt;br /&gt;
=== ADD A, r ===&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || colspan=&amp;quot;3&amp;quot;| ← r → &lt;br /&gt;
|}&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, r&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The contents of register r are added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 44h and Register C contains 11h, then upon the execution of an ADD A, C instruction, the Accumulator contains 55h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 4 || 1.0&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, n ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! 7 || 6 || 5 || 4 || 3 || 2 || 1 || 0 ||&lt;br /&gt;
|-&lt;br /&gt;
| 1 || 0 || 0 || 0 || 0 || 1 || 1 || 0 || C6&lt;br /&gt;
|-&lt;br /&gt;
| colspan=&amp;quot;8&amp;quot; | ← n →&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, n&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The n integer is added to the contents of the Accumulator, and the results are stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains 23h, then upon the execution of an ADD A, 33h instruction, the Accumulator contains 56h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
==== ADD A, (HL) ====&lt;br /&gt;
&#039;&#039;&#039;Operation&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A ← A + (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Op Code&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
ADD&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Operands&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A, (HL)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Description&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The byte at the memory address specified by the contents of the HL register pair is added to the contents of the Accumulator, and the result is stored in the Accumulator.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Condition Bits Affected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
* S is set if result is negative; otherwise, it is reset.&lt;br /&gt;
* Z is set if result is 0; otherwise, it is reset.&lt;br /&gt;
* H is set if carry from bit 3; otherwise, it is reset.&lt;br /&gt;
* P/V is set if overflow; otherwise, it is reset.&lt;br /&gt;
* N is reset.&lt;br /&gt;
* C is set if carry from bit 7; otherwise, it is reset.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Example&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If the Accumulator contains A0h, register pair HL contains 2323h, and memory location 2323h contains byte 08h, then upon the execution of an ADD A, (HL) instruction, the Accumulator contains A8h.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;text-align:center&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! M-Cyles || T-States || 4 MHz E.T.&lt;br /&gt;
|-&lt;br /&gt;
| 2 || 7 (4, 3) || 1.75&lt;br /&gt;
|}&lt;br /&gt;
{{Hr}}&lt;br /&gt;
&lt;br /&gt;
=== Rotate and Shift Group ===&lt;br /&gt;
&lt;br /&gt;
=== Bit Set, Reset and Test Group ===&lt;br /&gt;
&lt;br /&gt;
=== Jump Group ===&lt;br /&gt;
&lt;br /&gt;
=== Call and Return Group ===&lt;br /&gt;
&lt;br /&gt;
=== Input and Output Group ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 16-bit Arithmetic Group ===&lt;/div&gt;</summary>
		<author><name>Inari</name></author>
	</entry>
</feed>