mirror of
https://github.com/mist64/perfect6502.git
synced 2024-06-07 21:29:32 +00:00
separated emulator and runtime
This commit is contained in:
parent
c53fa8ff9c
commit
a2ad35412c
|
@ -819,22 +819,4 @@ void handle_monitor();
|
||||||
#elif defined(COMPARE)
|
#elif defined(COMPARE)
|
||||||
#include "compare.c"
|
#include "compare.c"
|
||||||
#else
|
#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
|
#endif
|
||||||
|
|
3
perfect6502.h
Normal file
3
perfect6502.h
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
extern void initAndResetChip();
|
||||||
|
extern void step();
|
||||||
|
extern void chipStatus();
|
|
@ -1,5 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "perfect6502.h"
|
||||||
|
|
||||||
extern unsigned char memory[65536]; /* XXX must be hooked up with RAM[] in runtime.c */
|
extern unsigned char memory[65536]; /* XXX must be hooked up with RAM[] in runtime.c */
|
||||||
|
|
||||||
extern unsigned short readPC();
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user