X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/612a69655af9bed89a1ad9e7e9225dfb3ed3ff42..32154e5a9e9bf0a52269b3715711b76dc8fcac0f:/avr/cmd_boot.c diff --git a/avr/cmd_boot.c b/avr/cmd_boot.c index 448ed48..f3bce9d 100644 --- a/avr/cmd_boot.c +++ b/avr/cmd_boot.c @@ -4,7 +4,7 @@ * (C) Copyright 2000-2003 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * - * SPDX-License-Identifier: GPL-2.0+ + * SPDX-License-Identifier: GPL-2.0 */ /* @@ -16,6 +16,8 @@ #include #include "command.h" +#include "cli_readline.h" +#include "cli.h" #include "env.h" #include "con-utils.h" #include "z80-if.h" @@ -81,7 +83,7 @@ command_ret_t do_busreq_pulse(cmd_tbl_t *cmdtp, int flag, int argc, char * const } if (argc > 1) - count = (uint16_t) strtoul(argv[2], NULL, 16); + count = (uint16_t) strtoul(argv[1], NULL, 16); z80_bus_cmd(Request); while (count--) @@ -116,11 +118,9 @@ command_ret_t do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (addr != 0) { uint8_t tmp[3]; - uint_fast8_t i; z80_bus_cmd(Request); - for (i = 0; i < 3; i++) - tmp[i] = z80_read(i); + z80_read_block (tmp, 0, 3); z80_write(0, 0xc3); z80_write(1, addr); z80_write(2, (addr >> 8)); @@ -128,8 +128,7 @@ command_ret_t do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) z80_bus_cmd(Run); z80_bus_cmd(M_Cycle); z80_bus_cmd(M_Cycle); - for (i = 0; i < 3; i++) - z80_write(i, tmp[i]); + z80_write_block(tmp, 0, 3); } else z80_bus_cmd(Run); @@ -170,8 +169,9 @@ void print_con_usage(char esc) { printf_P(PSTR("\n" "------------------------------------------------\n" " ?,H - This Help\n" - " R - Reset (Restart) CPU\n" " Q,X - Return to command line\n" + " R - Reset (Restart) CPU\n" + " : - Execute monitor command\n" " \\ - code input:\n" " \\nnn 3 decimal digits character code\n" " \\Xhh 2 hexadecimal digits character code\n" @@ -191,6 +191,8 @@ command_ret_t do_console(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv (void) cmdtp; (void) flag; (void) argc; (void) argv; + printf_P(PSTR("Connecting to CPU. Escape character is '^%c'.\n"), + esc_char + 0x40); while (1) { @@ -237,6 +239,13 @@ command_ret_t do_console(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv goto quit; break; + case ':': + putchar('\n'); + int cmdlen = cli_readline(PSTR(": "), 1); + if (cmdlen > 0) + run_command(console_buffer, 0); + break; + case '\\': code = 0; state = 3; @@ -259,6 +268,11 @@ command_ret_t do_console(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv if (isdigit(ch)) { code = code * 10 + ch - '0'; state++; + } else { + if (state > 3) + z80_memfifo_putc(fifo_conin, code); + z80_memfifo_putc(fifo_conin, ch); + state = 0; } if (state > 5) { z80_memfifo_putc(fifo_conin, code); @@ -273,6 +287,11 @@ command_ret_t do_console(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv ch -= 'A' - 10; code = code * 16 + ch - '0'; state++; + }else { + if (state > 6) + z80_memfifo_putc(fifo_conin, code); + z80_memfifo_putc(fifo_conin, ch); + state = 0; } if (state > 7) { z80_memfifo_putc(fifo_conin, code);