Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sinclair.basic
Class ZX81Basic

    java.lang.Object
      sinclair.basic.ZX81Basic

public class ZX81Basic
extends java.lang.Object

This class provides utilities to dump basic programs.

Author:
  hldswrth

Field Summary
`static boolean` | `DEBUG` Debug flag.

Constructor Summary
`ZX81Basic()`

Method Summary
`static int` | `comparePrograms(byte[] prog1, byte[] prog2, boolean compVars, int allowable)` Compare the two programs line-by-line.
`static int` | `comparePrograms(java.util.Map lines1, java.util.Map vars1, java.util.Map lines2, java.util.Map vars2, boolean compVars, int allowable)` Compare the two programs line-by-line.
`static void` | `dumpDisplay(byte[] memory, int start, int end, java.lang.StringBuffer buff)` Dump the display file.
`static void` | `dumpLine(byte[] memory, int number, boolean dumpNumberValues, boolean translate, boolean wrap, java.lang.StringBuffer buff)` Dump a basic program line.
`static void` | `dumpLine(byte[] memory, int number, boolean dumpNumberValues, java.lang.StringBuffer buff)` Dump a basic program line.
`static void` | `dumpProgram(byte[] memory, int start, int display, int vars, int varsEnd, boolean dumpNumberValues, java.lang.StringBuffer buff)` Dump a basic program, possibly including variables and display area.
`static void` | `dumpProgramLines(byte[] memory, int start, int end, boolean dumpNumberValues, java.lang.StringBuffer buff)` Dump a basic program.
`static void` | `dumpVariables(byte[] memory, int start, int end, java.lang.StringBuffer buff)` Dump variables.
`static void` | `getArray(byte[] content, int start, int len, java.lang.StringBuffer buff, boolean number, boolean wrap)` List an array.
`static void` | `getArray(byte[] content, int pos, java.lang.StringBuffer buff, int[] dims, int dim, boolean number)` List an array.
`static int` | `getNumber(byte[] content, int pos, java.lang.StringBuffer buff)` Get a number.
`static java.util.Map` | `getProgramLines(byte[] memory)` Get the program lines from the memory.
`static java.util.Map` | `getProgramLines(byte[] memory, int start, int end)` Return a map of the program lines, sorted by line number.
`static java.util.Map` | `getVariableMemory(byte[] memory)` Get all variables from the variables area.
`static java.util.Map` | `getVariableMemory(byte[] memory, int start, int end)` Get all variables from the variables area.
`static java.util.Map` | `getVariables(byte[] memory)` Get all variables from the variables area.
`static java.util.Map` | `getVariables(byte[] memory, int start, int end, boolean wrap)` Get all variables from the variables area.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEBUG

    public static boolean DEBUG

  Debug flag.

Constructor Detail

### ZX81Basic

    public ZX81Basic()

Method Detail

### dumpProgram

    public static void dumpProgram(byte[] memory,
                                   int start,
                                   int display,
                                   int vars,
                                   int varsEnd,
                                   boolean dumpNumberValues,
                                   java.lang.StringBuffer buff)

  Dump a basic program, possibly including variables and display area.

  Parameters:
    `memory` - The memory containing the program.
    `start` - The start index in memory to dump (assumed address 16519).
    `display` - The address of the display file.
    `vars` - The address of the variables.
    `varsEnd` - The address of the bottom of the stack (end of variables).
    `dumpNumberValues` - Indicates whether to dump number values.
    `buff` - The buffer to contain the result.

### dumpProgramLines

    public static void dumpProgramLines(byte[] memory,
                                        int start,
                                        int end,
                                        boolean dumpNumberValues,
                                        java.lang.StringBuffer buff)

  Dump a basic program.

  Parameters:
    `memory` - The memory containing the program.
    `start` - The start index in memory to dump (assumed address 16519).
    `end` - The end of the program.
    `dumpNumberValues` - Indicates whether to dump number values.
    `buff` - The buffer to contain the result.

### dumpLine

    public static void dumpLine(byte[] memory,
                                int number,
                                boolean dumpNumberValues,
                                java.lang.StringBuffer buff)

  Dump a basic program line.

  Parameters:
    `memory` - The memory containing the program line.
    `number` - The line number.
    `dumpNumberValues` - Indicates whether to dump number values.
    `buff` - The buffer to contain the result.

### dumpLine

    public static void dumpLine(byte[] memory,
                                int number,
                                boolean dumpNumberValues,
                                boolean translate,
                                boolean wrap,
                                java.lang.StringBuffer buff)

  Dump a basic program line.

  Parameters:
    `memory` - The memory containing the program line.
    `number` - The line number.
    `dumpNumberValues` - Indicates whether to dump number values.
    `translate` - Indicates whether to translate text.
    `wrap` - Indicates whether to wrap lines.
    `buff` - The buffer to contain the result.

### dumpDisplay

    public static void dumpDisplay(byte[] memory,
                                   int start,
                                   int end,
                                   java.lang.StringBuffer buff)

  Dump the display file.

  Parameters:
    `memory` - The memory containing the display.
    `start` - The start index in memory to dump.
    `end` - The end of the display.
    `buff` - The buffer to contain the result.

