I'm experiencing issues when using decb to write files to 35-track disk images, where decb will attempt to fit the file at the end of the disk image. If there aren't enough free granules/sectors at the end of the disk to fit the file, instead of decb looking for other free granules on the disk, it will append granules to the disk image.
The command that I use to write files to disk images is typically:
decb copy -2 -b -r %binary_path% %disk_path%,%filename%.BIN
I'm using the latest build of decb (v2.2 snapshot 20230717)
Please see the attached TESTDISK.DSK disk image, the DATA4.BIN and DATA5.BIN test files, and the readme.txt file outlining steps to recreate the issue.
Anonymous
When attempting to recreate this issue on a Linux box, I noticed I accidentally made a mistake in the included 'readme.txt' file, for steps to recreate the issue.
Incorrect command: decb copy -2 -b -4 %binary_path% %disk_path%,%filename%.BIN
Correct command: decb copy -2 -b -r %binary_path% %disk_path%,%filename%.BIN
While testing under Linux, the same issue is present.
Here is the updated 'readme.txt' file with the corrected syntax.
Last edit: Paul Fiscarelli 2023-09-08
find_free_granule() in libdecbwrite.c is broken. Working on a patch now, I'm not sure why it needs to test against path->hdbdos_offset. That seems like an error.
For why the hdbdos_offset is checked, please see commit 754:c257cd7fb0fb (and commit 753:a777c76f4833).
Last edit: Tormod Volden 2023-09-08
How do I find that commit?
hg log -v -p -r 754:c257cd7fb0fbhttps://sourceforge.net/p/toolshed/code/ci/a777c76f483348c20a0c95dc9a6c6e4720352f1a/
https://sourceforge.net/p/toolshed/code/ci/c257cd7fb0fb2006650bbc936f1a4e3f484c5a2b/
I just commed a change to fix this:
Add DECB executive option to set the granule count.
Change libdecb allocation algorithm to mimic what the ROM does.
Remove use of HDBDOS offset as a flag.
Document colon and plus operator when used in a decb path.
Docuemnt new granule count option.
I've been testing the latest push and the issue where granules were being appended to the disk image appears to be fixed. However, there is a new issue when attempting to write a file to a disk image with free granules, but there are not enough free granules to write the file.
The following error is thrown in this scenario:
Also, a new disk directory entry is created for the file on the disk image, but it appears no further data is attempted to be written to the disk. There is also a file type of hex $73 (byte-11 in the directory entry) written to the directory entry.
To reproduce the issue, use the following command with the attached files:
The TESTDISK.DSK image has two remaining free granules (granule-0 and granule-1), however the file DATA8.BIN requires 3 free granules to be written.
It appears this issue is only reproduced when the disk image still has free granules available, but not enough free granules to fit the file. If the disk image is completely full with no free granules, the correct error - 'Error: 248 - disk is filled to capacity' is thrown.
OK. This new issue is now fixed.
Both of these issues appear to be resolved - I've been testing for the last week and have yet to reproduce the issues.