- if (argc == 4) {
- count = strtoul(argv[3], NULL, 16);
- } else {
- count = 1;
- }
-
- if (!(z80_bus_cmd(Request) & ZST_ACQUIRED)) {
- my_puts_P(PSTR("Bus timeout\n"));
- return CMD_RET_FAILURE;
+ if (argc == 3)
+ count = eval_arg(argv[optind], NULL);
+
+ z80_bus_request_or_exit();
+ if (width == 1)
+ z80_memset(addr, writeval, count);
+ else {
+ while (count--) {
+ z80_write_block((const uint8_t *) &writeval, addr, width);
+ addr += width;
+ }