de.michab.simulator.mos6502
Class Opcodes

java.lang.Object
  extended byde.michab.simulator.mos6502.Opcodes

public final class Opcodes
extends java.lang.Object

Defines instruction encodings. Note that the attribute names are used to formally encode the addressing mode. This is used in reflective code to compute a human readable instruction representation.

The general format is <instructionName>_<addressingMode>, where the name is defined in numerous 6502 assembly language books and the addressingMode is one of:

Suffix Comment
IMP Implicit
IMM Immediate
ZP Zero page
ZPX Zero page, x-register relative
ZPY Zero page, y-register relative
ABS Absolute
ABSX Absolute x
ABSY Absolute y
IND Indirect
IZX X indirect
IZY Y indirect
REL Relative

Author:
Michael G. Binz

Field Summary
static int ADC_ABS
           
static int ADC_ABSX
           
static int ADC_ABSY
           
static int ADC_IMM
           
static int ADC_IZX
           
static int ADC_IZY
           
static int ADC_ZP
           
static int ADC_ZPX
           
static int AND_ABS
           
static int AND_ABSX
           
static int AND_ABSY
           
static int AND_IMM
           
static int AND_IZX
           
static int AND_IZY
           
static int AND_ZP
           
static int AND_ZPX
           
static int ASL_ABS
           
static int ASL_ABSX
           
static int ASL_IMP
           
static int ASL_ZP
           
static int ASL_ZPX
           
static int BCC_REL
           
static int BCS_REL
           
static int BEQ_REL
           
static int BIT_ABS
           
static int BIT_ABSX
           
static int BIT_ZP
           
static int BIT_ZPX
           
static int BMI_REL
           
static int BNE_REL
           
static int BPL_REL
           
static int BRK_IMP
           
static int BVC_REL
           
static int BVS_REL
           
static int CLC_IMP
           
static int CLD_IMP
           
static int CLI_IMP
           
static int CLV_IMP
           
static int CMP_ABS
           
static int CMP_ABSX
           
static int CMP_ABSY
           
static int CMP_IMM
           
static int CMP_IZX
           
static int CMP_IZY
           
static int CMP_ZP
           
static int CMP_ZPX
           
static int CPX_ABS
           
static int CPX_IMM
           
static int CPX_ZP
           
static int CPY_ABS
           
static int CPY_IMM
           
static int CPY_ZP
           
static int DEC_ABS
           
static int DEC_ABSX
           
static int DEC_ZP
           
static int DEC_ZPX
           
static int DEX_IMP
           
static int DEY_IMP
           
static int EOR_ABS
           
static int EOR_ABSX
           
static int EOR_ABSY
           
static int EOR_IMM
           
static int EOR_IZX
           
static int EOR_IZY
           
static int EOR_ZP
           
static int EOR_ZPX
           
static int INC_ABS
           
static int INC_ABSX
           
static int INC_ZP
           
static int INC_ZPX
           
static int INX_IMP
           
static int INY_IMP
           
static int JMP_ABS
           
static int JMP_IND
           
static int JSR_ABS
           
static int LDA_ABS
           
static int LDA_ABSX
           
static int LDA_ABSY
           
static int LDA_IMM
           
static int LDA_IZX
           
static int LDA_IZY
           
static int LDA_ZP
           
static int LDA_ZPX
           
static int LDX_ABS
           
static int LDX_ABSY
           
static int LDX_IMM
           
static int LDX_ZP
           
static int LDX_ZPY
           
static int LDY_ABS
           
static int LDY_ABSX
           
static int LDY_IMM
           
static int LDY_ZP
           
static int LDY_ZPX
           
static int LSR_ABS
           
static int LSR_ABSX
           
static int LSR_IMP
           
static int LSR_ZP
           
static int LSR_ZPX
           
static int NOP_IMP
           
static int ORA_ABS
           
static int ORA_ABSX
           
static int ORA_ABSY
           
static int ORA_IMM
           
static int ORA_IZX
           
static int ORA_IZY
           
static int ORA_ZP
           
static int ORA_ZPX
           
static int PHA_IMP
           
static int PHP_IMP
           
static int PLA_IMP
           
static int PLP_IMP
           
static int ROL_ABS
           
