Difference between revisions of "HuC6280 Instruction Set"

From Archaic Pixels
Jump to: navigation, search
(JSR - Jump to Subroutine)
 
(43 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
<css>
 +
table
 +
{
 +
  border-collapse: collapse;
 +
  spacing:1px;
 +
}
 +
 +
table th
 +
{
 +
  font-family: Courier, monospace;
 +
  background-color: #dddddd;
 +
  padding-left:10px;
 +
  padding-right:10px;
 +
  padding-top:2px;
 +
  padding-bottom:2px;
 +
  border-width:1px;
 +
  border-style: solid;
 +
  text-align: center;
 +
}
 +
 +
table td
 +
{
 +
  padding-left:10px;
 +
  padding-right:10px;
 +
  border-width:1px;
 +
  border-style: solid;
 +
}
 +
 +
.addressing { width: 525px; }
 +
.addressing td:nth-child(n + 3) { text-align: center; }
 +
 +
table pre
 +
{
 +
  border-style: hidden;
 +
  background-color: inherit;
 +
}
 +
</css>
 
== ADC - Add with Carry ==
 
== ADC - Add with Carry ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || ?
 +
|}
 
<p>Add the value specified by the operand, and 1 if the Carry flag is set, to the value in the accumulator.  If the result is too large to fit in the accumulator, the carry flag will be set, otherwise it will be cleared.</p>
 
<p>Add the value specified by the operand, and 1 if the Carry flag is set, to the value in the accumulator.  If the result is too large to fit in the accumulator, the carry flag will be set, otherwise it will be cleared.</p>
 
<p>If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).</p>
 
<p>If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).</p>
<p>The overflow flag is not affected by this instruction if in Decimal mode; otherwise, if bit7 of the result&nbsp;!= bit7 of the accumulator before the operation, and bit7 of the accumulator before the operation == bit7 of the value specified by the operand, the overflow flag is set, otherwise it is cleared.  In other words, if we were to treat the accumulator and value specified by the operand as [http://en.wikipedia.org/wiki/Two%27s_complement two's complement] numbers, in the range of -128 to 127, the overflow flag will be set if the end result is outside of this range(otherwise it will be cleared).</p>
+
<p>The overflow flag is not affected by this instruction if in Decimal mode; otherwise, if bit 7 of the result != bit  7 of the accumulator before the operation, and bit 7 of the accumulator before the operation == bit 7 of the value specified by the operand, the overflow flag is set, otherwise it is cleared.  In other words, if we were to treat the accumulator and value specified by the operand as [http://en.wikipedia.org/wiki/Two%27s_complement two's complement] numbers, in the range of -128 to 127, the overflow flag will be set if the end result is outside of this range(otherwise it will be cleared).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>ADC #$ii</td><td>$69</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>ADC $zz</td><td>$65</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>ADC $zz,X</td><td>$75</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>ADC $aaaa</td><td>$6d</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>ADC $aaaa,X</td><td>$7d</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>ADC $aaaa,Y</td><td>$79</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>ADC ($zz)</td><td>$72</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>ADC ($zz,X)</td><td>$61</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>ADC ($zz),Y</td><td>$71</td><td>2</td><td>7</td></tr></table>
+
<p>If T=1 (the previous instruction is SET) the zero-page byte specified by the X register is used instead of the A register.</p>
 +
 
 +
<p>Here is a recap of the status register after use :</p>
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 is set
 +
|-
 +
| V || Overflow Flag || Set if bit 7 (sign bit for 2's complement number) is incorrect
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if A == 0
 +
|-
 +
| C || Carry Flag || Set if overflow in bit 7 occured
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || ADC #$ii || $69 || 2 || 2
 +
|-
 +
| Zero Page || ADC $zz || $65 || 2 || 4
 +
|-
 +
| Zero Page, X || ADC $zz,X || $75 || 2 || 4
 +
|-
 +
| Absolute || ADC $aaaa || $6d || 3 || 5
 +
|-
 +
| Absolute, X || ADC $aaaa,X || $7d || 3 || 5
 +
|-
 +
| Absolute, Y || ADC $aaaa,Y || $79 || 3 || 5
 +
|-
 +
| Indirect || ADC ($zzzz) || $72 || 3 || 7
 +
|-
 +
| Indexed Indirect || ADC ($zz,X) || $61 || 2 || 7
 +
|-
 +
| Indirect, Index || ADC ($zz),Y || $71 || 2 || 7
 +
|}
 +
 
 
== AND - AND Accumulator with Memory ==
 
== AND - AND Accumulator with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>AND #$ii</td><td>$29</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>AND $zz</td><td>$25</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>AND $zz,X</td><td>$35</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>AND $aaaa</td><td>$2d</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>AND $aaaa,X</td><td>$3d</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>AND $aaaa,Y</td><td>$39</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>AND ($zz)</td><td>$32</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>AND ($zz,X)</td><td>$21</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>AND ($zz),Y</td><td>$31</td><td>2</td><td>7</td></tr></table>
+
|-
<p><br /></p>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 +
 
 +
Performs a bit by bit logical and on the accumulator with the value specified by the operand.
 +
 
 +
<p>Here is a recap of the processor status flags after use :</p>
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if A == 0
 +
|-
 +
| C || Carry Flag || N/A
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || AND #$ii || $29 || 2 || 2
 +
|-
 +
| Zero Page || AND $zz || $25 || 2 || 4
 +
|-
 +
| Zero Page, X || AND $zz,X || $35 || 2 || 4
 +
|-
 +
| Absolute || AND $aaaa || $2d || 3 || 5
 +
|-
 +
| Absolute, X || AND $aaaa,X || $3d || 3 || 5
 +
|-
 +
| Absolute, Y || AND $aaaa,Y || $39 || 3 || 5
 +
|-
 +
| Indirect || AND ($zzzz) || $32 || 3 || 7
 +
|-
 +
| Indexed Indirect || AND ($zz,X) || $21 || 2 || 7
 +
|-
 +
| Indirect, Index || AND ($zz),Y || $31 || 2 || 7
 +
|}
 +
 
 
== ASL - Arithmetic Shift Left ==
 
== ASL - Arithmetic Shift Left ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<p>Shifts the value at the location specified by the operand left by one bit, shifting in 0 to Bit0, and writes the result back to that location. Bit7 of the value before the shift is copied to the Carry flag.</p>
+
|-
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Accumulator</td><td>ASL A</td><td>$0a</td><td>1</td><td>2</td></tr><tr><td>Zero Page</td><td>ASL $zz</td><td>$06</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>ASL $zz,X</td><td>$16</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>ASL $aaaa</td><td>$0e</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>ASL $aaaa,X</td><td>$1e</td><td>3</td><td>7</td></tr></table>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
 
 +
<p>Shifts the value at the location specified by the operand left by one bit, shifting in 0 to bit 0, and writes the result back to that location. Bit 7 of the value before the shift is copied to the Carry flag.</p>
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the result is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if A == 0
 +
|-
 +
| C || Carry Flag || Set to previous value of bit 7
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Accumulator || ASL A || $0a || 1 || 2
 +
|-
 +
| Zero Page || ASL $zz || $06 || 2 || 6
 +
|-
 +
| Zero Page, X || ASL $zz,X || $16 || 2 || 6
 +
|-
 +
| Absolute || ASL $aaaa || $0e || 3 || 7
 +
|-
 +
| Absolute, X || ASL $aaaa,X || $1e || 3 || 7
 +
|}
 +
 
 
== BBRn - Branch on Bit Reset n ==
 
== BBRn - Branch on Bit Reset n ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If Bit 'n' of the value at the effective address specified by the second operand is clear, branch to the address calculated from the second operand.  The second operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If Bit 'n' of the value at the effective address specified by the second operand is clear, branch to the address calculated from the second operand.  The second operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page, Relative</td><td>BBR0 $zz, $rrrr</td><td>$0f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR1 $zz, $rrrr</td><td>$1f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR2 $zz, $rrrr</td><td>$2f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR3 $zz, $rrrr</td><td>$3f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR4 $zz, $rrrr</td><td>$4f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR5 $zz, $rrrr</td><td>$5f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR6 $zz, $rrrr</td><td>$6f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBR7 $zz, $rrrr</td><td>$7f</td><td>3</td><td>6*</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page, Relative || BBR0 $zz, $rr || $0f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR1 $zz, $rr || $1f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR2 $zz, $rr || $2f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR3 $zz, $rr || $3f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR4 $zz, $rr || $4f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR5 $zz, $rr || $5f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR6 $zz, $rr || $6f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBR7 $zz, $rr || $7f || 3 || 6*
 +
|}
 
<pre>* Add 2 extra cycles if branch is taken.</pre>
 
<pre>* Add 2 extra cycles if branch is taken.</pre>
 +
 
== BBSn - Branch on Bit Set n ==
 
== BBSn - Branch on Bit Set n ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If Bit 'n' of the value at the effective address specified by the operand is set, branch to the address calculated from the second operand.  The second operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If Bit 'n' of the value at the effective address specified by the operand is set, branch to the address calculated from the second operand.  The second operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page, Relative</td><td>BBS0 $zz, $rrrr</td><td>$8f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS1 $zz, $rrrr</td><td>$9f</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS2 $zz, $rrrr</td><td>$af</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS3 $zz, $rrrr</td><td>$bf</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS4 $zz, $rrrr</td><td>$cf</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS5 $zz, $rrrr</td><td>$df</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS6 $zz, $rrrr</td><td>$ef</td><td>3</td><td>6*</td></tr><tr><td>Zero Page, Relative</td><td>BBS7 $zz, $rrrr</td><td>$ff</td><td>3</td><td>6*</td></tr></table>
+
{| class="addressing"
<pre>* Add 2 extra cycles if branch is taken.</pre>
+
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page, Relative || BBS0 $zz, $rr || $8f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS1 $zz, $rr || $9f || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS2 $zz, $rr || $af || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS3 $zz, $rr || $bf || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS4 $zz, $rr || $cf || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS5 $zz, $rr || $df || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS6 $zz, $rr || $ef || 3 || 6*
 +
|-
 +
| Zero Page, Relative || BBS7 $zz, $rr || $ff || 3 || 6*
 +
|}
 +
[pre]* Add 2 extra cycles if branch is taken.[/pre]
 +
 
 
== BCC - Branch on Carry Clear ==
 
== BCC - Branch on Carry Clear ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the carry flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the carry flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BCC $rrrr</td><td>$90</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BCC $rr || $90 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BCS - Branch on Carry Set ==
 
== BCS - Branch on Carry Set ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the carry flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the carry flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BCS $rrrr</td><td>$b0</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BCS $rr || $b0 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BEQ - Branch on Equal(Zero Set) ==
 
== BEQ - Branch on Equal(Zero Set) ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the zero flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the zero flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BEQ $rrrr</td><td>$f0</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BEQ $rr || $f0 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BIT - Test Memory Bits with Accumulator ==
 
== BIT - Test Memory Bits with Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>BIT #$ii</td><td>$89</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>BIT $zz</td><td>$24</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>BIT $zz,X</td><td>$34</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>BIT $aaaa</td><td>$2c</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>BIT $aaaa,X</td><td>$3c</td><td>3</td><td>5</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || 
 +
|}
 +
 
 +
<p>Performs an AND between the accumulator and the specified operand without storing the result.
 +
Bit 7 and 6 of the memory operand are respectively saved in the negative (N) and overflow (V) flags.
 +
</p>
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Bit 7 of M
 +
|-
 +
| V || Overflow Flag || Bit 6 of M
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if A & M == 0
 +
|-
 +
| C || Carry Flag || N/A
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || BIT #$ii || $89 || 2 || 2
 +
