5 |
|
|
6 |
#if DEBUGF |
#if DEBUGF |
7 |
#define debugf(x) do { \ |
#define debugf(x) do { \ |
8 |
|
PerlIO_stdoutf("#> "); \ |
9 |
PerlIO_stdoutf x ; \ |
PerlIO_stdoutf x ; \ |
10 |
} while (0) |
} while (0) |
11 |
#else |
#else |
122 |
/** INT_NONE, INT_IRQ, INT_NMI, or INT_QUIT to exit the **/ |
/** INT_NONE, INT_IRQ, INT_NMI, or INT_QUIT to exit the **/ |
123 |
/** emulation loop. **/ |
/** emulation loop. **/ |
124 |
/************************************ TO BE WRITTEN BY USER **/ |
/************************************ TO BE WRITTEN BY USER **/ |
125 |
|
|
126 |
|
int hw_int = INT_NONE; |
127 |
|
|
128 |
byte Loop6502(register M6502 *R) { |
byte Loop6502(register M6502 *R) { |
129 |
debugf(("Loop6502\n")); |
debugf(("Loop6502\n")); |
130 |
dump_R; |
dump_R; |
131 |
return INT_NONE; |
return hw_int; |
132 |
} |
} |
133 |
|
|
134 |
/** Patch6502() **********************************************/ |
/** Patch6502() **********************************************/ |
176 |
PUSHMARK(SP); |
PUSHMARK(SP); |
177 |
call_pv("Arch::init", G_DISCARD | G_NOARGS ); |
call_pv("Arch::init", G_DISCARD | G_NOARGS ); |
178 |
|
|
179 |
pull_R(R); |
int cycles = 1; |
180 |
int cycles = SvIV( get_sv("M6502::run_for", FALSE) ); |
while ( cycles ) { |
181 |
printf("run CPU for %d cycles\n", cycles); |
call_pv("Arch::cli", G_DISCARD | G_NOARGS ); |
182 |
dump_R; |
pull_R(R); |
183 |
//Run6502(R); |
cycles = SvIV( get_sv("M6502::run_for", FALSE) ); |
184 |
Exec6502(R, cycles); |
printf("run CPU for %d cycles\n", cycles); |
185 |
dump_R; |
dump_R; |
186 |
push_R(R); |
//Run6502(R); |
187 |
printf("end of CPU run\n"); |
Exec6502(R, cycles); |
188 |
|
dump_R; |
189 |
|
push_R(R); |
190 |
|
printf("end of %d cycles CPU run\n", cycles); |
191 |
|
} |
192 |
} |
} |
193 |
free(R); |
free(R); |
194 |
perl_destruct(my_perl); |
perl_destruct(my_perl); |