NorthStar DOS 5.x (S)ingle/(D)ouble - Quick Reference
-----------------------------------------------------

DISKETTE FORMAT:
----------------
The diskette consists of 350 sectors, each of which is 256(S)/512(D)
bytes in size. Sectors are numbered 0-349. The first 4 sectors contain
the directory, which contains 64/128 entries, each of which is 16 bytes
in size:
        0-7     = Filename
        8-9     = Starting Disk sector address (0-349)
       10-11    = Nunber of sectors in file.
        12      = File type (0-128)
                    0 = Default type (Not set)
                    1 = Executable program
                    2 = BASIC program
                    3 = BASIC data file
                    5 = EDIT source file
                    8 = XEK source file
       13-15    = type-dependant data
                T(1): 13-14 = "GO" address

An empty directory entry contains all blanks (20h).

COMMANDS:
---------

    []          = Optional operands
    device      = A console device number: #0-#255
    drive       = A drive number: 1-3(S) / 1-4(D)
    file        = A file name (max 8 characters)
    D...        = A parameter value in Decimal
    H...        = A parameter value in Hexidecimal

LI  [device] [drive]

    Display file directory of selected drive:
        LI          <= Display drive 1
        LI 2        <= Display drive 2
        LI #1       <= Display drive 1 > device 1
        li #1 2     <= Display drive 2 > device 1

CR file length [Dsector]

    Create a file of Dlength sectors in size. File is placed immediately
    after last file on disk, unless Dsector is secified (0-349) to place
    the file at that specific disk sector address. Default file type is 0.

DE file

    Deletes a file.

TY file Dtype [Haddress]

    Sets the type of a file to Dtype (0-127). For type 1 file, Haddress
    must be supplied to set the "GO" address.

GO file [...]

    Loads a type1 file into memory at it's GO address and jumps to it.
    (ie: runs the file). HL points to the remainder of the command line.

JP Haddress [...]

    Jumps to a Program already loaded in memory at the specified Haddress.
    HL points to the remainder of the command line.

LF file Haddress
SF file Haddress

    Loads/Saves a file to/from memory at the specified Haddress.

RD Dsector Haddress Dnumber-of-sectors
WR Dsector Haddress Dnumber-of-sectors

    Reads/Writes data directly from absolite disk sector addresses
    (0-349) to/From memory at Haddress.

IN [drive]

    Initializes a new diskette. Entire diskette is written with ASCII
    blank characters, which erases all files and data content.


DISK ERRORS:
------------
In the event of a disk error, the system displays: Tx Dy S z
        x = Error type:
            1 = Sync byte (data) not found
            2 = CRC compare error
            3 = Verify compare error
            4 = No index pulse
            5 = Density mismatch
            6 = Write protect
        y = Drive number (0-3)
        z = sector number 0-249

ENTRY POINTS:
-------------
200D    - Character output function: A=device B=character
2010    - Character input  function: A=device EXIT: A=input character
2013    - Terminal initialization function
2016    - Test for CONTROL-C: Sets ZF if Control-C has been typed
    [The above functions may be supplied by the user in personalizing DOS]
    [to a specific system. 2900-29FF is avalable for these routines      ]
2019    - Called on Disk error - isses "Tx Dy S z" & enters DOS.
201C    - Directory lookup: HL=file[,drive] (CR or SP terminated)
          exit: A=drive number (1-3)
                CF=0 - Success: HL=pointer to directory entry
                CF=1 - Failure: HL=first free disk address
201F    - Write directory entry back to disk, must follow [201C]
2022    - Disk command: A=#sects DE=RAM address HL=Disk address
                        B=0/1/2:Write/Read/Verify
            Exit: CF=1 - Bad arguments.
            If disk error, [2019] is called.
2025    - List directory: A=drive L=output device (0=Console)
2028    - Entry point for loaded DOS (terminate program)
202B    - Data: Disk Read-After-Write check: 0=Disabled 1=Enabled
202C    - Called on CONTRL-C during [2025] or name error during [201C]
2030    - Data: Auto-Start flag: Normally 1 - set to 0 for TurnKey
2031    - Data: 16 bit pointer to DOS input buffer [Preset for TurnKey]
2033    - Data: Video console page size, normally 24.

UTILITIES:
----------
These commands reside on disk are are executed via the GO command:

GO DT [drive]

    Performs a diskette test - Writes patterns of data to the drive
    and reads it back to verify - DESTROYS THE DISK CONTENT.

GO CF [[file] file]

    Copies a File.

GO CD [drive [drive]]

    Copies an entire diskette from one drive to another.

GO CO [drive]

    Compacts the file space on a drive. Files are moved together, all
    unused space between files is moved to a single block the end of
    the disk.

GO M0000
GO M2A00    (S)ingle density version only
GO M2D00    (D)ouble density version only
GO M5700    [This version contains stand-alone I/O]
GO M6700
GO MF400

    NorthStar Monitor program:

    value   = Any value:
                x           = Hexidecimal value
                xH          = Hexidecimal value
                nT          = Decimal value
    address = A memory address: 0-FFFFh/65535T

    block   = Memory block:
            address         = 1 byte block
            address-address = Specified by address range
            address,length  = Specified by address & length

    CM block address        - Compare Memory
    FM block value          - Fill Memory
    MM block address        - Move Memory
    SM block value ...      - Search Memory
    TM block value          - Test Memory (value=Seconds between passes)
    DH block                - Display memory in Hexidecimal
    DA block                - Display memory in Hex with ASCII
    DS address              - Display memory & Allow Substution:
                x       = new byte value (0-FF)
                SPACE   = Advance to next location & display
                COMMA   = Advance to next location / no display.
                RETURN  = Terminate command
    JP address              - Jump to Program
    OS                      - Return to DOS
    IL                      - IPL - reboot
    OD #device              - Set monitor output device
    ID #device              - Set monitor input device