|-
 +
| Zero Page || BIT $zz || $24 || 2 || 4
 +
|-
 +
| Zero Page, X || BIT $zz,X || $34 || 2 || 4
 +
|-
 +
| Absolute || BIT $aaaa || $2c || 3 || 5
 +
|-
 +
| Absolute, X || BIT $aaaa,X || $3c || 3 || 5
 +
|}
 +
 
 
== BMI - Branch on Minus(Negative Set) ==
 
== BMI - Branch on Minus(Negative Set) ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the negative flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the negative flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BMI $rrrr</td><td>$30</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BMI $rr || $30 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BNE - Branch on Not Equal(Zero Clear) ==
 
== BNE - Branch on Not Equal(Zero Clear) ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the zero flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the zero flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BNE $rrrr</td><td>$d0</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BNE $rr || $d0 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BPL - Branch on Plus(Negative Clear) ==
 
== BPL - Branch on Plus(Negative Clear) ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the negative flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the negative flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BPL $rrrr</td><td>$10</td><td>2</td><td>2(4 if branch taken)</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BPL $rr || $10 || 2 || 2(4 if branch taken)
 +
|}
 +
 
 
== BRA - Branch ==
 
== BRA - Branch ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Unconditionally branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>Unconditionally branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<p><br /></p>
+
 
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BRA $rrrr</td><td>$80</td><td>2</td><td>4</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BRA $rr || $80 || 2 || 4
 +
|}
 +
 
 
== BRK - Break ==
 
== BRK - Break ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>0</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || 0 || 1 || || 
 +
|}
 
<p>Forces a software interrupt using [[IRQ2]]'s vector.  Contrary to IRQs, BRK will push the status flags register with bit 4('B' flag) set.</p>
 
<p>Forces a software interrupt using [[IRQ2]]'s vector.  Contrary to IRQs, BRK will push the status flags register with bit 4('B' flag) set.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>BRK</td><td>$00</td><td>1</td><td>8</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || BRK || $00 || 1 || 8
 +
|}
 +
 
 
== BSR - Branch to Subroutine ==
 
== BSR - Branch to Subroutine ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BSR $rrrr</td><td>$44</td><td>2</td><td>8</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
 
 +
The program counter (last byte of the BSR instruction) is pushed to stack and the CPU branches to the specified relative address.
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BSR $rr || $44 || 2 || 8
 +
|}
 +
 
 
== BVC - Branch on Overflow Clear ==
 
== BVC - Branch on Overflow Clear ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the overflow flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the overflow flag is clear, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BVC $rrrr</td><td>$50</td><td>2</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BVC $rr || $50 || 2 || 2
 +
|}
 +
 
 
== BVS - Branch on Overflow Set ==
 
== BVS - Branch on Overflow Set ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>If the overflow flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
<p>If the overflow flag is set, branch to the address calculated from the operand.  The operand is treated as an 8-bit signed number, -128 to 127.  When
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction.  For example, a branch instruction with an operand of $00 will never branch.</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
 
<p>256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Relative</td><td>BVS $rrrr</td><td>$70</td><td>2</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Relative || BVS $rr || $70 || 2 || 2
 +
|}
 +
 
 
== CLA - Clear Accumulator ==
 
== CLA - Clear Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Clears the accumulator(reset to 0).</p>
 
<p>Clears the accumulator(reset to 0).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLA</td><td>$62</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLA || $62 || 1 || 2
 +
|}
 +
 
 
== CLC - Clear Carry Flag ==
 
== CLC - Clear Carry Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>0</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 0
 +
|}
 
<p>Clears the carry flag.</p>
 
<p>Clears the carry flag.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLC</td><td>$18</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLC || $18 || 1 || 2
 +
|}
 +
 
 
== CLD - Clear Decimal Flag ==
 
== CLD - Clear Decimal Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || 0 || || || 
 +
|}
 
<p>Clears the decimal flag, disabling [[Decimal Mode | decimal mode]].</p>
 
<p>Clears the decimal flag, disabling [[Decimal Mode | decimal mode]].</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLD</td><td>$d8</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLD || $d8 || 1 || 2
 +
|}
 +
 
 
== CLI - Clear Interrupt Flag ==
 
== CLI - Clear Interrupt Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || 0 || || 
 +
|}
 
<p>Clears the interrupt flag, allowing IRQs to be processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).</p>
 
<p>Clears the interrupt flag, allowing IRQs to be processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLI</td><td>$58</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLI || $58 || 1 || 2
 +
|}
 +
 
 
== CLV - Clear Overflow Flag ==
 
== CLV - Clear Overflow Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>0</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLV</td><td>$b8</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || 0 || 0 || || || || 
 +
|}
 +
Clears the overflow flag (V).
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLV || $b8 || 1 || 2
 +
|}
 +
 
 
== CLX - Clear X ==
 
== CLX - Clear X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLX</td><td>$82</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
Clears the X register.
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLX || $82 || 1 || 2
 +
|}
 +
 
 
== CLY - Clear Y ==
 
== CLY - Clear Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CLY</td><td>$c2</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
Clears the Y register.
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CLY || $c2 || 1 || 2
 +
|}
 +
 
 
== CMP - Compare Accumulator with Memory ==
 
== CMP - Compare Accumulator with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>CMP #$ii</td><td>$c9</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>CMP $zz</td><td>$c5</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>CMP $zz,X</td><td>$d5</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>CMP $aaaa</td><td>$cd</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>CMP $aaaa,X</td><td>$dd</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>CMP $aaaa,Y</td><td>$d9</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>CMP ($zz)</td><td>$d2</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>CMP ($zz,X)</td><td>$c1</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>CMP ($zz),Y</td><td>$d1</td><td>2</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
 
 +
The content of the operand is subtracted from the accumulator and the status register is set accordingly.
 +
The result of the subtraction is not stored.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the result is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if A == M
 +
|-
 +
| C || Carry Flag || Set if A >= M
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || CMP #$ii || $c9 || 2 || 2
 +
|-
 +
| Zero Page || CMP $zz || $c5 || 2 || 4
 +
|-
 +
| Zero Page, X || CMP $zz,X || $d5 || 2 || 4
 +
|-
 +
| Absolute || CMP $aaaa || $cd || 3 || 5
 +
|-
 +
| Absolute, X || CMP $aaaa,X || $dd || 3 || 5
 +
|-
 +
| Absolute, Y || CMP $aaaa,Y || $d9 || 3 || 5
 +
|-
 +
| Indirect || CMP ($zzzz) || $d2 || 3 || 7
 +
|-
 +
| Indexed Indirect || CMP ($zz,X) || $c1 || 2 || 7
 +
|-
 +
| Indirect, Index || CMP ($zz),Y || $d1 || 2 || 7
 +
|}
 +
 
 
== CPX - Compare X with Memory ==
 
== CPX - Compare X with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>CPX #$ii</td><td>$e0</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>CPX $zz</td><td>$e4</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>CPX $aaaa</td><td>$ec</td><td>3</td><td>5</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
 
 +
The content of the operand is subtracted from the X register and the status register is set accordingly. The result of the subtraction is not stored.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the result is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if X == M
 +
|-
 +
| C || Carry Flag || Set if X >= M
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || CPX #$ii || $e0 || 2 || 2
 +
|-
 +
| Zero Page || CPX $zz || $e4 || 2 || 4
 +
|-
 +
| Absolute || CPX $aaaa || $ec || 3 || 5
 +
|}
 +
 
 
== CPY - Compare Y with Memory ==
 
== CPY - Compare Y with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>CPY #$ii</td><td>$c0</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>CPY $zz</td><td>$c4</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>CPY $aaaa</td><td>$cc</td><td>3</td><td>5</td></tr>
+
|-
</table>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
 
 +
The content of the operand is subtracted from the Y register and the status register is set accordingly. The result of the subtraction is not stored.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the result is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if Y == M
 +
|-
 +
| C || Carry Flag || Set if Y >= M
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || CPY #$ii || $c0 || 2 || 2
 +
|-
 +
| Zero Page || CPY $zz || $c4 || 2 || 4
 +
|-
 +
| Absolute || CPY $aaaa || $cc || 3 || 5
 +
|}
 +
 
 
== CSH - Change Speed High ==
 
== CSH - Change Speed High ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CSH</td><td>$d4</td><td>1</td><td>3</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
 
 +
Set CPU to high speed mode (7.16 MHz).
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CSH || $d4 || 1 || 3
 +
|}
 +
 
 
== CSL - Change Speed Low ==
 
== CSL - Change Speed Low ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>CSL</td><td>$54</td><td>1</td><td>3</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
 
 +
Set CPU to low speed mode (1.78 MHz).
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || CSL || $54 || 1 || 3
 +
|}
 +
 
 
== DEC - Decrement ==
 
== DEC - Decrement ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>DEC $zz</td><td>$c6</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>DEC $zz,X</td><td>$d6</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>DEC $aaaa</td><td>$ce</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>DEC $aaaa,X</td><td>$de</td><td>3</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 +
 
 +
Decrement the operand by 1.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the result is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if the result is zero
 +
|-
 +
| C || Carry Flag || N/A
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || DEC $zz || $c6 || 2 || 6
 +
|-
 +
| Zero Page, X || DEC $zz,X || $d6 || 2 || 6
 +
|-
 +
| Absolute || DEC $aaaa || $ce || 3 || 7
 +
|-
 +
| Absolute, X || DEC $aaaa,X || $de || 3 || 7
 +
|}
 +
 
 
== DEX - Decrement X ==
 
== DEX - Decrement X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>DEX</td><td>$ca</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 +
 
 +
Decrement the X register by 1.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the X register is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if the X register is zero
 +
|-
 +
| C || Carry Flag || N/A
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || DEX || $ca || 1 || 2
 +
|}
 +
 
 
== DEY - Decrement Y ==
 
== DEY - Decrement Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>DEY</td><td>$88</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 +
 
 +
Decrement the Y register by 1.
 +
 
 +
{|
 +
|-
 +
| N || Negative Flag || Set if bit 7 of the Y register is set
 +
|-
 +
| V || Overflow Flag || N/A
 +
|-
 +
| T || T Flag || 0
 +
|-
 +
| D || Decimal Flag || N/A
 +
|-
 +
| I || Interrupt Disable || N/A
 +
|-
 +
| Z || Zero Flag || Set if the Y register is zero
 +
|-
 +
| C || Carry Flag || N/A
 +
|-
 +
|}
 +
 
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || DEY || $88 || 1 || 2
 +
|}
 +
 
 
== EOR - Exclusive OR Accumulator with Memory ==
 
== EOR - Exclusive OR Accumulator with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Logically [[XOR]] the value referenced by the operand to the accumulator.</p>
 
<p>Logically [[XOR]] the value referenced by the operand to the accumulator.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>EOR #$ii</td><td>$49</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>EOR $zz</td><td>$45</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>EOR $zz,X</td><td>$55</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>EOR $aaaa</td><td>$4d</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>EOR $aaaa,X</td><td>$5d</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>EOR $aaaa,Y</td><td>$59</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>EOR ($zz)</td><td>$52</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>EOR ($zz,X)</td><td>$41</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>EOR ($zz),Y</td><td>$51</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || EOR #$ii || $49 || 2 || 2
 +
|-
 +
| Zero Page || EOR $zz || $45 || 2 || 4
 +
|-
 +
| Zero Page, X || EOR $zz,X || $55 || 2 || 4
 +
|-
 +
| Absolute || EOR $aaaa || $4d || 3 || 5
 +
|-
 +
| Absolute, X || EOR $aaaa,X || $5d || 3 || 5
 +
|-
 +
