X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/b51d2360e5a32408daae39b1c311868d0d34374c..4077419cee470571ea8f7f202b141faf385b6e5a:/avr/cmd_loadcpm3.c diff --git a/avr/cmd_loadcpm3.c b/avr/cmd_loadcpm3.c index f24ee19..39e3278 100644 --- a/avr/cmd_loadcpm3.c +++ b/avr/cmd_loadcpm3.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2015 Leo C. + * (C) Copyright 2015,2016 Leo C. * * SPDX-License-Identifier: GPL-2.0 */ @@ -8,15 +8,12 @@ * See CP/M 3 System Manual, Appendix D: CPM3.SYS File Format */ -#include "common.h" -#include +#include "cmd_loadcpm3.h" #include -#include -#include -#include "command.h" #include "env.h" #include "ff.h" +#include "eval_arg.h" #include "con-utils.h" #include "z80-if.h" #include "debug.h" @@ -63,7 +60,7 @@ int load(FIL *File, uint32_t addr, uint8_t len) #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) +command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, uint_fast8_t flag, int argc, char * const argv[]) { uint16_t mem_top; uint8_t res_len; @@ -88,11 +85,11 @@ command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg CONFIG_CPM3_BANKED_BASE); if (argc > 3) - banked_base = strtoul(argv[3], NULL, 16); + banked_base = eval_arg(argv[3], NULL); if (argc > 2) - common_base = strtoul(argv[2], NULL, 16); + common_base = eval_arg(argv[2], NULL); - fname = getenv_char(PSTR(ENV_CPM3_SYSFILE)); + fname = getenv_str(PSTR(ENV_CPM3_SYSFILE)); if (argc > 1) { fname = argv[1]; } @@ -143,6 +140,9 @@ command_ret_t do_loadcpm3(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg common_base = (uint16_t) buffer[0] + (buffer[1] << 8); setenv_hex(PSTR(ENV_CPM3_COMMON_BASE), common_base); } + + setenv_hex(PSTR(ENV_CPM3_SCB), mem_top - ((res_len - (6 - 1)) << 8) + common_base); + /* Main System Load */ /* Load Common Portion of System */