mirror of
https://github.com/DavidBuchanan314/6502-emu.git
synced 2024-12-25 22:30:50 +00:00
fixed some warnings and compiling errors, when compiling with G++ instead of GCC
This commit is contained in:
parent
8abf954b33
commit
b81e3c9da7
@ -19,10 +19,10 @@ void step_delay()
|
||||
nanosleep(&req, &rem);
|
||||
}
|
||||
|
||||
void run_cpu(long cycle_stop, int verbose, int mem_dump, int break_pc, int fast)
|
||||
void run_cpu(uint64_t cycle_stop, int verbose, int mem_dump, int break_pc, int fast)
|
||||
{
|
||||
long cycles = 0;
|
||||
int cycles_per_step = (CPU_FREQ / (ONE_SECOND / STEP_DURATION));
|
||||
uint64_t cycles = 0;
|
||||
uint64_t cycles_per_step = (CPU_FREQ / (ONE_SECOND / STEP_DURATION));
|
||||
|
||||
for (;;) {
|
||||
for (cycles %= cycles_per_step; cycles < cycles_per_step;) {
|
||||
@ -94,7 +94,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int a, x, y, sp, sr, pc, load_addr;
|
||||
int verbose, interactive, mem_dump, break_pc, fast;
|
||||
long cycles;
|
||||
uint64_t cycles;
|
||||
int opt;
|
||||
|
||||
verbose = 0;
|
||||
|
6
6502.c
6
6502.c
@ -416,12 +416,12 @@ static inline uint8_t stack_pull()
|
||||
|
||||
static inline uint8_t *read_ptr()
|
||||
{
|
||||
return read_addr = get_ptr[inst.mode]();
|
||||
return (uint8_t*) (read_addr = get_ptr[inst.mode]());
|
||||
}
|
||||
|
||||
static inline uint8_t *write_ptr()
|
||||
{
|
||||
return write_addr = get_ptr[inst.mode]();
|
||||
return (uint8_t*) (write_addr = get_ptr[inst.mode]());
|
||||
}
|
||||
|
||||
/* Branch logic common to all branch instructions */
|
||||
@ -1068,7 +1068,7 @@ int step_cpu(int verbose) // returns cycle count
|
||||
return inst.cycles + extra_cycles;
|
||||
}
|
||||
|
||||
void save_memory(char *filename) { // dump memory for analysis (slows down emulation significantly)
|
||||
void save_memory(const char *filename) { // dump memory for analysis (slows down emulation significantly)
|
||||
if (filename == NULL) filename = "memdump";
|
||||
FILE *fp = fopen(filename, "w");
|
||||
fwrite(&memory, sizeof(memory), 1, fp);
|
||||
|
4
6502.h
4
6502.h
@ -58,7 +58,7 @@ typedef enum {
|
||||
} Mode;
|
||||
|
||||
typedef struct {
|
||||
char *mnemonic;
|
||||
const char *mnemonic;
|
||||
void (*function)();
|
||||
Mode mode;
|
||||
uint8_t cycles;
|
||||
@ -74,4 +74,4 @@ int load_rom(char *filename, int load_addr);
|
||||
|
||||
int step_cpu(int verbose);
|
||||
|
||||
void save_memory(char *filename);
|
||||
void save_memory(const char *filename);
|
||||
|
Loading…
Reference in New Issue
Block a user