The nodelay setting for determining whether or not to block on keyboard input is now settable at runtime, in the debugger, using the "nonstop" command.

git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@65 64f78de7-aa59-e511-a0e8-0002a5492df0
This commit is contained in:
Daniel Loffgren 2015-12-09 02:27:13 +00:00
parent 0a8dd062aa
commit e015d9c0f1
3 changed files with 18 additions and 4 deletions

View File

@ -18,6 +18,7 @@
#include <v6502/cpu.h>
#include <v6502/mem.h>
#include <as6502/error.h>
#include <as6502/linectl.h>
#include "pia.h"
@ -31,6 +32,7 @@ static a1pia *pia;
static int consoleMessageSeen;
static as6502_symbol_table *table;
static v6502_breakpoint_list *breakpoint_list;
static int continuousMode;
static void fault(void *ctx, const char *e) {
(*(int *)ctx)++;
@ -46,7 +48,7 @@ static void run(v6502_cpu *cpu) {
cpu->fault_context = &faulted;
FILE *asmfile = fopen("runtime.s", "w");
pia_start(pia);
pia_start(pia, continuousMode);
// This depends on the fact that pia_start will get curses up and going
if (!consoleMessageSeen) {
@ -149,6 +151,7 @@ int main(int argc, const char * argv[])
if (v6502_handleDebuggerCommand(cpu, command, commandLen, breakpoint_list, table, run, &verbose)) {
if (v6502_compareDebuggerCommand(command, commandLen, "help")) {
printf("woz Print relevant woz monitor parameters and registers.\n");
printf("nonstop Read or toggle nonstop mode. Nonstop mode is considerably less efficient, but may be required for some software that expects runtime to continue while simultaneously waiting for keyboard input.\n");
}
continue;
}
@ -172,6 +175,17 @@ int main(int argc, const char * argv[])
v6502_read(cpu->memory, 0x2A, NO), // YSAV
v6502_read(cpu->memory, 0x2B, NO));// MODE
}
else if (v6502_compareDebuggerCommand(command, commandLen, "nonstop")) {
// command = trimheadtospc(command, commandLen);
//
// if(command[0]) {
printf("Nonstop mode %d -> %d\n", continuousMode, !continuousMode);
continuousMode = !continuousMode;
// }
// else {
// printf("Currently set to %d", continuousMode);
// }
}
else if (command[0] != ';') {
currentLineText = command;
as6502_executeAsmLineOnCPU(cpu, command, strlen(command));

View File

@ -143,11 +143,11 @@ void pia_destroy(a1pia *pia) {
free(pia);
}
void pia_start(a1pia *pia) {
void pia_start(a1pia *pia, int continuous) {
if (!pia->screen) {
pia->screen = initscr();
}
//nodelay(stdscr, true);
nodelay(stdscr, continuous);
crmode();
noecho();
nonl();

View File

@ -30,7 +30,7 @@ typedef struct {
a1pia *pia_create(v6502_memory *mem);
void pia_destroy(a1pia *pia);
void pia_start(a1pia *pia);
void pia_start(a1pia *pia, int continuous);
void pia_stop(a1pia *pia);
#endif /* defined(__apple1__pia__) */