GrafX2 2.9.3227
The ultimate 256-color painting program
|
6502 emulator instance. More...
#include <6502.h>
Data Fields | |
zusize | cycles |
Number of cycles executed in the current call to m6502_run . More... | |
void * | context |
The value used as the first argument when calling a callback. More... | |
zuint8(* | read )(void *context, zuint16 address) |
Callback: Called when the CPU needs to read 8 bits from memory. More... | |
void(* | write )(void *context, zuint16 address, zuint8 value) |
Callback: Called when the CPU needs to write 8 bits to memory. More... | |
Z6502State | state |
CPU registers and internal bits. More... | |
zuint8 | opcode |
Temporary storage for memory address resolution. More... | |
zuint8 | ea_cycles |
Temporary storage for the number of cycles consumed by instructions requiring memory address resolution. More... | |
zuint16 | ea |
Temporary storage for the resolved memory address. More... | |
6502 emulator instance.
This structure contains the state of the emulated CPU and callback pointers necessary to interconnect the emulator with external logic. There is no constructor function, so, before using an object of this type, some of its members must be initialized, in particular the following: context
, read
and write
.
zusize M6502::cycles |
Number of cycles executed in the current call to m6502_run
.
m6502_run
sets this variable to 0
before starting to execute instructions and its value persists after returning. The callbacks can use this variable to know during what cycle they are being called.
void* M6502::context |
The value used as the first argument when calling a callback.
This variable should be initialized before using the emulator and can be used to reference the context/instance of the machine being emulated.
Callback: Called when the CPU needs to read 8 bits from memory.
context | The value of the member context . |
address | The memory address to read from. |
Callback: Called when the CPU needs to write 8 bits to memory.
context | The value of the member context . |
address | The memory address to write to. |
value | The value to write. |
Z6502State M6502::state |
CPU registers and internal bits.
It contains the state of the registers and the interrupt flags. This is what a debugger should use as its data source.
zuint8 M6502::opcode |
Temporary storage for memory address resolution.
This is an internal private variable.
zuint8 M6502::ea_cycles |
Temporary storage for the number of cycles consumed by instructions requiring memory address resolution.
This is an internal private variable.
zuint16 M6502::ea |
Temporary storage for the resolved memory address.
This is an internal private variable.