| Absolute, Y || EOR $aaaa,Y || $59 || 3 || 5
 +
|-
 +
| Indirect || EOR ($zzzz) || $52 || 3 || 7
 +
|-
 +
| Indexed Indirect || EOR ($zz,X) || $41 || 2 || 7
 +
|-
 +
| Indirect, Index || EOR ($zz),Y || $51 || 2 || 7
 +
|}
 +
 
 
== INC - Increment ==
 
== INC - Increment ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Increments the value of the location specified by the operand by one.  The Carry flag is not used, nor is it modified.</p>
 
<p>Increments the value of the location specified by the operand by one.  The Carry flag is not used, nor is it modified.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Accumulator</td><td>INC A</td><td>$1a</td><td>1</td><td>2</td></tr><tr><td>Zero Page</td><td>INC $zz</td><td>$e6</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>INC $zz,X</td><td>$f6</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>INC $aaaa</td><td>$ee</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>INC $aaaa,X</td><td>$fe</td><td>3</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Accumulator || INC A || $1a || 1 || 2
 +
|-
 +
| Zero Page || INC $zz || $e6 || 2 || 6
 +
|-
 +
| Zero Page, X || INC $zz,X || $f6 || 2 || 6
 +
|-
 +
| Absolute || INC $aaaa || $ee || 3 || 7
 +
|-
 +
| Absolute, X || INC $aaaa,X || $fe || 3 || 7
 +
|}
 +
 
 
== INX - Increment X ==
 
== INX - Increment X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Increments the value in the X register by one.  The Carry flag is not used, nor is it modified.</p>
 
<p>Increments the value in the X register by one.  The Carry flag is not used, nor is it modified.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>INX</td><td>$e8</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || INX || $e8 || 1 || 2
 +
|}
 +
 
 
== INY - Increment Y ==
 
== INY - Increment Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Increments the value in the Y register by one.  The Carry flag is not used, nor is it modified.</p>
 
<p>Increments the value in the Y register by one.  The Carry flag is not used, nor is it modified.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>INY</td><td>$c8</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || INY || $c8 || 1 || 2
 +
|}
 +
 
 
== JMP - Jump ==
 
== JMP - Jump ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Transfers control(sets the program counter) to the effective address calculated from the operand.</p>
 
<p>Transfers control(sets the program counter) to the effective address calculated from the operand.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Absolute</td><td>JMP $aaaa</td><td>$4c</td><td>3</td><td>4</td></tr><tr><td>Indirect</td><td>JMP ($aaaa)</td><td>$6c</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>JMP ($aaaa,X)</td><td>$7c</td><td>3</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Absolute || JMP $aaaa || $4c || 3 || 4
 +
|-
 +
| Indirect || JMP ($zzzz) || $6c || 3 || 7
 +
|-
 +
| Indexed Indirect || JMP ($zzzz,X) || $7c || 3 || 7
 +
|}
 +
 
 
== JSR - Jump to Subroutine ==
 
== JSR - Jump to Subroutine ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Absolute</td><td>JSR $aaaa</td><td>$20</td><td>3</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
 
 +
Push the current program counter value (minus 1) onto the stack and set it to the address specified in the second operand.
 +
 
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Absolute || JSR $aaaa || $20 || 3 || 7
 +
|}
 +
 
 
== LDA - Load Accumulator ==
 
== LDA - Load Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Loads the accumulator with the value at the effective address.</p>
 
<p>Loads the accumulator with the value at the effective address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>LDA #$ii</td><td>$a9</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>LDA $zz</td><td>$a5</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>LDA $zz,X</td><td>$b5</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>LDA $aaaa</td><td>$ad</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>LDA $aaaa,X</td><td>$bd</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>LDA $aaaa,Y</td><td>$b9</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>LDA ($zz)</td><td>$b2</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>LDA ($zz,X)</td><td>$a1</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>LDA ($zz),Y</td><td>$b1</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || LDA #$ii || $a9 || 2 || 2
 +
|-
 +
| Zero Page || LDA $zz || $a5 || 2 || 4
 +
|-
 +
| Zero Page, X || LDA $zz,X || $b5 || 2 || 4
 +
|-
 +
| Absolute || LDA $aaaa || $ad || 3 || 5
 +
|-
 +
| Absolute, X || LDA $aaaa,X || $bd || 3 || 5
 +
|-
 +
| Absolute, Y || LDA $aaaa,Y || $b9 || 3 || 5
 +
|-
 +
| Indirect || LDA ($zzzz) || $b2 || 3 || 7
 +
|-
 +
| Indexed Indirect || LDA ($zz,X) || $a1 || 2 || 7
 +
|-
 +
| Indirect, Index || LDA ($zz),Y || $b1 || 2 || 7
 +
|}
 +
 
 
== LDX - Load X ==
 
== LDX - Load X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Loads the X register with the value at the effective address.</p>
 
<p>Loads the X register with the value at the effective address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>LDX #$ii</td><td>$a2</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>LDX $zz</td><td>$a6</td><td>2</td><td>4</td></tr><tr><td>Zero Page, Y</td><td>LDX $zz,Y</td><td>$b6</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>LDX $aaaa</td><td>$ae</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>LDX $aaaa,Y</td><td>$be</td><td>3</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || LDX #$ii || $a2 || 2 || 2
 +
|-
 +
| Zero Page || LDX $zz || $a6 || 2 || 4
 +
|-
 +
| Zero Page, Y || LDX $zz,Y || $b6 || 2 || 4
 +
|-
 +
| Absolute || LDX $aaaa || $ae || 3 || 5
 +
|-
 +
| Absolute, Y || LDX $aaaa,Y || $be || 3 || 5
 +
|}
 +
 
 
== LDY - Load Y ==
 
== LDY - Load Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Loads the Y register with the value at the effective address.</p>
 
<p>Loads the Y register with the value at the effective address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>LDY #$ii</td><td>$a0</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>LDY $zz</td><td>$a4</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>LDY $zz,X</td><td>$b4</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>LDY $aaaa</td><td>$ac</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>LDY $aaaa,X</td><td>$bc</td><td>3</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || LDY #$ii || $a0 || 2 || 2
 +
|-
 +
| Zero Page || LDY $zz || $a4 || 2 || 4
 +
|-
 +
| Zero Page, X || LDY $zz,X || $b4 || 2 || 4
 +
|-
 +
| Absolute || LDY $aaaa || $ac || 3 || 5
 +
|-
 +
| Absolute, X || LDY $aaaa,X || $bc || 3 || 5
 +
|}
 +
 
 
== LSR - Logical Shift Right ==
 
== LSR - Logical Shift Right ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>0</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Accumulator</td><td>LSR A</td><td>$4a</td><td>1</td><td>2</td></tr><tr><td>Zero Page</td><td>LSR $zz</td><td>$46</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>LSR $zz,X</td><td>$56</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>LSR $aaaa</td><td>$4e</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>LSR $aaaa,X</td><td>$5e</td><td>3</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 0
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Accumulator || LSR A || $4a || 1 || 2
 +
|-
 +
| Zero Page || LSR $zz || $46 || 2 || 6
 +
|-
 +
| Zero Page, X || LSR $zz,X || $56 || 2 || 6
 +
|-
 +
| Absolute || LSR $aaaa || $4e || 3 || 7
 +
|-
 +
| Absolute, X || LSR $aaaa,X || $5e || 3 || 7
 +
|}
 +
 
 
== NOP - No Operation ==
 
== NOP - No Operation ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>NOP</td><td>$ea</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || NOP || $ea || 1 || 2
 +
|}
 +
 
 
== ORA - OR Accumulator with Memory ==
 
== ORA - OR Accumulator with Memory ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Logically [[OR]] the value referenced by the operand with the accumulator, storing the result in the accumulator.</p>
 
<p>Logically [[OR]] the value referenced by the operand with the accumulator, storing the result in the accumulator.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>ORA #$ii</td><td>$09</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>ORA $zz</td><td>$05</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>ORA $zz,X</td><td>$15</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>ORA $aaaa</td><td>$0d</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>ORA $aaaa,X</td><td>$1d</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>ORA $aaaa,Y</td><td>$19</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>ORA ($zz)</td><td>$12</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>ORA ($zz,X)</td><td>$01</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>ORA ($zz),Y</td><td>$11</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || ORA #$ii || $09 || 2 || 2
 +
|-
 +
| Zero Page || ORA $zz || $05 || 2 || 4
 +
|-
 +
| Zero Page, X || ORA $zz,X || $15 || 2 || 4
 +
|-
 +
| Absolute || ORA $aaaa || $0d || 3 || 5
 +
|-
 +
| Absolute, X || ORA $aaaa,X || $1d || 3 || 5
 +
|-
 +
| Absolute, Y || ORA $aaaa,Y || $19 || 3 || 5
 +
|-
 +
| Indirect || ORA ($zzzz) || $12 || 3 || 7
 +
|-
 +
| Indexed Indirect || ORA ($zz,X) || $01 || 2 || 7
 +
|-
 +
| Indirect, Index || ORA ($zz),Y || $11 || 2 || 7
 +
|}
 +
 
 
== PHA - Push A ==
 
== PHA - Push A ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Pushes the accumulator to the stack.</p>
 
<p>Pushes the accumulator to the stack.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PHA</td><td>$48</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PHA || $48 || 1 || 3
 +
|}
 +
 
 
== PHP - Push P ==
 
== PHP - Push P ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Pushes the status flags(1 byte) to the stack.</p>
 
<p>Pushes the status flags(1 byte) to the stack.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PHP</td><td>$08</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PHP || $08 || 1 || 3
 +
|}
 +
 
 
== PHX - Push X ==
 
== PHX - Push X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Pushes the X register to the stack.</p>
 
<p>Pushes the X register to the stack.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PHX</td><td>$da</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PHX || $da || 1 || 3
 +
|}
 +
 
 
== PHY - Push Y ==
 
== PHY - Push Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Pushes the Y register to the stack.</p>
 
<p>Pushes the Y register to the stack.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PHY</td><td>$5a</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PHY || $5a || 1 || 3
 +
|}
 +
 
 
== PLA - Pull A ==
 
== PLA - Pull A ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Pulls a value off the stack, and stores the value in the accumulator.</p>
 
<p>Pulls a value off the stack, and stores the value in the accumulator.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PLA</td><td>$68</td><td>1</td><td>4</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PLA || $68 || 1 || 4
 +
|}
 +
 
 
== PLP - Pull P ==
 
== PLP - Pull P ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PLP</td><td>$28</td><td>1</td><td>4</td></tr></table>
+
|-
<p><br /></p>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || ? || ? || ? || ? || ?
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PLP || $28 || 1 || 4
 +
|}
 +
 
 
== PLX - Pull X ==
 
== PLX - Pull X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Pulls a value off the stack, and stores the value in the X register.</p>
 
<p>Pulls a value off the stack, and stores the value in the X register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PLX</td><td>$fa</td><td>1</td><td>4</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PLX || $fa || 1 || 4
 +
|}
 +
 
 
== PLY - Pull Y ==
 
== PLY - Pull Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Pulls a value off the stack, and stores the value in Y register.</p>
 
<p>Pulls a value off the stack, and stores the value in Y register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>PLY</td><td>$7a</td><td>1</td><td>4</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || PLY || $7a || 1 || 4
 +
|}
 +
 
 
== RMBn - Reset Memory Bit n ==
 
== RMBn - Reset Memory Bit n ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Reads the zero-page address specified by the operand, resets(clears) the bit "n", and then writes it back to the aforementioned address.</p>
 
