This commit is contained in:
Denis Molony 2020-11-20 19:19:51 +10:00
parent 678c49f540
commit 9fdbdf740c
3 changed files with 14 additions and 10 deletions

View File

@ -39,11 +39,11 @@ public class ApplesoftBasicProgram extends BasicProgram
int ptr = 0; int ptr = 0;
int prevOffset = 0; int prevOffset = 0;
int max = buffer.length - 4; // need at least 4 bytes to make a SourceLine int max = buffer.length - 4; // need at least 4 bytes to make a SourceLine
while (ptr < max) while (ptr <= max)
{ {
int offset = Utility.unsignedShort (buffer, ptr); int offset = Utility.unsignedShort (buffer, ptr);
if (offset <= prevOffset) if (offset <= prevOffset) // usually zero
break; break;
SourceLine line = new SourceLine (ptr); SourceLine line = new SourceLine (ptr);
@ -133,7 +133,6 @@ public class ApplesoftBasicProgram extends BasicProgram
// (see SEA BATTLE on DISK283.DSK) // (see SEA BATTLE on DISK283.DSK)
if (subline.is (TOKEN_REM) && lineText.length () > basicPreferences.wrapRemAt + 4) if (subline.is (TOKEN_REM) && lineText.length () > basicPreferences.wrapRemAt + 4)
{ {
// System.out.println (lineText.length ());
String copy = lineText.substring (4); String copy = lineText.substring (4);
text.append ("REM "); text.append ("REM ");
int inset = text.length () + 1; 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) if (ifIndent > 0)
alignPos = 0; alignPos = 0;
} }
@ -356,7 +355,7 @@ public class ApplesoftBasicProgram extends BasicProgram
if (subline.assignEqualPos > 0) // does the line have an equals sign? if (subline.assignEqualPos > 0) // does the line have an equals sign?
{ {
if (currentAlignPosition == 0) if (currentAlignPosition == 0)
currentAlignPosition = findHighest (subline); // examine following sublines for alignment currentAlignPosition = findHighest (subline); // examine following sublines
return currentAlignPosition; return currentAlignPosition;
} }
return 0; // reset it return 0; // reset it
@ -459,7 +458,7 @@ public class ApplesoftBasicProgram extends BasicProgram
int programLoadAddress = 0; int programLoadAddress = 0;
if (buffer.length > 1) if (buffer.length > 1)
{ {
int offset = Utility.intValue (buffer[0], buffer[1]); int offset = Utility.unsignedShort (buffer, 0);
programLoadAddress = offset - getLineLength (0); programLoadAddress = offset - getLineLength (0);
} }
return programLoadAddress; return programLoadAddress;
@ -485,7 +484,7 @@ public class ApplesoftBasicProgram extends BasicProgram
private void popLoopVariables (Stack<String> loopVariables, SubLine subline) private void popLoopVariables (Stack<String> loopVariables, SubLine subline)
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
if (subline.nextVariables.length == 0) // naked NEXT if (subline.nextVariables.length == 0) // naked NEXT
{ {
if (loopVariables.size () > 0) if (loopVariables.size () > 0)
loopVariables.pop (); loopVariables.pop ();
@ -777,6 +776,9 @@ public class ApplesoftBasicProgram extends BasicProgram
if (buffer[max] == 0) if (buffer[max] == 0)
--max; --max;
if (isImpliedGoto () && !basicPreferences.showThen)
line.append ("GOTO ");
for (int p = startPtr; p <= max; p++) for (int p = startPtr; p <= max; p++)
{ {
byte b = buffer[p]; byte b = buffer[p];

View File

@ -11,7 +11,7 @@ public class BasicPreferences
public boolean onlyShowTargetLineNumbers = true; public boolean onlyShowTargetLineNumbers = true;
public boolean showCaret = false; public boolean showCaret = false;
public boolean showThen = true; public boolean showThen = true;
public int wrapPrintAt = 40; public int wrapPrintAt = 0;
public int wrapRemAt = 60; public int wrapRemAt = 60;
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
@ -21,7 +21,7 @@ public class BasicPreferences
{ {
StringBuilder text = new StringBuilder (); 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 ("Align assign .......... %s%n", alignAssign));
text.append (String.format ("Show targets .......... %s%n", showTargets)); text.append (String.format ("Show targets .......... %s%n", showTargets));
text.append ( text.append (

View File

@ -267,9 +267,11 @@ public class DiskBrowser extends JFrame implements DiskSelectionListener, QuitLi
private static void setLookAndFeel () private static void setLookAndFeel ()
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
// FlatLightLaf.install ();
try try
{ {
UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ()); UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ());
// UIManager.setLookAndFeel (new FlatLightLaf ());
if (MAC) if (MAC)
System.setProperty ("apple.laf.useScreenMenuBar", "true"); System.setProperty ("apple.laf.useScreenMenuBar", "true");
} }