diff --git a/perfect6502.c b/perfect6502.c index 45f6a23..1ca88e0 100644 --- a/perfect6502.c +++ b/perfect6502.c @@ -819,22 +819,4 @@ void handle_monitor(); #elif defined(COMPARE) #include "compare.c" #else -int -main() -{ - initAndResetChip(); - - /* set up memory for user program */ - init_monitor(); - - /* emulate the 6502! */ - for (;;) { - step(); - if (isNodeHigh(clk0)) - handle_monitor(); - - chipStatus(); - //if (!(cycle % 1000)) printf("%d\n", cycle); - }; -} #endif diff --git a/perfect6502.h b/perfect6502.h new file mode 100644 index 0000000..bf42136 --- /dev/null +++ b/perfect6502.h @@ -0,0 +1,3 @@ +extern void initAndResetChip(); +extern void step(); +extern void chipStatus(); diff --git a/runtime_init.c b/runtime_init.c index c071d1d..f4fa6fd 100644 --- a/runtime_init.c +++ b/runtime_init.c @@ -1,5 +1,7 @@ #include +#include "perfect6502.h" + extern unsigned char memory[65536]; /* XXX must be hooked up with RAM[] in runtime.c */ extern unsigned short readPC(); @@ -102,3 +104,24 @@ handle_monitor() } } +int +main() +{ + int clk = 0; + + initAndResetChip(); + + /* set up memory for user program */ + init_monitor(); + + /* emulate the 6502! */ + for (;;) { + step(); + clk = !clk; + if (clk) + handle_monitor(); + + //chipStatus(); + //if (!(cycle % 1000)) printf("%d\n", cycle); + }; +}