<p>Reads the zero-page address specified by the operand, resets(clears) the bit "n", and then writes it back to the aforementioned address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>RMB0 $zz</td><td>$07</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB1 $zz</td><td>$17</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB2 $zz</td><td>$27</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB3 $zz</td><td>$37</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB4 $zz</td><td>$47</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB5 $zz</td><td>$57</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB6 $zz</td><td>$67</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>RMB7 $zz</td><td>$77</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || RMB0 $zz || $07 || 2 || 7
 +
|-
 +
| Zero Page || RMB1 $zz || $17 || 2 || 7
 +
|-
 +
| Zero Page || RMB2 $zz || $27 || 2 || 7
 +
|-
 +
| Zero Page || RMB3 $zz || $37 || 2 || 7
 +
|-
 +
| Zero Page || RMB4 $zz || $47 || 2 || 7
 +
|-
 +
| Zero Page || RMB5 $zz || $57 || 2 || 7
 +
|-
 +
| Zero Page || RMB6 $zz || $67 || 2 || 7
 +
|-
 +
| Zero Page || RMB7 $zz || $77 || 2 || 7
 +
|}
 +
 
 
== ROL - Rotate Left ==
 
== ROL - Rotate Left ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Accumulator</td><td>ROL A</td><td>$2a</td><td>1</td><td>2</td></tr><tr><td>Zero Page</td><td>ROL $zz</td><td>$26</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>ROL $zz,X</td><td>$36</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>ROL $aaaa</td><td>$2e</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>ROL $aaaa,X</td><td>$3e</td><td>3</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Accumulator || ROL A || $2a || 1 || 2
 +
|-
 +
| Zero Page || ROL $zz || $26 || 2 || 6
 +
|-
 +
| Zero Page, X || ROL $zz,X || $36 || 2 || 6
 +
|-
 +
| Absolute || ROL $aaaa || $2e || 3 || 7
 +
|-
 +
| Absolute, X || ROL $aaaa,X || $3e || 3 || 7
 +
|}
 +
 
 
== ROR - Rotate Right ==
 
== ROR - Rotate Right ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Accumulator</td><td>ROR A</td><td>$6a</td><td>1</td><td>2</td></tr><tr><td>Zero Page</td><td>ROR $zz</td><td>$66</td><td>2</td><td>6</td></tr><tr><td>Zero Page, X</td><td>ROR $zz,X</td><td>$76</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>ROR $aaaa</td><td>$6e</td><td>3</td><td>7</td></tr><tr><td>Absolute, X</td><td>ROR $aaaa,X</td><td>$7e</td><td>3</td><td>7</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || ?
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Accumulator || ROR A || $6a || 1 || 2
 +
|-
 +
| Zero Page || ROR $zz || $66 || 2 || 6
 +
|-
 +
| Zero Page, X || ROR $zz,X || $76 || 2 || 6
 +
|-
 +
| Absolute || ROR $aaaa || $6e || 3 || 7
 +
|-
 +
| Absolute, X || ROR $aaaa,X || $7e || 3 || 7
 +
|}
 +
 
 
== RTI - Return from Interrupt ==
 
== RTI - Return from Interrupt ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td><td>?</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>RTI</td><td>$40</td><td>1</td><td>7</td></tr></table>
+
|-
<p><br /></p>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || ? || ? || ? || ? || ?
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || RTI || $40 || 1 || 7
 +
|}
 +
 
 
== RTS - Return from Subroutine ==
 
== RTS - Return from Subroutine ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>RTS</td><td>$60</td><td>1</td><td>7</td></tr></table>
+
|-
<p><br /></p>
+
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || RTS || $60 || 1 || 7
 +
|}
 +
 
 
== SAX - Swap A and X ==
 
== SAX - Swap A and X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Swaps the values in the accumulator and X register.</p>
 
<p>Swaps the values in the accumulator and X register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SAX</td><td>$22</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SAX || $22 || 1 || 3
 +
|}
 +
 
 
== SAY - Swap A and Y ==
 
== SAY - Swap A and Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Swap the values in the accumulator and Y register.</p>
 
<p>Swap the values in the accumulator and Y register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SAY</td><td>$42</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SAY || $42 || 1 || 3
 +
|}
 +
 
 
== SBC - Subtract with Borrow ==
 
== SBC - Subtract with Borrow ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>?</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || ?
 +
|}
 
<p>If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).</p>
 
<p>If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).</p>
 
<p>The overflow flag is not affected by this instruction if in Decimal mode.</p>
 
<p>The overflow flag is not affected by this instruction if in Decimal mode.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>SBC #$ii</td><td>$e9</td><td>2</td><td>2</td></tr><tr><td>Zero Page</td><td>SBC $zz</td><td>$e5</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>SBC $zz,X</td><td>$f5</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>SBC $aaaa</td><td>$ed</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>SBC $aaaa,X</td><td>$fd</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>SBC $aaaa,Y</td><td>$f9</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>SBC ($zz)</td><td>$f2</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>SBC ($zz,X)</td><td>$e1</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>SBC ($zz),Y</td><td>$f1</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || SBC #$ii || $e9 || 2 || 2
 +
|-
 +
| Zero Page || SBC $zz || $e5 || 2 || 4
 +
|-
 +
| Zero Page, X || SBC $zz,X || $f5 || 2 || 4
 +
|-
 +
| Absolute || SBC $aaaa || $ed || 3 || 5
 +
|-
 +
| Absolute, X || SBC $aaaa,X || $fd || 3 || 5
 +
|-
 +
| Absolute, Y || SBC $aaaa,Y || $f9 || 3 || 5
 +
|-
 +
| Indirect || SBC ($zzzz) || $f2 || 3 || 7
 +
|-
 +
| Indexed Indirect || SBC ($zz,X) || $e1 || 2 || 7
 +
|-
 +
| Indirect, Index || SBC ($zz),Y || $f1 || 2 || 7
 +
|}
 +
 
 
== SEC - Set Carry Flag ==
 
== SEC - Set Carry Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>1</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 1
 +
|}
 
<p>Sets the carry flag.</p>
 
<p>Sets the carry flag.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SEC</td><td>$38</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SEC || $38 || 1 || 2
 +
|}
 +
 
 
== SED - Set Decimal Flag ==
 
== SED - Set Decimal Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || 1 || || || 
 +
|}
 
<p>Sets the decimal flag, enabling [[Decimal Mode | decimal mode]].</p>
 
<p>Sets the decimal flag, enabling [[Decimal Mode | decimal mode]].</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SED</td><td>$f8</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SED || $f8 || 1 || 2
 +
|}
 +
 
 
== SEI - Set Interrupt Flag ==
 
== SEI - Set Interrupt Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || 1 || || 
 +
|}
 
<p>Sets the interrupt flag, preventing IRQs from being processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).</p>
 
<p>Sets the interrupt flag, preventing IRQs from being processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SEI</td><td>$78</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SEI || $78 || 1 || 2
 +
|}
 +
 
 
== SET - Set T Flag ==
 
== SET - Set T Flag ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 1 || || || || 
 +
|}
 
<p>Sets the T flag, which changes the behavior of the next instruction if the next instruction is ADC, AND, EOR, ORA, or SBC, in which case the operation is performed on the zero-page address specified by the X register, instead of the accumulator.</p>
 
<p>Sets the T flag, which changes the behavior of the next instruction if the next instruction is ADC, AND, EOR, ORA, or SBC, in which case the operation is performed on the zero-page address specified by the X register, instead of the accumulator.</p>
 
<p>Note that interrupt processing preserves the T-flag, and clears the T-flag in the interrupt handler, so a programmer needn't worry about an interrupt
 
<p>Note that interrupt processing preserves the T-flag, and clears the T-flag in the interrupt handler, so a programmer needn't worry about an interrupt
 
occuring between SET and the next instruction.</p>
 
occuring between SET and the next instruction.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SET</td><td>$f4</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SET || $f4 || 1 || 2
 +
|}
 +
 
 
== SMBn - Set Memory Bit n ==
 
== SMBn - Set Memory Bit n ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Reads the zero-page address specified by the operand, sets the bit "n", and then writes it back to the aforementioned address.</p>
 
<p>Reads the zero-page address specified by the operand, sets the bit "n", and then writes it back to the aforementioned address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>SMB0 $zz</td><td>$87</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB1 $zz</td><td>$97</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB2 $zz</td><td>$a7</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB3 $zz</td><td>$b7</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB4 $zz</td><td>$c7</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB5 $zz</td><td>$d7</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB6 $zz</td><td>$e7</td><td>2</td><td>7</td></tr><tr><td>Zero Page</td><td>SMB7 $zz</td><td>$f7</td><td>2</td><td>7</td></tr>
+
{| class="addressing"
</table>
+
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || SMB0 $zz || $87 || 2 || 7
 +
|-
 +
| Zero Page || SMB1 $zz || $97 || 2 || 7
 +
|-
 +
| Zero Page || SMB2 $zz || $a7 || 2 || 7
 +
|-
 +
| Zero Page || SMB3 $zz || $b7 || 2 || 7
 +
|-
 +
| Zero Page || SMB4 $zz || $c7 || 2 || 7
 +
|-
 +
| Zero Page || SMB5 $zz || $d7 || 2 || 7
 +
|-
 +
| Zero Page || SMB6 $zz || $e7 || 2 || 7
 +
|-
 +
| Zero Page || SMB7 $zz || $f7 || 2 || 7
 +
|}
 +
 
 
== ST0 - Store [[HuC6270 | (HuC6270) VDC]] No. 0 ==
 
== ST0 - Store [[HuC6270 | (HuC6270) VDC]] No. 0 ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Writes the immediate value to the physical address $1FE000, the [[HuC6270 | (HuC6270) VDC]]'s address register.</p>
 
<p>Writes the immediate value to the physical address $1FE000, the [[HuC6270 | (HuC6270) VDC]]'s address register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>ST0 #$ii</td><td>$03</td><td>2</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || ST0 #$ii || $03 || 2 || 5
 +
|}
 +
 
 
== ST1 - Store [[HuC6270 | (HuC6270) VDC]] No. 1 ==
 
== ST1 - Store [[HuC6270 | (HuC6270) VDC]] No. 1 ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Writes the immediate value to the physical address $1FE002, the [[HuC6270 | (HuC6270) VDC]]'s lower data register.</p>
 
<p>Writes the immediate value to the physical address $1FE002, the [[HuC6270 | (HuC6270) VDC]]'s lower data register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>ST1 #$ii</td><td>$13</td><td>2</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || ST1 #$ii || $13 || 2 || 5
 +
|}
 +
 
 
== ST2 - Store [[HuC6270 | (HuC6270) VDC]] No. 2 ==
 
== ST2 - Store [[HuC6270 | (HuC6270) VDC]] No. 2 ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Writes the immediate value to the physical address $1FE003, the [[HuC6270 | (HuC6270) VDC]]'s upper data register.</p>
 
<p>Writes the immediate value to the physical address $1FE003, the [[HuC6270 | (HuC6270) VDC]]'s upper data register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>ST2 #$ii</td><td>$23</td><td>2</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || ST2 #$ii || $23 || 2 || 5
 +
|}
 +
 
 
== STA - Store Accumulator ==
 
== STA - Store Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Stores the value in the accumulator to the effective address specified by the operand.</p>
 
<p>Stores the value in the accumulator to the effective address specified by the operand.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>STA $zz</td><td>$85</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>STA $zz,X</td><td>$95</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>STA $aaaa</td><td>$8d</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>STA $aaaa,X</td><td>$9d</td><td>3</td><td>5</td></tr><tr><td>Absolute, Y</td><td>STA $aaaa,Y</td><td>$99</td><td>3</td><td>5</td></tr><tr><td>Indirect</td><td>STA ($zz)</td><td>$92</td><td>3</td><td>7</td></tr><tr><td>Indexed Indirect</td><td>STA ($zz,X)</td><td>$81</td><td>2</td><td>7</td></tr><tr><td>Indirect, Index</td><td>STA ($zz),Y</td><td>$91</td><td>2</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || STA $zz || $85 || 2 || 4
 +
