]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - avr/cmd_mem.c
move sys timer setup from main to timer.c
[z180-stamp.git] / avr / cmd_mem.c
index 7a8781cc7b7432d036bfc9c11cf2db5940eb686e..d641410639e3abcba368f99fbd0d3806cf335b80 100644 (file)
  * 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: