mirror of
https://github.com/satoshinm/pill_6502.git
synced 2024-06-12 23:29:33 +00:00
Add a fake6502.h header extracting the interface from fake6502
This commit is contained in:
parent
efb8da7c7a
commit
a8991b2e94
|
@ -105,6 +105,8 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "fake6502.h"
|
||||||
|
|
||||||
//6502 defines
|
//6502 defines
|
||||||
#define UNDOCUMENTED //when this is defined, undocumented opcodes are handled.
|
#define UNDOCUMENTED //when this is defined, undocumented opcodes are handled.
|
||||||
//otherwise, they're simply treated as NOPs.
|
//otherwise, they're simply treated as NOPs.
|
||||||
|
|
57
src/fake6502.h
Normal file
57
src/fake6502.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
// Header for declaring external interface to fake6502.c
|
||||||
|
|
||||||
|
|
||||||
|
/* Fake6502 requires you to provide two external *
|
||||||
|
* functions: *
|
||||||
|
* */
|
||||||
|
uint8_t read6502(uint16_t address);
|
||||||
|
void write6502(uint16_t address, uint8_t value);
|
||||||
|
/* *
|
||||||
|
* You may optionally pass Fake6502 the pointer to a *
|
||||||
|
* function which you want to be called after every *
|
||||||
|
* emulated instruction. This function should be a *
|
||||||
|
* void with no parameters expected to be passed to *
|
||||||
|
* it. *
|
||||||
|
* *
|
||||||
|
* This can be very useful. For example, in a NES *
|
||||||
|
* emulator, you check the number of clock ticks *
|
||||||
|
* that have passed so you can know when to handle *
|
||||||
|
* APU events. *
|
||||||
|
* *
|
||||||
|
* To pass Fake6502 this pointer, use the *
|
||||||
|
* hookexternal(void *funcptr) function provided. *
|
||||||
|
* *
|
||||||
|
* To disable the hook later, pass NULL to it. */
|
||||||
|
|
||||||
|
|
||||||
|
void reset6502();
|
||||||
|
/* - Call this once before you begin execution. */
|
||||||
|
|
||||||
|
void exec6502(uint32_t tickcount);
|
||||||
|
/* - Execute 6502 code up to the next specified *
|
||||||
|
* count of clock ticks. */
|
||||||
|
|
||||||
|
void step6502();
|
||||||
|
/* - Execute a single instrution. *
|
||||||
|
* */
|
||||||
|
|
||||||
|
void irq6502();
|
||||||
|
/* - Trigger a hardware IRQ in the 6502 core. */
|
||||||
|
|
||||||
|
void nmi6502();
|
||||||
|
/* - Trigger an NMI in the 6502 core. */
|
||||||
|
|
||||||
|
void hookexternal(void *funcptr);
|
||||||
|
/* - Pass a pointer to a void function taking no *
|
||||||
|
* parameters. This will cause Fake6502 to call *
|
||||||
|
* that function once after each emulated *
|
||||||
|
* instruction. */
|
||||||
|
|
||||||
|
extern uint32_t clockticks6502;
|
||||||
|
/* - A running total of the emulated cycle count. */
|
||||||
|
|
||||||
|
extern uint32_t instructions;
|
||||||
|
/* - A running total of the total emulated *
|
||||||
|
* instruction count. This is not related to *
|
||||||
|
* clock cycle timing. */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user