static int ROL_ABSX
           
static int ROL_IMP
           
static int ROL_ZP
           
static int ROL_ZPX
           
static int ROR_ABS
           
static int ROR_ABSX
           
static int ROR_IMP
           
static int ROR_ZP
           
static int ROR_ZPX
           
static int RTI_IMP
           
static int RTS_IMP
           
static int SBC_ABS
           
static int SBC_ABSX
           
static int SBC_ABSY
           
static int SBC_IMM
           
static int SBC_IZX
           
static int SBC_IZY
           
static int SBC_ZP
           
static int SBC_ZPX
           
static int SEC_IMP
           
static int SED_IMP
           
static int SEI_IMP
           
static int STA_ABS
           
static int STA_ABSX
           
static int STA_ABSY
           
static int STA_IZX
           
static int STA_IZY
           
static int STA_ZP
           
static int STA_ZPX
           
static int STX_ABS
           
static int STX_ZP
           
static int STX_ZPY
           
static int STY_ABS
           
static int STY_ZP
           
static int STY_ZPX
           
static int TAX_IMP
           
static int TAY_IMP
           
static int TSX_IMP
           
static int TXA_IMP
           
static int TXS_IMP
           
static int TYA_IMP
           
static int uLSE_ABS
           
static int uLSE_ABSX
           
static int uLSE_ABSY
           
static int uLSE_IZX
           
static int uLSE_IZY
           
static int uLSE_ZP
           
static int uLSE_ZPX
           
static int uSAX_ABS
           
static int uSAX_IZX
           
static int uSAX_ZP
           
static int uSAX_ZPY
           
 
Method Summary
static int getEncodingLength(int opcode)
          Get the length that an instruction based on the passed opcode uses in memory.
static java.lang.String getText(int opcode)
          Returns the textual representation for the passed opcode.
static int getTime(int opcode)
          Get the number of cycles required to execute the passed opcode.
static boolean isValidOpcode(int opcode)
          Checks whether the passed opcode is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADC_IMM

public static final int ADC_IMM
See Also:
Constant Field Values

ADC_ZP

public static final int ADC_ZP
See Also:
Constant Field Values

ADC_ZPX

public static final int ADC_ZPX
See Also:
Constant Field Values

ADC_ABS

public static final int ADC_ABS
See Also:
Constant Field Values

ADC_ABSX

public static final int ADC_ABSX
See Also:
Constant Field Values

ADC_ABSY

public static final int ADC_ABSY
See Also:
Constant Field Values

ADC_IZX

public static final int ADC_IZX
See Also:
Constant Field Values

ADC_IZY

public static final int ADC_IZY
See Also:
Constant Field Values

AND_IMM

public static final int AND_IMM
See Also:
Constant Field Values

AND_ZP

public static final int AND_ZP
See Also:
Constant Field Values

AND_ZPX

public static final int AND_ZPX
See Also:
Constant Field Values

AND_IZX

public static final int AND_IZX
See Also:
Constant Field Values

AND_IZY

public static final int AND_IZY
See Also:
Constant Field Values

AND_ABS

public static final int AND_ABS
See Also:
Constant Field Values

AND_ABSX

public static final int AND_ABSX
See Also:
Constant Field Values

AND_ABSY

public static final int AND_ABSY
See Also:
Constant Field Values

ASL_IMP

public static final int ASL_IMP
See Also:
Constant Field Values

ASL_ZP

public static final int ASL_ZP
See Also:
Constant Field Values

ASL_ZPX

public static final int ASL_ZPX
See Also:
Constant Field Values

ASL_ABS

public static final int ASL_ABS
See Also:
Constant Field Values

ASL_ABSX

public static final int ASL_ABSX
See Also:
Constant Field Values

BCC_REL

public static final int BCC_REL
See Also:
Constant Field Values

BCS_REL

public static final int BCS_REL
See Also:
Constant Field Values

BEQ_REL

public static final int BEQ_REL
See Also:
Constant Field Values

BIT_ZP

public static final int BIT_ZP
See Also:
Constant Field Values

BIT_ZPX

public static final int BIT_ZPX
See Also:
Constant Field Values

BIT_ABS

public static final int BIT_ABS
See Also:
Constant Field Values

