diff options
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 */ |