From 633b514b385870717184c81af6894c1bad36fc7d Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Sun, 20 Dec 2015 14:18:50 -0600 Subject: [PATCH] Removed debug statements from recent changes --- .../hardware/massStorage/DirectoryNode.java | 11 ++--- .../jace/hardware/massStorage/FileNode.java | 42 ++++++------------- .../massStorage/ProdosVirtualDisk.java | 1 - 3 files changed, 17 insertions(+), 37 deletions(-) diff --git a/src/main/java/jace/hardware/massStorage/DirectoryNode.java b/src/main/java/jace/hardware/massStorage/DirectoryNode.java index 9dbb795..5de592d 100644 --- a/src/main/java/jace/hardware/massStorage/DirectoryNode.java +++ b/src/main/java/jace/hardware/massStorage/DirectoryNode.java @@ -157,7 +157,6 @@ public class DirectoryNode extends DiskNode implements FileFilter { */ @SuppressWarnings("static-access") private void generateHeader(byte[] buffer) { -// System.out.println("Generating directory header"); // Previous block = 0 generateWord(buffer, 0, 0); // Next block @@ -200,7 +199,6 @@ public class DirectoryNode extends DiskNode implements FileFilter { * @param fileNumber number of file (indexed in Children array) to write */ private void generateFileEntry(byte[] buffer, int offset, int fileNumber) throws IOException { -// System.out.println("Generating entry for "+children.get(fileNumber).getName()); DiskNode child = children.get(fileNumber); child.allocate(); // Entry Type and length @@ -242,11 +240,10 @@ public class DirectoryNode extends DiskNode implements FileFilter { // yyyyyyym mmmddddd - Byte 0,1 // ---hhhhh --mmmmmm - Byte 2,3 - buffer[offset+1] = (byte) (((c.get(Calendar.YEAR) - 2000) << 1) | ((c.get(Calendar.MONTH)+1)>> 3)); -// buffer[offset+2] = (byte) ((c.get(Calendar.MONTH)>> 3) & 1); - buffer[offset+0] = (byte) (((((c.get(Calendar.MONTH)+1)&7)<<5) | c.get(Calendar.DAY_OF_MONTH)) & 0x0ff); - buffer[offset+3] = (byte) c.get(Calendar.HOUR_OF_DAY); - buffer[offset+2] = (byte) c.get(Calendar.MINUTE); + buffer[offset + 0] = (byte) (((((c.get(Calendar.MONTH) + 1) & 7) << 5) | c.get(Calendar.DAY_OF_MONTH)) & 0x0ff); + buffer[offset + 1] = (byte) (((c.get(Calendar.YEAR) - 2000) << 1) | ((c.get(Calendar.MONTH) + 1) >> 3)); + buffer[offset + 2] = (byte) c.get(Calendar.MINUTE); + buffer[offset + 3] = (byte) c.get(Calendar.HOUR_OF_DAY); } private void generateWord(byte[] buffer, int i, int value) { diff --git a/src/main/java/jace/hardware/massStorage/FileNode.java b/src/main/java/jace/hardware/massStorage/FileNode.java index e54dbca..c95bb00 100644 --- a/src/main/java/jace/hardware/massStorage/FileNode.java +++ b/src/main/java/jace/hardware/massStorage/FileNode.java @@ -27,7 +27,7 @@ import java.util.Arrays; * Representation of a prodos file with a known file type and having a known * size (either seedling, sapling or tree) * - * @author Brendan Robert (BLuRry) brendan.robert@gmail.com + * @author Brendan Robert (BLuRry) brendan.robert@gmail.com */ public class FileNode extends DiskNode { @@ -136,15 +136,11 @@ public class FileNode extends DiskNode { @Override public void doAllocate() throws IOException { - int dataBlocks = (int) ((getPhysicalFile().length()+ProdosVirtualDisk.BLOCK_SIZE-1) / ProdosVirtualDisk.BLOCK_SIZE); - int treeBlocks =(((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE-2)) / ProdosVirtualDisk.BLOCK_SIZE); - if (treeBlocks > 1) treeBlocks++; -// if (dataBlocks > 1 && (dataBlocks*2) < ProdosVirtualDisk.BLOCK_SIZE) { -// treeBlocks = 1; -// } else { -// treeBlocks = 1 + (dataBlocks * 2 / ProdosVirtualDisk.BLOCK_SIZE); -// } - System.out.println("Allocating "+(dataBlocks + treeBlocks)+" blocks for file "+getName()+"; data "+dataBlocks+"; tree "+treeBlocks); + int dataBlocks = (int) ((getPhysicalFile().length() + ProdosVirtualDisk.BLOCK_SIZE - 1) / ProdosVirtualDisk.BLOCK_SIZE); + int treeBlocks = (((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE - 2)) / ProdosVirtualDisk.BLOCK_SIZE); + if (treeBlocks > 1) { + treeBlocks++; + } for (int i = 0; i < dataBlocks + treeBlocks; i++) { new SubNode(i, this); } @@ -157,10 +153,11 @@ public class FileNode extends DiskNode { @Override public void readBlock(int block, byte[] buffer) throws IOException { -// System.out.println("Read block "+block+" of file "+getName()); - int dataBlocks = (int) ((getPhysicalFile().length()+ProdosVirtualDisk.BLOCK_SIZE-1) / ProdosVirtualDisk.BLOCK_SIZE); - int treeBlocks =(((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE-2)) / ProdosVirtualDisk.BLOCK_SIZE); - if (treeBlocks > 1) treeBlocks++; + int dataBlocks = (int) ((getPhysicalFile().length() + ProdosVirtualDisk.BLOCK_SIZE - 1) / ProdosVirtualDisk.BLOCK_SIZE); + int treeBlocks = (((dataBlocks * 2) + (ProdosVirtualDisk.BLOCK_SIZE - 2)) / ProdosVirtualDisk.BLOCK_SIZE); + if (treeBlocks > 1) { + treeBlocks++; + } switch (this.getType()) { case SEEDLING: readFile(buffer, 0); @@ -175,10 +172,8 @@ public class FileNode extends DiskNode { break; case TREE: if (block == 0) { - System.out.println("Reading index for "+getName()); generateIndex(buffer, 1, treeBlocks); } else if (block <= treeBlocks) { - System.out.println("Reading tree block "+block+" for "+getName()); int start = treeBlocks + ((block - 1) * 256); int end = treeBlocks + dataBlocks; generateIndex(buffer, start, end); @@ -197,22 +192,11 @@ public class FileNode extends DiskNode { } private void generateIndex(byte[] buffer, int indexStart, int indexLimit) { - System.out.println("Index block contents:"); Arrays.fill(buffer, (byte) 0); - for (int i = indexStart, count=0; count < 256 && i < indexLimit && i < additionalNodes.size(); i++, count++) { + for (int i = indexStart, count = 0; count < 256 && i < indexLimit && i < additionalNodes.size(); i++, count++) { int base = additionalNodes.get(i).baseBlock; - System.out.print(Integer.toHexString(base)+":"); buffer[count] = (byte) (base & 0x0ff); buffer[count + 256] = (byte) (base >> 8); } - System.out.println(); - for (int i=0; i < 256; i++) { - System.out.printf("%02X ",buffer[i]&0x0ff); - } - System.out.println(); - for (int i=256; i < 512; i++) { - System.out.printf("%02X ",buffer[i]&0x0ff); - } - System.out.println(); } -} \ No newline at end of file +} diff --git a/src/main/java/jace/hardware/massStorage/ProdosVirtualDisk.java b/src/main/java/jace/hardware/massStorage/ProdosVirtualDisk.java index ceeba10..7f4d566 100644 --- a/src/main/java/jace/hardware/massStorage/ProdosVirtualDisk.java +++ b/src/main/java/jace/hardware/massStorage/ProdosVirtualDisk.java @@ -137,7 +137,6 @@ public class ProdosVirtualDisk implements IDisk { for (DiskNode subnode : node.additionalNodes) { int blockNum = getNextFreeBlock(); - System.out.println("Allocating block " + Integer.toHexString(blockNum) + " for " + subnode.getName()); subnode.setBaseBlock(blockNum); physicalMap.put(blockNum, subnode); }