1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 23:18:05 +11:00

emul: add live register stats in the corner

This commit is contained in:
Virgil Dupras 2020-05-23 14:42:36 -04:00
parent 08b0c56ff6
commit 7f3e55cb51
3 changed files with 24 additions and 3 deletions

View File

@ -173,6 +173,12 @@ void emul_memdump()
fclose(fp); fclose(fp);
} }
void emul_debugstr(char *s)
{
sprintf(s, "SP %04x (%04x) IX %04x (%04x)",
m.cpu.R1.wr.SP, m.minsp, m.cpu.R1.wr.IX, m.maxix);
}
void emul_printdebug() void emul_printdebug()
{ {
fprintf(stderr, "Min SP: %04x\n", m.minsp); fprintf(stderr, "Min SP: %04x\n", m.minsp);

View File

@ -35,4 +35,5 @@ bool emul_steps(unsigned int steps);
void emul_loop(); void emul_loop();
void emul_trace(ushort addr); void emul_trace(ushort addr);
void emul_memdump(); void emul_memdump();
void emul_debugstr(char *s);
void emul_printdebug(); void emul_printdebug();

View File

@ -20,7 +20,15 @@
static FILE *fp; static FILE *fp;
static int retcode = 0; static int retcode = 0;
WINDOW *bw, *w; WINDOW *bw, *dw, *w;
void debug_panel()
{
char buf[30];
emul_debugstr(buf);
mvwaddnstr(dw, 0, 0, buf, 30);
wrefresh(dw);
}
static uint8_t iord_stdio() static uint8_t iord_stdio()
{ {
@ -28,6 +36,7 @@ static uint8_t iord_stdio()
if (fp != NULL) { if (fp != NULL) {
c = getc(fp); c = getc(fp);
} else { } else {
debug_panel();
c = wgetch(w); c = wgetch(w);
} }
if (c == EOF) { if (c == EOF) {
@ -74,13 +83,18 @@ int main(int argc, char *argv[])
} else if (argc == 1) { } else if (argc == 1) {
fp = NULL; fp = NULL;
initscr(); cbreak(); noecho(); nl(); clear(); initscr(); cbreak(); noecho(); nl(); clear();
// border window
bw = newwin(WLINES+2, WCOLS+2, 0, 0); bw = newwin(WLINES+2, WCOLS+2, 0, 0);
wborder(bw, 0, 0, 0, 0, 0, 0, 0, 0); wborder(bw, 0, 0, 0, 0, 0, 0, 0, 0);
wrefresh(bw); wrefresh(bw);
// debug panel
dw = newwin(1, 30, LINES-1, COLS-30);
w = newwin(WLINES, WCOLS, 1, 1); w = newwin(WLINES, WCOLS, 1, 1);
scrollok(w, 1); scrollok(w, 1);
while (emul_step()); while (emul_steps(1000)) {
nocbreak(); echo(); delwin(w); delwin(bw); endwin(); debug_panel();
}
nocbreak(); echo(); delwin(w); delwin(bw); delwin(dw); endwin();
printf("\nDone!\n"); printf("\nDone!\n");
emul_printdebug(); emul_printdebug();
} else { } else {