From 32de2aa69d104a8d38916afbd313f97c0feb9e1c Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Sat, 8 Feb 2020 09:21:13 +1000 Subject: [PATCH] method header lines --- .../applefile/DefaultAppleFile.java | 72 +++++++++-------- .../diskbrowser/applefile/DeviceDriver.java | 6 ++ .../applefile/DoubleHiResImage.java | 16 +++- .../bytezone/diskbrowser/utilities/CPU.java | 78 +++++++++++++++++++ 4 files changed, 139 insertions(+), 33 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/DefaultAppleFile.java b/src/com/bytezone/diskbrowser/applefile/DefaultAppleFile.java index 0d8464d..858ee3d 100755 --- a/src/com/bytezone/diskbrowser/applefile/DefaultAppleFile.java +++ b/src/com/bytezone/diskbrowser/applefile/DefaultAppleFile.java @@ -1,32 +1,42 @@ -package com.bytezone.diskbrowser.applefile; - -public class DefaultAppleFile extends AbstractFile -{ - String text; - - public DefaultAppleFile (String name, byte[] buffer) - { - super (name, buffer); - } - - public DefaultAppleFile (String name, byte[] buffer, String text) - { - super (name, buffer); - this.text = "Name : " + name + "\n\n" + text; - } - - public void setText (String text) - { - this.text = text; - } - - @Override - public String getText () - { - if (text != null) - return text; - if (buffer == null) - return "Invalid file : " + name; - return super.getText (); - } +package com.bytezone.diskbrowser.applefile; + +// -----------------------------------------------------------------------------------// +public class DefaultAppleFile extends AbstractFile +// -----------------------------------------------------------------------------------// +{ + String text; + + // ---------------------------------------------------------------------------------// + public DefaultAppleFile (String name, byte[] buffer) + // ---------------------------------------------------------------------------------// + { + super (name, buffer); + } + + // ---------------------------------------------------------------------------------// + public DefaultAppleFile (String name, byte[] buffer, String text) + // ---------------------------------------------------------------------------------// + { + super (name, buffer); + this.text = "Name : " + name + "\n\n" + text; + } + + // ---------------------------------------------------------------------------------// + public void setText (String text) + // ---------------------------------------------------------------------------------// + { + this.text = text; + } + + // ---------------------------------------------------------------------------------// + @Override + public String getText () + // ---------------------------------------------------------------------------------// + { + if (text != null) + return text; + if (buffer == null) + return "Invalid file : " + name; + return super.getText (); + } } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/applefile/DeviceDriver.java b/src/com/bytezone/diskbrowser/applefile/DeviceDriver.java index 8067fa6..df8124e 100644 --- a/src/com/bytezone/diskbrowser/applefile/DeviceDriver.java +++ b/src/com/bytezone/diskbrowser/applefile/DeviceDriver.java @@ -1,13 +1,17 @@ package com.bytezone.diskbrowser.applefile; +// -----------------------------------------------------------------------------------// public class DeviceDriver extends AbstractFile +// -----------------------------------------------------------------------------------// { private final int auxType; private final int classifications; private final int driverClass; private final boolean inactive; + // ---------------------------------------------------------------------------------// public DeviceDriver (String name, byte[] buffer, int auxType) + // ---------------------------------------------------------------------------------// { super (name, buffer); this.auxType = auxType; @@ -17,8 +21,10 @@ public class DeviceDriver extends AbstractFile inactive = (auxType & 0x8000) != 0; } + // ---------------------------------------------------------------------------------// @Override public String getText () + // ---------------------------------------------------------------------------------// { StringBuilder text = new StringBuilder ("Name : " + name + "\n\n"); diff --git a/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java b/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java index e7de067..f3bdddb 100644 --- a/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java +++ b/src/com/bytezone/diskbrowser/applefile/DoubleHiResImage.java @@ -5,7 +5,9 @@ import java.awt.image.DataBuffer; import com.bytezone.diskbrowser.utilities.HexFormatter; +// -----------------------------------------------------------------------------------// public class DoubleHiResImage extends HiResImage +// -----------------------------------------------------------------------------------// { private static int[] swap = { 0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15 }; @@ -13,7 +15,9 @@ public class DoubleHiResImage extends HiResImage private DoubleScrunch doubleScrunch; byte[] packedBuffer; + // ---------------------------------------------------------------------------------// public DoubleHiResImage (String name, byte[] buffer, byte[] auxBuffer) + // ---------------------------------------------------------------------------------// { super (name, buffer); @@ -21,7 +25,9 @@ public class DoubleHiResImage extends HiResImage createImage (); } + // ---------------------------------------------------------------------------------// public DoubleHiResImage (String name, byte[] buffer) + // ---------------------------------------------------------------------------------// { super (name, buffer); @@ -30,8 +36,8 @@ public class DoubleHiResImage extends HiResImage if (name.endsWith (".PAC")) { packedBuffer = buffer; - doubleScrunch = new DoubleScrunch (); - doubleScrunch.unscrunch (buffer); + doubleScrunch = new DoubleScrunch (buffer); + // doubleScrunch.unscrunch (buffer); auxBuffer = doubleScrunch.memory[0]; this.buffer = doubleScrunch.memory[1]; } @@ -50,8 +56,10 @@ public class DoubleHiResImage extends HiResImage createImage (); } + // ---------------------------------------------------------------------------------// @Override protected void createMonochromeImage () + // ---------------------------------------------------------------------------------// { // image will be doubled vertically image = new BufferedImage (560, 192 * 2, BufferedImage.TYPE_BYTE_GRAY); @@ -81,8 +89,10 @@ public class DoubleHiResImage extends HiResImage } } + // ---------------------------------------------------------------------------------// @Override protected void createColourImage () + // ---------------------------------------------------------------------------------// { paletteIndex = paletteFactory.getCurrentPaletteIndex (); Palette palette = paletteFactory.getCurrentPalette (); @@ -115,8 +125,10 @@ public class DoubleHiResImage extends HiResImage } } + // ---------------------------------------------------------------------------------// @Override public String getHexDump () + // ---------------------------------------------------------------------------------// { StringBuilder text = new StringBuilder (); diff --git a/src/com/bytezone/diskbrowser/utilities/CPU.java b/src/com/bytezone/diskbrowser/utilities/CPU.java index b22b630..bddf632 100644 --- a/src/com/bytezone/diskbrowser/utilities/CPU.java +++ b/src/com/bytezone/diskbrowser/utilities/CPU.java @@ -1,6 +1,8 @@ package com.bytezone.diskbrowser.utilities; +// -----------------------------------------------------------------------------------// public abstract class CPU +// -----------------------------------------------------------------------------------// { // registers private byte xReg; @@ -22,12 +24,16 @@ public abstract class CPU private boolean debug = false; + // ---------------------------------------------------------------------------------// protected void setDebug (boolean value) + // ---------------------------------------------------------------------------------// { debug = value; } + // ---------------------------------------------------------------------------------// protected void and (byte mask) // AND + // ---------------------------------------------------------------------------------// { aReg &= mask; zero = aReg == 0; @@ -35,7 +41,9 @@ public abstract class CPU debug ("AND"); } + // ---------------------------------------------------------------------------------// protected void asl () // ASL + // ---------------------------------------------------------------------------------// { carry = (aReg & 0x80) != 0; // move bit 7 into the carry flag aReg = (byte) (aReg << 1); // shift left @@ -45,7 +53,9 @@ public abstract class CPU } // unfinished + // ---------------------------------------------------------------------------------// protected void bit (byte value) // BIT + // ---------------------------------------------------------------------------------// { byte b = (byte) (aReg & value); zero = b == 0; @@ -54,25 +64,33 @@ public abstract class CPU debug ("BIT"); } + // ---------------------------------------------------------------------------------// protected void clc () // CLC + // ---------------------------------------------------------------------------------// { carry = false; debug ("CLC"); } + // ---------------------------------------------------------------------------------// protected void cli () // CLI + // ---------------------------------------------------------------------------------// { interrupt = false; debug ("CLI"); } + // ---------------------------------------------------------------------------------// protected void clv () // CLV + // ---------------------------------------------------------------------------------// { overflow = false; debug ("CLV"); } + // ---------------------------------------------------------------------------------// protected void cmp (byte value) // CMP + // ---------------------------------------------------------------------------------// { int tmp = (aReg & 0xFF) - (value & 0xFF); zero = tmp == 0; @@ -81,7 +99,9 @@ public abstract class CPU debug ("CMP"); } + // ---------------------------------------------------------------------------------// protected void cpx (byte value) // CPX + // ---------------------------------------------------------------------------------// { int tmp = (xReg & 0xFF) - (value & 0xFF); zero = tmp == 0; @@ -90,7 +110,9 @@ public abstract class CPU debug ("CPX"); } + // ---------------------------------------------------------------------------------// protected void cpy (byte value) // CPY + // ---------------------------------------------------------------------------------// { int tmp = (yReg & 0xFF) - (value & 0xFF); zero = tmp == 0; @@ -99,7 +121,9 @@ public abstract class CPU debug ("CPY"); } + // ---------------------------------------------------------------------------------// protected byte dec (byte value) // DEC + // ---------------------------------------------------------------------------------// { value = (byte) ((value & 0xFF) - 1); zero = value == 0; @@ -108,7 +132,9 @@ public abstract class CPU return value; } + // ---------------------------------------------------------------------------------// protected byte inc (byte value) // INC + // ---------------------------------------------------------------------------------// { value = (byte) ((value & 0xFF) + 1); zero = value == 0; @@ -117,7 +143,9 @@ public abstract class CPU return value; } + // ---------------------------------------------------------------------------------// protected void inx () // INX + // ---------------------------------------------------------------------------------// { xReg = (byte) ((xReg & 0xFF) + 1); xReg &= 0xFF; @@ -126,7 +154,9 @@ public abstract class CPU debug ("INX"); } + // ---------------------------------------------------------------------------------// protected void lda (byte value) // LDA + // ---------------------------------------------------------------------------------// { aReg = value; zero = aReg == 0; @@ -134,7 +164,9 @@ public abstract class CPU debug ("LDA"); } + // ---------------------------------------------------------------------------------// protected void lda (byte[] buffer, int offset) // LDA + // ---------------------------------------------------------------------------------// { aReg = buffer[offset]; zero = aReg == 0; @@ -142,7 +174,9 @@ public abstract class CPU debug ("LDA"); } + // ---------------------------------------------------------------------------------// protected void ldx (byte value) // LDX + // ---------------------------------------------------------------------------------// { xReg = value; zero = xReg == 0; @@ -150,7 +184,9 @@ public abstract class CPU debug ("LDX"); } + // ---------------------------------------------------------------------------------// protected void ldy (byte value) // LDY + // ---------------------------------------------------------------------------------// { yReg = value; zero = yReg == 0; @@ -158,7 +194,9 @@ public abstract class CPU debug ("LDY"); } + // ---------------------------------------------------------------------------------// protected void lsr () // LSR + // ---------------------------------------------------------------------------------// { negative = false; carry = (aReg & 0x01) != 0; @@ -167,7 +205,9 @@ public abstract class CPU debug ("LSR"); } + // ---------------------------------------------------------------------------------// protected void ora (byte mask) // ORA + // ---------------------------------------------------------------------------------// { aReg |= mask; zero = aReg == 0; @@ -175,7 +215,9 @@ public abstract class CPU debug ("ORA"); } + // ---------------------------------------------------------------------------------// protected void php () // PHP + // ---------------------------------------------------------------------------------// { byte flags = 0; if (negative) @@ -196,7 +238,9 @@ public abstract class CPU debug ("PHP"); } + // ---------------------------------------------------------------------------------// protected void plp () // PLP + // ---------------------------------------------------------------------------------// { byte flags = stack[sp++]; negative = (flags & 0x80) != 0; @@ -209,13 +253,17 @@ public abstract class CPU debug ("PLP"); } + // ---------------------------------------------------------------------------------// protected void pha () // PHA + // ---------------------------------------------------------------------------------// { stack[--sp] = aReg; debug ("PHA"); } + // ---------------------------------------------------------------------------------// protected void pla () // PLA + // ---------------------------------------------------------------------------------// { aReg = stack[sp++]; zero = aReg == 0; @@ -223,7 +271,9 @@ public abstract class CPU debug ("PLA"); } + // ---------------------------------------------------------------------------------// protected void rol () // ROL + // ---------------------------------------------------------------------------------// { boolean tempCarry = carry; carry = (aReg & 0x80) != 0; // move bit 7 into the carry flag @@ -235,7 +285,9 @@ public abstract class CPU debug ("ROL"); } + // ---------------------------------------------------------------------------------// protected byte rol (byte value) // ROL + // ---------------------------------------------------------------------------------// { boolean tempCarry = carry; carry = (value & 0x80) != 0; // move bit 7 into the carry flag @@ -249,7 +301,9 @@ public abstract class CPU return value; } + // ---------------------------------------------------------------------------------// protected byte ror (byte value) // ROR + // ---------------------------------------------------------------------------------// { boolean tempCarry = carry; carry = (value & 0x01) != 0; // move bit 0 into the carry flag @@ -263,13 +317,17 @@ public abstract class CPU return value; } + // ---------------------------------------------------------------------------------// protected byte sta () // STA + // ---------------------------------------------------------------------------------// { debug ("STA"); return aReg; } + // ---------------------------------------------------------------------------------// protected void sta (byte[] buffer, int offset) // STA + // ---------------------------------------------------------------------------------// { buffer[offset] = aReg; zero = aReg == 0; @@ -277,19 +335,25 @@ public abstract class CPU debug ("STA"); } + // ---------------------------------------------------------------------------------// protected byte stx () // STX + // ---------------------------------------------------------------------------------// { debug ("STX"); return xReg; } + // ---------------------------------------------------------------------------------// protected byte sty () // STY + // ---------------------------------------------------------------------------------// { debug ("STY"); return yReg; } + // ---------------------------------------------------------------------------------// protected void txa () // TXA + // ---------------------------------------------------------------------------------// { aReg = xReg; zero = aReg == 0; @@ -297,7 +361,9 @@ public abstract class CPU debug ("TXA"); } + // ---------------------------------------------------------------------------------// protected void tya () // TYA + // ---------------------------------------------------------------------------------// { aReg = yReg; zero = aReg == 0; @@ -305,7 +371,9 @@ public abstract class CPU debug ("TYA"); } + // ---------------------------------------------------------------------------------// protected void tax () // TAX + // ---------------------------------------------------------------------------------// { xReg = aReg; zero = xReg == 0; @@ -313,7 +381,9 @@ public abstract class CPU debug ("TAX"); } + // ---------------------------------------------------------------------------------// protected void tay () // TAY + // ---------------------------------------------------------------------------------// { yReg = aReg; zero = yReg == 0; @@ -321,18 +391,24 @@ public abstract class CPU debug ("TAY"); } + // ---------------------------------------------------------------------------------// protected void sei () // SEI + // ---------------------------------------------------------------------------------// { interrupt = true; debug ("SEI"); } + // ---------------------------------------------------------------------------------// protected String debugString () + // ---------------------------------------------------------------------------------// { return ""; } + // ---------------------------------------------------------------------------------// protected void debug (String cmd) + // ---------------------------------------------------------------------------------// { if (debug) { @@ -344,7 +420,9 @@ public abstract class CPU } } + // ---------------------------------------------------------------------------------// protected int indirectY (int base, byte offset, byte page) + // ---------------------------------------------------------------------------------// { if (debug) System.out.printf ("base: %,6d, page: %02X, offset: %02X, yReg: %02X%n", base, page,