From ba69664346a04ad1f1c9380503034e6f5a02afb2 Mon Sep 17 00:00:00 2001
From: Claus <claus@protovision.games>
Date: Fri, 2 Dec 2022 18:01:30 +0100
Subject: [PATCH 2/2] Another fix for the file allocation table printing
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---
cc1541.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cc1541.c b/cc1541.c
index 9e0fd08..f66d9cd 100644
--- a/cc1541.c
+++ b/cc1541.c
@@ -1616,6 +1616,7 @@ print_file_allocation(image_type type, const unsigned char* image, imagefile* fi
case FILETYPEPRG: {
int track = image[b + FILETRACKOFFSET];
int sector = image[b + FILESECTOROFFSET];
+ int numsectors = image[b + FILEBLOCKSLOOFFSET] + 256 * image[b + FILEBLOCKSHIOFFSET];
const unsigned char *filename = image + b + FILENAMEOFFSET;
b = linear_sector(type, track, sector);
if (b >= 0) {
@@ -1625,7 +1626,7 @@ print_file_allocation(image_type type, const unsigned char* image, imagefile* fi
existing_files[num_files].direntryindex = num_files;
existing_files[num_files].direntrysector = s;
existing_files[num_files].direntryoffset = o;
- existing_files[num_files].nrSectors = image[b + FILEBLOCKSLOOFFSET] + 256 * image[b + FILEBLOCKSHIOFFSET];
+ existing_files[num_files].nrSectors = numsectors;
if (is_transwarp_file(image, b)) {
existing_files[num_files].filetype = filetype | FILETYPETRANSWARPMASK;
--
2.39.1