From 72f51be1079d6a12651a033c7f59c186997d85e1 Mon Sep 17 00:00:00 2001 From: Rob Greene Date: Thu, 26 Oct 2023 23:01:25 -0500 Subject: [PATCH] Fixing acx create disk with DOS format to mark tracks 0-2 as used. #129 --- .../main/java/io/github/applecommander/acx/SystemType.java | 4 ++-- .../applecommander/storage/os/dos33/DosFormatDisk.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/cli-acx/src/main/java/io/github/applecommander/acx/SystemType.java b/app/cli-acx/src/main/java/io/github/applecommander/acx/SystemType.java index 4f15ea4..1bae329 100644 --- a/app/cli-acx/src/main/java/io/github/applecommander/acx/SystemType.java +++ b/app/cli-acx/src/main/java/io/github/applecommander/acx/SystemType.java @@ -98,8 +98,7 @@ public enum SystemType { static void copyDosSystemTracks(FormattedDisk targetDisk, FormattedDisk source) { DosFormatDisk target = (DosFormatDisk)targetDisk; - // FIXME messing with the VTOC should be handled elsewhere - byte[] vtoc = source.readSector(DosFormatDisk.CATALOG_TRACK, DosFormatDisk.VTOC_SECTOR); + byte[] vtoc = target.readVtoc(); int sectorsPerTrack = vtoc[0x35]; // Note that this also patches T0 S0 for BOOT0 for (int t=0; t<3; t++) { @@ -108,6 +107,7 @@ public enum SystemType { target.setSectorUsed(t, s, vtoc); } } + target.writeVtoc(vtoc); } static void copyProdosSystemFiles(FormattedDisk target, FormattedDisk source) { // We need to explicitly fix the boot block diff --git a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java index 82f2dc0..aec2032 100644 --- a/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java +++ b/lib/ac-api/src/main/java/com/webcodepro/applecommander/storage/os/dos33/DosFormatDisk.java @@ -275,14 +275,14 @@ public class DosFormatDisk extends FormattedDisk { /** * Return the VTOC (Volume Table Of Contents). */ - protected byte[] readVtoc() { + public byte[] readVtoc() { return readSector(CATALOG_TRACK, VTOC_SECTOR); } /** * Save the VTOC (Volume Table Of Contents) to disk. */ - protected void writeVtoc(byte[] vtoc) { + public void writeVtoc(byte[] vtoc) { writeSector(CATALOG_TRACK, VTOC_SECTOR, vtoc); }