Added THEN option for IF statements

This commit is contained in:
Denis Molony 2020-11-11 14:26:30 +10:00
parent c0dc5e8875
commit 9b1d09defe
4 changed files with 24 additions and 9 deletions

View File

@ -775,7 +775,10 @@ public class ApplesoftBasicProgram extends BasicProgram
line.append (' ');
int val = b & 0x7F;
if (val < ApplesoftConstants.tokens.length)
line.append (ApplesoftConstants.tokens[val]);
{
if (b != TOKEN_THEN || basicPreferences.showThen)
line.append (ApplesoftConstants.tokens[val]);
}
}
else if (isControlCharacter (b))
line.append (basicPreferences.showCaret ? "^" + (char) (b + 64) : "");

View File

@ -10,6 +10,7 @@ public class BasicPreferences
public boolean showHeader = true;
public boolean onlyShowTargetLineNumbers = true;
public boolean showCaret = false;
public boolean showThen = true;
public int wrapPrintAt = 40;
public int wrapRemAt = 60;
@ -26,7 +27,8 @@ public class BasicPreferences
text.append (
String.format ("Only target lines ..... %s%n", onlyShowTargetLineNumbers));
text.append (String.format ("Show header ........... %s%n", showHeader));
text.append (String.format ("Show caret ............ %s", showCaret));
text.append (String.format ("Show caret ............ %s%n", showCaret));
text.append (String.format ("Show THEN ............. %s", showThen));
return text.toString ();
}

View File

@ -19,10 +19,10 @@ import javax.swing.KeyStroke;
import com.bytezone.diskbrowser.applefile.AssemblerProgram;
import com.bytezone.diskbrowser.applefile.BasicProgram;
import com.bytezone.diskbrowser.applefile.BasicTextFile;
import com.bytezone.diskbrowser.applefile.HiResImage;
import com.bytezone.diskbrowser.applefile.Palette;
import com.bytezone.diskbrowser.applefile.PaletteFactory;
import com.bytezone.diskbrowser.applefile.BasicTextFile;
import com.bytezone.diskbrowser.applefile.VisicalcFile;
import com.bytezone.diskbrowser.disk.DataDisk;
import com.bytezone.diskbrowser.disk.FormattedDisk;
@ -48,6 +48,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
private static final String PREFS_ONLY_SHOW_TARGETS = "onlyShowTargets";
private static final String PREFS_SHOW_HEADER = "showHeader";
private static final String PREFS_SHOW_CARET = "showCaret";
private static final String PREFS_SHOW_THEN = "showThen";
private static final String PREFS_SHOW_ASSEMBLER_TARGETS = "showAssemblerTargets";
private static final String PREFS_SHOW_ASSEMBLER_STRINGS = "showAssemblerStrings";
@ -131,6 +132,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
new JCheckBoxMenuItem ("Only show target lines");
final JMenuItem showHeaderItem = new JCheckBoxMenuItem ("Show header");
final JMenuItem showCaretItem = new JCheckBoxMenuItem ("Show caret");
final JMenuItem showThenItem = new JCheckBoxMenuItem ("Show THEN after IF");
// Assembler menu items
final JMenuItem showAssemblerTargetsItem = new JCheckBoxMenuItem ("Show targets");
@ -224,6 +226,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
applesoftMenu.add (showBasicTargetsItem);
applesoftMenu.add (onlyShowTargetLinesItem);
applesoftMenu.add (showCaretItem);
applesoftMenu.add (showThenItem);
assemblerMenu.add (showAssemblerHeaderItem);
assemblerMenu.add (showAssemblerTargetsItem);
@ -280,6 +283,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
onlyShowTargetLinesItem.addActionListener (basicPreferencesAction);
showHeaderItem.addActionListener (basicPreferencesAction);
showCaretItem.addActionListener (basicPreferencesAction);
showThenItem.addActionListener (basicPreferencesAction);
showAssemblerTargetsItem.addActionListener (assemblerPreferencesAction);
showAssemblerStringsItem.addActionListener (assemblerPreferencesAction);
@ -322,6 +326,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
basicPreferences.splitRem = splitRemarkItem.isSelected ();
basicPreferences.alignAssign = alignAssignItem.isSelected ();
basicPreferences.showCaret = showCaretItem.isSelected ();
basicPreferences.showThen = showThenItem.isSelected ();
basicPreferences.showHeader = showHeaderItem.isSelected ();
basicPreferences.showTargets = showBasicTargetsItem.isSelected ();
basicPreferences.onlyShowTargetLineNumbers = onlyShowTargetLinesItem.isSelected ();
@ -476,6 +481,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
prefs.putBoolean (PREFS_SPLIT_REMARKS, splitRemarkItem.isSelected ());
prefs.putBoolean (PREFS_ALIGN_ASSIGN, alignAssignItem.isSelected ());
prefs.putBoolean (PREFS_SHOW_CARET, showCaretItem.isSelected ());
prefs.putBoolean (PREFS_SHOW_THEN, showThenItem.isSelected ());
prefs.putBoolean (PREFS_SHOW_HEADER, showHeaderItem.isSelected ());
prefs.putBoolean (PREFS_SHOW_TARGETS, showBasicTargetsItem.isSelected ());
prefs.putBoolean (PREFS_ONLY_SHOW_TARGETS, onlyShowTargetLinesItem.isSelected ());
@ -523,6 +529,7 @@ class MenuHandler implements DiskSelectionListener, FileSelectionListener, QuitL
splitRemarkItem.setSelected (prefs.getBoolean (PREFS_SPLIT_REMARKS, false));
alignAssignItem.setSelected (prefs.getBoolean (PREFS_ALIGN_ASSIGN, true));
showCaretItem.setSelected (prefs.getBoolean (PREFS_SHOW_CARET, false));
showThenItem.setSelected (prefs.getBoolean (PREFS_SHOW_THEN, true));
showHeaderItem.setSelected (prefs.getBoolean (PREFS_SHOW_HEADER, true));
showBasicTargetsItem.setSelected (prefs.getBoolean (PREFS_SHOW_TARGETS, false));
onlyShowTargetLinesItem

