diff --git a/src/com/bytezone/diskbrowser/applefile/AssemblerConstants.java b/src/com/bytezone/diskbrowser/applefile/AssemblerConstants.java index 5b23c83..9161767 100755 --- a/src/com/bytezone/diskbrowser/applefile/AssemblerConstants.java +++ b/src/com/bytezone/diskbrowser/applefile/AssemblerConstants.java @@ -2,66 +2,66 @@ package com.bytezone.diskbrowser.applefile; public interface AssemblerConstants { - // 1A = INC A, 3A = DEC A - String[] mnemonics = { "BRK", "ORA", "???", "???", "TSB", "ORA", "ASL", "???", // 00 - "PHP", "ORA", "ASL", "???", "TSB", "ORA", "ASL", "???", // 08 - "BPL", "ORA", "ORA", "???", "TRB", "ORA", "ASL", "???", // 10 - "CLC", "ORA", "INC", "???", "TRB", "ORA", "ASL", "???", // 18 - "JSR", "AND", "???", "???", "BIT", "AND", "ROL", "???", // 20 - "PLP", "AND", "ROL", "???", "BIT", "AND", "ROL", "???", // 28 - "BMI", "AND", "AND", "???", "BIT", "AND", "ROL", "???", // 30 - "SEC", "AND", "DEC", "???", "BIT", "AND", "ROL", "???", // 38 - "RTI", "EOR", "???", "???", "???", "EOR", "LSR", "???", // 40 - "PHA", "EOR", "LSR", "???", "JMP", "EOR", "LSR", "???", // 48 - "BVC", "EOR", "EOR", "???", "???", "EOR", "LSR", "???", // 50 - "CLI", "EOR", "PHY", "???", "???", "EOR", "LSR", "???", // 58 - "RTS", "ADC", "???", "???", "STZ", "ADC", "ROR", "???", // 60 - "PLA", "ADC", "ROR", "???", "JMP", "ADC", "ROR", "???", // 68 - "BVS", "ADC", "ADC", "???", "STZ", "ADC", "ROR", "???", // 70 - "SEI", "ADC", "PLY", "???", "JMP", "ADC", "ROR", "???", // 78 - "BRA", "STA", "???", "???", "STY", "STA", "STX", "???", // 80 - "DEY", "BIT", "TXA", "???", "STY", "STA", "STX", "???", // 88 - "BCC", "STA", "STA", "???", "STY", "STA", "STX", "???", // 90 - "TYA", "STA", "TXS", "???", "STZ", "STA", "STZ", "???", // 98 - "LDY", "LDA", "LDX", "???", "LDY", "LDA", "LDX", "???", // A0 - "TAY", "LDA", "TAX", "???", "LDY", "LDA", "LDX", "???", // A8 - "BCS", "LDA", "LDA", "???", "LDY", "LDA", "LDX", "???", // B0 - "CLV", "LDA", "TSX", "???", "LDY", "LDA", "LDX", "???", // B8 - "CPY", "CMP", "???", "???", "CPY", "CMP", "DEC", "???", // C0 - "INY", "CMP", "DEX", "???", "CPY", "CMP", "DEC", "???", // C8 - "BNE", "CMP", "CMP", "???", "???", "CMP", "DEC", "???", // D0 - "CLD", "CMP", "PHX", "???", "???", "CMP", "DEC", "???", // D8 - "CPX", "SBC", "???", "???", "CPX", "SBC", "INC", "???", // E0 - "INX", "SBC", "NOP", "???", "CPX", "SBC", "INC", "???", // E8 - "BEQ", "SBC", "SBC", "???", "???", "SBC", "INC", "???", // F0 - "SED", "SBC", "PLX", "???", "???", "SBC", "INC", "???" }; // F8 + // 1A = INC A, 3A = DEC A + String[] mnemonics = { "BRK", "ORA", "???", "???", "TSB", "ORA", "ASL", "???", // 00 + "PHP", "ORA", "ASL", "???", "TSB", "ORA", "ASL", "???", // 08 + "BPL", "ORA", "ORA", "???", "TRB", "ORA", "ASL", "???", // 10 + "CLC", "ORA", "INC", "???", "TRB", "ORA", "ASL", "???", // 18 + "JSR", "AND", "???", "???", "BIT", "AND", "ROL", "???", // 20 + "PLP", "AND", "ROL", "???", "BIT", "AND", "ROL", "???", // 28 + "BMI", "AND", "AND", "???", "BIT", "AND", "ROL", "???", // 30 + "SEC", "AND", "DEC", "???", "BIT", "AND", "ROL", "???", // 38 + "RTI", "EOR", "???", "???", "???", "EOR", "LSR", "???", // 40 + "PHA", "EOR", "LSR", "???", "JMP", "EOR", "LSR", "???", // 48 + "BVC", "EOR", "EOR", "???", "???", "EOR", "LSR", "???", // 50 + "CLI", "EOR", "PHY", "???", "???", "EOR", "LSR", "???", // 58 + "RTS", "ADC", "???", "???", "STZ", "ADC", "ROR", "???", // 60 + "PLA", "ADC", "ROR", "???", "JMP", "ADC", "ROR", "???", // 68 + "BVS", "ADC", "ADC", "???", "STZ", "ADC", "ROR", "???", // 70 + "SEI", "ADC", "PLY", "???", "JMP", "ADC", "ROR", "???", // 78 + "BRA", "STA", "???", "???", "STY", "STA", "STX", "???", // 80 + "DEY", "BIT", "TXA", "???", "STY", "STA", "STX", "???", // 88 + "BCC", "STA", "STA", "???", "STY", "STA", "STX", "???", // 90 + "TYA", "STA", "TXS", "???", "STZ", "STA", "STZ", "???", // 98 + "LDY", "LDA", "LDX", "???", "LDY", "LDA", "LDX", "???", // A0 + "TAY", "LDA", "TAX", "???", "LDY", "LDA", "LDX", "???", // A8 + "BCS", "LDA", "LDA", "???", "LDY", "LDA", "LDX", "???", // B0 + "CLV", "LDA", "TSX", "???", "LDY", "LDA", "LDX", "???", // B8 + "CPY", "CMP", "???", "???", "CPY", "CMP", "DEC", "???", // C0 + "INY", "CMP", "DEX", "???", "CPY", "CMP", "DEC", "???", // C8 + "BNE", "CMP", "CMP", "???", "???", "CMP", "DEC", "???", // D0 + "CLD", "CMP", "PHX", "???", "???", "CMP", "DEC", "???", // D8 + "CPX", "SBC", "???", "???", "CPX", "SBC", "INC", "???", // E0 + "INX", "SBC", "NOP", "???", "CPX", "SBC", "INC", "???", // E8 + "BEQ", "SBC", "SBC", "???", "???", "SBC", "INC", "???", // F0 + "SED", "SBC", "PLX", "???", "???", "SBC", "INC", "???" }; // F8 - byte[] sizes2 = { 1, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 00 - 0F - 2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 10 - 1F - 3, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 20 - 2F - 2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 30 - 3F - 1, 2, 0, 0, 0, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 40 - 4F - 2, 2, 2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+ 2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 70 - 7F + 2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // 80 - 8F + 2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // 90 - 9F + 2, 2, 2, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // A0 - AF + 2, 2, 2, 0, 2, 2, 2, 0, 1, 3, 1, 0, 3, 3, 3, 0, // B0 - BF + 2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // C0 - CF + 2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0, // D0 - DF + 2, 2, 0, 0, 2, 2, 2, 0, 1, 2, 1, 0, 3, 3, 3, 0, // E0 - EF + 2, 2, 2, 0, 0, 2, 2, 0, 1, 3, 1, 0, 0, 3, 3, 0 }; // F0 - FF - byte[] sizes = { 1, 1, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 }; + byte[] sizes = { 1, 1, 2, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2 }; - String[] mode = - { "Implied", "Accumulator", "Immediate", "Absolute", "Absolute, X", "Absolute, Y", - "(Absolute, X)", "(Absolute)", "Zero page", "Zero page, X", "Zero page, Y", - "(Zero page, X)", "(Zero page), Y", "(Zero page)", "Relative" }; + String[] mode = + { "Implied", "Accumulator", "Immediate", "Absolute", "Absolute, X", "Absolute, Y", + "(Absolute, X)", "(Absolute)", "Zero page", "Zero page, X", "Zero page, Y", + "(Zero page, X)", "(Zero page), Y", "(Zero page)", "Relative" }; - byte[] chip65c02 = - { 0x04, 0x0C, 0x12, 0x14, 0x1A, 0x1C, 0x32, 0x34, 0x3A, 0x3C, 0x52, 0x5A, 0x64, 0x72, - 0x74, 0x7A, 0x7C, (byte) 0x80, (byte) 0x89, (byte) 0x92, (byte) 0x9C, - (byte) 0x9E, (byte) 0xB2, (byte) 0xD2, (byte) 0xDA, (byte) 0xF2, (byte) 0xFA, }; + byte[] chip65c02 = + { 0x04, 0x0C, 0x12, 0x14, 0x1A, 0x1C, 0x32, 0x34, 0x3A, 0x3C, 0x52, 0x5A, 0x64, + 0x72, 0x74, 0x7A, 0x7C, (byte) 0x80, (byte) 0x89, (byte) 0x92, (byte) 0x9C, + (byte) 0x9E, (byte) 0xB2, (byte) 0xD2, (byte) 0xDA, (byte) 0xF2, (byte) 0xFA, }; } \ No newline at end of file diff --git a/src/com/bytezone/diskbrowser/applefile/equates.txt b/src/com/bytezone/diskbrowser/applefile/equates.txt index 6a418e6..7d6c0a2 100644 --- a/src/com/bytezone/diskbrowser/applefile/equates.txt +++ b/src/com/bytezone/diskbrowser/applefile/equates.txt @@ -116,27 +116,40 @@ F48A RIGHT EQU F4D5 UP EQU F504 DOWN EQU F6B9 HFNS + +F800 PLOT +F819 HLINE +F828 VLINE +F864 SETCOL +F871 SCRN + F940 PRINTYX F941 PRINTAX - print a hex number + FAA6 reboot DOS FAFF 0 = Autostart ROM, 1 = Old Monitor + FB1E PREAD - read game paddle FB2F initialise text screen FB39 text mode - SETTXT +FB40 SETGR FB5B TABV - monitor tab routine -FC66 CURSDWN - move cursor down -FBF4 CURSRIT - move cursor right -FC10 CURSLFT - move cursor left -FC1A CURSUP - move cursor up FB6F set powerup checksum FBC1 BASCALC - calculate video address FBDD BEEP +FBF4 CURSRIT - move cursor right + +FC10 CURSLFT - move cursor left +FC1A CURSUP - move cursor up FC22 VTAB FC42 CLREOP - clear to end of page FC58 HOME - clear screen FC62 CR +FC66 CURSDWN - move cursor down FC9C CLREOL FCA8 WAIT 1/2(26+27A+5A^2) microseconds +FCFA RD2BIT + FD0C RDKEY - Blink cursor FD1B KEYIN - Increment RNDL,H while polling keyboard FD35 RDCHAR - Call RDKEY @@ -147,9 +160,16 @@ FDDA PRBYTE - print A in hex FDED COUT - output a character FDF0 COUT1 - output a character to screen FD8E CROUT - generate a return + FE2C move a block of memory FE89 disconnect DOS from I/O links +FE8B INPORT FE93 disconnect DOS from I/O links +FE95 OUTPORT +FECD WRITE +FEFD READ + +FF02 READ2 FF3A BELL FF3F SAVE FF4A RESTORE diff --git a/src/com/bytezone/diskbrowser/visicalc/VisicalcCell.java b/src/com/bytezone/diskbrowser/visicalc/VisicalcCell.java index da49a23..525ec84 100644 --- a/src/com/bytezone/diskbrowser/visicalc/VisicalcCell.java +++ b/src/com/bytezone/diskbrowser/visicalc/VisicalcCell.java @@ -34,6 +34,13 @@ class VisicalcCell implements Comparable case '/': if (command.charAt (1) == 'F') // format cell { + // /FG - general + // /FD - default + // /FI - integer + // /F$ - dollars and cents + // /FL - left justified + // /FR - right justified + // /F* - graph format = command.charAt (2); if (command.length () > 3 && command.charAt (3) == '"') label = command.substring (4); @@ -73,6 +80,9 @@ class VisicalcCell implements Comparable double result = 0.0; double interim = 0.0; + if (formula.startsWith ("@LOOKUP(")) + return result; + Matcher m = cellContents.matcher (formula); while (m.find ()) { @@ -88,7 +98,7 @@ class VisicalcCell implements Comparable } catch (NumberFormatException e) { - System.out.printf ("NFE: %s%n", m.group (4)); + System.out.printf ("NFE: %s [%s]%n", m.group (4), formula); } else interim = parent.evaluateFunction (m.group (5)); // function diff --git a/src/com/bytezone/diskbrowser/visicalc/VisicalcSpreadsheet.java b/src/com/bytezone/diskbrowser/visicalc/VisicalcSpreadsheet.java index 759b4a0..c28a087 100644 --- a/src/com/bytezone/diskbrowser/visicalc/VisicalcSpreadsheet.java +++ b/src/com/bytezone/diskbrowser/visicalc/VisicalcSpreadsheet.java @@ -196,11 +196,11 @@ public class VisicalcSpreadsheet implements Iterable char subCommand = command.charAt (1); switch (subCommand) { - case 'W': + case 'W': // Window control // System.out.println (" Window command: " + data); break; - case 'G': + case 'G': // Global command // System.out.println (" Global command: " + data); try { @@ -224,7 +224,7 @@ public class VisicalcSpreadsheet implements Iterable } break; - case 'T': + case 'T': // Set title area // System.out.println (" Title command: " + data); break; @@ -268,6 +268,10 @@ public class VisicalcSpreadsheet implements Iterable { return result; } + if (function.startsWith ("@LOOKUP(")) + { + return result; + } Range range = getRange (function); if (range == null) @@ -305,6 +309,11 @@ public class VisicalcSpreadsheet implements Iterable max = getValue (address); result = max; } + else if (function.startsWith ("@LOOKUP")) + { + System.out.println ("Unfinished: " + function); + result = 0; + } else System.out.println ("Unimplemented function: " + function); // http://www.bricklin.com/history/refcard1.htm @@ -339,6 +348,7 @@ public class VisicalcSpreadsheet implements Iterable private Range getRange (String text) { Range range = null; + System.out.printf ("Range: [%s]%n", text); Matcher m = functionPattern.matcher (text); while (m.find ()) {