Added randomized gaps in NIB image generation code just to shake things up a little. :)

This commit is contained in:
Brendan Robert 2015-11-10 13:52:15 -06:00
parent 45f56756e4
commit cf87f30e35

View File

@ -167,16 +167,17 @@ public class FloppyDisk {
ByteArrayOutputStream output = new ByteArrayOutputStream(); ByteArrayOutputStream output = new ByteArrayOutputStream();
for (int track = 0; track < TRACK_COUNT; track++) { for (int track = 0; track < TRACK_COUNT; track++) {
for (int sector = 0; sector < SECTOR_COUNT; sector++) { for (int sector = 0; sector < SECTOR_COUNT; sector++) {
int gap2 = (int) ((Math.random() * 5.0) + 4);
// 15 junk bytes // 15 junk bytes
writeJunkBytes(output, 15); writeJunkBytes(output, 15);
// Address block // Address block
writeAddressBlock(output, track, sector); writeAddressBlock(output, track, sector);
// 4 junk bytes // 4 junk bytes
writeJunkBytes(output, 4); writeJunkBytes(output, gap2);
// Data block // Data block
nibblizeBlock(output, track, currentSectorOrder[sector], nibbles); nibblizeBlock(output, track, currentSectorOrder[sector], nibbles);
// 34 junk bytes // 34 junk bytes
writeJunkBytes(output, 34); writeJunkBytes(output, 38 - gap2);
} }
} }
return output.toByteArray(); return output.toByteArray();