<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://sneslab.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xetheria</id>
	<title>SnesLab - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://sneslab.net/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Xetheria"/>
	<link rel="alternate" type="text/html" href="https://sneslab.net/wiki/Special:Contributions/Xetheria"/>
	<updated>2026-04-21T12:46:18Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Timing_Control_Unit&amp;diff=21030</id>
		<title>Timing Control Unit</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Timing_Control_Unit&amp;diff=21030"/>
		<updated>2026-04-09T23:41:56Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: clarify that this contains a counter&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Timing Control Unit&#039;&#039;&#039; (TCU) is part of the [[65c816]].  It contains a counter that is reset at each instruction fetch and advances during each [[machine cycle]].  Together with the [[instruction register]], it helps the processor perform register transfers.&lt;br /&gt;
&lt;br /&gt;
=== Reference ===&lt;br /&gt;
* section 2.2, page 6: https://www.westerndesigncenter.com/wdc/documentation/w65c02s.pdf&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:65c816]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Reset_Vector&amp;diff=21021</id>
		<title>Reset Vector</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Reset_Vector&amp;diff=21021"/>
		<updated>2026-02-01T03:38:39Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: added table ref&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Reset Vector&#039;&#039;&#039; points to a subroutine that runs when the [[Control Deck]] first boots up or comes out of reset.&lt;br /&gt;
&lt;br /&gt;
It is located at $00:FFFC,FD and is only active in [[emulation mode]].&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Interrupt Handler]]&lt;br /&gt;
&lt;br /&gt;
=== Reference ===&lt;br /&gt;
* &amp;quot;Table 5-2 Emulation Mode Vector Locations (8-bit Mode)&amp;quot; on 65c816 datasheet, 2024 edition&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=List_of_Anomie%27s_Docs&amp;diff=21020</id>
		<title>List of Anomie&#039;s Docs</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=List_of_Anomie%27s_Docs&amp;diff=21020"/>
		<updated>2026-01-31T21:26:39Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: linkify bgmode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are nine documents by anomie available on [[RHDN]]:&lt;br /&gt;
&lt;br /&gt;
* [https://www.romhacking.net/documents/193 SNES Memory Mapping]&lt;br /&gt;
* [https://www.romhacking.net/documents/196 Register]&lt;br /&gt;
* [https://www.romhacking.net/documents/199 SNES Timing]&lt;br /&gt;
* [https://www.romhacking.net/documents/197 SPC700 with boot rom disassembly]&lt;br /&gt;
* [https://www.romhacking.net/documents/198 SPC700 Cycles]&lt;br /&gt;
* [https://www.romhacking.net/documents/191 S-DSP]&lt;br /&gt;
* [https://www.romhacking.net/documents/194 SNES OpenBus and Wrapping]&lt;br /&gt;
* [https://www.romhacking.net/documents/195 SNES Port]&lt;br /&gt;
* [https://www.romhacking.net/documents/192 C4 chip]&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
* In &#039;&#039;&#039;regs.txt&#039;&#039;&#039; under &amp;quot;BG Modes&amp;quot; we have &amp;quot;The SNES has 7 [[background modes]],&amp;quot; it should say 8.&lt;br /&gt;
* In the S-DSP doc, we have &amp;quot;Certain games do seem to depend on these exact formulas, trying to &#039;&#039;&#039;simplify&#039;&#039;&#039; will break some sound effects.&amp;quot;  But &amp;quot;approximate&amp;quot; would probably be clearer than &amp;quot;simplify,&amp;quot; as in mathematics simplifying a formula only reduces the number of symbols used to express it, which may be easier to read but otherwise leaves it equivalent.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[List of Y0shi&#039;s Docs]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:Documents]]&lt;br /&gt;
[[Category:Lists]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21019</id>
		<title>Priority Order Shifting</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21019"/>
		<updated>2026-01-31T01:26:01Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* References */ paragraph 20.3&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Priority Order Shifting&#039;&#039;&#039; (or &#039;&#039;&#039;Priority Rotation&#039;&#039;&#039;) refers to techniques that change which sprites appear on top or behind of other sprites.&lt;br /&gt;
&lt;br /&gt;
While this can be done in software (by moving sprites around in [[OAM]]) the SNES contains a hardware feature for priority order shifting, bit 7 of OAMADDH (2103h):&lt;br /&gt;
&lt;br /&gt;
* When clear, OBJ #0 has the highest priority.&lt;br /&gt;
* When set, the OBJ number specified by bits 1-7 of OAMADDL (2102h) has the highest priority.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* paragraph 20.3 on [https://archive.org/details/SNESDevManual/book1/page/n91 page 2-20-2 of Book I] of official Super Nintendo development manual&lt;br /&gt;
* https://www.problemkaputt.de/fullsnes.htm#snesmemoryoamaccessspriteattributes&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
[[Category:Official Jargon]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21018</id>
		<title>Priority Order Shifting</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21018"/>
		<updated>2026-01-31T01:16:59Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: also called priority rotation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Priority Order Shifting&#039;&#039;&#039; (or &#039;&#039;&#039;Priority Rotation&#039;&#039;&#039;) refers to techniques that change which sprites appear on top or behind of other sprites.&lt;br /&gt;
&lt;br /&gt;
While this can be done in software (by moving sprites around in [[OAM]]) the SNES contains a hardware feature for priority order shifting, bit 7 of OAMADDH (2103h):&lt;br /&gt;
&lt;br /&gt;
* When clear, OBJ #0 has the highest priority.&lt;br /&gt;
* When set, the OBJ number specified by bits 1-7 of OAMADDL (2102h) has the highest priority.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [https://archive.org/details/SNESDevManual/book1/page/n91 page 2-20-2 of Book I] of official Super Nintendo development manual&lt;br /&gt;
* https://www.problemkaputt.de/fullsnes.htm#snesmemoryoamaccessspriteattributes&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
[[Category:Official Jargon]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21017</id>
		<title>Priority Order Shifting</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21017"/>
		<updated>2026-01-31T01:10:55Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: linkify OAM&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Priority Order Shifting&#039;&#039;&#039; refers to techniques that change which sprites appear on top or behind of other sprites.&lt;br /&gt;
&lt;br /&gt;
While this can be done in software (by moving sprites around in [[OAM]]) the SNES contains a hardware feature for priority order shifting, bit 7 of OAMADDH (2103h):&lt;br /&gt;
&lt;br /&gt;
* When clear, OBJ #0 has the highest priority.&lt;br /&gt;
* When set, the OBJ number specified by bits 1-7 of OAMADDL (2102h) has the highest priority.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [https://archive.org/details/SNESDevManual/book1/page/n91 page 2-20-2 of Book I] of official Super Nintendo development manual&lt;br /&gt;
* https://www.problemkaputt.de/fullsnes.htm#snesmemoryoamaccessspriteattributes&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
[[Category:Official Jargon]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21016</id>
		<title>Priority Order Shifting</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Priority_Order_Shifting&amp;diff=21016"/>
		<updated>2026-01-31T00:58:47Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: added ref, formatting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Priority Order Shifting&#039;&#039;&#039; refers to techniques that change which sprites appear on top or behind of other sprites.&lt;br /&gt;
&lt;br /&gt;
While this can be done in software (by moving sprites around in OAM) the SNES contains a hardware feature for priority order shifting, bit 7 of OAMADDH (2103h):&lt;br /&gt;
&lt;br /&gt;
* When clear, OBJ #0 has the highest priority.&lt;br /&gt;
* When set, the OBJ number specified by bits 1-7 of OAMADDL (2102h) has the highest priority.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [https://archive.org/details/SNESDevManual/book1/page/n91 page 2-20-2 of Book I] of official Super Nintendo development manual&lt;br /&gt;
* https://www.problemkaputt.de/fullsnes.htm#snesmemoryoamaccessspriteattributes&lt;br /&gt;
&lt;br /&gt;
[[Category:Video]]&lt;br /&gt;
[[Category:Official Jargon]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Transfer_Switches&amp;diff=21015</id>
		<title>Transfer Switches</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Transfer_Switches&amp;diff=21015"/>
		<updated>2026-01-16T06:13:07Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* References */ hid archive URL&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Transfer Switches&#039;&#039;&#039; exist inside the [[65c816]].  They are connected to:&lt;br /&gt;
&lt;br /&gt;
* Internal Address Bus&lt;br /&gt;
* Internal Special Bus&lt;br /&gt;
* Internal Data Bus&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/n604 page 578]&lt;br /&gt;
* Figure 2-1 W65C816S Internal Architecture Simplified Block Diagram on page 8 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Transfer_Switches&amp;diff=21014</id>
		<title>Transfer Switches</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Transfer_Switches&amp;diff=21014"/>
		<updated>2026-01-16T00:49:15Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: what they are connected to&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Transfer Switches&#039;&#039;&#039; exist inside the [[65c816]].  They are connected to:&lt;br /&gt;
&lt;br /&gt;
* Internal Address Bus&lt;br /&gt;
* Internal Special Bus&lt;br /&gt;
* Internal Data Bus&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]] page 578: https://archive.org/details/0893037893ProgrammingThe65816/page/n604&lt;br /&gt;
* Figure 2-1 W65C816S Internal Architecture Simplified Block Diagram on page 8 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21013</id>
		<title>Eyes &amp; Lichty</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21013"/>
		<updated>2026-01-15T07:53:24Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Errata */ spelling of &amp;quot;addressing&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;&#039;&#039;&#039;Eyes &amp;amp; Lichty&#039;&#039;&#039;&amp;quot; is scene slang for the excellent manual &amp;quot;Programming the 65816 Including the 6502, 65C02, and 65802&amp;quot; by David Eyes &amp;amp; Ron Lichty.  It may be the best unofficial textbook on SNES programming, due in no small part to the fact that the [[Ricoh 5A22]] is based on the 65c816 and the [[SPC700]] is based on the 6502.&lt;br /&gt;
&lt;br /&gt;
=== Addressing Mode ===&lt;br /&gt;
Eyes &amp;amp; Lichty divides the 65c816&#039;s various addressing modes into two groups: simple and complex.  Simple addressing modes are explained first and require the processor to do little effective address calculation.  They are:&lt;br /&gt;
&lt;br /&gt;
==== Simple Addressing Modes ====&lt;br /&gt;
* [[Immediate]]&lt;br /&gt;
* [[Absolute]]&lt;br /&gt;
* [[Direct Page Addressing|Direct Page]]&lt;br /&gt;
* [[Accumulator Addressing|Accumulator]]&lt;br /&gt;
* [[Implied]]&lt;br /&gt;
* [[Stack Addressing|Stack]]&lt;br /&gt;
* [[Direct Page Indirect]]&lt;br /&gt;
* [[Absolute Long]]&lt;br /&gt;
* [[Direct Page Indirect Long]]&lt;br /&gt;
* [[Block Move Addressing|Block Move]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/108 page 108]&lt;br /&gt;
&lt;br /&gt;
==== Complex Addressing Modes ====&lt;br /&gt;
&lt;br /&gt;
* [[Absolute Indexed by X]]&lt;br /&gt;
* [[Absolute Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed by X]]&lt;br /&gt;
* [[Direct Page Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indirect Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed Indirect by X]]&lt;br /&gt;
* [[Absolute Indexed Indirect]]&lt;br /&gt;
* Non-zero Direct Page&lt;br /&gt;
* [[Absolute Long Indexed by X]]&lt;br /&gt;
* [[Direct Page Indirect Long Indexed by Y]]&lt;br /&gt;
* [[Stack Relative]]&lt;br /&gt;
* [[Stack Relative Indirect Indexed by Y]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/197 page 197]&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
Applicable to the 2015 edition:&lt;br /&gt;
* Starting on page 389, several effective address diagrams have the bank byte labeled with too many zeros.  Only two hex zero digits should fit in there.&lt;br /&gt;
* On page 498, opcode F5 has a &amp;quot;0&amp;quot; superscript on the # of cycles column.&lt;br /&gt;
* The [[stack]] diagram for [[RTI]] has the old [[status register]] value on the opposite side of the stack as the diagram for [[COP]]&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/75 page 75] says the 65c816 has 25 different addressing modes, but the datasheet says there are 24&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/94 Page 94] says the 65c816 has three push instructions that do not alter registers: [[PEA]], [[PEI]], and [[PER]].  But the [[stack pointer]] itself is modified.  Even not counting that, there are more than three, for example [[PHA]].&lt;br /&gt;
* [[PLB]] is not the only instruction that modifies the [[data bank register]]; [[MVP]] and [[MVN]] do too - see section 7.18 of the 65c816 datasheet&lt;br /&gt;
* In the section on [[accumulator addressing]], a sentence implies that all read-modify-write instructions are unary, but [[TRB]] and [[TSB]] are not.&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/497 page 497] recommends making sure the carry flag is already set, or to set it with [[SEC]] prior to doing a [[SBC]] to &amp;quot;avoid subtracting the carry flag&amp;quot; but it should say &amp;quot;to avoid subtracting one&amp;quot;&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/510 Page 510] on [[TCD]] and page 512 on [[TDC]] mentions the [[direct page register]], but this is missing from the index&lt;br /&gt;
* In the tables that show which MPU supports which instructions, an &amp;quot;X&amp;quot; denotes yes and a &amp;quot; &amp;quot; denotes no.  Many readers would find a check mark less confusing.&lt;br /&gt;
* The Rockwell 65c02 does not have a direct page, but the four Rockwell instructions are listed as having [[Direct Page Addressing]] anyway &amp;quot;for consistency.&amp;quot;&lt;br /&gt;
* The 65c02 datasheet does mention [[WAI]] and [[STP]] are supported ([https://archive.org/details/0893037893ProgrammingThe65816/page/532 page 532] has them listed as unavailable)&lt;br /&gt;
* The [[addressing mode]] for [[WDM]] is missing, but the datasheet says it is [[Implied]]&lt;br /&gt;
* Assemblers are described as requiring the [[signature byte]] for [[COP]], but on the next page it says the signature byte is optional&lt;br /&gt;
* The page on [[PLA]] has a typo that says the 65x pull instructions &amp;quot;set&amp;quot; the zero and negative flags; it should say &amp;quot;affect.&amp;quot;&lt;br /&gt;
* Table 18.2 seems to imply that the [[M flag]] does not exist in [[emulation mode]] but the 65c816 datasheet says the M flag is always equal to one in emulation mode in section 2.8.&lt;br /&gt;
&lt;br /&gt;
=== Quick Links ===&lt;br /&gt;
&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n7	Table of Contents]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n13	Preface]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n15	Acknowledgments]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n17	Foreword]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n19	Introduction]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n21	How to Use this Book]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n27	Part I Basics]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n29	Basic Assembly Language Programming Concepts]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n49	Part II Architecture]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n51	Architecture of the 6502]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n71	Architecture of the 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n75	Sixteen-Bit Architecture: The 65816 and the 65802]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n99	Part III Tutorial]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n101	SEP, REP, and Other Details]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n109	First Examples: Moving Data]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n133	The Simple Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n165	The Flow of Control]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n181	Built-In Arithmetic Functions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n205	Logic and Bit Manipulation Operations]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n223	The Complex Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n251	The Basic Building Block: The Subroutine]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n275	Interrupts and System Control Instructions]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n291	Part IV Applications]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n293	Selected Code Samples]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n325	DEBUG16 - A 65816 Programming Tool]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n387	Design and Debugging]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n397	Reference]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n399	The Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n447	The Instruction Sets]&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:10&amp;quot;&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n449	ADC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n451	AND]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n453	ASL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n454	BCC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n455	BCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n456	BEQ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n457	BIT]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n458	BMI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n459	BNE]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n460	BPL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n461	BRA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n462	BRK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n463	BRL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n465	BVC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n466	BVS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n467	CLC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n468	CLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n469	CLI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n470	CLV]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n471	CMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n473	COP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n475	CPX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n476	CPY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n477	DEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n478	DEX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n479	DEY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n480	EOR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n482	INC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n483	INX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n484	INY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n485	JMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n486	JSL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n487	JSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n488	LDA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n489	LDX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n490	LDY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n491	LSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n492	MVN]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n493	MVP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n497	ORA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n499	PEA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n500	PEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n501	PER]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n502	PHA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n503	PHB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n504	PHD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n505	PHK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n506	PHP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n507	PHX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n508	PHY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n509	PLA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n510	PLB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n511	PLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n512	PLP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n513	PLX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n514	PLY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n515	REP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n516	ROL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n517	ROR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n518	RTI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n520	RTL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n522	RTS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n523	SBC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n525	SEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n526	SED]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n527	SEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n528	SEP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n529	STA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n530	STP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n531	STX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n532	STY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n533	STZ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n534	TAX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n535	TAY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n536	TCD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n537	TCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n538	TDC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n539	TRB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n540	TSB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n541	TSC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n542	TSX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n543	TXA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n544	TXS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n545	TXY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n546	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n547	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n548	WAI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n549	WDM]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n550	XBA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n551	XCE]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n553	Instruction Lists]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n567	Appendices]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n569	65x Signal Description]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n577	65x Series Support Chips]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n587	The Rockwell 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n588	BBR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n589	BBS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n590	RMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n591	SMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n593	Instruction Groups]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n594	Group I Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n595	Group II Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n599	W65C816 Data Sheet]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n621	The ASCII Character Set]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n625	Index]&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Books]]&lt;br /&gt;
[[Category:Scene Slang]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Work_RAM&amp;diff=21012</id>
		<title>Work RAM</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Work_RAM&amp;diff=21012"/>
		<updated>2026-01-06T00:40:36Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: linkify refresh&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:wram schematic.png|thumb|The WRAM chip is straddling regions C1 and D1 in the [[jwdonal schematic]]]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WRAM&#039;&#039;&#039; (Work RAM) serves as the SNES&#039; main memory.  It is 128K x 8 bits (131,072 bytes) in size, which is exactly two [[banks]].  It has part number 21326. &amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;  WRAM is located at $7E:0000.&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though WRAM has both [[Address Bus A]] and [[Address Bus B]] connected to it, the chip can only pay attention to one at a time, so WRAM-to-WRAM [[DMA]] isn&#039;t possible.&lt;br /&gt;