BIT_ABSX

public static final int BIT_ABSX
See Also:
Constant Field Values

BMI_REL

public static final int BMI_REL
See Also:
Constant Field Values

BNE_REL

public static final int BNE_REL
See Also:
Constant Field Values

BPL_REL

public static final int BPL_REL
See Also:
Constant Field Values

BRK_IMP

public static final int BRK_IMP
See Also:
Constant Field Values

BVC_REL

public static final int BVC_REL
See Also:
Constant Field Values

BVS_REL

public static final int BVS_REL
See Also:
Constant Field Values

CLC_IMP

public static final int CLC_IMP
See Also:
Constant Field Values

CLD_IMP

public static final int CLD_IMP
See Also:
Constant Field Values

CLI_IMP

public static final int CLI_IMP
See Also:
Constant Field Values

CLV_IMP

public static final int CLV_IMP
See Also:
Constant Field Values

CMP_IMM

public static final int CMP_IMM
See Also:
Constant Field Values

CMP_ZP

public static final int CMP_ZP
See Also:
Constant Field Values

CMP_ZPX

public static final int CMP_ZPX
See Also:
Constant Field Values

CMP_IZX

public static final int CMP_IZX
See Also:
Constant Field Values

CMP_IZY

public static final int CMP_IZY
See Also:
Constant Field Values

CMP_ABS

public static final int CMP_ABS
See Also:
Constant Field Values

CMP_ABSX

public static final int CMP_ABSX
See Also:
Constant Field Values

CMP_ABSY

public static final int CMP_ABSY
See Also:
Constant Field Values

CPX_IMM

public static final int CPX_IMM
See Also:
Constant Field Values

CPX_ZP

public static final int CPX_ZP
See Also:
Constant Field Values

CPX_ABS

public static final int CPX_ABS
See Also:
Constant Field Values

CPY_IMM

public static final int CPY_IMM
See Also:
Constant Field Values

CPY_ZP

public static final int CPY_ZP
See Also:
Constant Field Values

CPY_ABS

public static final int CPY_ABS
See Also:
Constant Field Values

DEC_ZP

public static final int DEC_ZP
See Also:
Constant Field Values

DEC_ZPX

public static final int DEC_ZPX
See Also:
Constant Field Values

DEC_ABS

public static final int DEC_ABS
See Also:
Constant Field Values

DEC_ABSX

public static final int DEC_ABSX
See Also:
Constant Field Values

DEX_IMP

public static final int DEX_IMP
See Also:
Constant Field Values

DEY_IMP

public static final int DEY_IMP
See Also:
Constant Field Values

EOR_IMM

public static final int EOR_IMM
See Also:
Constant Field Values

EOR_ZP

public static final int EOR_ZP
See Also:
Constant Field Values

EOR_ZPX

public static final int EOR_ZPX
See Also:
Constant Field Values

EOR_ABS

public static final int EOR_ABS
See Also:
Constant Field Values

EOR_ABSX

public static final int EOR_ABSX
See Also:
Constant Field Values

EOR_ABSY

public static final int EOR_ABSY
See Also:
Constant Field Values

EOR_IZX

public static final int EOR_IZX
See Also:
Constant Field Values

EOR_IZY

public static final int EOR_IZY
See Also:
Constant Field Values

INC_ZP

public static final int INC_ZP
See Also:
Constant Field Values

INC_ZPX

public static final int INC_ZPX
See Also:
Constant Field Values

INC_ABS

public static final int INC_ABS
See Also:
Constant Field Values

INC_ABSX

public static final int INC_ABSX
See Also:
Constant Field Values

INX_IMP

public static final int INX_IMP
See Also:
Constant Field Values

INY_IMP

public static final int INY_IMP
See Also:
Constant Field Values

JMP_ABS

public static final int JMP_ABS
See Also:
Constant Field Values

JMP_IND

public static final int JMP_IND
See Also:
Constant Field Values

JSR_ABS

public static final int JSR_ABS
See Also:
Constant Field Values

LDA_IMM

public static final int LDA_IMM
See Also:
Constant Field Values

LDA_ZP

public static final int LDA_ZP
See Also:
Constant Field Values

LDA_ZPX

