Beagle Bros hacks
This commit is contained in:
parent
1062a18004
commit
2ef764ea5c
|
@ -256,8 +256,11 @@ public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftCons
|
|||
text.append ((char) b);
|
||||
}
|
||||
|
||||
assert ptr == nextLine - loadAddress;
|
||||
// ptr = nextLine - loadAddress;
|
||||
if (ptr != (nextLine - loadAddress))
|
||||
{
|
||||
System.out.printf ("ptr: %04X, nextLine: %04X%n", ptr, nextLine - loadAddress);
|
||||
// ptr = nextLine - loadAddress;
|
||||
}
|
||||
text.append ("\n");
|
||||
}
|
||||
}
|
||||
|
@ -302,7 +305,8 @@ public class ApplesoftBasicProgram extends BasicProgram implements ApplesoftCons
|
|||
}
|
||||
|
||||
// Beagle Bros often have multiline REM statements
|
||||
if (subline.is (TOKEN_REM) && subline.containsControlChars ())
|
||||
if (subline.is (TOKEN_REM) && basicPreferences.formatRem
|
||||
&& subline.containsControlChars ())
|
||||
{
|
||||
subline.addFormattedRem (text);
|
||||
fullText.append (text + "\n");
|
||||
|
|
|
@ -57,10 +57,9 @@ public class SourceLine implements ApplesoftConstants
|
|||
if (buffer[ptr] == TOKEN_THEN)
|
||||
++ptr;
|
||||
|
||||
// create subline from the condition (and THEN if it exists)
|
||||
// create subline from the condition (plus THEN if it exists)
|
||||
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
|
||||
startPtr = ptr;
|
||||
|
||||
break;
|
||||
|
||||
// end of subline, so add it, advance startPtr and continue
|
||||
|
@ -78,7 +77,6 @@ public class SourceLine implements ApplesoftConstants
|
|||
sublines.add (new SubLine (this, startPtr, (ptr - startPtr) - 1));
|
||||
startPtr = ptr - 1;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case Utility.ASCII_QUOTE:
|
||||
|
@ -87,8 +85,17 @@ public class SourceLine implements ApplesoftConstants
|
|||
}
|
||||
}
|
||||
|
||||
// add whatever is left
|
||||
sublines.add (new SubLine (this, startPtr, ptr - startPtr));
|
||||
this.length = ptr - linePtr;
|
||||
length = ptr - linePtr;
|
||||
|
||||
// add whatever is left - will either start with a token, or be a line number
|
||||
int bytesLeft = ptr - startPtr;
|
||||
sublines.add (new SubLine (this, startPtr, bytesLeft));
|
||||
|
||||
// if (lineNumber == 99)
|
||||
// {
|
||||
// System.out.printf ("linePtr: %04X length: %02X%n", linePtr, length);
|
||||
// System.out.println (HexFormatter.format (buffer, linePtr, length));
|
||||
// System.out.println (HexFormatter.format (buffer, startPtr, bytesLeft));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.bytezone.diskbrowser.applefile;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.bytezone.diskbrowser.utilities.HexFormatter;
|
||||
import com.bytezone.diskbrowser.utilities.Utility;;
|
||||
|
||||
// -----------------------------------------------------------------------------------//
|
||||
|
@ -59,13 +60,16 @@ public class SubLine implements ApplesoftConstants
|
|||
else
|
||||
{
|
||||
ptr = startPtr;
|
||||
if (Utility.isDigit (firstByte)) // implied GOTO
|
||||
if (Utility.isDigit (firstByte)) // split IF xx THEN nnn
|
||||
{
|
||||
addXref (getLineNumber (buffer, startPtr), gotoLines);
|
||||
return;
|
||||
}
|
||||
else // variable assignment
|
||||
else if (Utility.isLetter (firstByte)) // variable assignment
|
||||
recordEqualsPosition ();
|
||||
else // probably Beagle Bros 0D...
|
||||
System.out.printf ("Unexpected bytes at %5d: %s%n", parent.lineNumber,
|
||||
HexFormatter.formatNoHeader (buffer, startPtr, length).substring (5));
|
||||
}
|
||||
|
||||
String var = "";
|
||||
|
@ -403,11 +407,11 @@ public class SubLine implements ApplesoftConstants
|
|||
int max = startPtr + length - 1;
|
||||
while (ptr < max)
|
||||
{
|
||||
if (Utility.isHighBitSet (buffer[ptr]))
|
||||
text.append (tokens[buffer[ptr] & 0x7F]);
|
||||
byte b = buffer[ptr++];
|
||||
if (Utility.isHighBitSet (b))
|
||||
text.append (tokens[b & 0x7F]);
|
||||
else
|
||||
text.append ((char) buffer[ptr]);
|
||||
++ptr;
|
||||
text.append ((char) b);
|
||||
}
|
||||
|
||||
return text.toString ();
|
||||
|
@ -570,9 +574,10 @@ public class SubLine implements ApplesoftConstants
|
|||
// ---------------------------------------------------------------------------------//
|
||||
{
|
||||
int ptr = startPtr + 1;
|
||||
int max = startPtr + length - 2;
|
||||
int max = startPtr + length - 1;
|
||||
text.append ("REM ");
|
||||
|
||||
while (ptr <= max)
|
||||
while (ptr < max)
|
||||
{
|
||||
switch (buffer[ptr])
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ public class BasicPreferences
|
|||
public boolean showCaret = false;
|
||||
public boolean showThen = true;
|
||||
public boolean blankAfterReturn = false;
|
||||
public boolean formatRem = false;
|
||||
public boolean deleteExtraRemSpace = false;
|
||||
public boolean deleteExtraDataSpace = false;
|
||||
public boolean showXref = false;
|
||||
|
@ -53,6 +54,7 @@ public class BasicPreferences
|
|||
text.append (String.format ("Show duplicate symbols ... %s%n", showDuplicateSymbols));
|
||||
// text.append (String.format ("List strings ............. %s%n", listStrings));
|
||||
text.append (String.format ("Blank after RETURN ....... %s%n", blankAfterReturn));
|
||||
text.append (String.format ("Format REM ............... %s%n", formatRem));
|
||||
text.append (String.format ("Delete extra REM space ... %s%n", deleteExtraRemSpace));
|
||||
text.append (String.format ("Delete extra DATA space .. %s%n", deleteExtraDataSpace));
|
||||
text.append (String.format ("Wrap PRINT at ............ %d%n", wrapPrintAt));
|
||||
|
|
|
@ -63,6 +63,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
private static final String PREFS_SHOW_DUPLICATE_SYMBOLS = "showDuplicateSymbols";
|
||||
// private static final String PREFS_LIST_STRINGS = "listStrings";
|
||||
private static final String PREFS_BLANK_AFTER_RETURN = "blankAfterReturn";
|
||||
private static final String PREFS_FORMAT_REM = "formatRem";
|
||||
private static final String PREFS_DELETE_EXTRA_REM_SPACE = "deleteExtraRemSpace";
|
||||
private static final String PREFS_DELETE_EXTRA_DATA_SPACE = "deleteExtraDataSpace";
|
||||
|
||||
|
@ -156,7 +157,9 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
new JCheckBoxMenuItem ("Only show target line numbers");
|
||||
final JMenuItem showCaretItem = new JCheckBoxMenuItem ("Show caret");
|
||||
final JMenuItem showThenItem = new JCheckBoxMenuItem ("Show THEN after IF");
|
||||
final JMenuItem blankAfterReturn = new JCheckBoxMenuItem ("Blank line after RETURN");
|
||||
final JMenuItem blankAfterReturnItem =
|
||||
new JCheckBoxMenuItem ("Blank line after RETURN");
|
||||
final JMenuItem formatRemItem = new JCheckBoxMenuItem ("Allow formatted REM");
|
||||
final JMenuItem deleteExtraRemSpace = new JCheckBoxMenuItem ("Delete extra REM space");
|
||||
final JMenuItem deleteExtraDataSpace =
|
||||
new JCheckBoxMenuItem ("Delete extra DATA space");
|
||||
|
@ -268,7 +271,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
applesoftMenu.add (onlyShowTargetLinesItem);
|
||||
applesoftMenu.add (showCaretItem);
|
||||
applesoftMenu.add (showThenItem);
|
||||
applesoftMenu.add (blankAfterReturn);
|
||||
applesoftMenu.add (blankAfterReturnItem);
|
||||
applesoftMenu.add (formatRemItem);
|
||||
applesoftMenu.add (deleteExtraRemSpace);
|
||||
applesoftMenu.add (deleteExtraDataSpace);
|
||||
applesoftMenu.addSeparator ();
|
||||
|
@ -291,7 +295,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
|
||||
applesoftFormatItems = new ArrayList<> (Arrays.asList (splitRemarkItem, splitDimItem,
|
||||
alignAssignItem, showBasicTargetsItem, onlyShowTargetLinesItem, showCaretItem,
|
||||
showThenItem, blankAfterReturn, deleteExtraRemSpace, deleteExtraDataSpace));
|
||||
showThenItem, blankAfterReturnItem, formatRemItem, deleteExtraRemSpace,
|
||||
deleteExtraDataSpace));
|
||||
|
||||
applesoftXrefItems = new ArrayList<> (Arrays.asList (showXrefItem, showCallsItem,
|
||||
showSymbolsItem, showFunctionsItem, showConstantsItem, showDuplicateSymbolsItem));
|
||||
|
@ -398,7 +403,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
basicPreferences.onlyShowTargetLineNumbers = onlyShowTargetLinesItem.isSelected ();
|
||||
basicPreferences.showCaret = showCaretItem.isSelected ();
|
||||
basicPreferences.showThen = showThenItem.isSelected ();
|
||||
basicPreferences.blankAfterReturn = blankAfterReturn.isSelected ();
|
||||
basicPreferences.blankAfterReturn = blankAfterReturnItem.isSelected ();
|
||||
basicPreferences.formatRem = formatRemItem.isSelected ();
|
||||
basicPreferences.deleteExtraRemSpace = deleteExtraRemSpace.isSelected ();
|
||||
basicPreferences.deleteExtraDataSpace = deleteExtraDataSpace.isSelected ();
|
||||
|
||||
|
@ -581,7 +587,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
// prefs.putBoolean (PREFS_LIST_STRINGS, listStringsItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_SHOW_TARGETS, showBasicTargetsItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_ONLY_SHOW_TARGETS, onlyShowTargetLinesItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_BLANK_AFTER_RETURN, blankAfterReturn.isSelected ());
|
||||
prefs.putBoolean (PREFS_BLANK_AFTER_RETURN, blankAfterReturnItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_FORMAT_REM, formatRemItem.isSelected ());
|
||||
prefs.putBoolean (PREFS_DELETE_EXTRA_REM_SPACE, deleteExtraRemSpace.isSelected ());
|
||||
prefs.putBoolean (PREFS_DELETE_EXTRA_DATA_SPACE, deleteExtraDataSpace.isSelected ());
|
||||
|
||||
|
@ -643,7 +650,8 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
|
|||
showBasicTargetsItem.setSelected (prefs.getBoolean (PREFS_SHOW_TARGETS, false));
|
||||
onlyShowTargetLinesItem
|
||||
.setSelected (prefs.getBoolean (PREFS_ONLY_SHOW_TARGETS, false));
|
||||
blankAfterReturn.setSelected (prefs.getBoolean (PREFS_BLANK_AFTER_RETURN, false));
|
||||
blankAfterReturnItem.setSelected (prefs.getBoolean (PREFS_BLANK_AFTER_RETURN, false));
|
||||
formatRemItem.setSelected (prefs.getBoolean (PREFS_FORMAT_REM, false));
|
||||
deleteExtraRemSpace
|
||||
.setSelected (prefs.getBoolean (PREFS_DELETE_EXTRA_REM_SPACE, false));
|
||||
deleteExtraDataSpace
|
||||
|
|
Loading…
Reference in New Issue