Skip to content

Commit c01cfa8

Browse files
committed
Always advance the record number on read record from FCB
This fixes end-of-file detection when the file size is not a multiple of the record size. Fixes dmsc#33.
1 parent 40101bd commit c01cfa8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/dos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ static int dos_rw_record_fcb(int addr, int write, int update, int seq)
382382
// Update random and block positions
383383
if(update)
384384
{
385-
unsigned rnum = (pos + n) / rsize;
385+
unsigned rnum = (pos + ((n>0) ? rsize : 0)) / rsize;
386386
memory[0x20 + fcb] = rnum & 127;
387387
put16(0x0C + fcb, rnum / 128);
388388
if(!seq)

0 commit comments

Comments
 (0)