Adapted PIA code to allow dropping to the debugger via the back tick key
git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@34 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
parent
0d7a3c032a
commit
1660b3a08f
|
@ -24,7 +24,6 @@
|
|||
#define ROM_SIZE 0x00FF
|
||||
#define RESET_VECTOR 0xFF00
|
||||
|
||||
static int faulted = 0;
|
||||
static v6502_cpu *cpu;
|
||||
static a1pia *pia;
|
||||
|
||||
|
@ -37,9 +36,13 @@ static void fault(void *ctx, const char *e) {
|
|||
//}
|
||||
|
||||
static void run(v6502_cpu *cpu) {
|
||||
int faulted = 0;
|
||||
cpu->fault_callback = fault;
|
||||
cpu->fault_context = &faulted;
|
||||
|
||||
FILE *asmfile = fopen("runtime.s", "w");
|
||||
pia_start(pia);
|
||||
while (!faulted) {
|
||||
while (!faulted && !pia->signalled) {
|
||||
dis6502_printAnnotatedInstruction(asmfile, cpu, cpu->pc);
|
||||
v6502_step(cpu);
|
||||
v6502_printCpuState(asmfile, cpu);
|
||||
|
@ -58,8 +61,6 @@ int main(int argc, const char * argv[])
|
|||
{
|
||||
cpu = v6502_createCPU();
|
||||
cpu->memory = v6502_createMemory(v6502_memoryStartCeiling + 1);
|
||||
cpu->fault_callback = fault;
|
||||
cpu->fault_context = &faulted;
|
||||
|
||||
v6502_breakpoint_list *breakpoint_list = v6502_createBreakpointList();
|
||||
|
||||
|
|
10
apple1/pia.c
10
apple1/pia.c
|
@ -88,6 +88,11 @@ uint8_t keyboardReadReadyCallback(struct _v6502_memory *memory, uint16_t offset,
|
|||
saveFreeze(memory, "freeze.ram");
|
||||
int c = getch();
|
||||
|
||||
if (c == '`') {
|
||||
context->signalled++;
|
||||
return KEYBOARD_NOTREADY;
|
||||
}
|
||||
|
||||
if (c != ERR) {
|
||||
context->buf = asciiCharFromCursesKey(c);
|
||||
return KEYBOARD_READY;
|
||||
|
@ -145,8 +150,11 @@ void pia_start(a1pia *pia) {
|
|||
crmode();
|
||||
noecho();
|
||||
nonl();
|
||||
pia->signalled = 0;
|
||||
wrefresh(pia->screen);
|
||||
}
|
||||
|
||||
void pia_stop(a1pia *pia) {
|
||||
|
||||
pia->screen = NULL;
|
||||
endwin();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ typedef struct {
|
|||
/** @brief Hardwired memory used to trap video activity and report keyboard input */
|
||||
v6502_memory *memory;
|
||||
char buf;
|
||||
int signalled;
|
||||
} a1pia;
|
||||
|
||||
a1pia *pia_create(v6502_memory *mem);
|
||||
|
|
Loading…
Reference in New Issue