mirror of
https://github.com/DavidBuchanan314/6502-emu.git
synced 2025-01-14 00:31:32 +00:00
Static-ify instruction arrays
This commit is contained in:
parent
c3674370ef
commit
64df2291fc
@ -160,9 +160,9 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (optind >= argc) {
|
if (optind >= argc) {
|
||||||
fprintf(stderr, "Error: expected binary file to load\n\n");
|
fprintf(stderr, "Error: expected binary file to load\n\n");
|
||||||
usage(argv);
|
usage(argv);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (load_rom(argv[optind], load_addr) != 0) {
|
if (load_rom(argv[optind], load_addr) != 0) {
|
||||||
printf("Error loading \"%s\".\n", argv[optind]);
|
printf("Error loading \"%s\".\n", argv[optind]);
|
||||||
@ -171,7 +171,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (interactive) raw_stdin(); // allow individual keystrokes to be detected
|
if (interactive) raw_stdin(); // allow individual keystrokes to be detected
|
||||||
|
|
||||||
init_tables();
|
//init_tables();
|
||||||
init_uart();
|
init_uart();
|
||||||
|
|
||||||
reset_cpu(a, x, y, sp, sr, pc);
|
reset_cpu(a, x, y, sp, sr, pc);
|
||||||
|
14
6502.h
14
6502.h
@ -19,8 +19,8 @@ extern uint8_t SP; // points to first empty stack location
|
|||||||
extern uint8_t extra_cycles;
|
extern uint8_t extra_cycles;
|
||||||
extern uint64_t total_cycles;
|
extern uint64_t total_cycles;
|
||||||
|
|
||||||
extern void * read_addr;
|
extern void *read_addr;
|
||||||
extern void * write_addr;
|
extern void *write_addr;
|
||||||
|
|
||||||
struct StatusBits{
|
struct StatusBits{
|
||||||
bool carry:1; // bit 0
|
bool carry:1; // bit 0
|
||||||
@ -58,20 +58,20 @@ typedef enum {
|
|||||||
} Mode;
|
} Mode;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char * mnemonic;
|
char *mnemonic;
|
||||||
void (*function)();
|
void (*function)();
|
||||||
Mode mode;
|
Mode mode;
|
||||||
uint8_t cycles;
|
uint8_t cycles;
|
||||||
} Instruction;
|
} Instruction;
|
||||||
|
|
||||||
extern Instruction instructions[0x100];
|
//extern Instruction instructions[0x100];
|
||||||
|
|
||||||
void init_tables();
|
//void init_tables();
|
||||||
|
|
||||||
void reset_cpu(int _a, int _x, int _y, int _sp, int _sr, int _pc);
|
void reset_cpu(int _a, int _x, int _y, int _sp, int _sr, int _pc);
|
||||||
|
|
||||||
int load_rom(char * filename, int load_addr);
|
int load_rom(char *filename, int load_addr);
|
||||||
|
|
||||||
int step_cpu(int verbose);
|
int step_cpu(int verbose);
|
||||||
|
|
||||||
void save_memory(char * filename);
|
void save_memory(char *filename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user