com.monkeycoder.monkeynes.hardware
Class NesOpCodeTable

java.lang.Object
  |
  +--com.monkeycoder.monkeynes.hardware.NesOpCodeTable

public class NesOpCodeTable
extends Object

This class contains every shred of information available about every OpCode supported by the NES. Its arrays and helper functions are intended for static access.

Originally part of the MonkeyNES project.

Author:
David Stephens

Field Summary
static int[] bt_cycles
          This is the Branch Taken extra cycles count.
static int[] cycles
          The base number of machine cycles each OpCode requires to complete.
static int[] length
          The length in bytes of each OpCode.
static int[] mode
          The mode in which each OpCode operates.
static int MODE_ABSOLUTE
           
static int MODE_ABSOLUTE_X
           
static int MODE_ABSOLUTE_Y
           
static int MODE_ACCUMULATOR
           
static int MODE_COUNT
           
static int MODE_IMMEDIATE
           
static int MODE_IMPLIED
           
static int MODE_INDIRECT
           
static int MODE_INDIRECT_X
           
static int MODE_INDIRECT_Y
           
static int MODE_RELATIVE
           
static int MODE_UNKNOWN
           
static int MODE_ZERO_PAGE
           
static int MODE_ZERO_PAGE_X
           
static int MODE_ZERO_PAGE_Y
           
static String[] name
          The 6502 assembly name of the OpCode.
static int[] pb_cycles
          This is the Page Boundry Crossing Extra Cycle Count.
 
Constructor Summary
NesOpCodeTable()
           
 
Method Summary
static int getOpCodeBySyntax(String baseOp, String params)
          Returns the OpCode index value from a 6502 assembly statement based on the syntax of that statement.
static String getParam(String in)
          Returns just the actual hex value portion of a paramater from the full 6502 formatted parameter String.
static String getSyntaxFormatted(int opCodeNum, int inByte1, int inByte2)
          Produces a String containing the 6502 assembly language version of an OpCode and its parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_UNKNOWN

public static final int MODE_UNKNOWN
See Also:
Constant Field Values

MODE_IMPLIED

public static final int MODE_IMPLIED
See Also:
Constant Field Values

MODE_ACCUMULATOR

public static final int MODE_ACCUMULATOR
See Also:
Constant Field Values

MODE_IMMEDIATE

public static final int MODE_IMMEDIATE
See Also:
Constant Field Values

MODE_ZERO_PAGE

public static final int MODE_ZERO_PAGE
See Also:
Constant Field Values

MODE_ZERO_PAGE_X

public static final int MODE_ZERO_PAGE_X
See Also:
Constant Field Values

MODE_ZERO_PAGE_Y

public static final int MODE_ZERO_PAGE_Y
See Also:
Constant Field Values

MODE_ABSOLUTE

public static final int MODE_ABSOLUTE
See Also:
Constant Field Values

MODE_ABSOLUTE_X

public static final int MODE_ABSOLUTE_X
See Also:
Constant Field Values

MODE_ABSOLUTE_Y

public static final int MODE_ABSOLUTE_Y
See Also:
Constant Field Values

MODE_INDIRECT

public static final int MODE_INDIRECT
See Also:
Constant Field Values

MODE_INDIRECT_X

public static final int MODE_INDIRECT_X
See Also:
Constant Field Values

MODE_INDIRECT_Y

public static final int MODE_INDIRECT_Y
See Also:
Constant Field Values

MODE_RELATIVE

public static final int MODE_RELATIVE
See Also:
Constant Field Values

MODE_COUNT

public static final int MODE_COUNT
See Also:
Constant Field Values

name

public static final String[] name
The 6502 assembly name of the OpCode.


mode

public static final int[] mode
The mode in which each OpCode operates.


length

public static final int[] length
The length in bytes of each OpCode.


cycles

public static final int[] cycles
The base number of machine cycles each OpCode requires to complete. This does not take into account page boundry crossing or taking branches.


pb_cycles

public static final int[] pb_cycles
This is the Page Boundry Crossing Extra Cycle Count. This many cycles are added to the required cycle count if a page boundry is crossed.


bt_cycles

public static final int[] bt_cycles
This is the Branch Taken extra cycles count. This many cycles are added to the required cycle count if a branch is taken.

Constructor Detail

NesOpCodeTable

public NesOpCodeTable()
Method Detail

getSyntaxFormatted

public static String getSyntaxFormatted(int opCodeNum,
                                        int inByte1,
                                        int inByte2)
Produces a String containing the 6502 assembly language version of an OpCode and its parameters.

Parameters:
opCodeNum - The OpCode for which the 6502 assembly will be produced.
inByte1 - The first byte of parameter data or 0 if there is no first parameter.
inByte2 - The second byte of parameter data or 0 if there is no second parameter.
Returns:
The 6502 assembly formatted code.

getOpCodeBySyntax

public static int getOpCodeBySyntax(String baseOp,
                                    String params)
Returns the OpCode index value from a 6502 assembly statement based on the syntax of that statement.

Parameters:
baseOp - The OpCode nane.
params - The text of the params.
Returns:
The OpCode index value.

getParam

public static String getParam(String in)
Returns just the actual hex value portion of a paramater from the full 6502 formatted parameter String.

Parameters:
in - The String to analyze.
Returns:
The hex portion of the parameter string.