From: Alan Cox Date: Tue, 14 Apr 2015 00:00:49 +0000 (+0100) Subject: zx128/mdv: strengthen tools and fix the header write size X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9db5f84f839b76d28158137262000ae9175284c9;p=FUZIX.git zx128/mdv: strengthen tools and fix the header write size We now appear to read/write the fs correctly. Not yet sure why swap is bombing out with an error 3 on sector 155. --- diff --git a/Kernel/platform-zx128/microdrive.s b/Kernel/platform-zx128/microdrive.s index bc257ba0..a0ce7de3 100644 --- a/Kernel/platform-zx128/microdrive.s +++ b/Kernel/platform-zx128/microdrive.s @@ -289,7 +289,7 @@ mdv_put_blk: ld a, #0xE6 nop nop ld c, #0xE7 ; Data port - ld b, #0x0F ; Header + ld b, #0x1B ; Header otir ; Header bytes out ld hl, (_mdv_buf) otir ; First 256 data diff --git a/Kernel/tools/chkmdv.c b/Kernel/tools/chkmdv.c index 7fd8af0e..89d4d133 100644 --- a/Kernel/tools/chkmdv.c +++ b/Kernel/tools/chkmdv.c @@ -8,6 +8,8 @@ static int mdv_sec; +static int bad = 0; + static void SectorError(const char *p, ...) { va_list v; @@ -16,6 +18,7 @@ static void SectorError(const char *p, ...) va_start(v, p); vfprintf(stderr, p, v); va_end(v); + bad++; } @@ -43,6 +46,9 @@ static void mdv_check_header(uint8_t *buf, uint8_t sec) static void mdv_check_bufhdr(uint8_t *buf, uint8_t rec) { + int i; + int lb = bad; + if (buf[0] != 0) SectorError("Bad block type %d\n", buf[0]); if (buf[1] != rec) @@ -59,6 +65,19 @@ static void mdv_check_bufhdr(uint8_t *buf, uint8_t rec) if (buf[527] != mdv_csum(buf+15, 512)) SectorError("Bad block data checksum %02x %02x\n", buf[527], mdv_csum(buf+15, 512)); + for (i = 0; i < 32; i++) { + if (i != 4 && memcmp(buf + i, "FUZIX ", 10) == 0) + SectorError("FUZIX tag at %d not 4\n", i); + } + if (bad > lb) { + for (i = 0; i < 544; i++) { + if (!(i & 15)) + printf("%03x: ", i); + printf("%02x ", buf[i]); + if ((i & 15) == 15) + printf("\n"); + } + } } static void mdv_check_sectormap(uint8_t *buf)