From 95b0453a75580864d46de747042f7c2e316d54be Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 3 Dec 2025 04:21:26 -0500 Subject: unalf: Fix 15MB bug. --- src/io.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/io.c') diff --git a/src/io.c b/src/io.c index 9a0486d..c4fa295 100644 --- a/src/io.c +++ b/src/io.c @@ -1,3 +1,4 @@ +// #include #include "unalf.h" #include "addrs.h" @@ -130,6 +131,7 @@ int read_alf_header(void) { /* read buf_len_l/h bytes into buf_adr_l/h, then store the number of bytes actually read in buf_len_l/h. TODO: what about EOF? */ void readblock(void) { + static int bytes_read = 0; int bytes, len, bufadr; u8 *buf; @@ -137,9 +139,15 @@ void readblock(void) { buf = mem + bufadr; len = dpeek(buf_len_l); - // fprintf(stderr, "readblock, bufadr = $%04x, len = $%04x\n", bufadr, len); - bytes = fread(buf, 1, len, in_file); + bytes_read += bytes; + + /* mimic CIO's behaviour */ + if(feof(in_file)) { + ldy_i(0x88); + } else { + ldy_i(1); + } dpoke(buf_len_l, bytes); } -- cgit v1.2.3