MOS 6502 cpu emulator
Go to file
2021-06-25 00:08:30 +02:00
LICENSE Initial commit 2020-08-08 22:26:15 +02:00
puce6502.c fixed timing issues 2021-06-25 00:08:30 +02:00
puce6502.h fixed timing issues 2021-06-25 00:08:30 +02:00
README.md Update README.md 2021-06-25 00:04:03 +02:00

puce6502

This is a simple and readable emulation of the MOS 6502 CPU
It implements all original instructions and is cycle accurate It also passes the Klaus Test Suite - set _FUNCTIONNAL_TESTS to 1 and compile it as a standalone program.

API is as simple as :

uint16_t puce6502Exec(unsigned long long int cycleCount);
void puce6502RST();
void puce6502IRQ();
void puce6502NMI();

the first function will execute as many instructions as needed to reach cycleCount clock cycles - it will return the updated value of the Program Counter the 3 others will simulate a RESET, INTERUPT and NON-MASKABLE INTERUPT.

You are expected to provide the functions to handle read and writes to memory (ROM, RAM, Soft Switches, extension cards ROMs, PIA, VIA, ACIA etc...) They have to comply with these prototypes :

extern uint8_t readMem(uint16_t address);
extern void writeMem(uint16_t address, uint8_t value);

finnaly, you can import the variable ticks (extern ticks) into your code - it holds the accumulated clock cycles since start.

For an example of use, you can refer to reinette II plus a french Apple II plus emulator.

Have fun !