public static final int LDA_ZPX
See Also:
Constant Field Values

LDA_ABS

public static final int LDA_ABS
See Also:
Constant Field Values

LDA_ABSX

public static final int LDA_ABSX
See Also:
Constant Field Values

LDA_ABSY

public static final int LDA_ABSY
See Also:
Constant Field Values

LDA_IZX

public static final int LDA_IZX
See Also:
Constant Field Values

LDA_IZY

public static final int LDA_IZY
See Also:
Constant Field Values

LDX_IMM

public static final int LDX_IMM
See Also:
Constant Field Values

LDX_ZP

public static final int LDX_ZP
See Also:
Constant Field Values

LDX_ZPY

public static final int LDX_ZPY
See Also:
Constant Field Values

LDX_ABS

public static final int LDX_ABS
See Also:
Constant Field Values

LDX_ABSY

public static final int LDX_ABSY
See Also:
Constant Field Values

LDY_IMM

public static final int LDY_IMM
See Also:
Constant Field Values

LDY_ZP

public static final int LDY_ZP
See Also:
Constant Field Values

LDY_ZPX

public static final int LDY_ZPX
See Also:
Constant Field Values

LDY_ABS

public static final int LDY_ABS
See Also:
Constant Field Values

LDY_ABSX

public static final int LDY_ABSX
See Also:
Constant Field Values

LSR_IMP

public static final int LSR_IMP
See Also:
Constant Field Values

LSR_ZP

public static final int LSR_ZP
See Also:
Constant Field Values

LSR_ZPX

public static final int LSR_ZPX
See Also:
Constant Field Values

LSR_ABS

public static final int LSR_ABS
See Also:
Constant Field Values

LSR_ABSX

public static final int LSR_ABSX
See Also:
Constant Field Values

NOP_IMP

public static final int NOP_IMP
See Also:
Constant Field Values

ORA_IMM

public static final int ORA_IMM
See Also:
Constant Field Values

ORA_ZP

public static final int ORA_ZP
See Also:
Constant Field Values

ORA_ZPX

public static final int ORA_ZPX
See Also:
Constant Field Values

ORA_IZX

public static final int ORA_IZX
See Also:
Constant Field Values

ORA_IZY

public static final int ORA_IZY
See Also:
Constant Field Values

ORA_ABS

public static final int ORA_ABS
See Also:
Constant Field Values

ORA_ABSX

public static final int ORA_ABSX
See Also:
Constant Field Values

ORA_ABSY

public static final int ORA_ABSY
See Also:
Constant Field Values

PHA_IMP

public static final int PHA_IMP
See Also:
Constant Field Values

PHP_IMP

public static final int PHP_IMP
See Also:
Constant Field Values

PLA_IMP

public static final int PLA_IMP
See Also:
Constant Field Values

PLP_IMP

public static final int PLP_IMP
See Also:
Constant Field Values

ROL_IMP

public static final int ROL_IMP
See Also:
Constant Field Values

ROL_ZP

public static final int ROL_ZP
See Also:
Constant Field Values

ROL_ZPX

public static final int ROL_ZPX
See Also:
Constant Field Values

ROL_ABS

public static final int ROL_ABS
See Also:
Constant Field Values

ROL_ABSX

public static final int ROL_ABSX
See Also:
Constant Field Values

ROR_IMP

public static final int ROR_IMP
See Also:
Constant Field Values

ROR_ZP

public static final int ROR_ZP
See Also:
Constant Field Values

ROR_ZPX

public static final int ROR_ZPX
See Also:
Constant Field Values

ROR_ABS

public static final int ROR_ABS
See Also:
Constant Field Values

ROR_ABSX

public static final int ROR_ABSX
See Also:
Constant Field Values

RTI_IMP

public static final int RTI_IMP
See Also:
Constant Field Values

RTS_IMP

public static final int RTS_IMP
See Also:
Constant Field Values

SBC_IMM

public static final int SBC_IMM
See Also:
Constant Field Values

SBC_ZP

public static final int SBC_ZP
See Also:
Constant Field Values

SBC_ZPX

public static final int SBC_ZPX
See Also:
Constant Field Values

SBC_ABS

