separated emulator and runtime

This commit is contained in:
Michael Steil 2010-10-06 15:58:13 +00:00
parent c53fa8ff9c
commit a2ad35412c
3 changed files with 26 additions and 18 deletions

View File

@ -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

3
perfect6502.h Normal file
View File

@ -0,0 +1,3 @@
extern void initAndResetChip();
extern void step();
extern void chipStatus();

View File

@ -1,5 +1,7 @@
#include <stdio.h>
#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);
};
}