View File

@ -336,7 +336,6 @@ public class ProdosDisk extends AbstractFormattedDisk
// ---------------------------------------------------------------------------------//
{
StringBuilder text = new StringBuilder ();
String newLine = String.format ("%n");
String timeC = volumeDirectoryHeader.created == null ? ""
: df.format (volumeDirectoryHeader.created.getTime ());
@ -348,12 +347,16 @@ public class ProdosDisk extends AbstractFormattedDisk
String.format ("ProDOS version : %d%n", volumeDirectoryHeader.version));
text.append (
String.format ("Min ProDOS version : %d%n", volumeDirectoryHeader.minVersion));
text.append ("Access rights : " + volumeDirectoryHeader.access + newLine);
text.append ("Entry length : " + volumeDirectoryHeader.entryLength + newLine);
text.append (
"Entries per block : " + volumeDirectoryHeader.entriesPerBlock + newLine);
text.append ("File count : " + volumeDirectoryHeader.fileCount + newLine);
text.append ("Bitmap block : " + volumeDirectoryHeader.bitMapBlock + newLine);
String.format ("Access rights : %d%n", volumeDirectoryHeader.access));
text.append (
String.format ("Entry length : %d%n", volumeDirectoryHeader.entryLength));
text.append (String.format ("Entries per block : %d%n",
volumeDirectoryHeader.entriesPerBlock));
text.append (
String.format ("File count : %d%n", volumeDirectoryHeader.fileCount));
text.append (
String.format ("Bitmap block : %d%n", volumeDirectoryHeader.bitMapBlock));
text.append (
String.format ("Total blocks : %d%n", volumeDirectoryHeader.totalBlocks));
text.append (String.format ("Interleave : %d", disk.getInterleave ()));