|-
 +
| Zero Page, X || STA $zz,X || $95 || 2 || 4
 +
|-
 +
| Absolute || STA $aaaa || $8d || 3 || 5
 +
|-
 +
| Absolute, X || STA $aaaa,X || $9d || 3 || 5
 +
|-
 +
| Absolute, Y || STA $aaaa,Y || $99 || 3 || 5
 +
|-
 +
| Indirect || STA ($zzzz) || $92 || 3 || 7
 +
|-
 +
| Indexed Indirect || STA ($zz,X) || $81 || 2 || 7
 +
|-
 +
| Indirect, Index || STA ($zz),Y || $91 || 2 || 7
 +
|}
 +
 
 
== STX - Store X ==
 
== STX - Store X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Stores the value in the X register to the effective address specified by the operand.</p>
 
<p>Stores the value in the X register to the effective address specified by the operand.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>STX $zz</td><td>$86</td><td>2</td><td>4</td></tr><tr><td>Zero Page, Y</td><td>STX $zz,Y</td><td>$96</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>STX $aaaa</td><td>$8e</td><td>3</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || STX $zz || $86 || 2 || 4
 +
|-
 +
| Zero Page, Y || STX $zz,Y || $96 || 2 || 4
 +
|-
 +
| Absolute || STX $aaaa || $8e || 3 || 5
 +
|}
 +
 
 
== STY - Store Y ==
 
== STY - Store Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Stores the value in the Y register to the effective address specified by the operand.</p>
 
<p>Stores the value in the Y register to the effective address specified by the operand.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>STY $zz</td><td>$84</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>STY $zz,X</td><td>$94</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>STY $aaaa</td><td>$8c</td><td>3</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || STY $zz || $84 || 2 || 4
 +
|-
 +
| Zero Page, X || STY $zz,X || $94 || 2 || 4
 +
|-
 +
| Absolute || STY $aaaa || $8c || 3 || 5
 +
|}
 +
 
 
== STZ - Store Zero ==
 
== STZ - Store Zero ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Stores zero to the effective address specified by the operand.</p>
 
<p>Stores zero to the effective address specified by the operand.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>STZ $zz</td><td>$64</td><td>2</td><td>4</td></tr><tr><td>Zero Page, X</td><td>STZ $zz,X</td><td>$74</td><td>2</td><td>4</td></tr><tr><td>Absolute</td><td>STZ $aaaa</td><td>$9c</td><td>3</td><td>5</td></tr><tr><td>Absolute, X</td><td>STZ $aaaa,X</td><td>$9e</td><td>3</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || STZ $zz || $64 || 2 || 4
 +
|-
 +
| Zero Page, X || STZ $zz,X || $74 || 2 || 4
 +
|-
 +
| Absolute || STZ $aaaa || $9c || 3 || 5
 +
|-
 +
| Absolute, X || STZ $aaaa,X || $9e || 3 || 5
 +
|}
 +
 
 
== SXY - Swap X and Y ==
 
== SXY - Swap X and Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Swaps the values in the X register and the Y register.</p>
 
<p>Swaps the values in the X register and the Y register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>SXY</td><td>$02</td><td>1</td><td>3</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || SXY || $02 || 1 || 3
 +
|}
 +
 
 
== TAI - Transfer Alternate Increment ==
 
== TAI - Transfer Alternate Increment ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<pre>Alternate = 0
 
<pre>Alternate = 0
Line 320: Line 1,675:
 
  llll = llll - 1
 
  llll = llll - 1
 
  Alternate = Alternate ^ 1
 
  Alternate = Alternate ^ 1
While llll&nbsp;!= 0</pre>
+
While llll != 0</pre>
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
will be effectively treated as a length of "65536".</p>
 
will be effectively treated as a length of "65536".</p>
Line 326: Line 1,681:
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer
 
is complete.</p>
 
is complete.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Block Transfer</td><td>TAI $ssss, $dddd, $llll</td><td>$f3</td><td>7</td><td>17 + 6 * llll</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Block Transfer || TAI $ssss, $dddd, $llll || $f3 || 7 || 17 + 6 * llll
 +
|}
 +
 
 
== TAM - Transfer Accumulator to [[MPR | MPRs]] ==
 
== TAM - Transfer Accumulator to [[MPR | MPRs]] ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Copies the value in the accumulator to each MPR with the corresponding bit set in the immediate operand, eg. TAM #$41 will load MPR0 and MPR6 with the
 
<p>Copies the value in the accumulator to each MPR with the corresponding bit set in the immediate operand, eg. TAM #$41 will load MPR0 and MPR6 with the
 
value in the accumulator.  If no bits are set, no transfer will occur, and the instruction is effectively a 5-cycle NOP.</p>
 
value in the accumulator.  If no bits are set, no transfer will occur, and the instruction is effectively a 5-cycle NOP.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>TAM #$ii</td><td>$53</td><td>2</td><td>5</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || TAM #$ii || $53 || 2 || 5
 +
|}
 +
 
 
== TAX - Transfer Accumulator to X ==
 
== TAX - Transfer Accumulator to X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Copies the value of the accumulator to the X register.</p>
 
<p>Copies the value of the accumulator to the X register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TAX</td><td>$aa</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TAX || $aa || 1 || 2
 +
|}
 +
 
 
== TAY - Transfer Accumulator to Y ==
 
== TAY - Transfer Accumulator to Y ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Copies the value of the accumulator to the Y register.</p>
 
<p>Copies the value of the accumulator to the Y register.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TAY</td><td>$a8</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TAY || $a8 || 1 || 2
 +
|}
 +
 
 
== TDD - Transfer Decrement Decrement ==
 
== TDD - Transfer Decrement Decrement ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<pre>Do
 
<pre>Do
Line 349: Line 1,748:
 
  dddd = dddd - 1
 
  dddd = dddd - 1
 
  llll = llll - 1
 
  llll = llll - 1
While llll&nbsp;!= 0</pre>
+
While llll != 0</pre>
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
will be effectively treated as a length of "65536".</p>
 
will be effectively treated as a length of "65536".</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Block Transfer</td><td>TDD $ssss, $dddd, $llll</td><td>$c3</td><td>7</td><td>17 + 6 * llll</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Block Transfer || TDD $ssss, $dddd, $llll || $c3 || 7 || 17 + 6 * llll
 +
|}
 +
 
 
== TIA - Transfer Increment Alternate ==
 
== TIA - Transfer Increment Alternate ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p><br />
 
<p><br />
 
Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
Line 366: Line 1,776:
 
  llll = llll - 1
 
  llll = llll - 1
 
  Alternate = Alternate ^ 1
 
  Alternate = Alternate ^ 1
While llll&nbsp;!= 0</pre>
+
While llll != 0</pre>
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
will be effectively treated as a length of "65536".</p>
 
will be effectively treated as a length of "65536".</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Block Transfer</td><td>TIA $ssss, $dddd, $llll</td><td>$e3</td><td>7</td><td>17 + 6 * llll</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Block Transfer || TIA $ssss, $dddd, $llll || $e3 || 7 || 17 + 6 * llll
 +
|}
 +
 
 
== TII - Transfer Increment Increment ==
 
== TII - Transfer Increment Increment ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<pre>Do
 
<pre>Do
Line 381: Line 1,802:
 
  dddd = dddd + 1
 
  dddd = dddd + 1
 
  llll = llll - 1
 
  llll = llll - 1
While llll&nbsp;!= 0</pre>
+
While llll != 0</pre>
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
will be effectively treated as a length of "65536".</p>
 
will be effectively treated as a length of "65536".</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Block Transfer</td><td>TII $ssss, $dddd, $llll</td><td>$73</td><td>7</td><td>17 + 6 * llll</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Block Transfer || TII $ssss, $dddd, $llll || $73 || 7 || 17 + 6 * llll
 +
|}
 +
 
 
== TIN - Transfer Increment ==
 
== TIN - Transfer Increment ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<p>Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):</p>
 
<pre>Do
 
<pre>Do
Line 395: Line 1,827:
 
  ssss = ssss + 1
 
  ssss = ssss + 1
 
  llll = llll - 1
 
  llll = llll - 1
While llll&nbsp;!= 0</pre>
+
While llll != 0</pre>
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
<p>It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0"
 
will be effectively treated as a length of "65536".</p>
 
will be effectively treated as a length of "65536".</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
 
<p>Please note that the cycles-per-byte-transferred will be higher if [[HuC6270 | (HuC6270) VDC]] registers are used as source and/or destination.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Block Transfer</td><td>TIN $ssss, $dddd, $llll</td><td>$d3</td><td>7</td><td>17 + 6 * llll</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Block Transfer || TIN $ssss, $dddd, $llll || $d3 || 7 || 17 + 6 * llll
 +
|}
 +
 
 
== TMA - Transfer MPR to Accumulator ==
 
== TMA - Transfer MPR to Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Copies the value in the MPR, specified by the corresponding bit being set in the immediate operand, to the accumulator.  If an immediate value of $00 is used, the accumulator will be loaded with the last value transfered by TAM(note that if an immediate value of $00 is used with TAM, no transfer occurs, and as such won't be read back if an immediate value of $00 is used with TMA).  Undefined behavior results if multiple bits are set.</p>
 
<p>Copies the value in the MPR, specified by the corresponding bit being set in the immediate operand, to the accumulator.  If an immediate value of $00 is used, the accumulator will be loaded with the last value transfered by TAM(note that if an immediate value of $00 is used with TAM, no transfer occurs, and as such won't be read back if an immediate value of $00 is used with TMA).  Undefined behavior results if multiple bits are set.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate</td><td>TMA #$ii</td><td>$43</td><td>2</td><td>4</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate || TMA #$ii || $43 || 2 || 4
 +
|}
 +
 
 
== TRB - Test and Reset Bits against Accumulator ==
 
== TRB - Test and Reset Bits against Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || 
 +
|}
 
<p>Loads the value specified by the effective address of the operand, clears all bits whose corresponding bits are set in the accumulator(result = value &amp; ~accumulator), and stores the result to the aforementioned address.</p>
 
<p>Loads the value specified by the effective address of the operand, clears all bits whose corresponding bits are set in the accumulator(result = value &amp; ~accumulator), and stores the result to the aforementioned address.</p>
 
<p>The zero flag is set according to the result.  The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.</p>
 
<p>The zero flag is set according to the result.  The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>TRB $zz</td><td>$14</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>TRB $aaaa</td><td>$1c</td><td>3</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || TRB $zz || $14 || 2 || 6
 +
|-
 +
| Absolute || TRB $aaaa || $1c || 3 || 7
 +
|}
 +
 
 
== TSB - Test and Set Bits against Accumulator ==
 
== TSB - Test and Set Bits against Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || 
 +
|}
 
<p>Loads the value specified by the effective address of the operand, sets all bits whose corresponding bits are set in the accumulator(result = value &amp; ~accumulator), and stores the result to the aforementioned address.</p>
 
<p>Loads the value specified by the effective address of the operand, sets all bits whose corresponding bits are set in the accumulator(result = value &amp; ~accumulator), and stores the result to the aforementioned address.</p>
 
<p>The zero flag is set according to the result.  The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.</p>
 
<p>The zero flag is set according to the result.  The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Zero Page</td><td>TSB $zz</td><td>$04</td><td>2</td><td>6</td></tr><tr><td>Absolute</td><td>TSB $aaaa</td><td>$0c</td><td>3</td><td>7</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Zero Page || TSB $zz || $04 || 2 || 6
 +
