Added suspension tracking to PIA, which allows prompting for input on keyboard reads in the debugger

git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@41 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
Daniel Loffgren 2015-09-19 05:16:51 +00:00
parent bd321ad1a7
commit d8d3d30bfb
2 changed files with 13 additions and 0 deletions

View File

@ -87,7 +87,17 @@ uint8_t keyboardReadReadyCallback(struct _v6502_memory *memory, uint16_t offset,
}
saveFreeze(memory, "freeze.ram");
if (context->suspended) {
printf("Keyboard readiness register ($D011) trap read.\n");
printf("Press a key for input to keyboard register ($D010): ");
fflush(stdout);
crmode();
}
int c = getch();
if (context->suspended) {
printf("%c\r\n", c);
}
if (c == '`') {
context->signalled++;
@ -152,10 +162,12 @@ void pia_start(a1pia *pia) {
noecho();
nonl();
pia->signalled = 0;
pia->suspended = 0;
wrefresh(pia->screen);
}
void pia_stop(a1pia *pia) {
pia->suspended = 1;
pia->screen = NULL;
endwin();
}

View File

@ -24,6 +24,7 @@ typedef struct {
v6502_memory *memory;
char buf;
int signalled;
int suspended;
} a1pia;
a1pia *pia_create(v6502_memory *mem);