&lt;br /&gt;
WRAM is left intact by a [[Reset]]. &amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;  But, Nintendo still recommendeds checking to make sure the contents are correct after a reset.  &amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;  WRAM is DRAM and as such must be [[REFRESH and DRAMMODE|refreshed]].&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:Integrated Circuits]]&lt;br /&gt;
[[Category:ICs with unconnected pins]]&lt;br /&gt;
[[Category:Address Spaces]]&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[ARAM]]&lt;br /&gt;
* [[VRAM]]&lt;br /&gt;
* [[OAM]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# https://problemkaputt.de/fullsnes.htm#snesmemoryworkramaccess&lt;br /&gt;
# https://problemkaputt.de/fullsnes.htm#snescontrollersotherinputs&lt;br /&gt;
# [https://archive.org/details/SNESDevManual/book2/page/n404 page 1 of Book II], &amp;quot;Super NES Parts List&amp;quot; in the official Nintendo development manual&lt;br /&gt;
# paragraph 22.3 on [https://archive.org/details/SNESDevManual/book1/page/n97 page 2-22-1 of Book I], lbid&lt;br /&gt;
# caution #11: [https://archive.org/details/SNESDevManual/book1/page/n105 page 2-24-3 of Book I]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Set_Overflow&amp;diff=21011</id>
		<title>Set Overflow</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Set_Overflow&amp;diff=21011"/>
		<updated>2025-12-15T18:59:15Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: see also&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[65c816]] has no SO pin.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Overflow Flag]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]] [https://archive.org/details/0893037893ProgrammingThe65816/page/546 page 546]&lt;br /&gt;
# http://www.6502.org/tutorials/vflag.html#4&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Set_Overflow&amp;diff=21010</id>
		<title>Set Overflow</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Set_Overflow&amp;diff=21010"/>
		<updated>2025-12-15T18:57:38Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: SO pin does not exist&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The [[65c816]] has no SO pin.&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]] page 546: [https://archive.org/details/0893037893ProgrammingThe65816/page/546 page 546]&lt;br /&gt;
# http://www.6502.org/tutorials/vflag.html#4&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21009</id>
		<title>Eyes &amp; Lichty</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21009"/>
		<updated>2025-12-13T21:11:32Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Errata */ linkify page 532&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;&#039;&#039;&#039;Eyes &amp;amp; Lichty&#039;&#039;&#039;&amp;quot; is scene slang for the excellent manual &amp;quot;Programming the 65816 Including the 6502, 65C02, and 65802&amp;quot; by David Eyes &amp;amp; Ron Lichty.  It may be the best unofficial textbook on SNES programming, due in no small part to the fact that the [[Ricoh 5A22]] is based on the 65c816 and the [[SPC700]] is based on the 6502.&lt;br /&gt;
&lt;br /&gt;
=== Addressing Mode ===&lt;br /&gt;
Eyes &amp;amp; Lichty divides the 65c816&#039;s various addressing modes into two groups: simple and complex.  Simple addressing modes are explained first and require the processor to do little effective address calculation.  They are:&lt;br /&gt;
&lt;br /&gt;
==== Simple Addressing Modes ====&lt;br /&gt;
* [[Immediate]]&lt;br /&gt;
* [[Absolute]]&lt;br /&gt;
* [[Direct Page Addressing|Direct Page]]&lt;br /&gt;
* [[Accumulator Addressing|Accumulator]]&lt;br /&gt;
* [[Implied]]&lt;br /&gt;
* [[Stack Addressing|Stack]]&lt;br /&gt;
* [[Direct Page Indirect]]&lt;br /&gt;
* [[Absolute Long]]&lt;br /&gt;
* [[Direct Page Indirect Long]]&lt;br /&gt;
* [[Block Move Addressing|Block Move]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/108 page 108]&lt;br /&gt;
&lt;br /&gt;
==== Complex Addressing Modes ====&lt;br /&gt;
&lt;br /&gt;
* [[Absolute Indexed by X]]&lt;br /&gt;
* [[Absolute Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed by X]]&lt;br /&gt;
* [[Direct Page Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indirect Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed Indirect by X]]&lt;br /&gt;
* [[Absolute Indexed Indirect]]&lt;br /&gt;
* Non-zero Direct Page&lt;br /&gt;
* [[Absolute Long Indexed by X]]&lt;br /&gt;
* [[Direct Page Indirect Long Indexed by Y]]&lt;br /&gt;
* [[Stack Relative]]&lt;br /&gt;
* [[Stack Relative Indirect Indexed by Y]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/197 page 197]&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
Applicable to the 2015 edition:&lt;br /&gt;
* Starting on page 389, several effective address diagrams have the bank byte labeled with too many zeros.  Only two hex zero digits should fit in there.&lt;br /&gt;
* On page 498, opcode F5 has a &amp;quot;0&amp;quot; superscript on the # of cycles column.&lt;br /&gt;
* The [[stack]] diagram for [[RTI]] has the old [[status register]] value on the opposite side of the stack as the diagram for [[COP]]&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/75 page 75] says the 65c816 has 25 different addressesing modes, but the datasheet says there are 24&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/94 Page 94] says the 65c816 has three push instructions that do not alter registers: [[PEA]], [[PEI]], and [[PER]].  But the [[stack pointer]] itself is modified.  Even not counting that, there are more than three, for example [[PHA]].&lt;br /&gt;
* [[PLB]] is not the only instruction that modifies the [[data bank register]]; [[MVP]] and [[MVN]] do too - see section 7.18 of the 65c816 datasheet&lt;br /&gt;
* In the section on [[accumulator addressing]], a sentence implies that all read-modify-write instructions are unary, but [[TRB]] and [[TSB]] are not.&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/497 page 497] recommends making sure the carry flag is already set, or to set it with [[SEC]] prior to doing a [[SBC]] to &amp;quot;avoid subtracting the carry flag&amp;quot; but it should say &amp;quot;to avoid subtracting one&amp;quot;&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/510 Page 510] on [[TCD]] and page 512 on [[TDC]] mentions the [[direct page register]], but this is missing from the index&lt;br /&gt;
* In the tables that show which MPU supports which instructions, an &amp;quot;X&amp;quot; denotes yes and a &amp;quot; &amp;quot; denotes no.  Many readers would find a check mark less confusing.&lt;br /&gt;
* The Rockwell 65c02 does not have a direct page, but the four Rockwell instructions are listed as having [[Direct Page Addressing]] anyway &amp;quot;for consistency.&amp;quot;&lt;br /&gt;
* The 65c02 datasheet does mention [[WAI]] and [[STP]] are supported ([https://archive.org/details/0893037893ProgrammingThe65816/page/532 page 532] has them listed as unavailable)&lt;br /&gt;
* The [[addressing mode]] for [[WDM]] is missing, but the datasheet says it is [[Implied]]&lt;br /&gt;
* Assemblers are described as requiring the [[signature byte]] for [[COP]], but on the next page it says the signature byte is optional&lt;br /&gt;
* The page on [[PLA]] has a typo that says the 65x pull instructions &amp;quot;set&amp;quot; the zero and negative flags; it should say &amp;quot;affect.&amp;quot;&lt;br /&gt;
* Table 18.2 seems to imply that the [[M flag]] does not exist in [[emulation mode]] but the 65c816 datasheet says the M flag is always equal to one in emulation mode in section 2.8.&lt;br /&gt;
&lt;br /&gt;
=== Quick Links ===&lt;br /&gt;
&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n7	Table of Contents]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n13	Preface]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n15	Acknowledgments]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n17	Foreword]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n19	Introduction]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n21	How to Use this Book]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n27	Part I Basics]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n29	Basic Assembly Language Programming Concepts]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n49	Part II Architecture]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n51	Architecture of the 6502]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n71	Architecture of the 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n75	Sixteen-Bit Architecture: The 65816 and the 65802]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n99	Part III Tutorial]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n101	SEP, REP, and Other Details]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n109	First Examples: Moving Data]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n133	The Simple Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n165	The Flow of Control]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n181	Built-In Arithmetic Functions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n205	Logic and Bit Manipulation Operations]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n223	The Complex Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n251	The Basic Building Block: The Subroutine]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n275	Interrupts and System Control Instructions]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n291	Part IV Applications]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n293	Selected Code Samples]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n325	DEBUG16 - A 65816 Programming Tool]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n387	Design and Debugging]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n397	Reference]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n399	The Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n447	The Instruction Sets]&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:10&amp;quot;&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n449	ADC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n451	AND]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n453	ASL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n454	BCC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n455	BCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n456	BEQ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n457	BIT]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n458	BMI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n459	BNE]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n460	BPL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n461	BRA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n462	BRK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n463	BRL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n465	BVC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n466	BVS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n467	CLC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n468	CLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n469	CLI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n470	CLV]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n471	CMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n473	COP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n475	CPX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n476	CPY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n477	DEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n478	DEX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n479	DEY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n480	EOR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n482	INC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n483	INX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n484	INY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n485	JMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n486	JSL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n487	JSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n488	LDA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n489	LDX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n490	LDY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n491	LSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n492	MVN]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n493	MVP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n497	ORA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n499	PEA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n500	PEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n501	PER]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n502	PHA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n503	PHB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n504	PHD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n505	PHK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n506	PHP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n507	PHX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n508	PHY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n509	PLA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n510	PLB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n511	PLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n512	PLP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n513	PLX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n514	PLY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n515	REP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n516	ROL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n517	ROR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n518	RTI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n520	RTL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n522	RTS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n523	SBC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n525	SEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n526	SED]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n527	SEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n528	SEP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n529	STA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n530	STP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n531	STX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n532	STY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n533	STZ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n534	TAX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n535	TAY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n536	TCD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n537	TCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n538	TDC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n539	TRB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n540	TSB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n541	TSC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n542	TSX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n543	TXA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n544	TXS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n545	TXY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n546	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n547	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n548	WAI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n549	WDM]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n550	XBA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n551	XCE]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n553	Instruction Lists]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n567	Appendices]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n569	65x Signal Description]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n577	65x Series Support Chips]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n587	The Rockwell 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n588	BBR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n589	BBS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n590	RMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n591	SMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n593	Instruction Groups]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n594	Group I Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n595	Group II Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n599	W65C816 Data Sheet]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n621	The ASCII Character Set]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n625	Index]&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Books]]&lt;br /&gt;
[[Category:Scene Slang]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21008</id>
		<title>Eyes &amp; Lichty</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=21008"/>
		<updated>2025-12-13T18:35:08Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: spelling of errata&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;&#039;&#039;&#039;Eyes &amp;amp; Lichty&#039;&#039;&#039;&amp;quot; is scene slang for the excellent manual &amp;quot;Programming the 65816 Including the 6502, 65C02, and 65802&amp;quot; by David Eyes &amp;amp; Ron Lichty.  It may be the best unofficial textbook on SNES programming, due in no small part to the fact that the [[Ricoh 5A22]] is based on the 65c816 and the [[SPC700]] is based on the 6502.&lt;br /&gt;
&lt;br /&gt;
=== Addressing Mode ===&lt;br /&gt;
Eyes &amp;amp; Lichty divides the 65c816&#039;s various addressing modes into two groups: simple and complex.  Simple addressing modes are explained first and require the processor to do little effective address calculation.  They are:&lt;br /&gt;
&lt;br /&gt;
==== Simple Addressing Modes ====&lt;br /&gt;
* [[Immediate]]&lt;br /&gt;
* [[Absolute]]&lt;br /&gt;
* [[Direct Page Addressing|Direct Page]]&lt;br /&gt;
* [[Accumulator Addressing|Accumulator]]&lt;br /&gt;
* [[Implied]]&lt;br /&gt;
* [[Stack Addressing|Stack]]&lt;br /&gt;
* [[Direct Page Indirect]]&lt;br /&gt;
* [[Absolute Long]]&lt;br /&gt;
* [[Direct Page Indirect Long]]&lt;br /&gt;
* [[Block Move Addressing|Block Move]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/108 page 108]&lt;br /&gt;
&lt;br /&gt;
==== Complex Addressing Modes ====&lt;br /&gt;
&lt;br /&gt;
* [[Absolute Indexed by X]]&lt;br /&gt;
* [[Absolute Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed by X]]&lt;br /&gt;
* [[Direct Page Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indirect Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed Indirect by X]]&lt;br /&gt;
* [[Absolute Indexed Indirect]]&lt;br /&gt;
* Non-zero Direct Page&lt;br /&gt;
* [[Absolute Long Indexed by X]]&lt;br /&gt;
* [[Direct Page Indirect Long Indexed by Y]]&lt;br /&gt;
* [[Stack Relative]]&lt;br /&gt;
* [[Stack Relative Indirect Indexed by Y]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/197 page 197]&lt;br /&gt;
&lt;br /&gt;
=== Errata ===&lt;br /&gt;
Applicable to the 2015 edition:&lt;br /&gt;
* Starting on page 389, several effective address diagrams have the bank byte labeled with too many zeros.  Only two hex zero digits should fit in there.&lt;br /&gt;
* On page 498, opcode F5 has a &amp;quot;0&amp;quot; superscript on the # of cycles column.&lt;br /&gt;
* The [[stack]] diagram for [[RTI]] has the old [[status register]] value on the opposite side of the stack as the diagram for [[COP]]&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/75 page 75] says the 65c816 has 25 different addressesing modes, but the datasheet says there are 24&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/94 Page 94] says the 65c816 has three push instructions that do not alter registers: [[PEA]], [[PEI]], and [[PER]].  But the [[stack pointer]] itself is modified.  Even not counting that, there are more than three, for example [[PHA]].&lt;br /&gt;
* [[PLB]] is not the only instruction that modifies the [[data bank register]]; [[MVP]] and [[MVN]] do too - see section 7.18 of the 65c816 datasheet&lt;br /&gt;
* In the section on [[accumulator addressing]], a sentence implies that all read-modify-write instructions are unary, but [[TRB]] and [[TSB]] are not.&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/497 page 497] recommends making sure the carry flag is already set, or to set it with [[SEC]] prior to doing a [[SBC]] to &amp;quot;avoid subtracting the carry flag&amp;quot; but it should say &amp;quot;to avoid subtracting one&amp;quot;&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/510 Page 510] on [[TCD]] and page 512 on [[TDC]] mentions the [[direct page register]], but this is missing from the index&lt;br /&gt;
* In the tables that show which MPU supports which instructions, an &amp;quot;X&amp;quot; denotes yes and a &amp;quot; &amp;quot; denotes no.  Many readers would find a check mark less confusing.&lt;br /&gt;
* The Rockwell 65c02 does not have a direct page, but the four Rockwell instructions are listed as having [[Direct Page Addressing]] anyway &amp;quot;for consistency.&amp;quot;&lt;br /&gt;
* The 65c02 datasheet does mention [[WAI]] and [[STP]] are supported (page 532 has them listed as unavailable)&lt;br /&gt;
* The [[addressing mode]] for [[WDM]] is missing, but the datasheet says it is [[Implied]]&lt;br /&gt;
* Assemblers are described as requiring the [[signature byte]] for [[COP]], but on the next page it says the signature byte is optional&lt;br /&gt;
* The page on [[PLA]] has a typo that says the 65x pull instructions &amp;quot;set&amp;quot; the zero and negative flags; it should say &amp;quot;affect.&amp;quot;&lt;br /&gt;
* Table 18.2 seems to imply that the [[M flag]] does not exist in [[emulation mode]] but the 65c816 datasheet says the M flag is always equal to one in emulation mode in section 2.8.&lt;br /&gt;
&lt;br /&gt;
=== Quick Links ===&lt;br /&gt;
&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n7	Table of Contents]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n13	Preface]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n15	Acknowledgments]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n17	Foreword]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n19	Introduction]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n21	How to Use this Book]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n27	Part I Basics]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n29	Basic Assembly Language Programming Concepts]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n49	Part II Architecture]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n51	Architecture of the 6502]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n71	Architecture of the 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n75	Sixteen-Bit Architecture: The 65816 and the 65802]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n99	Part III Tutorial]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n101	SEP, REP, and Other Details]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n109	First Examples: Moving Data]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n133	The Simple Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n165	The Flow of Control]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n181	Built-In Arithmetic Functions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n205	Logic and Bit Manipulation Operations]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n223	The Complex Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n251	The Basic Building Block: The Subroutine]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n275	Interrupts and System Control Instructions]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n291	Part IV Applications]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n293	Selected Code Samples]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n325	DEBUG16 - A 65816 Programming Tool]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n387	Design and Debugging]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n397	Reference]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n399	The Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n447	The Instruction Sets]&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:10&amp;quot;&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n449	ADC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n451	AND]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n453	ASL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n454	BCC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n455	BCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n456	BEQ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n457	BIT]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n458	BMI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n459	BNE]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n460	BPL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n461	BRA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n462	BRK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n463	BRL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n465	BVC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n466	BVS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n467	CLC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n468	CLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n469	CLI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n470	CLV]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n471	CMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n473	COP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n475	CPX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n476	CPY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n477	DEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n478	DEX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n479	DEY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n480	EOR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n482	INC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n483	INX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n484	INY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n485	JMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n486	JSL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n487	JSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n488	LDA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n489	LDX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n490	LDY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n491	LSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n492	MVN]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n493	MVP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n497	ORA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n499	PEA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n500	PEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n501	PER]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n502	PHA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n503	PHB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n504	PHD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n505	PHK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n506	PHP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n507	PHX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n508	PHY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n509	PLA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n510	PLB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n511	PLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n512	PLP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n513	PLX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n514	PLY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n515	REP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n516	ROL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n517	ROR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n518	RTI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n520	RTL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n522	RTS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n523	SBC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n525	SEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n526	SED]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n527	SEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n528	SEP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n529	STA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n530	STP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n531	STX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n532	STY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n533	STZ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n534	TAX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n535	TAY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n536	TCD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n537	TCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n538	TDC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n539	TRB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n540	TSB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n541	TSC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n542	TSX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n543	TXA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n544	TXS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n545	TXY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n546	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n547	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n548	WAI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n549	WDM]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n550	XBA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n551	XCE]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n553	Instruction Lists]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n567	Appendices]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n569	65x Signal Description]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n577	65x Series Support Chips]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n587	The Rockwell 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n588	BBR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n589	BBS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n590	RMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n591	SMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n593	Instruction Groups]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n594	Group I Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n595	Group II Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n599	W65C816 Data Sheet]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n621	The ASCII Character Set]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n625	Index]&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Books]]&lt;br /&gt;
[[Category:Scene Slang]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=21007</id>
		<title>Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=21007"/>
		<updated>2025-12-13T10:02:56Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: added very rare address space straddling quirk&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Emulation Mode Flag&#039;&#039;&#039; (E) controls whether the [[65c816]] is behaving like a 6502:&lt;br /&gt;
* When clear, the &#039;816 is in &#039;&#039;&#039;65c816 native mode.&#039;&#039;&#039;&lt;br /&gt;
* When set, the &#039;816 is in &#039;&#039;&#039;6502 emulation mode.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This flag cannot be modified directly and is normally hidden from the programmer.  To modify it, use the [[XCE]] instruction to swap its value with the [[carry flag]]&#039;s value.  This treats the [[status register]] bits as a game of musical chairs.&lt;br /&gt;
&lt;br /&gt;
The designers likely omitted CLE and SEE opcodes to set or clear it directly because dedicating two opcodes to such a rare operation is overkill.&lt;br /&gt;
&lt;br /&gt;
The flag is set when a [[RESET]] interrupt is fired. In other words, the CPU always starts in emulation mode at boot and after a reset.&lt;br /&gt;
&lt;br /&gt;
Emulation mode is not perfect.  Some important behavior differences from the 6502 are:&lt;br /&gt;
* The 65c816 does not attempt to emulate the illegal 6502 opcodes because its [[65c816 Opcode Matrix|opcode matrix]] is already full.  All 256 opcodes work in both native and emulation mode, but many are less useful in emulation mode.&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* The [[direct page]] is fully relocatable in both native and emulation mode even though it doesn&#039;t exist on the 6502, so pointing it to the zero page right before running 6502 code is advised to ensure maximum compatibility&lt;br /&gt;
* Direct page indexed addressing will always wrap around and remain within the direct page in emulation mode, instead of possibly crossing over into the next page. ([[E&amp;amp;L]], [https://archive.org/details/0893037893ProgrammingThe65816/page/374 page 374])&lt;br /&gt;
* The [[program bank register]] and [[data bank register]] still exist in emulation mode even though they don&#039;t exist on a 6502, so memory accesses may not always access bank zero.&lt;br /&gt;
* the hidden [[B accumulator]] still exists in emulation mode even though it does not on a 6502&lt;br /&gt;
* (&#039;&#039;very rare)&#039;&#039; 6502 code trying to load the word straddling the end of the 16-bit address space will instead cross over into the next bank in emulation mode.&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For writing new SNES code it is recommended to almost always stay in native mode even if dealing with 8 bit data.  Some reasons are:&lt;br /&gt;
* Page boundary crossings incur a one cycle penalty in emulation mode.  Emulation mode emulates the NMOS 6502 cycle counts.&lt;br /&gt;
* Large amounts of 8-bit data can sometimes be processed in 16-bit chunks, and doing so can take fewer loads/stores/transfers than treating them as 8-bit.&lt;br /&gt;
* The [[break flag]] need not be examined in native mode because there are more interrupt vectors.  (In fact, it does not even exist).&lt;br /&gt;
&lt;br /&gt;
On the other hand, [[COP]], [[BRK]], and [[RTI]] take one extra cycle in native mode because of the [[bank]] number.  For running 6502 code with minimal issues it is still recommended to use emulation mode.  For example, one quirk of 8-bit native mode is that [[TXS]] points the [[stack]] to the [[zeropage]].&lt;br /&gt;
&lt;br /&gt;
Emulation code need not be in [[bank]] 0.&lt;br /&gt;
&lt;br /&gt;
In emulation mode, the [[stack pointer]]&#039;s high byte is always one.  The M and X flags are always set in emulation mode.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SA-1]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 17.3, [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#APPENDIX&lt;br /&gt;
# section 7.8 of 65c816 datasheet: https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# section 2.8, lbid.&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#5.12&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Category:Transfer_Instructions&amp;diff=21006</id>
		<title>Category:Transfer Instructions</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Category:Transfer_Instructions&amp;diff=21006"/>
		<updated>2025-12-12T19:35:32Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: note about counterparts, TRB and TSB&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are [[65c816]] instructions whose mnemonic begins with &amp;quot;T&amp;quot; for &amp;quot;Transfer.&amp;quot;  By exchanging the second and third letter of the mnemonic you can always find the counterpart to transfer in the opposite direction.&lt;br /&gt;
&lt;br /&gt;
The only two transfer instructions that do not alter any flags are [[TCS]] and [[TXS]].&lt;br /&gt;
&lt;br /&gt;
[[TRB]] and [[TSB]] are the only non-transfer 65c816 instructions that begin with &amp;quot;T&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:One-byte Instructions]]&lt;br /&gt;
[[Category:Two-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Direct_Page_Indirect_Addressing&amp;diff=21005</id>
		<title>Direct Page Indirect Addressing</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Direct_Page_Indirect_Addressing&amp;diff=21005"/>
		<updated>2025-12-12T16:01:09Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: emulation mode quirk&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Direct Page Indirect Addressing&#039;&#039;&#039; is supported by eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (opcode 72)&lt;br /&gt;
* [[AND]] (opcode 32)&lt;br /&gt;
* [[CMP]] (opcode D2)&lt;br /&gt;
* [[EOR]] (opcode 52)&lt;br /&gt;
* [[LDA]] (opcode B2)&lt;br /&gt;
* [[ORA]] (opcode 12)&lt;br /&gt;
* [[SBC]] (opcode F2)&lt;br /&gt;
* [[STA]] (opcode 92)&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA (dp)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, the 16-bit address stored at location dp of the direct page is fetched, and then the accumulator is loaded with the byte that lives at that address.&lt;br /&gt;
&lt;br /&gt;
In [[emulation mode]], the 16-bit pointer can&#039;t straddle a page boundary.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Direct Page Indirect Long Addressing]]&lt;br /&gt;
* [[Direct Page Addressing]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/393 page 393]&lt;br /&gt;
# [https://archive.org/details/0893037893ProgrammingThe65816/page/128 page 128], lbid&lt;br /&gt;
# section 3.5.16 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#5.9&lt;br /&gt;
&lt;br /&gt;
[[Category:Addressing Modes]]&lt;br /&gt;
[[Category:Simple Admodes]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Talk:Emulation_Mode_Flag&amp;diff=21004</id>
		<title>Talk:Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Talk:Emulation_Mode_Flag&amp;diff=21004"/>
		<updated>2025-12-12T14:25:04Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: might want to remove bullet point&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Can&#039;t seem to get Bruce Clark link working here.&lt;br /&gt;
&lt;br /&gt;
Might want to remove/move that bullet point on direct page wrapping - that whole set of bullet points are about differences between running code on a real 6502 and running it in emulation mode on a 65816, not how a 65816 feature normally behaves&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=TAY&amp;diff=21003</id>
		<title>TAY</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=TAY&amp;diff=21003"/>
		<updated>2025-12-12T11:00:01Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: does not care how wide accumulator is&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 1)&lt;br /&gt;
|A8&lt;br /&gt;
|1 byte&lt;br /&gt;
|2 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|N&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|Z&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TAY&#039;&#039;&#039; is a 65x instruction that transfers the value of the [[accumulator]] to the [[Y index register]].  The size of the Y index register determines how many bytes are transferred.  TAY does not care how wide the accumulator is.  TAY always takes two cycles, regardless of whether one or two bytes are transferred.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot;|Instruction Behavior&lt;br /&gt;
|+&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;8-bit accumulator (m=1)&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;16-bit accumulator (m=0)&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;8-bit index registers (x=1)&#039;&#039;&#039;&lt;br /&gt;
|8 bits are transferred&lt;br /&gt;
|8 bits are transferred (low byte of accumulator)&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;16-bit index registers (x=0)&#039;&#039;&#039;&lt;br /&gt;
|16 bits are transferred (including hidden upper byte) &lt;br /&gt;
|16 bits are transferred (full C accumulator)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TAY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[TAX]]&lt;br /&gt;
* [[TYA]]&lt;br /&gt;
* [[TCD]]&lt;br /&gt;
* [[TCS]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/509 page 509] on TAY&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n200 page 190] on TAY&lt;br /&gt;
* 7.13 on [[MCS6500 Manual]], [https://archive.org/details/mos_microcomputers_programming_manual/page/n119 page 101] on TAY&lt;br /&gt;
* [[Leventhal]], [https://archive.org/details/6502-assembly-language-programming/page/n149 page 3-100] on TAY&lt;br /&gt;
* snes9x implementation of TAY: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L2289&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Transfer Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Two-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=TAX&amp;diff=21002</id>
		<title>TAX</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=TAX&amp;diff=21002"/>
		<updated>2025-12-12T10:56:17Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: does not care how wide accumulator is&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 1)&lt;br /&gt;
|AA&lt;br /&gt;
|1 byte&lt;br /&gt;
|2 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|N&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|Z&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TAX&#039;&#039;&#039; is a 65x instruction that transfers the value of the [[accumulator]] to the [[X index register]].  The size of the X index register determines how many bytes are transferred.  TAX does not care how wide the accumulator is.  TAX always takes two cycles, regardless of whether one or two bytes are transferred.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;3&amp;quot;|Instruction Behavior&lt;br /&gt;
|+&lt;br /&gt;
|&lt;br /&gt;
|&#039;&#039;&#039;8-bit accumulator (m=1)&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;16-bit accumulator (m=0)&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;8-bit index registers (x=1)&#039;&#039;&#039;&lt;br /&gt;
|8 bits are transferred&lt;br /&gt;
|8 bits are transferred (low byte of accumulator)&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;16-bit index registers (x=0)&#039;&#039;&#039;&lt;br /&gt;
|16 bits are transferred (including hidden upper byte)&lt;br /&gt;
|16 bits are transferred (full C accumulator)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TAX&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[TAY]]&lt;br /&gt;
* [[TXA]]&lt;br /&gt;
* [[TCD]]&lt;br /&gt;
* [[TCS]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/508 page 508] on TAX&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n199 page 189] on TAX&lt;br /&gt;
* 7.11 on [[MCS6500 Manual]], [https://archive.org/details/mos_microcomputers_programming_manual/page/n118 page 100] on TAX&lt;br /&gt;
* [[Carr]], [https://archive.org/details/6502UsersManual/page/n288 page 275] on TAX&lt;br /&gt;
* [[Leventhal]], [https://archive.org/details/6502-assembly-language-programming/page/n148 page 3-99] on TAX&lt;br /&gt;
* snes9x implementation of TAX: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L2258&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Transfer Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Two-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=SA-1&amp;diff=20995</id>
		<title>SA-1</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=SA-1&amp;diff=20995"/>
		<updated>2025-12-01T07:25:15Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Features */ base is slowrom&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Nintendo SA-1&#039;&#039;&#039; (Super Accelerator) is an [[enhancement chip]] made by [http://en.wikipedia.org/wiki/Nintendo Nintendo], used in 33 SNES games. The RF5A123 chip is based on the [[65c816]] processor, the same one used by the main SNES CPU, the [[RF5A22]]. With identical architecture to the SNES one, the chip is ideal for games and ROM hacks that can reuse code from the main CPU, thus not having to learn an additional assembling language or architecture.&lt;br /&gt;
&lt;br /&gt;
When you are on the SA-1 context, the SA-1 CPU is often referred as &amp;quot;C-CPU&amp;quot; (&amp;quot;C&amp;quot; stands for co-processor) while the SNES CPU is often referred as &amp;quot;S-CPU&amp;quot; (&amp;quot;S&amp;quot; stands for SNES). There is no master or slave, because both processors can interrupt each other though [[IRQ]]s, keeping in mind that initially SA-1 boots up in the sleeping state and must be initialized by the SNES CPU.&lt;br /&gt;
&lt;br /&gt;
{{TOClimit|4}}&lt;br /&gt;
&lt;br /&gt;
== Features ==&lt;br /&gt;
&lt;br /&gt;
The embedded co-processor has a &#039;&#039;&#039;10.74 MHz&#039;&#039;&#039; base clock speed, which is four times faster compared to the 2.68 MHz base clock speed from the S-CPU (a.k.a. [[SlowROM]]). In addition to that, it includes additional hardware circuits for data I/O, bitmap manipulation modes, arithmetic registers and high-speed internal memory.&lt;br /&gt;
&lt;br /&gt;
* 16-bit 65c816 processor clocked at 10.74 MHz.&lt;br /&gt;
* 2 kB internal work memory (I-RAM), clocked at 10.74 MHz.&lt;br /&gt;
* Multi-processor processing, with parallel operating mode and automatic memory sharing control.&lt;br /&gt;
* Large capacity memory, with a total capability of 8 MB ROM and 256 kB BW-RAM, both clocked at 5.37 MHz, with ROM having an effective 10.74 MHz speed because of the 16-bit data bus.&lt;br /&gt;
* High speed arithmetic multiplication, division and cumulative sum (multiply with add) hardware.&lt;br /&gt;
* Bitmap and Character Conversion functions for fast graphics manipulation.&lt;br /&gt;
* Custom DMA circuit for fast transfers between ROM, I-RAM and BW-RAM.&lt;br /&gt;
* Variable-Length Bit data processing for enhanced algorithms such as graphics and data compression.&lt;br /&gt;
* Super MMC memory mapping capabilities for BW-RAM and bank switching for multiple ROM image access and mirroring.&lt;br /&gt;
&lt;br /&gt;
== ROM Hacking ==&lt;br /&gt;
&lt;br /&gt;
[[SA-1 Root]] and [[SA-1 Pack]] are known patches used for enabling SA-1 on SNES games that didn&#039;t include the chip previously and had problems with slowdown, such as &#039;&#039;[[Super Mario World]]&#039;&#039;, &#039;&#039;[[Gradius III]]&#039;&#039; and &#039;&#039;[[Contra III]]&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
= Technical Information =&lt;br /&gt;
There is not much technical information available on how the SA-1 chip works. Most of the findings are recent and are based on both official documents from Nintendo and experiments on real SA-1 carts. This section is getting continuously updated with new information and findings though the time. The information available here is expected to be accurate. Information about undefined behavior or design details is considered scarce right now.&lt;br /&gt;
&lt;br /&gt;
== Hardware Registers ==&lt;br /&gt;
The SA-1 internal registers are assigned on range $2200-$23FF, on banks $00-$3F and $80-$BF. $2200 though $22FF are write-only registers while $2300 though $23FF are read-only registers.&lt;br /&gt;
&lt;br /&gt;
* Attempting to read a write-only register yields [[open bus]].&lt;br /&gt;
* Attempting to write a SA-1 write register on SNES side or vice-versa yields nothing, with the exception of hybrid write registers.&lt;br /&gt;
* Attempting to read a SA-1 read register on SNES side or vice-versa yields open bus.&lt;br /&gt;
&lt;br /&gt;
=== Register Summary ===&lt;br /&gt;
&lt;br /&gt;
==== Write Registers ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Address !! Length !! Code !! Access !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $2200 || 1 byte || CCNT || SNES || SA-1 CPU CONTROL&lt;br /&gt;
|-&lt;br /&gt;
| $2201 || 1 byte || SIE || SNES || SUPER NES CPU INT ENABLE&lt;br /&gt;
|-&lt;br /&gt;
| $2202 || 1 byte || SIC || SNES || SUPER NES CPU INT CLEAR&lt;br /&gt;
|-&lt;br /&gt;
| $2203 || 2 bytes || CRV || SNES || SA-1 CPU RESET VECTOR&lt;br /&gt;
|-&lt;br /&gt;
| $2205 || 2 bytes || CNV || SNES || SA-1 CPU NMI VECTOR&lt;br /&gt;
|-&lt;br /&gt;
| $2207 || 2 bytes || CIV || SNES || SA-1 CPU IRQ VECTOR&lt;br /&gt;
|-&lt;br /&gt;
| $2209 || 1 byte || SCNT || SA-1 || SUPER NES CPU CONTROL&lt;br /&gt;
|-&lt;br /&gt;
| $220A || 1 byte || CIE || SA-1 || SA-1 CPU INT ENABLE&lt;br /&gt;
|-&lt;br /&gt;
| $220B || 1 byte || CIC || SA-1 || SA-1 CPU INT CLEAR&lt;br /&gt;
|-&lt;br /&gt;
| $220C || 2 bytes || SNV || SA-1 || SUPER NES CPU NMI VECTOR&lt;br /&gt;
|-&lt;br /&gt;
| $220E || 2 bytes || SIV || SA-1 || SUPER NES CPU IRQ VECTOR&lt;br /&gt;
|-&lt;br /&gt;
| $2210 || 1 byte || TMC || SA-1 || H/V TIMER CONTROL&lt;br /&gt;
|-&lt;br /&gt;
| $2211 || 1 byte || CTR || SA-1 || SA-1 CPU TIMER RESTART&lt;br /&gt;
|-&lt;br /&gt;
| $2212 || 2 bytes || HCNT || SA-1 || SET H-COUNT&lt;br /&gt;
|-&lt;br /&gt;
| $2214 || 2 bytes || VCNT || SA-1 || SET V-COUNT&lt;br /&gt;
|-&lt;br /&gt;
| $2220 || 1 byte || CXB || SNES || SET SUPER MMC BANK C&lt;br /&gt;
|-&lt;br /&gt;
| $2221 || 1 byte || DXB || SNES || SET SUPER MMC BANK D&lt;br /&gt;
|-&lt;br /&gt;
| $2222 || 1 byte || EXB || SNES || SET SUPER MMC BANK E&lt;br /&gt;
|-&lt;br /&gt;
| $2223 || 1 byte || FXB || SNES || SET SUPER MMC BANK F&lt;br /&gt;
|-&lt;br /&gt;
| $2224 || 1 byte || BMAPS || SNES || SUPER NES CPU BW-RAM ADDRESS MAPPING&lt;br /&gt;
|-&lt;br /&gt;
| $2225 || 1 byte || BMAP || SA-1 || SA-1 CPU BW-RAM ADDRESS MAPPING&lt;br /&gt;
|-&lt;br /&gt;
| $2226 || 1 byte || SBWE || SNES || SUPER NES CPU BW-RAM WRITE ENABLE&lt;br /&gt;
|-&lt;br /&gt;
| $2227 || 1 byte || CBWE || SA-1 || SA-1 CPU BW-RAM WRITE ENABLE&lt;br /&gt;
|-&lt;br /&gt;
| $2228 || 1 byte || BPWA || SNES || BW-RAM WRITE-PROTECTED AREA&lt;br /&gt;
|-&lt;br /&gt;
| $2229 || 1 byte || SIWP || SNES || SA-1 I-RAM WRITE PROTECTION&lt;br /&gt;
|-&lt;br /&gt;
| $222A || 1 byte || CIWP || SA-1 || SA-1 I-RAM WRITE PROTECTION&lt;br /&gt;
|-&lt;br /&gt;
| $2230 || 1 byte || DCNT || SA-1 || DMA CONTROL&lt;br /&gt;
|-&lt;br /&gt;
| $2231 || 1 byte || CDMA || Both || CHARACTER CONVERSION OMA PARAMETERS&lt;br /&gt;
|-&lt;br /&gt;
| $2232 || 3 bytes || SDA || Both || DMA SOURCE DEVICE START ADDRESS&lt;br /&gt;
|-&lt;br /&gt;
| $2235 || 3 bytes || DDA || Both || DMA DESTINATION START ADDRESS&lt;br /&gt;
|-&lt;br /&gt;
| $2238 || 2 bytes || DTC || SA-1 || DMA TERMINAL COUNTER&lt;br /&gt;
|-&lt;br /&gt;
| $223F || 1 byte || BBF || SA-1 || BW-RAM BIT MAP FORMAT&lt;br /&gt;
|-&lt;br /&gt;
| $2240 || 16 bytes || BRF || SA-1 || BIT MAP REGISTER FILE&lt;br /&gt;
|-&lt;br /&gt;
| $2250 || 1 byte || MCNT || SA-1 || ARITHMETIC CONTROL&lt;br /&gt;
|-&lt;br /&gt;
| $2251 || 2 bytes || MA || SA-1 || ARITHMETIC PARAMETERS: MULTIPLICAND/DIVIDEND&lt;br /&gt;
|-&lt;br /&gt;
| $2253 || 2 bytes || MB || SA-1 || ARITHMETIC PARAMETERS: MULTIPLIER/DIVISOR&lt;br /&gt;
|-&lt;br /&gt;
| $2258 || 1 byte || VBD || SA-1 || VARIABLE-LENGTH BIT PROCESSING&lt;br /&gt;
|-&lt;br /&gt;
| $2259 || 3 bytes || VDA || SA-1 || VARIABLE-LENGTH BIT GAME PAK ROM START ADDRESS&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Read Registers ====&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Address !! Length !! Code !! Access !! Description&lt;br /&gt;
|-&lt;br /&gt;
| $2300 || 1 bytes || SFR || SNES || SUPER NES CPU FLAG READ&lt;br /&gt;
|-&lt;br /&gt;
| $2301 || 1 bytes || CFR || SA-1 || SA-1 CPU FLAG READ&lt;br /&gt;
|-&lt;br /&gt;
| $2302 || 2 bytes || HCR || SA-1 || H-COUNT READ&lt;br /&gt;
|-&lt;br /&gt;
| $2304 || 2 bytes || VCR || SA-1 || V-COUNT READ&lt;br /&gt;
|-&lt;br /&gt;
| $2306 || 5 bytes || MR || SA-1 || ARITHMETIC RESULT [PRODUCT/QUOTIENT/ACCUMULATIVE SUM]&lt;br /&gt;
|-&lt;br /&gt;
| $230B || 1 bytes || OF || SA-1 || ARITHMETIC OVERFLOW FLAG&lt;br /&gt;
|-&lt;br /&gt;
| $230C || 2 bytes || VDP || SA-1 || VARIABLE-LENGTH DATA READ PORT&lt;br /&gt;
|-&lt;br /&gt;
| $230E || 1 byte || VC || SNES || VERSION CODE REGISTER (OPEN BUS)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Register Details ===&lt;br /&gt;
&lt;br /&gt;
==== $2200 - SA-1 CPU CONTROL ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2201 - SUPER NES CPU INT ENABLE ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2202 - SUPER NES CPU INT CLEAR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2203 - SA-1 CPU RESET VECTOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2205 - SA-1 CPU NMI VECTOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2207 - SA-1 CPU IRQ VECTOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2209 - SUPER NES CPU CONTROL ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $220A - SA-1 CPU INT ENABLE ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $220B - SA-1 CPU INT CLEAR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $220C - SUPER NES CPU NMI VECTOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $220E - SUPER NES CPU IRQ VECTOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2210 - H/V TIMER CONTROL ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2211 - SA-1 CPU TIMER RESTART ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2212 - SET H-COUNT ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2214 - SET V-COUNT ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2220-$2223 - SET SUPER MMC BANK C/D/E/F ====&lt;br /&gt;
{{32bit-reg|2220|2221|2222|2223&lt;br /&gt;
|CBM|0|0|0|0|CB2|CB1|CB0&lt;br /&gt;
|DBM|0|0|0|0|CB2|CB1|CB0&lt;br /&gt;
|EBM|0|0|0|0|CB2|CB1|CB0&lt;br /&gt;
|FBM|0|0|0|0|CB2|CB1|CB0}}&lt;br /&gt;
&lt;br /&gt;
CB2~CB0: Which megabyte of the ROM to map to $C0-$CF / $D0-$DF / $E0-$EF / $F0-$FF.&lt;br /&gt;
&lt;br /&gt;
CBM/DBM/EBM/FBM: If set, apply image projection to LoROM banks as well.&lt;br /&gt;
{|style=&amp;quot;width:auto&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Flag !! Bank Range&lt;br /&gt;
|-&lt;br /&gt;
| CBM || Apply to banks $00-$1F&lt;br /&gt;
|-&lt;br /&gt;
| DBM || Apply to banks $20-$3F&lt;br /&gt;
|-&lt;br /&gt;
| EBM || Apply to banks $80-$9F&lt;br /&gt;
|-&lt;br /&gt;
| FBM || Apply to banks $A0-$BF&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Registers are responsible for setting up the ROM bank mapping.&lt;br /&gt;
By default, the values { $00, $01, $02, $03 } are loaded on power up.&lt;br /&gt;
&lt;br /&gt;
Bits CBM/DBM/EBM/FBM determine if the mapping should apply to the LoROM banks as well, otherwise they will have the constant value of { $00, $01, $02, $03 } regardless of the ROM size. Given that, it&#039;s possible the entire 8 MB layout at once by storing values { $04, $05, $06, $07 } to the registers. Snes9x 1.53 and older always treated these flags as set, making the mapping always apply to the LoROM banks.&lt;br /&gt;
&lt;br /&gt;
{|style=&amp;quot;width:auto&amp;quot;&lt;br /&gt;
|+Common values&lt;br /&gt;
|-&lt;br /&gt;
! Register !! $2220 !! $2221 !! $2222 !! $2223 !! Comment&lt;br /&gt;
|-&lt;br /&gt;
| Value || $00 || $01 || $02 || $03 || Default values&lt;br /&gt;
|-&lt;br /&gt;
| Value || $04 || $05 || $06 || $07 || Maps the first 4 MB to banks $00-$3F and $80-$BF, with LoROM-like layout. The last 4 MB is mapped to $C0-$FF, with HiROM-like layout.&lt;br /&gt;
|-&lt;br /&gt;
| Value || $80 || $81 || $80 || $81 || Simulates the standard LoROM map with FastROM compatibility by mapping the first 2 MB to $00-$3F and $80-$BF.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The Super MMC register affects all memory maps, including SNES, SA-1, SA-1 DMA and SA-1 Variable Length Bit maps.&lt;br /&gt;
bsnes 0.7x does not apply the custom memory mapping to Variable Length Bit circuit.&lt;br /&gt;
&lt;br /&gt;
Hardware verification has shown that the unused bits has no effects to the chip pinout and therefore the maximum ROM size for the SA-1 without using a custom ROM controller outside the chip is 8 MB (megabytes).&lt;br /&gt;
&lt;br /&gt;
==== $2224 - SUPER NES CPU BW-RAM ADDRESS MAPPING ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2225 - SA-1 CPU BW-RAM ADDRESS MAPPING ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2226 - SUPER NES CPU BW-RAM WRITE ENABLE ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2227 - SA-1 CPU BW-RAM WRITE ENABLE ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2228 - BW-RAM WRITE-PROTECTED AREA ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2229 - SA-1 I-RAM WRITE PROTECTION ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $222A - SA-1 I-RAM WRITE PROTECTION ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2230 - DMA CONTROL ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2231 - CHARACTER CONVERSION OMA PARAMETERS ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2232 - DMA SOURCE DEVICE START ADDRESS ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2235 - DMA DESTINATION START ADDRESS ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2238 - DMA TERMINAL COUNTER ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $223F - BW-RAM BIT MAP FORMAT ====&lt;br /&gt;
{{8bit-reg|223F|SEL42|-|-|-|-|-|-|-}}&lt;br /&gt;
{| style=&amp;quot;width:auto&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| SEL42 || 0 to make banks $60-$6F split in 4 bits chunks (4BPP) or 1 to split in 2 bits chunks (2BPP)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== $2240 - BIT MAP REGISTER FILE ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2250 - ARITHMETIC CONTROL ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2251 - ARITHMETIC PARAMETERS: MULTIPLICAND/DIVIDEND ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2253 - ARITHMETIC PARAMETERS: MULTIPLIER/DIVISOR ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2258 - VARIABLE-LENGTH BIT PROCESSING ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2259 - VARIABLE-LENGTH BIT GAME PAK ROM START ADDRESS ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2300 - SUPER NES CPU FLAG READ ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2301 - SA-1 CPU FLAG READ ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2302 - H-COUNT READ ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2304 - V-COUNT READ ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $2306 - ARITHMETIC RESULT [PRODUCT/QUOTIENT/ACCUMULATIVE SUM] ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $230B - ARITHMETIC OVERFLOW FLAG ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $230C - VARIABLE-LENGTH DATA READ PORT ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== $230E - VERSION CODE REGISTER (OPEN BUS) ====&lt;br /&gt;
{{8bit-reg|230E|VC7|VC6|VC5|VC4|VC3|VC2|VC1|VC0}}&lt;br /&gt;
{| style=&amp;quot;width:auto&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Bits !! Meaning&lt;br /&gt;
|-&lt;br /&gt;
| VC0 ~ VC7 || SA-1 Device Version&lt;br /&gt;
|}&lt;br /&gt;
According the SNES Development Book II, this register was supposed to hold the SA-1 chip version code, however tests made on some real carts has shown that this register in particular is actually [[open bus]].&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
== Memory and Bus ==&lt;br /&gt;
&lt;br /&gt;
=== Memory Map ===&lt;br /&gt;
&lt;br /&gt;
==== SNES Side ====&lt;br /&gt;
&lt;br /&gt;
==== SA-1 Side ====&lt;br /&gt;
&lt;br /&gt;
==== Open Bus Behavior ====&lt;br /&gt;
&lt;br /&gt;
=== ROM ===&lt;br /&gt;
&lt;br /&gt;
=== I-RAM ===&lt;br /&gt;
&lt;br /&gt;
==== Write Protection ====&lt;br /&gt;
&lt;br /&gt;
=== BW-RAM ===&lt;br /&gt;
&lt;br /&gt;
==== Write Protection ====&lt;br /&gt;
&lt;br /&gt;
=== Virtual Bitmap Memory ===&lt;br /&gt;
&lt;br /&gt;
=== Super MMC ===&lt;br /&gt;
&lt;br /&gt;
=== Bus Conflicts ===&lt;br /&gt;
&lt;br /&gt;
== Direct Memory Access ==&lt;br /&gt;
&lt;br /&gt;
=== Character Conversion DMA ===&lt;br /&gt;
&lt;br /&gt;
=== Parallel DMA ===&lt;br /&gt;
&lt;br /&gt;
=== Interactions with SNES DMA ===&lt;br /&gt;
&lt;br /&gt;
=== Undefined Behavior ===&lt;br /&gt;
&lt;br /&gt;
== Variable Length Bit ==&lt;br /&gt;
&lt;br /&gt;
=== Fixed Mode ===&lt;br /&gt;
&lt;br /&gt;
=== Automatic Mode ===&lt;br /&gt;
&lt;br /&gt;
=== Mixed Mode ===&lt;br /&gt;
&lt;br /&gt;
== Arithmetic Operations ==&lt;br /&gt;
&lt;br /&gt;
=== Multiplication ===&lt;br /&gt;
&lt;br /&gt;
=== Division ===&lt;br /&gt;
&lt;br /&gt;
=== Cumulative Sum ===&lt;br /&gt;
&lt;br /&gt;
== Parallelism and I/O ==&lt;br /&gt;
&lt;br /&gt;
=== IRQ ===&lt;br /&gt;
&lt;br /&gt;
=== NMI ===&lt;br /&gt;
&lt;br /&gt;
=== FastROM Interactions ===&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Integrated Circuits]]&lt;br /&gt;
[[Category:Enhancement Chips]]&lt;br /&gt;
[[Category:SA-1]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=SYSCK&amp;diff=20994</id>
		<title>SYSCK</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=SYSCK&amp;diff=20994"/>
		<updated>2025-11-30T06:26:46Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: System Clock&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;SYSCK&#039;&#039;&#039; (System Clock) is a signal that is produced by the [[S-CPU]], coming out of pin 72.  It goes into:&lt;br /&gt;
&lt;br /&gt;
* pin 6 of [[WRAM]].&lt;br /&gt;
* pin pad 57 of the [[Cartridge Slot]] (both [[List of 46-pin Games|46-pin]] and [[List of 62-pin Games|62-pin]] cartridges have this pin)&lt;br /&gt;
&lt;br /&gt;
According to the [[jwdonal schematic]], it is most likely the current memory access cycle clock.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Master Clock]]&lt;br /&gt;
* [[FastROM]]&lt;br /&gt;
* [[SlowROM]]&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:Traces]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=SYSCLK&amp;diff=20993</id>
		<title>SYSCLK</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=SYSCLK&amp;diff=20993"/>
		<updated>2025-11-30T06:24:08Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: created page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[SYSCK]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=20992</id>
		<title>Eyes &amp; Lichty</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Eyes_%26_Lichty&amp;diff=20992"/>
		<updated>2025-11-28T08:04:40Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Eratta */ M flag does always exist&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;&#039;&#039;&#039;Eyes &amp;amp; Lichty&#039;&#039;&#039;&amp;quot; is scene slang for the excellent manual &amp;quot;Programming the 65816 Including the 6502, 65C02, and 65802&amp;quot; by David Eyes &amp;amp; Ron Lichty.  It may be the best unofficial textbook on SNES programming, due in no small part to the fact that the [[Ricoh 5A22]] is based on the 65c816 and the [[SPC700]] is based on the 6502.&lt;br /&gt;
&lt;br /&gt;
=== Addressing Mode ===&lt;br /&gt;
Eyes &amp;amp; Lichty divides the 65c816&#039;s various addressing modes into two groups: simple and complex.  Simple addressing modes are explained first and require the processor to do little effective address calculation.  They are:&lt;br /&gt;
&lt;br /&gt;
==== Simple Addressing Modes ====&lt;br /&gt;
* [[Immediate]]&lt;br /&gt;
* [[Absolute]]&lt;br /&gt;
* [[Direct Page Addressing|Direct Page]]&lt;br /&gt;
* [[Accumulator Addressing|Accumulator]]&lt;br /&gt;
* [[Implied]]&lt;br /&gt;
* [[Stack Addressing|Stack]]&lt;br /&gt;
* [[Direct Page Indirect]]&lt;br /&gt;
* [[Absolute Long]]&lt;br /&gt;
* [[Direct Page Indirect Long]]&lt;br /&gt;
* [[Block Move Addressing|Block Move]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/108 page 108]&lt;br /&gt;
&lt;br /&gt;
==== Complex Addressing Modes ====&lt;br /&gt;
&lt;br /&gt;
* [[Absolute Indexed by X]]&lt;br /&gt;
* [[Absolute Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed by X]]&lt;br /&gt;
* [[Direct Page Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indirect Indexed by Y]]&lt;br /&gt;
* [[Direct Page Indexed Indirect by X]]&lt;br /&gt;
* [[Absolute Indexed Indirect]]&lt;br /&gt;
* Non-zero Direct Page&lt;br /&gt;
* [[Absolute Long Indexed by X]]&lt;br /&gt;
* [[Direct Page Indirect Long Indexed by Y]]&lt;br /&gt;
* [[Stack Relative]]&lt;br /&gt;
* [[Stack Relative Indirect Indexed by Y]]&lt;br /&gt;
&lt;br /&gt;
see [https://archive.org/details/0893037893ProgrammingThe65816/page/197 page 197]&lt;br /&gt;
&lt;br /&gt;
=== Eratta ===&lt;br /&gt;
Applicable to the 2015 edition:&lt;br /&gt;
* Starting on page 389, several effective address diagrams have the bank byte labeled with too many zeros.  Only two hex zero digits should fit in there.&lt;br /&gt;
* On page 498, opcode F5 has a &amp;quot;0&amp;quot; superscript on the # of cycles column.&lt;br /&gt;
* The [[stack]] diagram for [[RTI]] has the old [[status register]] value on the opposite side of the stack as the diagram for [[COP]]&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/75 page 75] says the 65c816 has 25 different addressesing modes, but the datasheet says there are 24&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/94 Page 94] says the 65c816 has three push instructions that do not alter registers: [[PEA]], [[PEI]], and [[PER]].  But the [[stack pointer]] itself is modified.  Even not counting that, there are more than three, for example [[PHA]].&lt;br /&gt;
* [[PLB]] is not the only instruction that modifies the [[data bank register]]; [[MVP]] and [[MVN]] do too - see section 7.18 of the 65c816 datasheet&lt;br /&gt;
* In the section on [[accumulator addressing]], a sentence implies that all read-modify-write instructions are unary, but [[TRB]] and [[TSB]] are not.&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/497 page 497] recommends making sure the carry flag is already set, or to set it with [[SEC]] prior to doing a [[SBC]] to &amp;quot;avoid subtracting the carry flag&amp;quot; but it should say &amp;quot;to avoid subtracting one&amp;quot;&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/510 Page 510] on [[TCD]] and page 512 on [[TDC]] mentions the [[direct page register]], but this is missing from the index&lt;br /&gt;
* In the tables that show which MPU supports which instructions, an &amp;quot;X&amp;quot; denotes yes and a &amp;quot; &amp;quot; denotes no.  Many readers would find a check mark less confusing.&lt;br /&gt;
* The Rockwell 65c02 does not have a direct page, but the four Rockwell instructions are listed as having [[Direct Page Addressing]] anyway &amp;quot;for consistency.&amp;quot;&lt;br /&gt;
* The 65c02 datasheet does mention [[WAI]] and [[STP]] are supported (page 532 has them listed as unavailable)&lt;br /&gt;
* The [[addressing mode]] for [[WDM]] is missing, but the datasheet says it is [[Implied]]&lt;br /&gt;
* Assemblers are described as requiring the [[signature byte]] for [[COP]], but on the next page it says the signature byte is optional&lt;br /&gt;
* The page on [[PLA]] has a typo that says the 65x pull instructions &amp;quot;set&amp;quot; the zero and negative flags; it should say &amp;quot;affect.&amp;quot;&lt;br /&gt;
* Table 18.2 seems to imply that the [[M flag]] does not exist in [[emulation mode]] but the 65c816 datasheet says the M flag is always equal to one in emulation mode in section 2.8.&lt;br /&gt;
&lt;br /&gt;
=== Quick Links ===&lt;br /&gt;
&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n7	Table of Contents]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n13	Preface]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n15	Acknowledgments]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n17	Foreword]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n19	Introduction]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n21	How to Use this Book]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n27	Part I Basics]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n29	Basic Assembly Language Programming Concepts]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n49	Part II Architecture]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n51	Architecture of the 6502]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n71	Architecture of the 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n75	Sixteen-Bit Architecture: The 65816 and the 65802]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n99	Part III Tutorial]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n101	SEP, REP, and Other Details]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n109	First Examples: Moving Data]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n133	The Simple Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n165	The Flow of Control]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n181	Built-In Arithmetic Functions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n205	Logic and Bit Manipulation Operations]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n223	The Complex Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n251	The Basic Building Block: The Subroutine]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n275	Interrupts and System Control Instructions]&lt;br /&gt;
====[https://archive.org/details/0893037893ProgrammingThe65816/page/n291	Part IV Applications]====&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n293	Selected Code Samples]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n325	DEBUG16 - A 65816 Programming Tool]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n387	Design and Debugging]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n397	Reference]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n399	The Addressing Modes]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n447	The Instruction Sets]&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:10&amp;quot;&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n449	ADC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n451	AND]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n453	ASL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n454	BCC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n455	BCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n456	BEQ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n457	BIT]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n458	BMI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n459	BNE]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n460	BPL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n461	BRA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n462	BRK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n463	BRL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n465	BVC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n466	BVS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n467	CLC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n468	CLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n469	CLI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n470	CLV]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n471	CMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n473	COP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n475	CPX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n476	CPY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n477	DEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n478	DEX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n479	DEY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n480	EOR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n482	INC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n483	INX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n484	INY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n485	JMP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n486	JSL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n487	JSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n488	LDA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n489	LDX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n490	LDY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n491	LSR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n492	MVN]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n493	MVP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n497	ORA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n499	PEA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n500	PEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n501	PER]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n502	PHA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n503	PHB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n504	PHD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n505	PHK]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n506	PHP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n507	PHX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n508	PHY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n509	PLA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n510	PLB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n511	PLD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n512	PLP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n513	PLX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n514	PLY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n515	REP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n516	ROL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n517	ROR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n518	RTI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n520	RTL]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n522	RTS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n523	SBC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n525	SEC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n526	SED]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n527	SEI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n528	SEP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n529	STA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n530	STP]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n531	STX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n532	STY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n533	STZ]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n534	TAX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n535	TAY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n536	TCD]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n537	TCS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n538	TDC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n539	TRB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n540	TSB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n541	TSC]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n542	TSX]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n543	TXA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n544	TXS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n545	TXY]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n546	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n547	TYA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n548	WAI]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n549	WDM]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n550	XBA]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n551	XCE]&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n553	Instruction Lists]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n567	Appendices]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n569	65x Signal Description]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n577	65x Series Support Chips]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n587	The Rockwell 65C02]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n588	BBR]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n589	BBS]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n590	RMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n591	SMB]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n593	Instruction Groups]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n594	Group I Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n595	Group II Instructions]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n599	W65C816 Data Sheet]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n621	The ASCII Character Set]&lt;br /&gt;
*[https://archive.org/details/0893037893ProgrammingThe65816/page/n625	Index]&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Books]]&lt;br /&gt;
[[Category:Scene Slang]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Memory/Accumulator_Select&amp;diff=20991</id>
		<title>Memory/Accumulator Select</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Memory/Accumulator_Select&amp;diff=20991"/>
		<updated>2025-11-28T08:00:15Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: M flag does in fact always exist&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Memory/Accumulator Select&#039;&#039;&#039; (M) flag is bit 5 of the [[65c816]]&#039;s [[processor status register]].  It indicates whether the [[accumulator]] is 8 or 16 bits wide:&lt;br /&gt;
&lt;br /&gt;
* When clear, the accumulator is 16 bits wide.  It can only be clear in [[native mode]].&lt;br /&gt;
* When set, the accumulator is 8 bits wide, but the high byte (B)  is still retained.  This is the case after reset because the processor is in [[emulation mode]].&lt;br /&gt;
&lt;br /&gt;
It can be affected by:&lt;br /&gt;
&lt;br /&gt;
* [[REP]] (clears it if bit 5 of operand is set)&lt;br /&gt;
* [[SEP]] (sets it if bit 5 of operand is set)&lt;br /&gt;
* [[PLP]] (pops it off the [[stack]])&lt;br /&gt;
* [[RTI]]&lt;br /&gt;
&lt;br /&gt;
It affects the behavior of (possibly incomplete list):&lt;br /&gt;
&lt;br /&gt;
* [[LDA]]&lt;br /&gt;
* [[STA]]&lt;br /&gt;
* [[STZ]]&lt;br /&gt;
* [[ADC]]&lt;br /&gt;
* [[SBC]]&lt;br /&gt;
* [[BIT]]&lt;br /&gt;
* [[CMP]]&lt;br /&gt;
* [[PHA]]&lt;br /&gt;
* [[PLA]]&lt;br /&gt;
* [[LSR]]&lt;br /&gt;
* [[ASL]]&lt;br /&gt;
* [[ROR]]&lt;br /&gt;
* [[ROL]]&lt;br /&gt;
* [[ORA]]&lt;br /&gt;
* [[AND]]&lt;br /&gt;
* [[EOR]]&lt;br /&gt;
* [[INC]]&lt;br /&gt;
* [[DEC]]&lt;br /&gt;
* [[TSB]]&lt;br /&gt;
* [[TRB]]&lt;br /&gt;
&lt;br /&gt;
But it does not affect [[XBA]], [[TDC]], [[TCD]], [[TCS]], or [[TSC]].&lt;br /&gt;
&lt;br /&gt;
There are no BMS or BMC instructions that examine this flag.  [[Eyes &amp;amp; Lichty]] has a table which seems to imply that the M flag does not exist in [[emulation mode]]&amp;lt;sup&amp;gt;[1]&amp;lt;/sup&amp;gt;, but the datasheet clearly states that the M flag is always equal to one in emulation mode.&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Index Register Select]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/422 page 422], Table 18.2. 65x Flags.&lt;br /&gt;
# section 2.8 &amp;quot;Processor Status Register (P)&amp;quot; of 65c816 datasheet, 2024 edition&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Overflow_Flag&amp;diff=20990</id>
		<title>Overflow Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Overflow_Flag&amp;diff=20990"/>
		<updated>2025-11-26T03:18:58Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: added another definition&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Overflow Flag&#039;&#039;&#039; (V) is bit 6 of the [[status register]].  It is affected only by the following eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (indicates signed sum overflowed)&lt;br /&gt;
* [[SBC]] (indicates signed difference underflowed)&lt;br /&gt;
* [[CLV]] (always clears it)&lt;br /&gt;
* [[BIT]] (becomes bit 6 or bit 14 of operand except in [[immediate addressing]])&lt;br /&gt;
* [[PLP]] (pulls it off the stack)&lt;br /&gt;
* [[RTI]] (pulls it off the stack)&lt;br /&gt;
* [[SEP]] (might set it)&lt;br /&gt;
* [[REP]] (might clear it)&lt;br /&gt;
&lt;br /&gt;
Here is how it behaves:&lt;br /&gt;
&lt;br /&gt;
* When the [[accumulator]] is 8 bits wide, V indicates whether the sum/difference of [[ADC]]/[[SBC]] is outside the range of -128 to 127.&lt;br /&gt;
* When the accumulator is 16 bits wide, V indicates whether the result of [[ADC]]/[[SBC]] is outside the range of -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
In other words, the overflow flag is set when an arithmetic operation causes the most significant bit of the accumulator to change and is cleared if the bit is unchanged.  Adding a positive and negative integer together never sets the overflow flag because the sum has a smaller magnitude than either addend.&lt;br /&gt;
&lt;br /&gt;
It may be the most misunderstood flag of the [[65c816]] and the 6502.&amp;lt;sup&amp;gt;[2][3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is no [[SEV]] instruction to directly set the overflow flag, but the 6502 and 65c02 do have a hardware signal to set it.  Unfortunately this hardware signal was removed on the 65c816 (or fortunately, as now it can no longer get set by accident.)&lt;br /&gt;
&lt;br /&gt;
On the [[SPC700]] it can be cleared with [[CLRV]] and is set whenever the [[half-carry flag]] is set.&lt;br /&gt;
&lt;br /&gt;
[[BVC]] and [[BVS]] both examine the overflow flag to decide whether or not to branch.&lt;br /&gt;
&lt;br /&gt;
The overflow flag is invalid in [[decimal mode]] on the NMOS 6502, but it is valid in the 65c816&#039;s decimal mode.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[BVC (SPC700)]]&lt;br /&gt;
* [[BVS (SPC700)]]&lt;br /&gt;
* [[O/V]]&lt;br /&gt;
* [[Carry Flag]]&lt;br /&gt;
* [[Zero Flag]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/439 page 439]&lt;br /&gt;
# lbid, &amp;quot;Branching Based on the Overflow Flag&amp;quot; on [https://archive.org/details/0893037893ProgrammingThe65816/page/150 page 150]&lt;br /&gt;
# Clark, Bruce.  http://www.6502.org/tutorials/vflag.html&lt;br /&gt;
# Shirriff, Ken.  The 6502 overflow flag explained mathematically. https://www.righto.com/2012/12/the-6502-overflow-flag-explained.html&lt;br /&gt;
# lbid. https://www.righto.com/2013/01/a-small-part-of-6502-chip-explained.html&lt;br /&gt;
# Labiak, William. [https://archive.org/details/Programming_the_65816/page/n118 Page 108.]&lt;br /&gt;
# Pickens, John.  NMOS 6502 Opcodes.  http://www.6502.org/tutorials/6502opcodes.html#VFLAG&lt;br /&gt;
# https://forums.nesdev.org/viewtopic.php?t=6331&lt;br /&gt;
# Table 7-1 Caveats of 65c816 datasheet&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Condition Codes]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Absolute_Long_Indexed,_X_Addressing&amp;diff=20989</id>
		<title>Absolute Long Indexed, X Addressing</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Absolute_Long_Indexed,_X_Addressing&amp;diff=20989"/>
		<updated>2025-11-25T21:51:59Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: replaced BBR and BBS&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Absolute Long Indexed, X Addressing&#039;&#039;&#039; is supported by eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (opcode 7F)&lt;br /&gt;
* [[AND]] (opcode 3F)&lt;br /&gt;
* [[CMP]] (opcode DF)&lt;br /&gt;
* [[EOR]] (opcode 5F)&lt;br /&gt;
* [[LDA]] (opcode BF)&lt;br /&gt;
* [[ORA]] (opcode 1F)&lt;br /&gt;
* [[SBC]] (opcode FF)&lt;br /&gt;
* [[STA]] (opcode 9F)&lt;br /&gt;
&lt;br /&gt;
These opcodes replaced the 65c02&#039;s BBR and BBS.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA long, X&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Absolute Long Addressing]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/386 page 386]&lt;br /&gt;
* section 3.5.6 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#5.17&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Addressing Modes]]&lt;br /&gt;
[[Category:Complex Admodes]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=dstbnk&amp;diff=20988</id>
		<title>dstbnk</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=dstbnk&amp;diff=20988"/>
		<updated>2025-11-24T13:18:06Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: created page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[Block Move Addressing]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=srcbnk&amp;diff=20987</id>
		<title>srcbnk</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=srcbnk&amp;diff=20987"/>
		<updated>2025-11-24T13:17:36Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: created page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[Block Move Addressing]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=S-CLK&amp;diff=20986</id>
		<title>S-CLK</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=S-CLK&amp;diff=20986"/>
		<updated>2025-11-20T07:43:24Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: added ref&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;S-CLK&#039;&#039;&#039; is a clock multiplier/divider that exists only on PAL consoles.&lt;br /&gt;
&lt;br /&gt;
=== Reference ===&lt;br /&gt;
* https://fabiensanglard.net/snes_video/index.html&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=65c816_opcode_matrix&amp;diff=20985</id>
		<title>65c816 opcode matrix</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=65c816_opcode_matrix&amp;diff=20985"/>
		<updated>2025-11-16T00:40:54Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: created page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#redirect [[65c816 Opcode Matrix]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Processor_Status_Register&amp;diff=20984</id>
		<title>Processor Status Register</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Processor_Status_Register&amp;diff=20984"/>
		<updated>2025-11-07T06:26:18Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: clarify why STP was mentioned&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Processor Status Register&#039;&#039;&#039; (P) is on the [[65c816]] and contains several flags:&lt;br /&gt;
&lt;br /&gt;
* 7: [[Negative Flag]] - N&lt;br /&gt;
* 6: [[Overflow Flag]] - V&lt;br /&gt;
* 5: [[Memory/Accumulator Select]] - M&lt;br /&gt;
* 4: [[Index Register Select]] - X&lt;br /&gt;
* 3: [[Decimal Mode]] - D&lt;br /&gt;
* 2: [[Interrupt Disable Flag]] - I&lt;br /&gt;
* 1: [[Zero Flag]] - Z&lt;br /&gt;
* 0: [[Carry Flag]] - C&lt;br /&gt;
&lt;br /&gt;
It can be pulled from the [[stack]] via [[PLP]] and [[RTI]].  To push it to the stack, use [[PHP]].  [[COP]] and [[BRK]] also push it to the stack.&lt;br /&gt;
&lt;br /&gt;
There are nine instructions that directly modify these flags, including:&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* [[REP]] (can clear multiple)&lt;br /&gt;
* [[SEP]] (can set multiple)&lt;br /&gt;
* [[CLC]]&lt;br /&gt;
* [[SEC]]&lt;br /&gt;
* [[CLD]]&lt;br /&gt;
* [[SED]]&lt;br /&gt;
* [[CLI]]&lt;br /&gt;
* [[SEI]]&lt;br /&gt;
* [[CLV]]&lt;br /&gt;
&lt;br /&gt;
LDP does not exist, and [[STP]] does not store the register anywhere despite looking like it could stand for &amp;quot;store P&amp;quot; like other store commands.&lt;br /&gt;
&lt;br /&gt;
Several other instructions affect the flags as a side effect.  The only transfer instructions that do not modify these flags are [[TCS]] and [[TXS]].&lt;br /&gt;
&lt;br /&gt;
These instructions do not modify any status flags:&lt;br /&gt;
* [[BCC]]&lt;br /&gt;
* [[BCS]]&lt;br /&gt;
* [[BEQ]]&lt;br /&gt;
* [[BMI]]&lt;br /&gt;
* [[BNE]]&lt;br /&gt;
* [[BPL]]&lt;br /&gt;
* [[BRA]]&lt;br /&gt;
* [[BRL]]&lt;br /&gt;
* [[BVC]]&lt;br /&gt;
* [[BVS]]&lt;br /&gt;
* [[JMP]]&lt;br /&gt;
* [[JSL]]&lt;br /&gt;
* [[JSR]]&lt;br /&gt;
* [[MVN]]&lt;br /&gt;
* [[MVP]]&lt;br /&gt;
* [[NOP]]&lt;br /&gt;
* [[PEA]]&lt;br /&gt;
* [[PEI]]&lt;br /&gt;
* [[PER]]&lt;br /&gt;
* [[PHA]]&lt;br /&gt;
* [[PHB]]&lt;br /&gt;
* [[PHD]]&lt;br /&gt;
* [[PHK]]&lt;br /&gt;
* [[PHP]] ([[fullsnes]] claims the break flag is set)&lt;br /&gt;
* [[PHX]]&lt;br /&gt;
* [[PHY]]&lt;br /&gt;
* [[RTL]]&lt;br /&gt;
* [[RTS]]&lt;br /&gt;
* [[STA]]&lt;br /&gt;
* [[STP]]&lt;br /&gt;
* [[STX]]&lt;br /&gt;
* [[STY]]&lt;br /&gt;
* [[STZ]]&lt;br /&gt;
* [[TCS]]&lt;br /&gt;
* [[TXS]]&lt;br /&gt;
* [[WAI]]&lt;br /&gt;
* [[WDM]]&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Emulation Mode Flag]]&lt;br /&gt;
* [[Program Status Word]]&lt;br /&gt;
* [[DSP1 Status Register]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Table 18.2 [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/422 page 422]&lt;br /&gt;
# Figure 17.3, Lbid, [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# lbid, Status Register Control Instructions, [https://archive.org/details/0893037893ProgrammingThe65816/page/262 page 262]&lt;br /&gt;
# lbid, [https://archive.org/details/0893037893ProgrammingThe65816/page/29 page 29]&lt;br /&gt;
&lt;br /&gt;
[[Category:Registers]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:ASM]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Derailment&amp;diff=20983</id>
		<title>Derailment</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Derailment&amp;diff=20983"/>
		<updated>2025-11-06T04:28:38Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: derailment became easier on SNES&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Derailment&#039;&#039;&#039; is a failure state the [[65c816]] can enter.  Usually as the result of a programming error, derailment from the instruction stream occurs when the CPU misinterprets an operand byte as an opcode byte or vice versa.  With the SNES, derailment became easier to do than on the NES because of the existence of the [[M Flag]] and [[X Flag]], which can change the length the CPU expects some [[immediate addressing]] instructions to be, and cause catastrophic program errors if they are toggled incorrectly.&lt;br /&gt;
&lt;br /&gt;
Zeroing memory can help mitigate derailment because accidentally running opcode 00h causes a [[BRK]] interrupt.  To safely shut down the CPU, consider [[STP]].&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SEP]]&lt;br /&gt;
* [[REP]]&lt;br /&gt;
&lt;br /&gt;
=== Reference ===&lt;br /&gt;
* https://forums.nesdev.org/viewtopic.php?p=104280#p104280&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Scene Slang]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=PER&amp;diff=20982</id>
		<title>PER</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=PER&amp;diff=20982"/>
		<updated>2025-11-05T05:08:42Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: self-relocatable code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Stack Addressing|Stack]] (PC Relative Long)&lt;br /&gt;