### dumpVariables

    public static void dumpVariables(byte[] memory,
                                     int start,
                                     int end,
                                     java.lang.StringBuffer buff)

  Dump variables.

  Parameters:
    `memory` - The memory containing the variables.
    `start` - The start index in memory to dump.
    `end` - The end of the variables.
    `buff` - The buffer to contain the result.

### getNumber

    public static int getNumber(byte[] content,
                                int pos,
                                java.lang.StringBuffer buff)

  Get a number.

  Parameters:
    `content` - The content of the file.
    `pos` - The position of the start of the number.
    `buff` - The buffer containing the listing.
  Returns:
    The new position.

### getArray

    public static void getArray(byte[] content,
                                int start,
                                int len,
                                java.lang.StringBuffer buff,
                                boolean number,
                                boolean wrap)

  List an array.

  Parameters:
    `content` - The content of the file.
    `start` - The position of the start of the array.
    `len` - The length of the array.
    `buff` - The buffer containing the listing.
    `number` - Indicates whether it is a number array.
    `wrap` - Indicates whether to wrap the variable value.

### getArray

    public static void getArray(byte[] content,
                                int pos,
                                java.lang.StringBuffer buff,
                                int[] dims,
                                int dim,
                                boolean number)

  List an array.

  Parameters:
    `content` - The content of the file.
    `pos` - The position of the start of the array.
    `buff` - The buffer containing the listing.
    `dims` - The array dimensions.
    `dim` - The current dimension being listed.
    `number` - Indicates whether it is a number array.

### comparePrograms

    public static int comparePrograms(byte[] prog1,
                                      byte[] prog2,
                                      boolean compVars,
                                      int allowable)

  Compare the two programs line-by-line.

  The comparison optionally includes variables.

  Parameters:
    `prog1` -
    `prog2` -
    `compVars` -
    `allowable` -
  Returns:
    The number of bytes different.

### comparePrograms

    public static int comparePrograms(java.util.Map lines1,
                                      java.util.Map vars1,
                                      java.util.Map lines2,
                                      java.util.Map vars2,
                                      boolean compVars,
                                      int allowable)

  Compare the two programs line-by-line.

  The comparison optionally includes variables.

  Parameters:
    `lines1` -
    `vars1` -
    `lines2` -
    `vars2` -
    `compVars` -
    `allowable` -
  Returns:
    The number of bytes different.

### getProgramLines

    public static java.util.Map getProgramLines(byte[] memory)

  Get the program lines from the memory.

  It is assumed the memory is a standard saved program, i.e. byte 0 in the array represents the contents of memory at ZX81SysVars.SAVE_START.

  Parameters:
    `memory` -
  Returns:
    The lines.

### getProgramLines

    public static java.util.Map getProgramLines(byte[] memory,
                                                int start,
                                                int end)

  Return a map of the program lines, sorted by line number.

  Parameters:
    `memory` - The program memory.
    `start` - The start of BASIC.
    `end` - The end of BASIC.
  Returns:
    The map of program lines.

### getVariables

    public static java.util.Map getVariables(byte[] memory)

  Get all variables from the variables area.

  It is assumed the memory is a standard saved program, i.e. byte 0 in the array represents the contents of memory at ZX81SysVars.SAVE_START.

  Parameters:
    `memory` - The program memory.
  Returns:
    The variables.

### getVariables

    public static java.util.Map getVariables(byte[] memory,
                                             int start,
                                             int end,
                                             boolean wrap)

  Get all variables from the variables area. There are basically six types. The first byte of a variable stores the first letter of the variable in bits 0 to 4 and the type in bits 5 to 7. Type Use 2 String 3 Numeric with a single letter name 4 Numeric array 5 Numeric with a multiple letter name 6 Character array (dimensioned string) 7 Index (used in a FOR loop)

  Parameters:
    `memory` - The program memory.
    `start` - The start of BASIC.
    `end` - The end of BASIC.
    `wrap` - Indicates whether to wrap the variable value.
  Returns:
    The variables.

### getVariableMemory

    public static java.util.Map getVariableMemory(byte[] memory)

  Get all variables from the variables area.

  It is assumed the memory is a standard saved program, i.e. byte 0 in the array represents the contents of memory at ZX81SysVars.SAVE_START.

  Parameters:
    `memory` - The program memory.
  Returns:
    The variables.

### getVariableMemory

    public static java.util.Map getVariableMemory(byte[] memory,
                                                  int start,
                                                  int end)

  Get all variables from the variables area. There are basically six types. The first byte of a variable stores the first letter of the variable in bits 0 to 4 and the type in bits 5 to 7. Type Use 2 String 3 Numeric with a single letter name 4 Numeric array 5 Numeric with a multiple letter name 6 Character array (dimensioned string) 7 Index (used in a FOR loop)

  Parameters:
    `memory` - The program memory.
    `start` - The start of BASIC.
    `end` - The end of BASIC.
  Returns:
    The variables.

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD