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

tools/emul/shell: add debug output

This commit is contained in:
Virgil Dupras 2019-05-30 14:55:16 -04:00
parent 83e375936c
commit cdc865f8c6

View File

@ -25,6 +25,8 @@
* 3 - Filesystem blockdev seek / tell. High byte * 3 - Filesystem blockdev seek / tell. High byte
*/ */
//#define DEBUG
// in sync with shell.asm // in sync with shell.asm
#define RAMSTART 0x4000 #define RAMSTART 0x4000
#define STDIO_PORT 0x00 #define STDIO_PORT 0x00
@ -51,8 +53,12 @@ static uint8_t io_read(int unused, uint16_t addr)
return c; return c;
} else if (addr == FS_DATA_PORT) { } else if (addr == FS_DATA_PORT) {
if (fsdev_ptr < fsdev_size) { if (fsdev_ptr < fsdev_size) {
#ifdef DEBUG
fprintf(stderr, "Reading FSDEV at offset %d\n", fsdev_ptr);
#endif
return fsdev[fsdev_ptr++]; return fsdev[fsdev_ptr++];
} else { } else {
fprintf(stderr, "Out of bounds FSDEV read at %d\n", fsdev_ptr);
return 0; return 0;
} }
} else if (addr == FS_SEEKL_PORT) { } 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) { } else if (addr == FS_DATA_PORT) {
if (fsdev_ptr < fsdev_size) { if (fsdev_ptr < fsdev_size) {
fsdev[fsdev_ptr++] = val; fsdev[fsdev_ptr++] = val;
} else {
fprintf(stderr, "Out of bounds FSDEV write at %d\n", fsdev_ptr);
} }
} else if (addr == FS_SEEKL_PORT) { } else if (addr == FS_SEEKL_PORT) {
fsdev_ptr = (fsdev_ptr & 0xffff00) | val; fsdev_ptr = (fsdev_ptr & 0xffff00) | val;