Class DM6502

The main emulator class.

class DM6502 ;

Fields

NameTypeDescription
STACK_ADDRESS const(ushort)Address where the stack data is located.
VECTOR_IRQ const(ushort)Address where the Interrupt ReQuest vector address is located.
VECTOR_NMI const(ushort)Address where the Non-Maskable Interrupt vector address is located.
VECTOR_RES const(ushort)Address where the RESet vector address is located.

Methods

NameDescription
addBusComponent (Component, Address) Installs a bus component into the instance.
addInstruction (Element) Installs an instruction in this instance.
addInstructionSet (Set) Installs a whole instruction set on this instance.
addressAbsolute () Fetch the value stored on the address next to the current instruction being executed.
addressAbsoluteX () Fetch the value stored on the address next to the current instruction plus the value of the X register.
addressAbsoluteY () Fetch the value stored on the address next to the current instruction plus the value of the Y register.
addressImmediate () Fetch the value next from the current instruction being executed.
addressIndirect () Fetch the value pointed by the address stored on the address next to the current executing instruction.
addressIndirectX () Fetch the value stored on the address pointed by the value next to the current instruction plus the value of the X register.
addressIndirectY () Fetch the value stored on the address pointed by the value next to the current instruction plus the value of the Y register.
addressRelative () Fetch the value pointed by the address of the next instruction plus the value stored next to the currently executing instruction.
addressZero () Fetch the value stored on the zero page pointed by the byte next to the currently executing instruction.
addressZeroX () Fetch the value at the address stored next to the currently executing instruction plus the value of the X register.
addressZeroY () Fetch the value at the address stored next to the currently executing instruction plus the value of the X register.
consolidate () Consolidates this instance. Consolidated means that the instance is ready for execution, while the instance is in this state, you cannot add any kind of component to this instance, the opposite happens if is not consolidated, you cannot execute anything unless you consolidate the instance.
decreaseAccumulator (Value) Decrease the accumulator by the given value.
decreaseAccumulatorBCD (Value) Decrease the accumulator by the given value in BCD mode.
decreaseProgramCounter (Value) Decrease the program counter by the given value.
decreaseStackPointer (Value) Decrease the stack pointer by the given value.
decreaseXRegister (Value) Decrease the X register by the given value.
decreaseYRegister (Value) Decrease the Y register by the given value.
doOpcode () Execute the opcode pointed by the program counter.
fetch () Reads the byte stored on the current address of the program counter and increase the program counter by one.
fetchAddress () Reads an address stored on the current address of the program counter and increase the program counter by two.
getAccumulator () Returns the current accumulator's value.
getBreakFlag () Returns the break flag's status.
getBusDeviceByAddress (Address) Returns a bus component located on the given address, if there's nothing on that address, null will be returned instead.
getCarryFlag () Returns the carry flag's status.
getClockController () Get the current clock controller of this instance.
getDecimalFlag () Returns the decimal flag's status.
getFlags () Return the flags's value.
getInstruction (Opcode) Returns the instruction with the given opcode, if there's no instruction, null is returned instead.
getInterruptFlag () Returns the interrupt flag's status.
getNegativeFlag () Returns the negative flag's status.
getOverflowFlag () Returns the overflow flag's status.
getProgramCounter () Returns the current program counter's value.
getStackPointer () Returns the current stack pointer's value.
getTracer () Get the current tracer used on this instance.
getXRegister () Returns the current X register's value.
getYRegister () Returns the current Y register's value.
getZeroFlag () Returns the zero flag's status.
hasTracer () Checks if this instance has a tracer installed.
increaseAccumulator (Value) Increase the accumulator by the given value.
increaseAccumulatorBCD (Value) Increase the accumulator by the given value in BCD mode.
increaseProgramCounter (Value) Increase the program counter by the given value.
increaseStackPointer (Value) Increase the stack pointer by the given value.
increaseXRegister (Value) Increase the X register by the given value.
increaseYRegister (Value) Increase the Y register by the given value.
isConsolidated () Checks if this instance is consolidated.
isRunning () Checks if this instance is running.
jumpToIRQ () Set the program counter with the address stored on the IRQ vector address.
jumpToNMI () Set the program counter with the address stored on the NMI vector address.
jumpToRES () Set the program counter with the address stored on the RES vector address.
pop () Pop a byte from the stack.
popAddress () Pop an address from the stack.
push (Value) Push a byte into the stack.
pushAddress (Address) Push an address into the stack.
read (Address) Read a byte from the bus.
readShort (Address) Read a 16-bit value from the bus.
removeTracer () Removes the tracer of this instance.
run () Executes in a loop this emulator instance.
setAccumulator (Value) Set the accumulator to a new value.
setBreakFlag (Status) Enables/Disables the break flag.
setCarryFlag (Status) Enables/Disables the carry flag.
setClockController (Clock) Sets the clock controller on this instance.
setDecimalFlag (Status) Enables/Disables the decimal flag.
setFlags (Value) Set the flags to a new value.
setInterruptFlag (Status) Enables/Disables the interrupt flag.
setNegativeFlag (Status) Enables/Disables the negative flag.
setOverflowFlag (Status) Enables/Disables the overflow flag.
setProgramCounter (Value) Set the program counter to a new value.
setStackPointer (Value) Set the stack pointer to a new value.
setTracer (NewTracer) Installs a tracer on this instance.
setXRegister (Value) Set the X register to a new value.
setYRegister (Value) Set the Y register to a new value.
setZeroFlag (Status) Enables/Disables the zero flag.
stop () Stops the loop execution of this instance.
triggerIRQ () Trigger the IRQ just like the original 6502 would do.
triggerNMI () Trigger the NMI just like the original 6502 would do.
triggerRES () Trigger a reset just like the original 6502 would do.
waitCycle () Calls the waitCycle method of the clock controller of this instance.
waitCycles (Cycles) Calls the waitCycle method for the given amount.
write (Address, Data) Write a byte into the address bus.
writeShort (Address, Value) Write a 16-bit value into the address bus.