|-
 +
| Absolute || TSB $aaaa || $0c || 3 || 7
 +
|}
 +
 
 
== TST - Test ==
 
== TST - Test ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>?</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || ? || 0 || || || ? || 
 +
|}
 
<p>The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address(they are *not* set as the result of
 
<p>The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address(they are *not* set as the result of
 
the [[AND]] operation used to determine the Z flag's state).</p>
 
the [[AND]] operation used to determine the Z flag's state).</p>
 
<p>The Z flag is determined according to the result of logically [[AND]]'ing the immediate value and the value at the effective address.</p>
 
<p>The Z flag is determined according to the result of logically [[AND]]'ing the immediate value and the value at the effective address.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Immediate, Zero Page</td><td>TST #$ii, $zz</td><td>$83</td><td>3</td><td>7</td></tr><tr><td>Immediate, Zero Page, X</td><td>TST #$ii, $zz, X</td><td>$a3</td><td>3</td><td>7</td></tr><tr><td>Immediate, Absolute</td><td>TST #$ii, $aaaa</td><td>$93</td><td>4</td><td>8</td></tr><tr><td>Immediate, Absolute, X</td><td>TST #$ii, $aaaa, X</td><td>$b3</td><td>4</td><td>8</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Immediate, Zero Page || TST #$ii, $zz || $83 || 3 || 7
 +
|-
 +
| Immediate, Zero Page, X || TST #$ii, $zz, X || $a3 || 3 || 7
 +
|-
 +
| Immediate, Absolute || TST #$ii, $aaaa || $93 || 4 || 8
 +
|-
 +
| Immediate, Absolute, X || TST #$ii, $aaaa, X || $b3 || 4 || 8
 +
|}
 +
 
 
== TSX - Transfer Stack Pointer to X ==
 
== TSX - Transfer Stack Pointer to X ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TSX</td><td>$ba</td><td>1</td><td>2</td></tr></table>
+
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 +
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TSX || $ba || 1 || 2
 +
|}
 +
 
 
== TXA - Transfer X to A ==
 
== TXA - Transfer X to A ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Copies the value in the X register to the Accumulator.</p>
 
<p>Copies the value in the X register to the Accumulator.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TXA</td><td>$8a</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TXA || $8a || 1 || 2
 +
|}
 +
 
 
== TXS - Track X to Stack Pointer ==
 
== TXS - Track X to Stack Pointer ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>&nbsp;</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| || || 0 || || || || 
 +
|}
 
<p>Copies the value in X to the [[Stack Pointer | stack pointer]].</p>
 
<p>Copies the value in X to the [[Stack Pointer | stack pointer]].</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TXS</td><td>$9a</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TXS || $9a || 1 || 2
 +
|}
 +
 
 
== TYA - Transfer Y to Accumulator ==
 
== TYA - Transfer Y to Accumulator ==
<table><tr><td><b>N</b></td><td><b>V</b></td><td><b>T</b></td><td><b>D</b></td><td><b>I</b></td><td><b>Z</b></td><td><b>C</b></td></tr><tr><td>?</td><td>&nbsp;</td><td>0</td><td>&nbsp;</td><td>&nbsp;</td><td>?</td><td>&nbsp;</td></tr></table>
+
{|
 +
|-
 +
! N !! V !! T !! D !! I !! Z !! C
 +
|-
 +
| ? || || 0 || || || ? || 
 +
|}
 
<p>Copies the value in Y to the Accumulator.</p>
 
<p>Copies the value in Y to the Accumulator.</p>
<table><tr><td><b>Addressing Mode</b></td><td><b>Syntax</b></td><td><b>Opcode</b></td><td><b>Bytes</b></td><td><b>Cycles</b></td></tr><tr><td>Implied</td><td>TYA</td><td>$98</td><td>1</td><td>2</td></tr></table>
+
{| class="addressing"
 +
|-
 +
! Addressing Mode !! Syntax !! Opcode !! Bytes !! Cycles
 +
|-
 +
| Implied || TYA || $98 || 1 || 2
 +
|}

Latest revision as of 15:08, 12 January 2019

Contents

ADC - Add with Carry

N V T D I Z C
 ?  ? 0  ?  ?

Add the value specified by the operand, and 1 if the Carry flag is set, to the value in the accumulator. If the result is too large to fit in the accumulator, the carry flag will be set, otherwise it will be cleared.

If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).

The overflow flag is not affected by this instruction if in Decimal mode; otherwise, if bit 7 of the result != bit 7 of the accumulator before the operation, and bit 7 of the accumulator before the operation == bit 7 of the value specified by the operand, the overflow flag is set, otherwise it is cleared. In other words, if we were to treat the accumulator and value specified by the operand as two's complement numbers, in the range of -128 to 127, the overflow flag will be set if the end result is outside of this range(otherwise it will be cleared).

If T=1 (the previous instruction is SET) the zero-page byte specified by the X register is used instead of the A register.

Here is a recap of the status register after use :

