diff options
author | Ian C <ianc@noddybox.co.uk> | 2023-01-09 16:44:23 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2023-01-09 16:44:23 +0000 |
commit | d8f1b09f3b9d1a9039ab81549cc8414b46ed6828 (patch) | |
tree | 8b719719aefc27e0b7167456164d4d7aab37c423 /tapls.c | |
parent | 31c3c29a580fbefe8e3c26ca063e993b3927a27e (diff) |
Initial working version. Still dump to add.
Diffstat (limited to 'tapls.c')
-rw-r--r-- | tapls.c | 29 |
1 files changed, 16 insertions, 13 deletions
@@ -83,6 +83,7 @@ static void TAPLoad(const char *path, FILE **tapfile) { Z80Word blen; Z80Byte type,b,csum,tape_csum; + int warned = FALSE; b = 0; @@ -105,22 +106,24 @@ static void TAPLoad(const char *path, FILE **tapfile) while(blen) { - b=GetTAPByte(tapfile); - csum^=b; - blen--; - } + b = GetTAPByte(tapfile); + + if (!*tapfile && !warned) + { + fprintf(stderr,"%s: hit EOF during block (%u left)\n", path, + blen); + warned = TRUE; + } + + if (blen > 1) + { + csum ^= b; + } - /* Get the checksum - */ - if (blen) - { - tape_csum=GetTAPByte(tapfile); blen--; } - else - { - tape_csum=b; - } + + tape_csum = b; /* Check the checksum */ |