From 9fdbdf740c00493cb33046cbc86866385e4b4153 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Fri, 20 Nov 2020 19:19:51 +1000 Subject: [PATCH] tidying --- .../applefile/ApplesoftBasicProgram.java | 18 ++++++++++-------- .../diskbrowser/gui/BasicPreferences.java | 4 ++-- .../bytezone/diskbrowser/gui/DiskBrowser.java | 2 ++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java index 22bd250..817ecd0 100644 --- a/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java +++ b/src/com/bytezone/diskbrowser/applefile/ApplesoftBasicProgram.java @@ -39,11 +39,11 @@ public class ApplesoftBasicProgram extends BasicProgram int ptr = 0; int prevOffset = 0; - int max = buffer.length - 4; // need at least 4 bytes to make a SourceLine - while (ptr < max) + int max = buffer.length - 4; // need at least 4 bytes to make a SourceLine + while (ptr <= max) { int offset = Utility.unsignedShort (buffer, ptr); - if (offset <= prevOffset) + if (offset <= prevOffset) // usually zero break; SourceLine line = new SourceLine (ptr); @@ -133,7 +133,6 @@ public class ApplesoftBasicProgram extends BasicProgram // (see SEA BATTLE on DISK283.DSK) if (subline.is (TOKEN_REM) && lineText.length () > basicPreferences.wrapRemAt + 4) { - // System.out.println (lineText.length ()); String copy = lineText.substring (4); text.append ("REM "); int inset = text.length () + 1; @@ -213,7 +212,7 @@ public class ApplesoftBasicProgram extends BasicProgram } } - // Reset alignment value if we just left an IF - the indentation will be different now. + // Reset alignment value if we just left an IF - the indentation will be different now if (ifIndent > 0) alignPos = 0; } @@ -356,7 +355,7 @@ public class ApplesoftBasicProgram extends BasicProgram if (subline.assignEqualPos > 0) // does the line have an equals sign? { if (currentAlignPosition == 0) - currentAlignPosition = findHighest (subline); // examine following sublines for alignment + currentAlignPosition = findHighest (subline); // examine following sublines return currentAlignPosition; } return 0; // reset it @@ -459,7 +458,7 @@ public class ApplesoftBasicProgram extends BasicProgram int programLoadAddress = 0; if (buffer.length > 1) { - int offset = Utility.intValue (buffer[0], buffer[1]); + int offset = Utility.unsignedShort (buffer, 0); programLoadAddress = offset - getLineLength (0); } return programLoadAddress; @@ -485,7 +484,7 @@ public class ApplesoftBasicProgram extends BasicProgram private void popLoopVariables (Stack loopVariables, SubLine subline) // ---------------------------------------------------------------------------------// { - if (subline.nextVariables.length == 0) // naked NEXT + if (subline.nextVariables.length == 0) // naked NEXT { if (loopVariables.size () > 0) loopVariables.pop (); @@ -777,6 +776,9 @@ public class ApplesoftBasicProgram extends BasicProgram if (buffer[max] == 0) --max; + if (isImpliedGoto () && !basicPreferences.showThen) + line.append ("GOTO "); + for (int p = startPtr; p <= max; p++) { byte b = buffer[p]; diff --git a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java index 7ad66dd..f01321b 100644 --- a/src/com/bytezone/diskbrowser/gui/BasicPreferences.java +++ b/src/com/bytezone/diskbrowser/gui/BasicPreferences.java @@ -11,7 +11,7 @@ public class BasicPreferences public boolean onlyShowTargetLineNumbers = true; public boolean showCaret = false; public boolean showThen = true; - public int wrapPrintAt = 40; + public int wrapPrintAt = 0; public int wrapRemAt = 60; // ---------------------------------------------------------------------------------// @@ -21,7 +21,7 @@ public class BasicPreferences { StringBuilder text = new StringBuilder (); - text.append (String.format ("Split remark .......... %s%n", splitRem)); + text.append (String.format ("Split REM ............. %s%n", splitRem)); text.append (String.format ("Align assign .......... %s%n", alignAssign)); text.append (String.format ("Show targets .......... %s%n", showTargets)); text.append ( diff --git a/src/com/bytezone/diskbrowser/gui/DiskBrowser.java b/src/com/bytezone/diskbrowser/gui/DiskBrowser.java index 0f26558..d39386a 100755 --- a/src/com/bytezone/diskbrowser/gui/DiskBrowser.java +++ b/src/com/bytezone/diskbrowser/gui/DiskBrowser.java @@ -267,9 +267,11 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi private static void setLookAndFeel () // ---------------------------------------------------------------------------------// { + // FlatLightLaf.install (); try { UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ()); + // UIManager.setLookAndFeel (new FlatLightLaf ()); if (MAC) System.setProperty ("apple.laf.useScreenMenuBar", "true"); }