diff options
Diffstat (limited to 'avr/cmd_mem.c')
-rw-r--r-- | avr/cmd_mem.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/avr/cmd_mem.c b/avr/cmd_mem.c index 7a8781c..d641410 100644 --- a/avr/cmd_mem.c +++ b/avr/cmd_mem.c @@ -13,11 +13,9 @@ * Copied from FADS ROM, Dan Malek (dmalek@jlc.net) */ -#include "common.h" -#include <ctype.h> +#include "cmd_mem.h" #include <avr/interrupt.h> -#include "command.h" #include "cli_readline.h" #include "print-utils.h" #include "con-utils.h" @@ -55,6 +53,19 @@ static ERRNUM z180_read_buf(uint8_t *buf, uint32_t addr, uint8_t count) /*--------------------------------------------------------------------------*/ +command_ret_t do_mem_size(cmd_tbl_t *cmdtp UNUSED, uint_fast8_t flag UNUSED, int argc UNUSED, char * const argv[] UNUSED) +{ + int32_t ramsize = z80_memsize_detect(); + + if (ramsize < 0) + cmd_error(CMD_RET_FAILURE, (ERRNUM) -ramsize, PSTR("Couldn't access RAM")); + + printf_P(PSTR("Detected RAM: Start %.5lx, End: %.5lx, Size: %.5lx (%ld dec)\n"), + 0l, ramsize ? ramsize-1 : 0l, ramsize, ramsize); + + return CMD_RET_SUCCESS; +} + /* Memory Display * * Syntax: |