diff options
Diffstat (limited to 'src/io.c')
| -rw-r--r-- | src/io.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -1,3 +1,4 @@ +// #include <f65.h> #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); } |
