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

CMP (Super FX)

From SnesLab
Revision as of 18:35, 9 July 2024 by Xetheria (talk | contribs) (blurb about specifying sreg/dreg in advance)
Jump to: navigation, search
Basic Info
Addressing Mode Opcode Length ROM Speed RAM Speed Cache Speed
Implied (type 1) 3F6n 2 bytes 6 cycles 6 cycles 2 cycles
Flags Affected
B ALT1 ALT2 O/V S CY Z
0 0 0

CMP (Compare) is a Super FX instruction that compares the operand register with the source register. Internally, this is done via a subtraction, but the difference is not stored anywhere. Thus, the purpose of CMP is to setup the flags.

The operand serves as the subtrahend and can be any register from R0 to R15.

The source register should be specified in advance using WITH or FROM. Otherwise, R0 serves as the default.

Syntax

CMP Rn

Example

Let:

Sreg : R1
R1 = 8000h
R3 = 2fffh

After executing CMP R3, the overflow and carry flags are set but the sign and zero flags are clear.

See Also

External Links