From 08f870dd381ffaea3faa46c4088c6c92982bede5 Mon Sep 17 00:00:00 2001 From: Nick Downing Date: Mon, 9 May 2022 22:16:49 +1000 Subject: [PATCH] Fix critical bug with saving that prevents BLOAD/BRUN working on the saved file --- utils/dos33fs-utils/dos33.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/dos33fs-utils/dos33.c b/utils/dos33fs-utils/dos33.c index 6e1fe5d5..40aa15cb 100644 --- a/utils/dos33fs-utils/dos33.c +++ b/utils/dos33fs-utils/dos33.c @@ -270,6 +270,10 @@ static int dos33_add_file(unsigned char *vtoc, /* clear the t/s sector */ memset(ts_buffer,0,BYTES_PER_SECTOR); + /* set offset into file */ + ts_buffer[TSL_OFFSET_H]=get_high_byte(i); + ts_buffer[TSL_OFFSET_L]=get_low_byte(i); + lseek(fd,DISK_OFFSET((ts_list>>8)&0xff,ts_list&0xff),SEEK_SET); result=write(fd,ts_buffer,BYTES_PER_SECTOR); @@ -291,10 +295,6 @@ static int dos33_add_file(unsigned char *vtoc, ts_buffer[TSL_NEXT_TRACK]=get_high_byte(ts_list); ts_buffer[TSL_NEXT_SECTOR]=get_low_byte(ts_list); - /* set offset into file */ - ts_buffer[TSL_OFFSET_H]=get_high_byte((i-122)*256); - ts_buffer[TSL_OFFSET_L]=get_low_byte((i-122)*256); - /* write out the old t/s list with updated info */ lseek(fd, DISK_OFFSET(get_high_byte(old_ts_list),