N Negative Flag Set if bit 7 is set
V Overflow Flag Set if bit 7 (sign bit for 2's complement number) is incorrect
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if A == 0
C Carry Flag Set if overflow in bit 7 occured


Addressing Mode Syntax Opcode Bytes Cycles
Immediate ADC #$ii $69 2 2
Zero Page ADC $zz $65 2 4
Zero Page, X ADC $zz,X $75 2 4
Absolute ADC $aaaa $6d 3 5
Absolute, X ADC $aaaa,X $7d 3 5
Absolute, Y ADC $aaaa,Y $79 3 5
Indirect ADC ($zzzz) $72 3 7
Indexed Indirect ADC ($zz,X) $61 2 7
Indirect, Index ADC ($zz),Y $71 2 7

AND - AND Accumulator with Memory

N V T D I Z C
 ? 0  ?

Performs a bit by bit logical and on the accumulator with the value specified by the operand.

Here is a recap of the processor status flags after use :

N Negative Flag Set if bit 7 is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if A == 0
C Carry Flag N/A


Addressing Mode Syntax Opcode Bytes Cycles
Immediate AND #$ii $29 2 2
Zero Page AND $zz $25 2 4
Zero Page, X AND $zz,X $35 2 4
Absolute AND $aaaa $2d 3 5
Absolute, X AND $aaaa,X $3d 3 5
Absolute, Y AND $aaaa,Y $39 3 5
Indirect AND ($zzzz) $32 3 7
Indexed Indirect AND ($zz,X) $21 2 7
Indirect, Index AND ($zz),Y $31 2 7

ASL - Arithmetic Shift Left

N V T D I Z C
 ? 0  ?  ?

Shifts the value at the location specified by the operand left by one bit, shifting in 0 to bit 0, and writes the result back to that location. Bit 7 of the value before the shift is copied to the Carry flag.

N Negative Flag Set if bit 7 of the result is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if A == 0
C Carry Flag Set to previous value of bit 7


Addressing Mode Syntax Opcode Bytes Cycles
Accumulator ASL A $0a 1 2
Zero Page ASL $zz $06 2 6
Zero Page, X ASL $zz,X $16 2 6
Absolute ASL $aaaa $0e 3 7
Absolute, X ASL $aaaa,X $1e 3 7

BBRn - Branch on Bit Reset n

N V T D I Z C
0

If Bit 'n' of the value at the effective address specified by the second operand is clear, branch to the address calculated from the second operand. The second operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page, Relative BBR0 $zz, $rr $0f 3 6*
Zero Page, Relative BBR1 $zz, $rr $1f 3 6*
Zero Page, Relative BBR2 $zz, $rr $2f 3 6*
Zero Page, Relative BBR3 $zz, $rr $3f 3 6*
Zero Page, Relative BBR4 $zz, $rr $4f 3 6*
Zero Page, Relative BBR5 $zz, $rr $5f 3 6*
Zero Page, Relative BBR6 $zz, $rr $6f 3 6*
Zero Page, Relative BBR7 $zz, $rr $7f 3 6*
* Add 2 extra cycles if branch is taken.

BBSn - Branch on Bit Set n

N V T D I Z C
0

If Bit 'n' of the value at the effective address specified by the operand is set, branch to the address calculated from the second operand. The second operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed second operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page, Relative BBS0 $zz, $rr $8f 3 6*
Zero Page, Relative BBS1 $zz, $rr $9f 3 6*
Zero Page, Relative BBS2 $zz, $rr $af 3 6*
Zero Page, Relative BBS3 $zz, $rr $bf 3 6*
Zero Page, Relative BBS4 $zz, $rr $cf 3 6*
Zero Page, Relative BBS5 $zz, $rr $df 3 6*
Zero Page, Relative BBS6 $zz, $rr $ef 3 6*
Zero Page, Relative BBS7 $zz, $rr $ff 3 6*

* Add 2 extra cycles if branch is taken.

BCC - Branch on Carry Clear

N V T D I Z C
0

If the carry flag is clear, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BCC $rr $90 2 2(4 if branch taken)

BCS - Branch on Carry Set

N V T D I Z C
0

If the carry flag is set, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BCS $rr $b0 2 2(4 if branch taken)

BEQ - Branch on Equal(Zero Set)

N V T D I Z C
0

If the zero flag is set, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BEQ $rr $f0 2 2(4 if branch taken)

BIT - Test Memory Bits with Accumulator

N V T D I Z C
 ?  ? 0  ?

Performs an AND between the accumulator and the specified operand without storing the result. Bit 7 and 6 of the memory operand are respectively saved in the negative (N) and overflow (V) flags.

N Negative Flag Bit 7 of M
V Overflow Flag Bit 6 of M
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if A & M == 0
C Carry Flag N/A


Addressing Mode Syntax Opcode Bytes Cycles
Immediate BIT #$ii $89 2 2
Zero Page BIT $zz $24 2 4
Zero Page, X BIT $zz,X $34 2 4
Absolute BIT $aaaa $2c 3 5
Absolute, X BIT $aaaa,X $3c 3 5

BMI - Branch on Minus(Negative Set)

N V T D I Z C
0

If the negative flag is set, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BMI $rr $30 2 2(4 if branch taken)

BNE - Branch on Not Equal(Zero Clear)

N V T D I Z C
0

If the zero flag is clear, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BNE $rr $d0 2 2(4 if branch taken)

BPL - Branch on Plus(Negative Clear)

N V T D I Z C
0

If the negative flag is clear, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BPL $rr $10 2 2(4 if branch taken)

BRA - Branch

N V T D I Z C
0

Unconditionally branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BRA $rr $80 2 4

BRK - Break

N V T D I Z C
0 0 1

Forces a software interrupt using IRQ2's vector. Contrary to IRQs, BRK will push the status flags register with bit 4('B' flag) set.

Addressing Mode Syntax Opcode Bytes Cycles
Implied BRK $00 1 8

BSR - Branch to Subroutine

N V T D I Z C
0

The program counter (last byte of the BSR instruction) is pushed to stack and the CPU branches to the specified relative address.

Addressing Mode Syntax Opcode Bytes Cycles
Relative BSR $rr $44 2 8

BVC - Branch on Overflow Clear

N V T D I Z C
0

If the overflow flag is clear, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BVC $rr $50 2 2

BVS - Branch on Overflow Set

N V T D I Z C
0

If the overflow flag is set, branch to the address calculated from the operand. The operand is treated as an 8-bit signed number, -128 to 127. When calculating the branch address, the 8-bit signed operand is added to the address of the byte immediately following the branch instruction. For example, a branch instruction with an operand of $00 will never branch.

256-byte and 8192-byte page-boundary crossing do not incur cycle penalties, unlike other 6502-based processors(or, depending on how the HuC6280 is engineered internally, ALL branches occur a 1-cycle page-crossing penalty on the HuC6280, regardless of page crossing or not).

Addressing Mode Syntax Opcode Bytes Cycles
Relative BVS $rr $70 2 2

CLA - Clear Accumulator

N V T D I Z C
0

Clears the accumulator(reset to 0).

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLA $62 1 2

CLC - Clear Carry Flag

N V T D I Z C
0 0

Clears the carry flag.

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLC $18 1 2

CLD - Clear Decimal Flag

N V T D I Z C
0 0

Clears the decimal flag, disabling decimal mode.

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLD $d8 1 2

CLI - Clear Interrupt Flag

N V T D I Z C
0 0

Clears the interrupt flag, allowing IRQs to be processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLI $58 1 2

CLV - Clear Overflow Flag

N V T D I Z C
0 0

Clears the overflow flag (V).

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLV $b8 1 2

CLX - Clear X

N V T D I Z C
0

Clears the X register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLX $82 1 2

CLY - Clear Y

N V T D I Z C
0

Clears the Y register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied CLY $c2 1 2

CMP - Compare Accumulator with Memory

N V T D I Z C
 ? 0  ?  ?

The content of the operand is subtracted from the accumulator and the status register is set accordingly. The result of the subtraction is not stored.

N Negative Flag Set if bit 7 of the result is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if A == M
C Carry Flag Set if A >= M


Addressing Mode Syntax Opcode Bytes Cycles
Immediate CMP #$ii $c9 2 2
Zero Page CMP $zz $c5 2 4
Zero Page, X CMP $zz,X $d5 2 4
Absolute CMP $aaaa $cd 3 5
Absolute, X CMP $aaaa,X $dd 3 5
Absolute, Y CMP $aaaa,Y $d9 3 5
Indirect CMP ($zzzz) $d2 3 7
Indexed Indirect CMP ($zz,X) $c1 2 7
Indirect, Index CMP ($zz),Y $d1 2 7

CPX - Compare X with Memory

N V T D I Z C
 ? 0  ?  ?

The content of the operand is subtracted from the X register and the status register is set accordingly. The result of the subtraction is not stored.

N Negative Flag Set if bit 7 of the result is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if X == M
C Carry Flag Set if X >= M


Addressing Mode Syntax Opcode Bytes Cycles
Immediate CPX #$ii $e0 2 2
Zero Page CPX $zz $e4 2 4
Absolute CPX $aaaa $ec 3 5

CPY - Compare Y with Memory

N V T D I Z C
 ? 0  ?  ?

The content of the operand is subtracted from the Y register and the status register is set accordingly. The result of the subtraction is not stored.

N Negative Flag Set if bit 7 of the result is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if Y == M
C Carry Flag Set if Y >= M


Addressing Mode Syntax Opcode Bytes Cycles
Immediate CPY #$ii $c0 2 2
Zero Page CPY $zz $c4 2 4
Absolute CPY $aaaa $cc 3 5

CSH - Change Speed High

N V T D I Z C
0

Set CPU to high speed mode (7.16 MHz).

Addressing Mode Syntax Opcode Bytes Cycles
Implied CSH $d4 1 3

CSL - Change Speed Low

N V T D I Z C
0

Set CPU to low speed mode (1.78 MHz).

Addressing Mode Syntax Opcode Bytes Cycles
Implied CSL $54 1 3

DEC - Decrement

N V T D I Z C
 ? 0  ?

Decrement the operand by 1.

N Negative Flag Set if bit 7 of the result is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if the result is zero
C Carry Flag N/A


Addressing Mode Syntax Opcode Bytes Cycles
Zero Page DEC $zz $c6 2 6
Zero Page, X DEC $zz,X $d6 2 6
Absolute DEC $aaaa $ce 3 7
Absolute, X DEC $aaaa,X $de 3 7

DEX - Decrement X

N V T D I Z C
 ? 0  ?

Decrement the X register by 1.

N Negative Flag Set if bit 7 of the X register is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if the X register is zero
C Carry Flag N/A


Addressing Mode Syntax Opcode Bytes Cycles
Implied DEX $ca 1 2

DEY - Decrement Y

N V T D I Z C
 ? 0  ?

Decrement the Y register by 1.

N Negative Flag Set if bit 7 of the Y register is set
V Overflow Flag N/A
T T Flag 0
D Decimal Flag N/A
I Interrupt Disable N/A
Z Zero Flag Set if the Y register is zero
C Carry Flag N/A


Addressing Mode Syntax Opcode Bytes Cycles
Implied DEY $88 1 2

EOR - Exclusive OR Accumulator with Memory

N V T D I Z C
 ? 0  ?

Logically XOR the value referenced by the operand to the accumulator.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate EOR #$ii $49 2 2
Zero Page EOR $zz $45 2 4
Zero Page, X EOR $zz,X $55 2 4
Absolute EOR $aaaa $4d 3 5
Absolute, X EOR $aaaa,X $5d 3 5
Absolute, Y EOR $aaaa,Y $59 3 5
Indirect EOR ($zzzz) $52 3 7
Indexed Indirect EOR ($zz,X) $41 2 7
Indirect, Index EOR ($zz),Y $51 2 7

INC - Increment

N V T D I Z C
 ? 0  ?

Increments the value of the location specified by the operand by one. The Carry flag is not used, nor is it modified.

Addressing Mode Syntax Opcode Bytes Cycles
Accumulator INC A $1a 1 2
Zero Page INC $zz $e6 2 6
Zero Page, X INC $zz,X $f6 2 6
Absolute INC $aaaa $ee 3 7
Absolute, X INC $aaaa,X $fe 3 7

INX - Increment X

N V T D I Z C
 ? 0  ?

Increments the value in the X register by one. The Carry flag is not used, nor is it modified.

Addressing Mode Syntax Opcode Bytes Cycles
Implied INX $e8 1 2

INY - Increment Y

N V T D I Z C
 ? 0  ?

Increments the value in the Y register by one. The Carry flag is not used, nor is it modified.

Addressing Mode Syntax Opcode Bytes Cycles
Implied INY $c8 1 2

JMP - Jump

N V T D I Z C
0

Transfers control(sets the program counter) to the effective address calculated from the operand.

Addressing Mode Syntax Opcode Bytes Cycles
Absolute JMP $aaaa $4c 3 4
Indirect JMP ($zzzz) $6c 3 7
Indexed Indirect JMP ($zzzz,X) $7c 3 7

JSR - Jump to Subroutine

N V T D I Z C
0

Push the current program counter value (minus 1) onto the stack and set it to the address specified in the second operand.

Addressing Mode Syntax Opcode Bytes Cycles
Absolute JSR $aaaa $20 3 7

LDA - Load Accumulator

N V T D I Z C
 ? 0  ?

Loads the accumulator with the value at the effective address.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate LDA #$ii $a9 2 2
Zero Page LDA $zz $a5 2 4
Zero Page, X LDA $zz,X $b5 2 4
Absolute LDA $aaaa $ad 3 5
Absolute, X LDA $aaaa,X $bd 3 5
Absolute, Y LDA $aaaa,Y $b9 3 5
Indirect LDA ($zzzz) $b2 3 7
Indexed Indirect LDA ($zz,X) $a1 2 7
Indirect, Index LDA ($zz),Y $b1 2 7

LDX - Load X

N V T D I Z C
 ? 0  ?

Loads the X register with the value at the effective address.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate LDX #$ii $a2 2 2
Zero Page LDX $zz $a6 2 4
Zero Page, Y LDX $zz,Y $b6 2 4
Absolute LDX $aaaa $ae 3 5
Absolute, Y LDX $aaaa,Y $be 3 5

LDY - Load Y

N V T D I Z C
 ? 0  ?

Loads the Y register with the value at the effective address.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate LDY #$ii $a0 2 2
Zero Page LDY $zz $a4 2 4
Zero Page, X LDY $zz,X $b4 2 4
Absolute LDY $aaaa $ac 3 5
Absolute, X LDY $aaaa,X $bc 3 5

LSR - Logical Shift Right

N V T D I Z C
 ? 0  ? 0
Addressing Mode Syntax Opcode Bytes Cycles
Accumulator LSR A $4a 1 2
Zero Page LSR $zz $46 2 6
Zero Page, X LSR $zz,X $56 2 6
Absolute LSR $aaaa $4e 3 7
Absolute, X LSR $aaaa,X $5e 3 7

NOP - No Operation

N V T D I Z C
0
Addressing Mode Syntax Opcode Bytes Cycles
Implied NOP $ea 1 2

ORA - OR Accumulator with Memory

N V T D I Z C
 ? 0  ?

Logically OR the value referenced by the operand with the accumulator, storing the result in the accumulator.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate ORA #$ii $09 2 2
Zero Page ORA $zz $05 2 4
Zero Page, X ORA $zz,X $15 2 4
Absolute ORA $aaaa $0d 3 5
Absolute, X ORA $aaaa,X $1d 3 5
Absolute, Y ORA $aaaa,Y $19 3 5
Indirect ORA ($zzzz) $12 3 7
Indexed Indirect ORA ($zz,X) $01 2 7
Indirect, Index ORA ($zz),Y $11 2 7

PHA - Push A

N V T D I Z C
0

Pushes the accumulator to the stack.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PHA $48 1 3

PHP - Push P

N V T D I Z C
0

Pushes the status flags(1 byte) to the stack.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PHP $08 1 3

PHX - Push X

N V T D I Z C
0

Pushes the X register to the stack.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PHX $da 1 3

PHY - Push Y

N V T D I Z C
0

Pushes the Y register to the stack.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PHY $5a 1 3

PLA - Pull A

N V T D I Z C
 ? 0  ?

Pulls a value off the stack, and stores the value in the accumulator.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PLA $68 1 4

PLP - Pull P

N V T D I Z C
 ?  ?  ?  ?  ?  ?  ?
Addressing Mode Syntax Opcode Bytes Cycles
Implied PLP $28 1 4

PLX - Pull X

N V T D I Z C
 ? 0  ?

Pulls a value off the stack, and stores the value in the X register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PLX $fa 1 4

PLY - Pull Y

N V T D I Z C
 ? 0  ?

Pulls a value off the stack, and stores the value in Y register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied PLY $7a 1 4

RMBn - Reset Memory Bit n

N V T D I Z C
0

Reads the zero-page address specified by the operand, resets(clears) the bit "n", and then writes it back to the aforementioned address.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page RMB0 $zz $07 2 7
Zero Page RMB1 $zz $17 2 7
Zero Page RMB2 $zz $27 2 7
Zero Page RMB3 $zz $37 2 7
Zero Page RMB4 $zz $47 2 7
Zero Page RMB5 $zz $57 2 7
Zero Page RMB6 $zz $67 2 7
Zero Page RMB7 $zz $77 2 7

ROL - Rotate Left

N V T D I Z C
 ? 0  ?  ?
Addressing Mode Syntax Opcode Bytes Cycles
Accumulator ROL A $2a 1 2
Zero Page ROL $zz $26 2 6
Zero Page, X ROL $zz,X $36 2 6
Absolute ROL $aaaa $2e 3 7
Absolute, X ROL $aaaa,X $3e 3 7

ROR - Rotate Right

N V T D I Z C
 ? 0  ?  ?
Addressing Mode Syntax Opcode Bytes Cycles
Accumulator ROR A $6a 1 2
Zero Page ROR $zz $66 2 6
Zero Page, X ROR $zz,X $76 2 6
Absolute ROR $aaaa $6e 3 7
Absolute, X ROR $aaaa,X $7e 3 7

RTI - Return from Interrupt

N V T D I Z C
 ?  ?  ?  ?  ?  ?  ?
Addressing Mode Syntax Opcode Bytes Cycles
Implied RTI $40 1 7

RTS - Return from Subroutine

N V T D I Z C
0
Addressing Mode Syntax Opcode Bytes Cycles
Implied RTS $60 1 7

SAX - Swap A and X

N V T D I Z C
0

Swaps the values in the accumulator and X register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SAX $22 1 3

SAY - Swap A and Y

N V T D I Z C
0

Swap the values in the accumulator and Y register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SAY $42 1 3

SBC - Subtract with Borrow

N V T D I Z C
 ?  ? 0  ?  ?

If the Decimal-mode CPU flag is set, an extra cycle will be taken(*confirmed with Immediate mode only, however, other addressing modes need to be tested, but should yield the same result).

The overflow flag is not affected by this instruction if in Decimal mode.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate SBC #$ii $e9 2 2
Zero Page SBC $zz $e5 2 4
Zero Page, X SBC $zz,X $f5 2 4
Absolute SBC $aaaa $ed 3 5
Absolute, X SBC $aaaa,X $fd 3 5
Absolute, Y SBC $aaaa,Y $f9 3 5
Indirect SBC ($zzzz) $f2 3 7
Indexed Indirect SBC ($zz,X) $e1 2 7
Indirect, Index SBC ($zz),Y $f1 2 7

SEC - Set Carry Flag

N V T D I Z C
0 1

Sets the carry flag.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SEC $38 1 2

SED - Set Decimal Flag

N V T D I Z C
0 1

Sets the decimal flag, enabling decimal mode.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SED $f8 1 2

SEI - Set Interrupt Flag

N V T D I Z C
0 1

Sets the interrupt flag, preventing IRQs from being processed(note that a change in the interrupt flag with SEI/CLI will only prevent/allow interrupts AFTER the next instruction is executed).

Addressing Mode Syntax Opcode Bytes Cycles
Implied SEI $78 1 2

SET - Set T Flag

N V T D I Z C
1

Sets the T flag, which changes the behavior of the next instruction if the next instruction is ADC, AND, EOR, ORA, or SBC, in which case the operation is performed on the zero-page address specified by the X register, instead of the accumulator.

Note that interrupt processing preserves the T-flag, and clears the T-flag in the interrupt handler, so a programmer needn't worry about an interrupt occuring between SET and the next instruction.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SET $f4 1 2

SMBn - Set Memory Bit n

N V T D I Z C
0

Reads the zero-page address specified by the operand, sets the bit "n", and then writes it back to the aforementioned address.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page SMB0 $zz $87 2 7
Zero Page SMB1 $zz $97 2 7
Zero Page SMB2 $zz $a7 2 7
Zero Page SMB3 $zz $b7 2 7
Zero Page SMB4 $zz $c7 2 7
Zero Page SMB5 $zz $d7 2 7
Zero Page SMB6 $zz $e7 2 7
Zero Page SMB7 $zz $f7 2 7

ST0 - Store (HuC6270) VDC No. 0

N V T D I Z C
0

Writes the immediate value to the physical address $1FE000, the (HuC6270) VDC's address register.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate ST0 #$ii $03 2 5

ST1 - Store (HuC6270) VDC No. 1

N V T D I Z C
0

Writes the immediate value to the physical address $1FE002, the (HuC6270) VDC's lower data register.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate ST1 #$ii $13 2 5

ST2 - Store (HuC6270) VDC No. 2

N V T D I Z C
0

Writes the immediate value to the physical address $1FE003, the (HuC6270) VDC's upper data register.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate ST2 #$ii $23 2 5

STA - Store Accumulator

N V T D I Z C
0

Stores the value in the accumulator to the effective address specified by the operand.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page STA $zz $85 2 4
Zero Page, X STA $zz,X $95 2 4
Absolute STA $aaaa $8d 3 5
Absolute, X STA $aaaa,X $9d 3 5
Absolute, Y STA $aaaa,Y $99 3 5
Indirect STA ($zzzz) $92 3 7
Indexed Indirect STA ($zz,X) $81 2 7
Indirect, Index STA ($zz),Y $91 2 7

STX - Store X

N V T D I Z C
0

Stores the value in the X register to the effective address specified by the operand.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page STX $zz $86 2 4
Zero Page, Y STX $zz,Y $96 2 4
Absolute STX $aaaa $8e 3 5

STY - Store Y

N V T D I Z C
0

Stores the value in the Y register to the effective address specified by the operand.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page STY $zz $84 2 4
Zero Page, X STY $zz,X $94 2 4
Absolute STY $aaaa $8c 3 5

STZ - Store Zero

N V T D I Z C
0

Stores zero to the effective address specified by the operand.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page STZ $zz $64 2 4
Zero Page, X STZ $zz,X $74 2 4
Absolute STZ $aaaa $9c 3 5
Absolute, X STZ $aaaa,X $9e 3 5

SXY - Swap X and Y

N V T D I Z C
0

Swaps the values in the X register and the Y register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied SXY $02 1 3

TAI - Transfer Alternate Increment

N V T D I Z C
0

Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):

