From cf87f30e351e912121d24767d9be644ecc673dea Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Tue, 10 Nov 2015 13:52:15 -0600 Subject: [PATCH] Added randomized gaps in NIB image generation code just to shake things up a little. :) --- src/main/java/jace/hardware/FloppyDisk.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/jace/hardware/FloppyDisk.java b/src/main/java/jace/hardware/FloppyDisk.java index 6c06441..a01b516 100644 --- a/src/main/java/jace/hardware/FloppyDisk.java +++ b/src/main/java/jace/hardware/FloppyDisk.java @@ -167,16 +167,17 @@ public class FloppyDisk { ByteArrayOutputStream output = new ByteArrayOutputStream(); for (int track = 0; track < TRACK_COUNT; track++) { for (int sector = 0; sector < SECTOR_COUNT; sector++) { + int gap2 = (int) ((Math.random() * 5.0) + 4); // 15 junk bytes writeJunkBytes(output, 15); // Address block writeAddressBlock(output, track, sector); // 4 junk bytes - writeJunkBytes(output, 4); + writeJunkBytes(output, gap2); // Data block nibblizeBlock(output, track, currentSectorOrder[sector], nibbles); // 34 junk bytes - writeJunkBytes(output, 34); + writeJunkBytes(output, 38 - gap2); } } return output.toByteArray();