From 9b4b907236003375bfb1373f8236c8a4cf440bdc Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 12 May 2019 14:32:24 -0400 Subject: [PATCH] tools/emul/shell: fix srong SeekL return value Also, add warning on attempts to write to ROM. --- tools/emul/shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/emul/shell.c b/tools/emul/shell.c index 0f7e74d..f3263bf 100644 --- a/tools/emul/shell.c +++ b/tools/emul/shell.c @@ -26,6 +26,7 @@ */ // in sync with shell.asm +#define RAMSTART 0x4000 #define STDIO_PORT 0x00 #define FS_DATA_PORT 0x01 #define FS_SEEKL_PORT 0x02 @@ -54,7 +55,7 @@ static uint8_t io_read(int unused, uint16_t addr) return 0; } } else if (addr == FS_SEEKL_PORT) { - return fsdev_ptr && 0xff; + return fsdev_ptr & 0xff; } else if (addr == FS_SEEKH_PORT) { return fsdev_ptr >> 8; } else { @@ -92,6 +93,9 @@ static uint8_t mem_read(int unused, uint16_t addr) static void mem_write(int unused, uint16_t addr, uint8_t val) { + if (addr < RAMSTART) { + fprintf(stderr, "Writing to ROM (%d)!\n", addr); + } mem[addr] = val; }