GO BASIC

    Execute the NorthStar BASIC interpreter, described below
    (FPBASIC is a version which uses N* hardware floating point board)
-----------------------------------------------------------------
DIRECT COMMANDS:
----------------
LIST [#dev] [line[,line]] [interval] - List program
DEL line,line                   - Delete multiple program lines
SCR                             - Scratch: Erase program and workspace
REN [line[,increment]]          - Renumber program
AUTO [stert[,increment]]        - Automatic line entry
CAT [#dev] [drive]              - Display disk catalog (directory)
SAVE file[,drive]               - Save program to disk
NSAVE file[,drive] [size]       - Save program to new file
LOAD file[,drive]               - Load program from disk
APPEND file[,drive]             - Appends program to disk file
RUN [line]                      - Execute program
CONT                            - Resume after STOP/CONTROL -C
PSIZE                           - Display program size in file blocks
MEMSET address                  - Set upper memory bound used by BASIC
LINE [#dev,]value               - Set device line length
BYE                             - Exit BASIC, return to DOS

PROGRAM STATEMENTS:
-------------------
REM text                        - Comment - ignored
DIM var(size[,size])[,...]      - Set variable array dimensions
LET variable=expression         - Assign variable
PRINT [#dev,]value[,...][,]     - Display variables and strings
INPUT [#dev,][string,][vars]    - Input variables
DATA constant[,constant]        - Set constant data block
READ variable[,variable]        - Read constant data block
RESTORE [line]                  - Reset/Set data block read pointer
GOTO line                       - Jump to line
IF expr THEN stmt [ELSE stmt]   - Conditional execution
ON expr GOTO line[,...]         - Computed GOTO
STOP                            - Halt execution with message
END                             - Halt execution without message
FOR v=value TO limit [STEP val] - Begin counted loop
NEXT [v]                        - End counted loop
EXIT line                       - Exit from within FOR loop (cleans stack)
GOSUB line                      - Call subroutine
RETURN                          - Return from subroutine
DEF name(var[,var...])=stmt     - Define single line user function
DEF name(var[,var...])          - Define multi-line user function
        End with FNEND, pass back value with: RETURN value
ERRSET line,Lvariable,Evariable - Define an error handler L=Line E=Errtype
CHAIN "file"                    - Transfer to program on disk
CREATE file,sise[,type]         - Create a disk file
DESTROY file                    - Delete a file
OPEN #fno[%type],file[,size-variable]   - Open a file
CLOSE #fno                      - Close a file
READ #fno[%address],variable-list   - Read data from file
WRITE #fno[%address],expr-list  - Write data to file
    During random-write, use NOENDMARK as last item in list to inhibit
    writing the end mark (which would terminate the file).
OUT port,value                  - Write to 8080 I/O port
FILL address,value              - POKE (write memory)

FUNCTIONS:
----------
ABS(value)                      - Absolute value
SGN(value)                      - 1=Positive, -1=Negative, 0=Zero
INT(value)                      - Integer component of FP value
LOG(value)                      - Natural logarithm
EXP(value)                      - e**value
SQRT(value)                     - Square root
SIN(value)                      - Sine
COS(value)                      - Cosine
ATN(value)                      - Arctangent
LEN(string)                     - Length of string
CHR$(value)                     - 1-char string with ASCII value char.
ASC(string)                     - ASCII-Decimal value of first char
VAL(string)                     - Value from string number "123" -> 123
STR$(value)                     - String from value number 123 -> "123"
INCHAR$(device)                 - Get char from device
INP(0-255)                      - Read from 8080 I/O port
TYP(file)                       - Type of next data item in open file:
                                    0=EOF 1=String 2=Numeric
FILE(string)                    - Get type of file (-1 = not found)
RND(value)                      - Random number: -=BuildSeed 0=Next +=UseSeed
EXAM(value)                     - PEEK (read memory)
FREE(0)                         - Available memory
TAB(value)                      - Tab to column (PRINT statement only)
CALL(value[,DEvalue])           - Execute 8080 code, returns HL

VARIABLES:
----------
    A/A0-A9 - Z/Z0-Z9           - Numeric variables
    A$/A0$-A9$ - Z$/Z0$-Z9$     - String variables

ARITHMETIC OPERATORS:
---------------------
    +       - Addition          *   - Multiplication
    -       - Subtraction       /   - Division
    ^       - Exponentation     ~   - Negation

RELATIONAL OPERATORS:
---------------------
    =       - Equal to          <>  - Not equal to
    >       - Greater than      >=  - Greater than or equal to
    <       - Less than         <=  - Less than or equal to

BOOLIAN OPERATORS:
------------------
    NOT     - Invert a single condition
    AND     - Logical AND of two conditions
    OR      - Logical OR  of two conditions

STRING OPERATORS:
-----------------
    +       - Concatination

