diff --git a/Tools/unix/zx/zx.c b/Tools/unix/zx/zx.c index 0ea315d0..ea5c4d37 100644 --- a/Tools/unix/zx/zx.c +++ b/Tools/unix/zx/zx.c @@ -39,10 +39,12 @@ char *parse_to_fcb(char *s, int afcb) RAM[afcb] = 0; memset(fcb, ' ', 11); + while (*s == ' ') ++s; + while (1) { - if (s[0] == 0) break; - if (s[0] == ' ') {++s; continue; } + if (s[0] == 0) break; + if (s[0] == ' ') break; if (s[1] == ':') { RAM[afcb] = s[0] - '@'; @@ -58,7 +60,7 @@ char *parse_to_fcb(char *s, int afcb) } *fcb = *s; if (islower(*fcb)) *fcb = toupper(*fcb); ++s; - ++fcb; + ++fcb; if (fcb >= &RAM[afcb+12]) break; } return s; @@ -353,10 +355,9 @@ int main(int ac, char **av) str = parse_to_fcb(pCmd, 0x5C); parse_to_fcb(str, 0x6C); -/* This statement is very useful when creating a client like zxc or zxas + // This statement is very useful when creating a client like zxc or zxas + Msg("Command tail is \"%s\"\n", pCmd); - printf("Command tail is %s\n", pCmd); -*/ load_bios(); memset(RAM + 0xFE9C, 0, 0x64); /* Zap the SCB */ @@ -417,8 +418,8 @@ int zx_term(void) word n; - n = RAM[0x81]; /* Get the return code. This is Hi-Tech C */ - n = (n << 8) | RAM[0x80]; /* specific and fails with other COM files */ + //n = RAM[0x81]; /* Get the return code. This is Hi-Tech C */ + //n = (n << 8) | RAM[0x80]; /* specific and fails with other COM files */ putchar('\n'); diff --git a/Tools/unix/zx/zxcbdos.c b/Tools/unix/zx/zxcbdos.c index e199ada2..355dd687 100644 --- a/Tools/unix/zx/zxcbdos.c +++ b/Tools/unix/zx/zxcbdos.c @@ -28,13 +28,47 @@ void bdos_rdline(word line, word *PC) void bdos_rdline(word line, word *PC) { + unsigned char c; + unsigned char *p; + int n; int maxlen; if (!line) line = cpm_dma; maxlen = RAM[line]; - fgets((char *)(RAM + line + 2), maxlen, stdin); - RAM[line + 1] = strlen((char *)(RAM + line + 2)) - 1; + // fgets causes extra linefeeds, so we invent our own + //fgets((char *)(RAM + line + 2), maxlen, stdin); + + p = (RAM + line + 2); + n = 0; + + while (1) { + c = cin(); + if (c == '\r') + break; + if (c == '\b') { + if (n > 0) { + cout('\b'); + cout(' '); + cout('\b'); + n--; + p--; + } + } + else { + if (n < maxlen) { + cout(c); + *p++ = c; + n++; + } + } + } + + cout('\r'); + *p = '\0'; + + //RAM[line + 1] = strlen((char *)(RAM + line + 2)) - 1; + RAM[line + 1] = (unsigned char)n; Msg("Input: [%d] %-*.*s\n", RAM[line + 1], RAM[line + 1], RAM[line +1], (char *)(RAM+line+2)); } diff --git a/Tools/zx/zx-src.zip b/Tools/zx/zx-src.zip index dc6b02a9..859cef32 100644 Binary files a/Tools/zx/zx-src.zip and b/Tools/zx/zx-src.zip differ diff --git a/Tools/zx/zx.exe b/Tools/zx/zx.exe index bc42198e..322ad372 100644 Binary files a/Tools/zx/zx.exe and b/Tools/zx/zx.exe differ diff --git a/Tools/zx/zxdbg.exe b/Tools/zx/zxdbg.exe index 42c061bc..c02fc8e3 100644 Binary files a/Tools/zx/zxdbg.exe and b/Tools/zx/zxdbg.exe differ