visicalc bug

This commit is contained in:
Denis Molony 2016-07-20 20:35:13 +10:00
parent bff1e8de2d
commit d84b4c4528
4 changed files with 24 additions and 19 deletions

View File

@ -15,9 +15,9 @@ import com.bytezone.diskbrowser.utilities.HexFormatter;
class CodeManager extends AbstractFile
{
Header header;
int codeSize;
Map<Integer, Routine> routines = new TreeMap<Integer, Routine> ();
private final Header header;
private int codeSize;
private final Map<Integer, Routine> routines = new TreeMap<Integer, Routine> ();
public CodeManager (Header header)
{
@ -60,7 +60,7 @@ class CodeManager extends AbstractFile
return blocks;
}
public void addMissingRoutines ()
void addMissingRoutines ()
{
System.out.printf ("%nWalking the code block%n%n");
int total = 0;
@ -125,12 +125,12 @@ class CodeManager extends AbstractFile
return text.toString ();
}
public boolean containsRoutineAt (int address)
boolean containsRoutineAt (int address)
{
return (routines.containsKey (address));
}
public void addCodeRoutines ()
void addCodeRoutines ()
{
List<Integer> routines = header.objectManager.getCodeRoutines ();
System.out.println ("Adding " + routines.size () + " code routines");
@ -138,7 +138,7 @@ class CodeManager extends AbstractFile
addRoutine (address, 0);
}
public void addActionRoutines ()
void addActionRoutines ()
{
List<Integer> routines = header.grammar.getActionRoutines ();
System.out.println ("Adding " + routines.size () + " action routines");
@ -146,7 +146,7 @@ class CodeManager extends AbstractFile
addRoutine (address, 0);
}
public Routine addRoutine (int address, int caller)
Routine addRoutine (int address, int caller)
{
if (address == 0) // stack-based call
return null;
@ -174,7 +174,7 @@ class CodeManager extends AbstractFile
return r;
}
public Routine getRoutine (int address)
Routine getRoutine (int address)
{
return routines.get (address);
}

View File

@ -22,13 +22,13 @@ class Header extends InfocomAbstractFile
int checksum;
int stringPointer;
Abbreviations abbreviations;
Dictionary dictionary;
ObjectManager objectManager;
StringManager stringManager;
CodeManager codeManager;
Globals globals;
Grammar grammar;
final Abbreviations abbreviations;
final Dictionary dictionary;
final ObjectManager objectManager;
final StringManager stringManager;
final CodeManager codeManager;
final Globals globals;
final Grammar grammar;
public Header (String name, byte[] buffer, Disk disk)
{

View File

@ -195,7 +195,7 @@ class Cell implements Comparable<Cell>, Value
@Override
public boolean isError ()
{
assert isValue () : "Cell type: " + type;
// assert isValue () : "Cell type: " + type;
return value.isError ();
}
@ -211,7 +211,12 @@ class Cell implements Comparable<Cell>, Value
@Override
public Value calculate ()
{
assert type == CellType.VALUE;
if (!isValue ())
{
System.out.println ("Not a value");
return this;
}
assert isValue () : "Cell type: " + type + " @ " + address;
if (expressionText == null)
{
System.out.printf ("%s null expression text %n", address);

View File

@ -124,7 +124,7 @@ class Expression implements Value
@Override
public Value calculate ()
{
// System.out.printf ("Calculating: %s%n", text);
System.out.printf ("Calculating: %s%n", text);
// if (text.equals ("@NA"))
// Utility.printStackTrace ();