We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS

DEC (SPC700): Difference between revisions

From SnesLab
Jump to: navigation, search
(→‎See Also: DEX, DEY)
(made flags affected more prominent)
 
(13 intermediate revisions by the same user not shown)
Line 7: Line 7:
|'''Speed'''
|'''Speed'''
|+
|+
|
|[[Accumulator Addressing | Accumulator]]
|9C
|9C
|1 byte
|1 byte
|2 cycles
|2 cycles
|+
|+
|
|[[Direct Page Addressing | Direct Page]]
|8B
|8B
|2 byte
|2 bytes
|4 cycles
|4 cycles
|+
|+
|
|[[Direct Page Indexed by X]]
|9B
|9B
|2 byte
|2 bytes
|5 cycles
|5 cycles
|+
|+
|
|[[Absolute Addressing | Absolute]]
|8C
|8C
|3 bytes
|3 bytes
|5 cycles
|5 cycles
|+
|+
|
|[[Implied]] (type 1)
|1D
|1D
|1 byte
|1 byte
|2 cycles
|2 cycles
|+
|+
|
|[[Implied]] (type 1)
|DC
|DC
|1 byte
|1 byte
Line 39: Line 39:


{| class="wikitable" style="float:right;clear:right;width:30%"
{| class="wikitable" style="float:right;clear:right;width:30%"
!colspan="8"|Flags Clobbered
!colspan="8"|Flags Affected
|+
|[[Negative Flag|N]]
|[[Overflow Flag|V]]
|[[Direct Page Flag|P]]
|[[Break Flag|B]]
|[[Half-Carry Flag|H]]
|[[Interrupt Enable Flag|I]]
|[[Zero Flag|Z]]
|[[Carry Flag|C]]
|+
|+
|N
|N
|V
|P
|B
|H
|I
|Z
|C
|+
|
|.
|.
|.
|.
Line 56: Line 56:
|.
|.
|.
|.
|Z
|.
|.
|
|}
|}


'''DEC''' is an [[SPC700]] instruction that decrements its operand.
'''DEC''' is an [[SPC700]] instruction that decrements its operand by one.
 
==== Syntax ====
<pre>
DEC A
DEC dp
DEC dp+X
DEC !abs
DEC X
DEC Y
</pre>
 
The above are official, but some people prefer alternate mnemonics like:
 
<pre>
DEA
DEX
DEY
</pre>


=== See Also ===
=== See Also ===
Line 67: Line 85:
* [[DEX]]
* [[DEX]]
* [[DEY]]
* [[DEY]]
* [[SBC (SPC700)]]
* [[SBC]]


=== External Links ===
=== External Links ===
* Official Super Nintendo development manual on DEC: [https://archive.org/details/SNESDevManual/book1/page/n232 Appendix C-7 of Book I]
* Official Super Nintendo development manual on DEC: [https://archive.org/details/SNESDevManual/book1/page/n232 Appendix C-7 of Book I]
* anomie: https://github.com/yupferris/TasmShiz/blob/8fabc9764c33a7ae2520a76d80ed7220bb939f12/spc700.txt#L415


[[Category:ASM]]
[[Category:ASM]]
[[Category:SPC700]]
[[Category:SPC700]]
[[Category:Addition and Subtraction Commands]]
[[Category:Addition and Subtraction Commands]]

Latest revision as of 13:57, 30 July 2024

Basic Info
Addressing Mode Opcode Length Speed
Accumulator 9C 1 byte 2 cycles
Direct Page 8B 2 bytes 4 cycles
Direct Page Indexed by X 9B 2 bytes 5 cycles
Absolute 8C 3 bytes 5 cycles
Implied (type 1) 1D 1 byte 2 cycles
Implied (type 1) DC 1 byte 2 cycles
Flags Affected
N V P B H I Z C
N . . . . . Z .

DEC is an SPC700 instruction that decrements its operand by one.

Syntax

DEC A
DEC dp
DEC dp+X
DEC !abs
DEC X
DEC Y

The above are official, but some people prefer alternate mnemonics like:

DEA
DEX
DEY

See Also

External Links