update cpu6502 with Jim's improvements

This commit is contained in:
Brad Grantham
2018-09-10 12:29:16 -07:00
parent 5e8adf5de1
commit 85f7d8d7dd

View File

@@ -14,6 +14,12 @@
void read(int addr, unsigned char data); void read(int addr, unsigned char data);
*/ */
#ifndef CPU6502_H
#define CPU6502_H
#include <stdlib.h>
#include <assert.h>
template<class CLK, class BUS> template<class CLK, class BUS>
struct CPU6502 struct CPU6502
{ {
@@ -1468,7 +1474,8 @@ struct CPU6502
default: default:
printf("unhandled instruction %02X at %04X\n", inst, pc - 1); printf("unhandled instruction %02X at %04X\n", inst, pc - 1);
fflush(stdout); exit(1); fflush(stdout);
exit(1);
} }
assert(cycles[inst] > 0); assert(cycles[inst] > 0);
clk.add_cpu_cycles(cycles[inst]); clk.add_cpu_cycles(cycles[inst]);
@@ -1496,3 +1503,5 @@ int CPU6502<CLK, BUS>::cycles[256] =
/* 0xF- */ 2, 5, -1, -1, -1, 4, 6, -1, 2, 4, -1, -1, -1, 4, 7, -1, /* 0xF- */ 2, 5, -1, -1, -1, 4, 6, -1, 2, 4, -1, -1, -1, 4, 7, -1,
}; };
#endif // CPU6502_H