|62&lt;br /&gt;
|3 bytes&lt;br /&gt;
|6 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;9&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;PER&#039;&#039;&#039; (Push pc RElative indirect Address) is a [[65c816]] instruction that pushes a 16-bit sum to the [[stack]].  The addends are:&lt;br /&gt;
* the [[program counter]] after it has been incremented to point to the instruction following PER, and&lt;br /&gt;
* the 16-bit displacement following the PER opcode.&lt;br /&gt;
The high byte of the sum is pushed before the low byte.  PER is useful in writing self-relocatable code.&lt;br /&gt;
&lt;br /&gt;
No flags are affected.  Neither the [[program bank register]] or [[program counter]] are modified either.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
PER label&lt;br /&gt;
PER #label&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Assemblers that accept PER with the # syntax are rare.&lt;br /&gt;
&lt;br /&gt;
PER works even in [[emulation mode]].&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[PEA]]&lt;br /&gt;
* [[PEI]]&lt;br /&gt;
* [[return address]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/475 page 475] on PER&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n169 page 159] on PER&lt;br /&gt;
* snes9x implementation of PER: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L1685&lt;br /&gt;
* undisbeliever on PER: https://undisbeliever.net/snesdev/65816-opcodes.html#per-push-effective-pc-relative-indirect-address&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.8.1&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Push Instructions]]&lt;br /&gt;
[[Category:Three-byte Instructions]]&lt;br /&gt;
[[Category:Six-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20981</id>
		<title>Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20981"/>
		<updated>2025-11-05T03:42:20Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: why COP, BRK, and RTI take an extra cycle in native mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Emulation Mode Flag&#039;&#039;&#039; (E) controls whether the [[65c816]] is behaving like a 6502:&lt;br /&gt;
* When clear, the &#039;816 is in &#039;&#039;&#039;65c816 native mode.&#039;&#039;&#039;&lt;br /&gt;
* When set, the &#039;816 is in &#039;&#039;&#039;6502 emulation mode.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This flag cannot be modified directly and is normally hidden from the programmer.  To modify it, use the [[XCE]] instruction to swap its value with the [[carry flag]]&#039;s value.  This treats the [[status register]] bits as a game of musical chairs.&lt;br /&gt;
&lt;br /&gt;
The designers likely omitted CLE and SEE opcodes to set or clear it directly because dedicating two opcodes to such a rare operation is overkill.&lt;br /&gt;
&lt;br /&gt;
The flag is set when a [[RESET]] interrupt is fired. In other words, the CPU always starts in emulation mode at boot and after a reset.&lt;br /&gt;
&lt;br /&gt;
Emulation mode is not perfect.  Some important behavior differences from the 6502 are:&lt;br /&gt;
* The 65c816 does not attempt to emulate the illegal 6502 opcodes because its [[65c816 Opcode Matrix|opcode matrix]] is already full.  All 256 opcodes work in both native and emulation mode, but many are less useful in emulation mode.&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* The [[direct page]] is fully relocatable in both native and emulation mode even though it doesn&#039;t exist on the 6502, so pointing it to the zero page right before running 6502 code is advised to ensure maximum compatibility&lt;br /&gt;
* Direct page indexed addressing will always wrap around and remain within the direct page in emulation mode, instead of possibly crossing over into the next page. ([[E&amp;amp;L]], [https://archive.org/details/0893037893ProgrammingThe65816/page/374 page 374])&lt;br /&gt;
* The [[program bank register]] and [[data bank register]] still exist in emulation mode even though they don&#039;t exist on a 6502, so memory accesses may not always access bank zero.&lt;br /&gt;
* the hidden [[B accumulator]] still exists in emulation mode even though it does not on a 6502&lt;br /&gt;
&lt;br /&gt;
For writing new SNES code it is recommended to almost always stay in native mode even if dealing with 8 bit data.  Some reasons are:&lt;br /&gt;
* Page boundary crossings incur a one cycle penalty in emulation mode.  Emulation mode emulates the NMOS 6502 cycle counts.&lt;br /&gt;
* Large amounts of 8-bit data can sometimes be processed in 16-bit chunks, and doing so can take fewer loads/stores/transfers than treating them as 8-bit.&lt;br /&gt;
* The [[break flag]] need not be examined in native mode because there are more interrupt vectors.  (In fact, it does not even exist).&lt;br /&gt;
&lt;br /&gt;
On the other hand, [[COP]], [[BRK]], and [[RTI]] take one extra cycle in native mode because of the [[bank]] number.  For running 6502 code with minimal issues it is still recommended to use emulation mode.  For example, one quirk of 8-bit native mode is that [[TXS]] points the [[stack]] to the [[zeropage]].&lt;br /&gt;
&lt;br /&gt;
Emulation code need not be in [[bank]] 0.&lt;br /&gt;
&lt;br /&gt;
In emulation mode, the [[stack pointer]]&#039;s high byte is always one.  The M and X flags are always set in emulation mode.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SA-1]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 17.3, [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#APPENDIX&lt;br /&gt;
# section 7.8 of 65c816 datasheet: https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# section 2.8, lbid.&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=WDM&amp;diff=20980</id>
		<title>WDM</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=WDM&amp;diff=20980"/>
		<updated>2025-11-04T07:27:25Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: note about breakpoints&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 3)&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt; &lt;br /&gt;
|42&lt;br /&gt;
|2 bytes&lt;br /&gt;
|2 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[N Flag|N]]&lt;br /&gt;
|[[V Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[D Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Z Flag|Z]]&lt;br /&gt;
|[[C Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WDM&#039;&#039;&#039; (the initials of [https://themenschfoundation.org/who-is-william-d-mensch-jr-aka-bill-mensch/ William David Mensch], the designer of the [[65c816]]) is an instruction that reserves its [[signature byte]] for future expansion of the instruction set.  None of these extra 256 opcodes were ever implemented, so WDM functions essentially as a two-byte [[NOP]].&lt;br /&gt;
&lt;br /&gt;
No flags are affected, but future expanded WDM opcodes may affect the flags (or even have different instruction lengths/speeds for that matter.)&lt;br /&gt;
&lt;br /&gt;
WDM &amp;quot;works&amp;quot; even in [[emulation mode]].&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
WDM&lt;br /&gt;
WDM sig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ca65 for example requires the signature byte to be specified in the assembly source.&lt;br /&gt;
&lt;br /&gt;
Directly specifying the opcode 42h can be used to skip the next instruction.&amp;lt;sup&amp;gt;[5]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
WDM is a popular way to insert debug breakpoints into SNES code - by configuring your emulator to trip on WDM, the signature byte can be used to disambiguate which breakpoint has been reached.&lt;br /&gt;
&lt;br /&gt;
=== Trivia ===&lt;br /&gt;
* WDM is the only [[implied addressing]] instruction that is more than one byte long&lt;br /&gt;
* The [[Labiak]] textbook does not describe the WDM instruction.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[COP]]&lt;br /&gt;
* [[BRK]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/523 page 523] on WDM&lt;br /&gt;
# snes9x implementation of WDM: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3335&lt;br /&gt;
# undisbeliever on WDM: https://undisbeliever.net/snesdev/65816-opcodes.html#wdm-reserved-for-future-expansion&lt;br /&gt;
# Table 5-4 Opcode Matrix of official 65c816 datasheet&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.7&lt;br /&gt;
&lt;br /&gt;
[[Category: ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Two-byte Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Two-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20979</id>
		<title>Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20979"/>
		<updated>2025-10-29T21:36:57Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: mentioned TXS quirk&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Emulation Mode Flag&#039;&#039;&#039; (E) controls whether the [[65c816]] is behaving like a 6502:&lt;br /&gt;
* When clear, the &#039;816 is in &#039;&#039;&#039;65c816 native mode.&#039;&#039;&#039;&lt;br /&gt;
* When set, the &#039;816 is in &#039;&#039;&#039;6502 emulation mode.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This flag cannot be modified directly and is normally hidden from the programmer.  To modify it, use the [[XCE]] instruction to swap its value with the [[carry flag]]&#039;s value.  This treats the [[status register]] bits as a game of musical chairs.&lt;br /&gt;
&lt;br /&gt;
The designers likely omitted CLE and SEE opcodes to set or clear it directly because dedicating two opcodes to such a rare operation is overkill.&lt;br /&gt;
&lt;br /&gt;
The flag is set when a [[RESET]] interrupt is fired. In other words, the CPU always starts in emulation mode at boot and after a reset.&lt;br /&gt;
&lt;br /&gt;
Emulation mode is not perfect.  Some important behavior differences from the 6502 are:&lt;br /&gt;
* The 65c816 does not attempt to emulate the illegal 6502 opcodes because its [[65c816 Opcode Matrix|opcode matrix]] is already full.  All 256 opcodes work in both native and emulation mode, but many are less useful in emulation mode.&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* The [[direct page]] is fully relocatable in both native and emulation mode even though it doesn&#039;t exist on the 6502, so pointing it to the zero page right before running 6502 code is advised to ensure maximum compatibility&lt;br /&gt;
* Direct page indexed addressing will always wrap around and remain within the direct page in emulation mode, instead of possibly crossing over into the next page. ([[E&amp;amp;L]], [https://archive.org/details/0893037893ProgrammingThe65816/page/374 page 374])&lt;br /&gt;
* The [[program bank register]] and [[data bank register]] still exist in emulation mode even though they don&#039;t exist on a 6502, so memory accesses may not always access bank zero.&lt;br /&gt;
* the hidden [[B accumulator]] still exists in emulation mode even though it does not on a 6502&lt;br /&gt;
&lt;br /&gt;
For writing new SNES code it is recommended to almost always stay in native mode even if dealing with 8 bit data.  Some reasons are:&lt;br /&gt;
* Page boundary crossings incur a one cycle penalty in emulation mode.  Emulation mode emulates the NMOS 6502 cycle counts.&lt;br /&gt;
* Large amounts of 8-bit data can sometimes be processed in 16-bit chunks, and doing so can take fewer loads/stores/transfers than treating them as 8-bit.&lt;br /&gt;
* The [[break flag]] need not be examined in native mode because there are more interrupt vectors.  (In fact, it does not even exist).&lt;br /&gt;
&lt;br /&gt;
On the other hand, [[COP]], [[BRK]], and [[RTI]] take one extra cycle in native mode.  For running 6502 code with minimal issues it is still recommended to use emulation mode.  For example, one quirk of 8-bit native mode is that [[TXS]] points the [[stack]] to the [[zeropage]].&lt;br /&gt;
&lt;br /&gt;
Emulation code need not be in [[bank]] 0.&lt;br /&gt;
&lt;br /&gt;
In emulation mode, the [[stack pointer]]&#039;s high byte is always one.  The M and X flags are always set in emulation mode.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SA-1]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 17.3, [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#APPENDIX&lt;br /&gt;
# section 7.8 of 65c816 datasheet: https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# section 2.8, lbid.&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Overflow_Flag&amp;diff=20978</id>
		<title>Overflow Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Overflow_Flag&amp;diff=20978"/>
		<updated>2025-10-28T22:49:22Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* References */ cleaner URLs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Overflow Flag&#039;&#039;&#039; (V) is bit 6 of the [[status register]].  It is affected only by the following eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (indicates signed sum overflowed)&lt;br /&gt;
* [[SBC]] (indicates signed difference underflowed)&lt;br /&gt;
* [[CLV]] (always clears it)&lt;br /&gt;
* [[BIT]] (becomes bit 6 or bit 14 of operand except in [[immediate addressing]])&lt;br /&gt;
* [[PLP]] (pulls it off the stack)&lt;br /&gt;
* [[RTI]] (pulls it off the stack)&lt;br /&gt;
* [[SEP]] (might set it)&lt;br /&gt;
* [[REP]] (might clear it)&lt;br /&gt;
&lt;br /&gt;
Here is how it behaves:&lt;br /&gt;
&lt;br /&gt;
* When the [[accumulator]] is 8 bits wide, V indicates whether the sum/difference of [[ADC]]/[[SBC]] is outside the range of -128 to 127.&lt;br /&gt;
* When the accumulator is 16 bits wide, V indicates whether the result of [[ADC]]/[[SBC]] is outside the range of -32768 to 32767.&lt;br /&gt;
&lt;br /&gt;
Adding a positive and negative integer together never sets the overflow flag because the sum has a smaller magnitude than either addend.&lt;br /&gt;
&lt;br /&gt;
It may be the most misunderstood flag of the [[65c816]] and the 6502.&amp;lt;sup&amp;gt;[2][3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is no [[SEV]] instruction to directly set the overflow flag, but the 6502 and 65c02 do have a hardware signal to set it.  Unfortunately this hardware signal was removed on the 65c816 (or fortunately, as now it can no longer get set by accident.)&lt;br /&gt;
&lt;br /&gt;
On the [[SPC700]] it can be cleared with [[CLRV]] and is set whenever the [[half-carry flag]] is set.&lt;br /&gt;
&lt;br /&gt;
[[BVC]] and [[BVS]] both examine the overflow flag to decide whether or not to branch.&lt;br /&gt;
&lt;br /&gt;
The overflow flag is invalid in [[decimal mode]] on the NMOS 6502, but it is valid in the 65c816&#039;s decimal mode.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[BVC (SPC700)]]&lt;br /&gt;
* [[BVS (SPC700)]]&lt;br /&gt;
* [[O/V]]&lt;br /&gt;
* [[Carry Flag]]&lt;br /&gt;
* [[Zero Flag]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/439 page 439]&lt;br /&gt;
# lbid, &amp;quot;Branching Based on the Overflow Flag&amp;quot; on [https://archive.org/details/0893037893ProgrammingThe65816/page/150 page 150]&lt;br /&gt;
# Clark, Bruce.  http://www.6502.org/tutorials/vflag.html&lt;br /&gt;
# Shirriff, Ken.  The 6502 overflow flag explained mathematically. https://www.righto.com/2012/12/the-6502-overflow-flag-explained.html&lt;br /&gt;
# lbid. https://www.righto.com/2013/01/a-small-part-of-6502-chip-explained.html&lt;br /&gt;
# Labiak, William. [https://archive.org/details/Programming_the_65816/page/n118 Page 108.]&lt;br /&gt;
# Pickens, John.  NMOS 6502 Opcodes.  http://www.6502.org/tutorials/6502opcodes.html#VFLAG&lt;br /&gt;
# https://forums.nesdev.org/viewtopic.php?t=6331&lt;br /&gt;
# Table 7-1 Caveats of 65c816 datasheet&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Condition Codes]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=XBA&amp;diff=20977</id>
		<title>XBA</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=XBA&amp;diff=20977"/>
		<updated>2025-10-28T22:36:25Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Syntax */ probably doesn&amp;#039;t use register renaming&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 1)&lt;br /&gt;
|EB&lt;br /&gt;
|1 byte&lt;br /&gt;
|3 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|N&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|Z&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;XBA&#039;&#039;&#039; is a [[65c816]] instruction that exchanges the values of the high byte (B) and low byte (typically called A) of the [[C accumulator]].  It works even in [[6502 emulation mode]].  In [[65816 native mode]], its standard mnemonic is still &amp;quot;XBA&amp;quot; even when the accumulator is 16-bits wide.  An alternative mnemonic is &amp;quot;SWA.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XBA can be used to convert [[big endian]] data to [[little endian]] and vice versa.  XBA appears to be the only direct way to access the high B byte when the [[M flag]] is set without losing any register values, with [[TCD]], [[TCS]], [[TAX]], and [[TAY]] &lt;br /&gt;
providing less direct access.&lt;br /&gt;
&lt;br /&gt;
The [[negative flag]] will match the most significant bit of the new low byte (A) of the accumulator.&lt;br /&gt;
The [[zero flag]] will be set if and only if the new low byte (A) of the accumulator is zero, otherwise it is cleared.  In other words, XBA ignores the M flag.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XBA&lt;br /&gt;
SWA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the hidden B byte is colloquially considered to be a second, more limited accumulator, XBA still isn&#039;t considered to use [[accumulator addressing]].  As of 2025 it is unknown whether XBA uses register renaming, but it would be surprising if it did because it should only take two cycles to flip a flip-flop.&lt;br /&gt;
&lt;br /&gt;
[[File:xba.png]]&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[XCE]]&lt;br /&gt;
* [[XCN]]&lt;br /&gt;
* [[SWAP]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/524 page 524] on XBA&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n214 page 204] on XBA&lt;br /&gt;
* snes9x implementation of XBA: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3261&lt;br /&gt;
* undisbeliever on XBA: https://undisbeliever.net/snesdev/65816-opcodes.html#xba-exchange-the-b-and-a-accumulators&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.10.3&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Exchange Instructions]]&lt;br /&gt;
[[Category:One-byte Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Three-cycle Instructions]]&lt;br /&gt;
[[Category:Single Admode Mnemonics]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20976</id>
		<title>Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20976"/>
		<updated>2025-10-28T18:51:28Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: clarify that memory accesses may not always access bank 0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Emulation Mode Flag&#039;&#039;&#039; (E) controls whether the [[65c816]] is behaving like a 6502:&lt;br /&gt;
* When clear, the &#039;816 is in &#039;&#039;&#039;65c816 native mode.&#039;&#039;&#039;&lt;br /&gt;
* When set, the &#039;816 is in &#039;&#039;&#039;6502 emulation mode.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This flag cannot be modified directly and is normally hidden from the programmer.  To modify it, use the [[XCE]] instruction to swap its value with the [[carry flag]]&#039;s value.  This treats the [[status register]] bits as a game of musical chairs.&lt;br /&gt;
&lt;br /&gt;
The designers likely omitted CLE and SEE opcodes to set or clear it directly because dedicating two opcodes to such a rare operation is overkill.&lt;br /&gt;
&lt;br /&gt;
The flag is set when a [[RESET]] interrupt is fired. In other words, the CPU always starts in emulation mode at boot and after a reset.&lt;br /&gt;
&lt;br /&gt;
Emulation mode is not perfect.  Some important behavior differences from the 6502 are:&lt;br /&gt;
* The 65c816 does not attempt to emulate the illegal 6502 opcodes because its [[65c816 Opcode Matrix|opcode matrix]] is already full.  All 256 opcodes work in both native and emulation mode, but many are less useful in emulation mode.&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* The [[direct page]] is fully relocatable in both native and emulation mode even though it doesn&#039;t exist on the 6502, so pointing it to the zero page right before running 6502 code is advised to ensure maximum compatibility&lt;br /&gt;
* Direct page indexed addressing will always wrap around and remain within the direct page in emulation mode, instead of possibly crossing over into the next page. ([[E&amp;amp;L]], [https://archive.org/details/0893037893ProgrammingThe65816/page/374 page 374])&lt;br /&gt;
* The [[program bank register]] and [[data bank register]] still exist in emulation mode even though they don&#039;t exist on a 6502, so memory accesses may not always access bank zero.&lt;br /&gt;
* the hidden [[B accumulator]] still exists in emulation mode even though it does not on a 6502&lt;br /&gt;
&lt;br /&gt;
For writing new SNES code it is recommended to almost always stay in native mode even if dealing with 8 bit data.  Some reasons are:&lt;br /&gt;
* Page boundary crossings incur a one cycle penalty in emulation mode.  Emulation mode emulates the NMOS 6502 cycle counts.&lt;br /&gt;
* Large amounts of 8-bit data can sometimes be processed in 16-bit chunks, and doing so can take fewer loads/stores/transfers than treating them as 8-bit.&lt;br /&gt;
* The [[break flag]] need not be examined in native mode because there are more interrupt vectors.  (In fact, it does not even exist).&lt;br /&gt;
&lt;br /&gt;
On the other hand, [[COP]], [[BRK]], and [[RTI]] take one extra cycle in native mode.&lt;br /&gt;
&lt;br /&gt;
Emulation code need not be in [[bank]] 0.&lt;br /&gt;
&lt;br /&gt;
In emulation mode, the [[stack pointer]]&#039;s high byte is always one.  The M and X flags are always set in emulation mode.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SA-1]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 17.3, [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#APPENDIX&lt;br /&gt;
# section 7.8 of 65c816 datasheet: https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# section 2.8, lbid.&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Bank_Address_Register&amp;diff=20975</id>
		<title>Bank Address Register</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Bank_Address_Register&amp;diff=20975"/>
		<updated>2025-10-28T18:49:32Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: works even in emulation mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;Note: this page is likely inaccurate/confusing;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;Bank Address Register&#039;&#039;&#039; (also known as the &#039;&#039;&#039;bank byte&#039;&#039;&#039;) is Nintendo&#039;s name for the 8-bit register that fills in the most significant bits of a 24-bit address memory access by the [[5A22]].  It keeps track of what [[bank]] the CPU is configured to use.  It is cleared to zero on reset.&amp;lt;sup&amp;gt;[2]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
WDC calls this register the &#039;&#039;&#039;Data Bank Register&#039;&#039;&#039; (DBR).  Even in [[emulation mode]], DBR still exists and tells the &#039;816 which bank to use.&lt;br /&gt;
&lt;br /&gt;
[[PLB]], [[MVN]], and [[MVP]] modify this register.  [[PHB]] pushes it onto the [[stack]].  [[TSB]] does not transfer the [[stack pointer]] to the DBR despite appearing like a transfer mnemonic.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Program Bank Register]]&lt;br /&gt;
* [[Address Bus A]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 2-21-2 on [https://archive.org/details/SNESDevManual/book1/page/n94 page 2-21-3 of Book I] of the official Super Nintendo development manual&lt;br /&gt;
# section 2.5 on page 6 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/53 page 53]&lt;br /&gt;
# lbid, [https://archive.org/details/0893037893ProgrammingThe65816/page/55 page 55]&lt;br /&gt;
# lbid, [https://archive.org/details/0893037893ProgrammingThe65816/page/114 page 114]&lt;br /&gt;
&lt;br /&gt;
[[Category:Registers]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Bank Registers]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20974</id>
		<title>Emulation Mode Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Emulation_Mode_Flag&amp;diff=20974"/>
		<updated>2025-10-28T18:35:28Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: linkify page 374&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Emulation Mode Flag&#039;&#039;&#039; (E) controls whether the [[65c816]] is behaving like a 6502:&lt;br /&gt;
* When clear, the &#039;816 is in &#039;&#039;&#039;65c816 native mode.&#039;&#039;&#039;&lt;br /&gt;
* When set, the &#039;816 is in &#039;&#039;&#039;6502 emulation mode.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
This flag cannot be modified directly and is normally hidden from the programmer.  To modify it, use the [[XCE]] instruction to swap its value with the [[carry flag]]&#039;s value.  This treats the [[status register]] bits as a game of musical chairs.&lt;br /&gt;
&lt;br /&gt;
The designers likely omitted CLE and SEE opcodes to set or clear it directly because dedicating two opcodes to such a rare operation is overkill.&lt;br /&gt;
&lt;br /&gt;
The flag is set when a [[RESET]] interrupt is fired. In other words, the CPU always starts in emulation mode at boot and after a reset.&lt;br /&gt;
&lt;br /&gt;
Emulation mode is not perfect.  Some important behavior differences from the 6502 are:&lt;br /&gt;
* The 65c816 does not attempt to emulate the illegal 6502 opcodes because its [[65c816 Opcode Matrix|opcode matrix]] is already full.  All 256 opcodes work in both native and emulation mode, but many are less useful in emulation mode.&amp;lt;sup&amp;gt;[3]&amp;lt;/sup&amp;gt;&lt;br /&gt;
* The [[direct page]] is fully relocatable in both native and emulation mode even though it doesn&#039;t exist on the 6502, so pointing it to the zero page right before running 6502 code is advised to ensure maximum compatibility&lt;br /&gt;
* Direct page indexed addressing will always wrap around and remain within the direct page in emulation mode, instead of possibly crossing over into the next page. ([[E&amp;amp;L]], [https://archive.org/details/0893037893ProgrammingThe65816/page/374 page 374])&lt;br /&gt;
* The [[program bank register]] and [[data bank register]] still exist in emulation mode even though they don&#039;t exist on a 6502&lt;br /&gt;
* the hidden [[B accumulator]] still exists in emulation mode even though it does not on a 6502&lt;br /&gt;
&lt;br /&gt;
For writing new SNES code it is recommended to almost always stay in native mode even if dealing with 8 bit data.  Some reasons are:&lt;br /&gt;
* Page boundary crossings incur a one cycle penalty in emulation mode.  Emulation mode emulates the NMOS 6502 cycle counts.&lt;br /&gt;
* Large amounts of 8-bit data can sometimes be processed in 16-bit chunks, and doing so can take fewer loads/stores/transfers than treating them as 8-bit.&lt;br /&gt;
* The [[break flag]] need not be examined in native mode because there are more interrupt vectors.  (In fact, it does not even exist).&lt;br /&gt;
&lt;br /&gt;
On the other hand, [[COP]], [[BRK]], and [[RTI]] take one extra cycle in native mode.&lt;br /&gt;
&lt;br /&gt;
Emulation code need not be in [[bank]] 0.&lt;br /&gt;
&lt;br /&gt;
In emulation mode, the [[stack pointer]]&#039;s high byte is always one.  The M and X flags are always set in emulation mode.&amp;lt;sup&amp;gt;[4]&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[SA-1]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
# Figure 17.3, [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/377 page 377]&lt;br /&gt;
# Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#APPENDIX&lt;br /&gt;
# section 7.8 of 65c816 datasheet: https://www.westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
# section 2.8, lbid.&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=TCS&amp;diff=20973</id>
		<title>TCS</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=TCS&amp;diff=20973"/>
		<updated>2025-10-28T18:07:57Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: ignores M flag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 1)&lt;br /&gt;
|1B&lt;br /&gt;
|1 byte&lt;br /&gt;
|2 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;9&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;TCS&#039;&#039;&#039; (Transfer Accumulator to Stack Pointer) is a [[65c816]] instruction that transfers the value of the [[accumulator]] to the [[stack pointer]].  An alternative mmenonic for this instruction is &amp;quot;TAS.&amp;quot;  TCS always transfers 16 bits in [[native mode]] and 8 bits in emulation mode.  TCS ignores the M flag.  TCS always takes two cycles, regardless of whether one or two bytes are transferred.&lt;br /&gt;
&lt;br /&gt;
No flags are affected.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
TCS&lt;br /&gt;
TAS&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[TXS]]&lt;br /&gt;
* [[TSC]]&lt;br /&gt;
* [[TCD]]&lt;br /&gt;
* [[TAX]]&lt;br /&gt;
* [[TAY]]&lt;br /&gt;
* [[XBA]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/511 page 511] on TCS&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n202 page 192] on TCS&lt;br /&gt;
* snes9x implementation of TCS: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L2328&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.10.2&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Transfer Instructions]]&lt;br /&gt;
[[Category:One-byte Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Two-cycle Instructions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=XBA&amp;diff=20972</id>
		<title>XBA</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=XBA&amp;diff=20972"/>
		<updated>2025-10-28T17:53:45Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: XBA ignores M flag, clarified that other instructions overwrite regs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Implied]] (type 1)&lt;br /&gt;
|EB&lt;br /&gt;
|1 byte&lt;br /&gt;
|3 cycles&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:30%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]]&lt;br /&gt;
|[[Decimal Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|N&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|Z&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;XBA&#039;&#039;&#039; is a [[65c816]] instruction that exchanges the values of the high byte (B) and low byte (typically called A) of the [[C accumulator]].  It works even in [[6502 emulation mode]].  In [[65816 native mode]], its standard mnemonic is still &amp;quot;XBA&amp;quot; even when the accumulator is 16-bits wide.  An alternative mnemonic is &amp;quot;SWA.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
XBA can be used to convert [[big endian]] data to [[little endian]] and vice versa.  XBA appears to be the only direct way to access the high B byte when the [[M flag]] is set without losing any register values, with [[TCD]], [[TCS]], [[TAX]], and [[TAY]] &lt;br /&gt;
providing less direct access.&lt;br /&gt;
&lt;br /&gt;
The [[negative flag]] will match the most significant bit of the new low byte (A) of the accumulator.&lt;br /&gt;
The [[zero flag]] will be set if and only if the new low byte (A) of the accumulator is zero, otherwise it is cleared.  In other words, XBA ignores the M flag.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
XBA&lt;br /&gt;
SWA&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Even though the hidden B byte is colloquially considered to be a second, more limited accumulator, XBA still isn&#039;t considered to use [[accumulator addressing]].  As of 2025 it is unknown whether XBA is implemented with register renaming.&lt;br /&gt;
&lt;br /&gt;
[[File:xba.png]]&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[XCE]]&lt;br /&gt;
* [[XCN]]&lt;br /&gt;
* [[SWAP]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/524 page 524] on XBA&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n214 page 204] on XBA&lt;br /&gt;
* snes9x implementation of XBA: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L3261&lt;br /&gt;
* undisbeliever on XBA: https://undisbeliever.net/snesdev/65816-opcodes.html#xba-exchange-the-b-and-a-accumulators&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c816opcodes.html#6.10.3&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Exchange Instructions]]&lt;br /&gt;
[[Category:One-byte Instructions]]&lt;br /&gt;
[[Category:Implied Instructions]]&lt;br /&gt;
[[Category:Three-cycle Instructions]]&lt;br /&gt;
[[Category:Single Admode Mnemonics]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Direct_Page_Indexed_Indirect,_X_Addressing&amp;diff=20971</id>
		<title>Direct Page Indexed Indirect, X Addressing</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Direct_Page_Indexed_Indirect,_X_Addressing&amp;diff=20971"/>
		<updated>2025-10-28T02:27:33Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* References */ hid archive URL&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Direct Page Indexed Indirect, X Addressing&#039;&#039;&#039; is supported by eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (opcode 61)&lt;br /&gt;
* [[AND]] (opcode 21)&lt;br /&gt;
* [[CMP]] (opcode C1)&lt;br /&gt;
* [[EOR]] (opcode 41)&lt;br /&gt;
* [[LDA]] (opcode A1)&lt;br /&gt;
* [[ORA]] (opcode 01)&lt;br /&gt;
* [[SBC]] (opcode E1)&lt;br /&gt;
* [[STA]] (opcode 81)&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA (dp, X)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== See Also ====&lt;br /&gt;
* [[Direct Page Indirect Addressing]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/392 page 392]&lt;br /&gt;
* section 3.5.10 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;br /&gt;
[[Category:Complex Admodes]]&lt;br /&gt;
[[Category:Addressing Modes]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Direct_Page_Indirect_Addressing&amp;diff=20970</id>
		<title>Direct Page Indirect Addressing</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Direct_Page_Indirect_Addressing&amp;diff=20970"/>
		<updated>2025-10-28T02:04:33Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: /* Syntax */ meaning&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Direct Page Indirect Addressing&#039;&#039;&#039; is supported by eight instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (opcode 72)&lt;br /&gt;
* [[AND]] (opcode 32)&lt;br /&gt;
* [[CMP]] (opcode D2)&lt;br /&gt;
* [[EOR]] (opcode 52)&lt;br /&gt;
* [[LDA]] (opcode B2)&lt;br /&gt;
* [[ORA]] (opcode 12)&lt;br /&gt;
* [[SBC]] (opcode F2)&lt;br /&gt;
* [[STA]] (opcode 92)&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
LDA (dp)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, the 16-bit address stored at location dp of the direct page is fetched, and then the accumulator is loaded with the byte that lives at that address.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[Direct Page Indirect Long Addressing]]&lt;br /&gt;
* [[Direct Page Addressing]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/393 page 393]&lt;br /&gt;
* [https://archive.org/details/0893037893ProgrammingThe65816/page/128 page 128], lbid&lt;br /&gt;
* section 3.5.16 of 65c816 datasheet, https://westerndesigncenter.com/wdc/documentation/w65c816s.pdf&lt;br /&gt;
&lt;br /&gt;
[[Category:Addressing Modes]]&lt;br /&gt;
[[Category:Simple Admodes]]&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:65c816 additions]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=BRK&amp;diff=20969</id>
		<title>BRK</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=BRK&amp;diff=20969"/>
		<updated>2025-10-28T00:59:14Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: NMOS 6502 BRK did not affect decimal flag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;8&amp;quot;|Basic Info&lt;br /&gt;
|+&lt;br /&gt;
|&#039;&#039;&#039;Addressing Mode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Opcode&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Length&#039;&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Speed&#039;&#039;&#039;&lt;br /&gt;
|+&lt;br /&gt;
|[[Stack Addressing|Stack]] (Interrupt)&lt;br /&gt;
|00&lt;br /&gt;
|2 bytes&lt;br /&gt;
|8 cycles*&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;float:right;clear:right;width:40%&amp;quot;&lt;br /&gt;
!colspan=&amp;quot;9&amp;quot;|Flags Affected&lt;br /&gt;
|+&lt;br /&gt;
|&lt;br /&gt;
|[[Negative Flag|N]]&lt;br /&gt;
|[[Overflow Flag|V]]&lt;br /&gt;
|[[M Flag|M]]&lt;br /&gt;
|[[X Flag|X]] / [[Break Flag|B]]&lt;br /&gt;
|[[D Flag|D]]&lt;br /&gt;
|[[I Flag|I]]&lt;br /&gt;
|[[Zero Flag|Z]]&lt;br /&gt;
|[[Carry Flag|C]]&lt;br /&gt;
|+&lt;br /&gt;
|[[65c816 native mode]]&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|+&lt;br /&gt;
|[[6502 emulation mode]]&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|1&lt;br /&gt;
|0&lt;br /&gt;
|1&lt;br /&gt;
|.&lt;br /&gt;
|.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;BRK&#039;&#039;&#039; (Break) is a 65x instruction that triggers a non-maskable software interrupt ([[Non-Maskable Interrupt|NMI]]).  The byte following the opcode is called the [[signature byte]].  The state of the [[interrupt disable flag]] has no effect on the behavior of BRK although it will be set after BRK runs.&lt;br /&gt;
&lt;br /&gt;
In [[native mode]] the [[program bank register]] is pushed to the [[stack]].  Then the [[program counter]] is incremented by two and then pushed to the stack.  Then the [[status register]] (with the [[break flag]] set, if in emulation mode) is pushed to the stack.  Then the interrupt disable flag is set.  In native mode, the program bank register is then cleared.&lt;br /&gt;
&lt;br /&gt;
Control is routed to the BRK handler, whose address is stored at the BRK vector:&lt;br /&gt;
* In native mode, this vector is at $00:FFE6.&lt;br /&gt;
* In emulation mode, this vector is at $FFFE.&lt;br /&gt;
&lt;br /&gt;
==== Syntax ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
BRK&lt;br /&gt;
BRK sig&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Cycle Skipped ====&lt;br /&gt;
BRK takes one fewer cycle in [[emulation mode]] as it doesn&#039;t need to push the [[program counter bank register]] to the [[stack]].&lt;br /&gt;
&lt;br /&gt;
If the signature byte was omitted from the assembler source, then it ends up serving double duty as the opcode of the next instruction.  In this case the [[interrupt handler]] must decrement the [[return address]] on the [[stack]] so that the eventual [[RTI]] does not cause [[derailment]].&lt;br /&gt;
&lt;br /&gt;
[[File:brk.png]]&lt;br /&gt;
&lt;br /&gt;
BRK used to be considered a one-byte instruction in an early datasheet.  On the NMOS 6502, BRK does not affect the decimal flag, but this likely only affects porting code from systems other than the NES because the NES does not have decimal mode anyway.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[RTI]]&lt;br /&gt;
* [[BRK (SPC700)]]&lt;br /&gt;
* [[NMI]]&lt;br /&gt;
* [[IRQ]]&lt;br /&gt;
* [[COP]]&lt;br /&gt;
* [[WDM]]&lt;br /&gt;
* [[CLD]]&lt;br /&gt;
* [[SEI]]&lt;br /&gt;
&lt;br /&gt;
=== External Links ===&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], [https://archive.org/details/0893037893ProgrammingThe65816/page/436 page 436] on BRK&lt;br /&gt;
* Figure 13.3, Break Signature Byte Illustration, lbid, [https://archive.org/details/0893037893ProgrammingThe65816/page/n282 page 256]&lt;br /&gt;
* [[Labiak]], [https://archive.org/details/Programming_the_65816/page/n136 page 126] on BRK&lt;br /&gt;
* 9.11 on [[MCS6500 Manual]], [https://archive.org/details/mos_microcomputers_programming_manual/page/n164 page 144] on BRK&lt;br /&gt;
* [[Carr]], [https://archive.org/details/6502UsersManual/page/n265 page 252] on BRK&lt;br /&gt;
* [[Leventhal]], [https://archive.org/details/6502-assembly-language-programming/page/n98 page 3-49] on BRK&lt;br /&gt;
* snes9x implementation of BRK: https://github.com/snes9xgit/snes9x/blob/master/cpuops.cpp#L2547&lt;br /&gt;
* Pickens, John. http://www.6502.org/tutorials/6502opcodes.html#BRK&lt;br /&gt;
* Clark, Bruce. http://www.6502.org/tutorials/65c02opcodes.html#6&lt;br /&gt;
* https://undisbeliever.net/snesdev/65816-opcodes.html#software-interrupts&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Two-byte Instructions]]&lt;br /&gt;
[[Category:Single Admode Mnemonics]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Carry_Flag&amp;diff=20968</id>
		<title>Carry Flag</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Carry_Flag&amp;diff=20968"/>
		<updated>2025-10-25T21:54:49Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: CMP, CPX, CPY set if no borrow required&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Carry Flag&#039;&#039;&#039; (C) is bit 0 of the [[65c816]]&#039;s [[status register]].&lt;br /&gt;
&lt;br /&gt;
It can be set with [[SEC]] and cleared with [[CLC]].  Or, [[SEP]] and [[REP]] can be used.&lt;br /&gt;
&lt;br /&gt;
The following other 10 instructions have side effects that directly affect the carry flag, which includes all arithmetic instructions (except those that can only increment/decrement by one) and all shift/rotate instructions:&lt;br /&gt;
&lt;br /&gt;
* [[ADC]] (becomes set when an addition overflows)&lt;br /&gt;
* [[ASL]] (becomes whatever the most significant bit was)&lt;br /&gt;
* [[CMP]] (set if no borrow required, cleared otherwise)&lt;br /&gt;
* [[CPX]]  (set if no borrow required, cleared otherwise)&lt;br /&gt;
* [[CPY]]  (set if no borrow required, cleared otherwise)&lt;br /&gt;
* [[LSR]] (becomes whatever bit 0 was)&lt;br /&gt;
* [[ROL]] (becomes whatever the most significant bit was)&lt;br /&gt;
* [[ROR]] (becomes whatever bit 0 was)&lt;br /&gt;
* [[SBC]] (where it is often called the &amp;quot;borrow flag&amp;quot; instead)&lt;br /&gt;
* [[XCE]] (becomes whatever the e flag was)&lt;br /&gt;
&lt;br /&gt;
The following two instructions indirectly affect the carry flag by loading the [[status register]]:&lt;br /&gt;
&lt;br /&gt;
* [[PLP]]&lt;br /&gt;
* [[RTI]]&lt;br /&gt;
&lt;br /&gt;
The carry flag influences whether [[BCS]] and [[BCC]] branch or not.&lt;br /&gt;
&lt;br /&gt;
As mentioned above, none of [[INC]], [[DEC]], [[INX]], [[DEX]], [[INY]] nor [[DEY]] modify the carry flag.&lt;br /&gt;
&lt;br /&gt;
=== See Also ===&lt;br /&gt;
* [[CY]], the [[Super FX]]&#039;s carry flag&lt;br /&gt;
* [[Negative Flag]]&lt;br /&gt;
* [[Overflow Flag]]&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
* Labiak, William.  [https://archive.org/details/Programming_the_65816/page/n118 Page 108.]&lt;br /&gt;
* [[Eyes &amp;amp; Lichty]], &amp;quot;Branching Based on the Carry Flag&amp;quot; on [https://archive.org/details/0893037893ProgrammingThe65816/page/147 page 147]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:ASM]]&lt;br /&gt;
[[Category:Flags]]&lt;br /&gt;
[[Category:Inherited from 6502]]&lt;br /&gt;
[[Category:Condition Codes]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
	<entry>
		<id>https://sneslab.net/mw/index.php?title=Control_Deck&amp;diff=20967</id>
		<title>Control Deck</title>
		<link rel="alternate" type="text/html" href="https://sneslab.net/mw/index.php?title=Control_Deck&amp;diff=20967"/>
		<updated>2025-10-25T20:21:32Z</updated>

		<summary type="html">&lt;p&gt;Xetheria: official jargon&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The &#039;&#039;&#039;Control Deck&#039;&#039;&#039; is the main console device, containing the [[SNES Motherboard]] and having an [[ABS|ABS plastic]] shell exterior.&lt;br /&gt;
&lt;br /&gt;
It has part numbers 22945 (SNS) and 21712 (SFX).&lt;br /&gt;
&lt;br /&gt;
[[Category:SNES Hardware]]&lt;br /&gt;
[[Category:Official Jargon]]&lt;/div&gt;</summary>
		<author><name>Xetheria</name></author>
	</entry>
</feed>