From cdc865f8c6b623f79ee95e874c2b1db49082d7b9 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 30 May 2019 14:55:16 -0400 Subject: [PATCH] tools/emul/shell: add debug output --- tools/emul/shell/shell.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/emul/shell/shell.c b/tools/emul/shell/shell.c index 6079dc2..9459b73 100644 --- a/tools/emul/shell/shell.c +++ b/tools/emul/shell/shell.c @@ -25,6 +25,8 @@ * 3 - Filesystem blockdev seek / tell. High byte */ +//#define DEBUG + // in sync with shell.asm #define RAMSTART 0x4000 #define STDIO_PORT 0x00 @@ -51,8 +53,12 @@ static uint8_t io_read(int unused, uint16_t addr) return c; } else if (addr == FS_DATA_PORT) { if (fsdev_ptr < fsdev_size) { +#ifdef DEBUG + fprintf(stderr, "Reading FSDEV at offset %d\n", fsdev_ptr); +#endif return fsdev[fsdev_ptr++]; } else { + fprintf(stderr, "Out of bounds FSDEV read at %d\n", fsdev_ptr); return 0; } } else if (addr == FS_SEEKL_PORT) { @@ -79,6 +85,8 @@ static void io_write(int unused, uint16_t addr, uint8_t val) } else if (addr == FS_DATA_PORT) { if (fsdev_ptr < fsdev_size) { fsdev[fsdev_ptr++] = val; + } else { + fprintf(stderr, "Out of bounds FSDEV write at %d\n", fsdev_ptr); } } else if (addr == FS_SEEKL_PORT) { fsdev_ptr = (fsdev_ptr & 0xffff00) | val;