fix gotchas with unspecified start

This commit is contained in:
steve 2024-04-10 20:02:02 +01:00
parent 1ea8f82c68
commit 6e58a7c298

View File

@ -395,7 +395,7 @@ uint32_t dumpBlock(uint32_t start, uint32_t end)
Serial.println(line); Serial.println(line);
if (checkForBreak()) if (checkForBreak())
{ {
return; return addr;
} }
memset(line, ' ', sizeof(line)); memset(line, ' ', sizeof(line));
count = 0; count = 0;
@ -711,10 +711,11 @@ void loop()
switch (cmd) switch (cmd)
{ {
case CMD_BLANK: case CMD_BLANK:
erasedBlockCheck(start, if_unspec(end, prom.end())); erasedBlockCheck(if_unspec(start, 0), if_unspec(end, prom.end()));
break; break;
case CMD_CHECKSUM: case CMD_CHECKSUM:
start = if_unspec(start, 0);
end = if_unspec(end, prom.end()); end = if_unspec(end, prom.end());
w = checksumBlock(start, end); w = checksumBlock(start, end);
Serial.print(F("Checksum ")); Serial.print(F("Checksum "));
@ -764,6 +765,7 @@ void loop()
break; break;
case CMD_READ: case CMD_READ:
start = if_unspec(start, 0);
end = if_unspec(end, prom.end()); end = if_unspec(end, prom.end());
if (xmodem.SendFile(start, end - start + 1)) if (xmodem.SendFile(start, end - start + 1))
{ {
@ -779,6 +781,7 @@ void loop()
case CMD_WRITE: case CMD_WRITE:
prom.resetDebugStats(); prom.resetDebugStats();
start = if_unspec(start, 0);
numBytes = xmodem.ReceiveFile(start); numBytes = xmodem.ReceiveFile(start);
if (numBytes) if (numBytes)
{ {
@ -797,16 +800,16 @@ void loop()
break; break;
case CMD_SCAN: case CMD_SCAN:
scanBlock(start, if_unspec(end, prom.end())); scanBlock(if_unspec(start, 0), if_unspec(end, prom.end()));
break; break;
case CMD_TEST: case CMD_TEST:
testAddr(start); testAddr(if_unspec(start, 0));
break; break;
case CMD_ZAP: case CMD_ZAP:
prom.resetDebugStats(); prom.resetDebugStats();
zapTest(start); zapTest(if_unspec(start, 0));
break; break;
#endif /* ENABLE_DEBUG_COMMANDS */ #endif /* ENABLE_DEBUG_COMMANDS */