Alternate = 0
Do
 Value = Read(ssss + Alternate)
 Write(dddd, value)
 dddd = dddd + 1
 llll = llll - 1
 Alternate = Alternate ^ 1
While llll != 0

It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0" will be effectively treated as a length of "65536".

Please note that the cycles-per-byte-transferred will be higher if (HuC6270) VDC registers are used as source and/or destination.

All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.

Addressing Mode Syntax Opcode Bytes Cycles
Block Transfer TAI $ssss, $dddd, $llll $f3 7 17 + 6 * llll

TAM - Transfer Accumulator to MPRs

N V T D I Z C
0

Copies the value in the accumulator to each MPR with the corresponding bit set in the immediate operand, eg. TAM #$41 will load MPR0 and MPR6 with the value in the accumulator. If no bits are set, no transfer will occur, and the instruction is effectively a 5-cycle NOP.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate TAM #$ii $53 2 5

TAX - Transfer Accumulator to X

N V T D I Z C
 ? 0  ?

Copies the value of the accumulator to the X register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied TAX $aa 1 2

TAY - Transfer Accumulator to Y

N V T D I Z C
 ? 0  ?

Copies the value of the accumulator to the Y register.

Addressing Mode Syntax Opcode Bytes Cycles
Implied TAY $a8 1 2

TDD - Transfer Decrement Decrement

N V T D I Z C
0

Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):

Do
 Value = Read(ssss)
 Write(dddd, value)
 ssss = ssss - 1
 dddd = dddd - 1
 llll = llll - 1
While llll != 0

It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0" will be effectively treated as a length of "65536".

Please note that the cycles-per-byte-transferred will be higher if (HuC6270) VDC registers are used as source and/or destination.

All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.

Addressing Mode Syntax Opcode Bytes Cycles
Block Transfer TDD $ssss, $dddd, $llll $c3 7 17 + 6 * llll

TIA - Transfer Increment Alternate

N V T D I Z C
0


Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):

Alternate = 0
Do
 Value = Read(ssss)
 Write(dddd + Alternate, Value)
 ssss = ssss + 1
 llll = llll - 1
 Alternate = Alternate ^ 1
While llll != 0

It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0" will be effectively treated as a length of "65536".

All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.

Please note that the cycles-per-byte-transferred will be higher if (HuC6270) VDC registers are used as source and/or destination.

Addressing Mode Syntax Opcode Bytes Cycles
Block Transfer TIA $ssss, $dddd, $llll $e3 7 17 + 6 * llll

TII - Transfer Increment Increment

N V T D I Z C
0

Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):

Do
 Value = Read(ssss)
 Write(dddd, Value)
 ssss = ssss + 1
 dddd = dddd + 1
 llll = llll - 1
While llll != 0

It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0" will be effectively treated as a length of "65536".

All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.

Please note that the cycles-per-byte-transferred will be higher if (HuC6270) VDC registers are used as source and/or destination.

Addressing Mode Syntax Opcode Bytes Cycles
Block Transfer TII $ssss, $dddd, $llll $73 7 17 + 6 * llll

TIN - Transfer Increment

N V T D I Z C
0

Enters block memory transfer sequence shown by this pseudocode('ssss' is the 16-bit source address, 'dddd' is the 16-bit destination address, and 'llll' is the 16-bit length counter, in bytes):

Do
 Value = Read(ssss)
 Write(dddd, value)
 ssss = ssss + 1
 llll = llll - 1
While llll != 0

It is important to note that the comparison of the length counter to 0 is done AFTER the length counter is decremented, not before, so a length of "0" will be effectively treated as a length of "65536".

All block-transfer instructions push Y, A, X in that order before beginning the block transfer, and pop X, A, Y in that order after the transfer is complete.

Please note that the cycles-per-byte-transferred will be higher if (HuC6270) VDC registers are used as source and/or destination.

Addressing Mode Syntax Opcode Bytes Cycles
Block Transfer TIN $ssss, $dddd, $llll $d3 7 17 + 6 * llll

TMA - Transfer MPR to Accumulator

N V T D I Z C
0

Copies the value in the MPR, specified by the corresponding bit being set in the immediate operand, to the accumulator. If an immediate value of $00 is used, the accumulator will be loaded with the last value transfered by TAM(note that if an immediate value of $00 is used with TAM, no transfer occurs, and as such won't be read back if an immediate value of $00 is used with TMA). Undefined behavior results if multiple bits are set.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate TMA #$ii $43 2 4

TRB - Test and Reset Bits against Accumulator

N V T D I Z C
 ?  ? 0  ?

Loads the value specified by the effective address of the operand, clears all bits whose corresponding bits are set in the accumulator(result = value & ~accumulator), and stores the result to the aforementioned address.

The zero flag is set according to the result. The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page TRB $zz $14 2 6
Absolute TRB $aaaa $1c 3 7

TSB - Test and Set Bits against Accumulator

N V T D I Z C
 ?  ? 0  ?

Loads the value specified by the effective address of the operand, sets all bits whose corresponding bits are set in the accumulator(result = value & ~accumulator), and stores the result to the aforementioned address.

The zero flag is set according to the result. The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address, before it is operated on.

Addressing Mode Syntax Opcode Bytes Cycles
Zero Page TSB $zz $04 2 6
Absolute TSB $aaaa $0c 3 7

TST - Test

N V T D I Z C
 ?  ? 0  ?

The N and V flags are copied from bit7 and bit6 of the value loaded from the effective address(they are *not* set as the result of the AND operation used to determine the Z flag's state).

The Z flag is determined according to the result of logically AND'ing the immediate value and the value at the effective address.

Addressing Mode Syntax Opcode Bytes Cycles
Immediate, Zero Page TST #$ii, $zz $83 3 7
Immediate, Zero Page, X TST #$ii, $zz, X $a3 3 7
Immediate, Absolute TST #$ii, $aaaa $93 4 8
Immediate, Absolute, X TST #$ii, $aaaa, X $b3 4 8

TSX - Transfer Stack Pointer to X

N V T D I Z C
 ? 0  ?
Addressing Mode Syntax Opcode Bytes Cycles
Implied TSX $ba 1 2

TXA - Transfer X to A

N V T D I Z C
 ? 0  ?

Copies the value in the X register to the Accumulator.

Addressing Mode Syntax Opcode Bytes Cycles
Implied TXA $8a 1 2

TXS - Track X to Stack Pointer

N V T D I Z C
0

Copies the value in X to the stack pointer.

Addressing Mode Syntax Opcode Bytes Cycles
Implied TXS $9a 1 2

TYA - Transfer Y to Accumulator

N V T D I Z C
 ? 0  ?

Copies the value in Y to the Accumulator.

Addressing Mode Syntax Opcode Bytes Cycles
Implied TYA $98 1 2