public static final int SBC_ABS
See Also:
Constant Field Values

SBC_ABSX

public static final int SBC_ABSX
See Also:
Constant Field Values

SBC_ABSY

public static final int SBC_ABSY
See Also:
Constant Field Values

SBC_IZX

public static final int SBC_IZX
See Also:
Constant Field Values

SBC_IZY

public static final int SBC_IZY
See Also:
Constant Field Values

SEC_IMP

public static final int SEC_IMP
See Also:
Constant Field Values

SED_IMP

public static final int SED_IMP
See Also:
Constant Field Values

SEI_IMP

public static final int SEI_IMP
See Also:
Constant Field Values

STA_ZP

public static final int STA_ZP
See Also:
Constant Field Values

STA_ZPX

public static final int STA_ZPX
See Also:
Constant Field Values

STA_ABS

public static final int STA_ABS
See Also:
Constant Field Values

STA_ABSX

public static final int STA_ABSX
See Also:
Constant Field Values

STA_ABSY

public static final int STA_ABSY
See Also:
Constant Field Values

STA_IZX

public static final int STA_IZX
See Also:
Constant Field Values

STA_IZY

public static final int STA_IZY
See Also:
Constant Field Values

STX_ZP

public static final int STX_ZP
See Also:
Constant Field Values

STX_ZPY

public static final int STX_ZPY
See Also:
Constant Field Values

STX_ABS

public static final int STX_ABS
See Also:
Constant Field Values

STY_ZP

public static final int STY_ZP
See Also:
Constant Field Values

STY_ZPX

public static final int STY_ZPX
See Also:
Constant Field Values

STY_ABS

public static final int STY_ABS
See Also:
Constant Field Values

TAX_IMP

public static final int TAX_IMP
See Also:
Constant Field Values

TAY_IMP

public static final int TAY_IMP
See Also:
Constant Field Values

TSX_IMP

public static final int TSX_IMP
See Also:
Constant Field Values

TXA_IMP

public static final int TXA_IMP
See Also:
Constant Field Values

TXS_IMP

public static final int TXS_IMP
See Also:
Constant Field Values

TYA_IMP

public static final int TYA_IMP
See Also:
Constant Field Values

uLSE_ZP

public static final int uLSE_ZP
See Also:
Constant Field Values

uLSE_ZPX

public static final int uLSE_ZPX
See Also:
Constant Field Values

uLSE_IZX

public static final int uLSE_IZX
See Also:
Constant Field Values

uLSE_IZY

public static final int uLSE_IZY
See Also:
Constant Field Values

uLSE_ABS

public static final int uLSE_ABS
See Also:
Constant Field Values

uLSE_ABSX

public static final int uLSE_ABSX
See Also:
Constant Field Values

uLSE_ABSY

public static final int uLSE_ABSY
See Also:
Constant Field Values

uSAX_ZP

public static final int uSAX_ZP
See Also:
Constant Field Values

uSAX_ZPY

public static final int uSAX_ZPY
See Also:
Constant Field Values

uSAX_IZX

public static final int uSAX_IZX
See Also:
Constant Field Values

uSAX_ABS

public static final int uSAX_ABS
See Also:
Constant Field Values
Method Detail

getText

public static java.lang.String getText(int opcode)
Returns the textual representation for the passed opcode. This may contain argument slots in a java.text.MessageFormat compatible way. Note that only the lower eight bits of the passed opcode are used for lookup.

Parameters:
opcode - The opcode to decode.
Returns:
The textual representation for the passed opcode.

getEncodingLength

public static int getEncodingLength(int opcode)
Get the length that an instruction based on the passed opcode uses in memory.

Parameters:
opcode - The opcode to decode.
Returns:
The length of an instruction based on the passed opcode.

getTime

public static int getTime(int opcode)
Get the number of cycles required to execute the passed opcode.

Parameters:
opcode - The opcode.
Returns:
The number of cycles required to execute the passed instruction.

isValidOpcode

public static boolean isValidOpcode(int opcode)
Checks whether the passed opcode is valid. Valid means that this class knows a string representation for this opcode, it does not mean that it is a documented opcode.

Parameters:
opcode - The opcode to check.
Returns:
true in case the opcode can be translated into a mnemonic.