From c93d7095a1d59837997da6689432f65a742f4ac6 Mon Sep 17 00:00:00 2001 From: Rob Greene Date: Sat, 3 Mar 2018 12:22:31 -0600 Subject: [PATCH] Resolved a OzDOS and UniDOS format issue. #12 --- .../storage/os/dos33/OzDosFormatDisk.java | 15 +++++++++++++-- .../storage/os/dos33/UniDosFormatDisk.java | 15 +++++++++++++-- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/webcodepro/applecommander/storage/os/dos33/OzDosFormatDisk.java b/src/main/java/com/webcodepro/applecommander/storage/os/dos33/OzDosFormatDisk.java index 03e071f..d863d6b 100644 --- a/src/main/java/com/webcodepro/applecommander/storage/os/dos33/OzDosFormatDisk.java +++ b/src/main/java/com/webcodepro/applecommander/storage/os/dos33/OzDosFormatDisk.java @@ -98,8 +98,19 @@ public class OzDosFormatDisk extends DosFormatDisk { * @see com.webcodepro.applecommander.storage.FormattedDisk#format() */ public void format() { - getImageOrder().format(); - format(31, 50, 32); + final int tracksPerDisk = 50; + final int sectorsPerTrack = 32; + final int firstCatalogSector = 31; + // We can't use the ImageLayout to format this disk since that actually wipes the entire + // 800K volume (that is, both disk1 and disk2 get cleared). + byte[] data = new byte[SECTOR_SIZE]; + for (int t = 0; t < tracksPerDisk; t++) { + for (int s = 0; s < sectorsPerTrack; s++) { + writeSector(t, s, data); + } + } + // Lay down the catalog track... + format(firstCatalogSector, tracksPerDisk, sectorsPerTrack); } /** * Retrieve the specified sector. diff --git a/src/main/java/com/webcodepro/applecommander/storage/os/dos33/UniDosFormatDisk.java b/src/main/java/com/webcodepro/applecommander/storage/os/dos33/UniDosFormatDisk.java index 9d462c4..d7f9a6d 100644 --- a/src/main/java/com/webcodepro/applecommander/storage/os/dos33/UniDosFormatDisk.java +++ b/src/main/java/com/webcodepro/applecommander/storage/os/dos33/UniDosFormatDisk.java @@ -97,8 +97,19 @@ public class UniDosFormatDisk extends DosFormatDisk { * @see com.webcodepro.applecommander.storage.FormattedDisk#format() */ public void format() { - getImageOrder().format(); - format(31, 50, 32); + final int tracksPerDisk = 50; + final int sectorsPerTrack = 32; + final int firstCatalogSector = 31; + // We can't use the ImageLayout to format this disk since that actually wipes the entire + // 800K volume (that is, both disk1 and disk2 get cleared). + byte[] data = new byte[SECTOR_SIZE]; + for (int t = 0; t < tracksPerDisk; t++) { + for (int s = 0; s < sectorsPerTrack; s++) { + writeSector(t, s, data); + } + } + // Lay down the catalog track... + format(firstCatalogSector, tracksPerDisk, sectorsPerTrack); } /**