summaryrefslogtreecommitdiff
path: root/tapls.c
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2023-01-09 16:44:23 +0000
committerIan C <ianc@noddybox.co.uk>2023-01-09 16:44:23 +0000
commitd8f1b09f3b9d1a9039ab81549cc8414b46ed6828 (patch)
tree8b719719aefc27e0b7167456164d4d7aab37c423 /tapls.c
parent31c3c29a580fbefe8e3c26ca063e993b3927a27e (diff)
Initial working version. Still dump to add.
Diffstat (limited to 'tapls.c')
-rw-r--r--tapls.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/tapls.c b/tapls.c
index 3442c76..c00ec47 100644
--- a/tapls.c
+++ b/tapls.c
@@ -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
*/