Tiny BASIC on R316: Information

  • lesio
    5th February Member 2 Permalink

    Credit to LBPHacker for the R316 computer and TPTASM
    Credit to lithium404 for the C to TPTASM compiler and patient support


    Inspired heavily by this Wikipedia page: https://en.wikipedia.org/wiki/Tiny_BASIC

    Still a prototype, make sure to report mistakes and bugs please

     

    Usage of the command line:
    Enter a command to run it immediately
    Enter a line number, a space and then a command to store it at that line in the code (for example "4 PRINT A")
    Enter RUN to start execution at line 0

     

    Variables are capital letters from A to Z
    Supported expression operations: +, -, *, /
    Expressions support square brackets for grouping

     

    Convenience features:

    • P is an alias for the PRINT command,
    • The usual equal sign in LET is omitted,
    • The usual "THEN" in IF is omitted,
    • The backslash '\' interrupts a running program,
    • Use the DEBUG command to toggle printing the code as it runs,
    • Use square brackets instead of normal ones to avoid having to press shift,
    • Use single quotes (') instead of double ones for the same reason as above

    Note, that:

    • Available lines are 0 to 99,
    • Gaps of 10 between line numbers like often done in BASIC are not recommended,
    • An END command in the code will speed up exiting,
    • Expressions should not contain spaces,
    • Only non-negative integers are supported so far,
    • Strings are only supported by PRINT,
    • Not all mistakes in your code will cause an error

    Keyboard layout reminder:

    '+' is shift + '='

    '*' is shift + '8'

    '<' and '>' are shift + ',' and '.' respectively

     

    Commands:

    PRINT (list of exprs and strings)
    Displays results of expressions and/or strings
    Can be abbreviated as P
    Examples:
    PRINT 'Hi!'
    PRINT A
    PRINT 10-5
    P 'Result:',C,[D-1]*2


    LET (var) (expr)
    Stores expression result in variable
    Examples:
    LET X X+1
    LET H 10


    IF (expr)(comparison)(expr) (command)
    Executes command if comparison is true
    Comparison operators: =, !=, <, >, <=, >=
    Examples:
    IF A+1>B PRINT 'YES'
    IF B!=10 GOTO 5

     

    GOTO (expr)
    Continues execution at given line

     

    GOSUB (expr)
    Calls the subroutine at given line

     

    INPUT (list of vars)
    Asks for the values each of the variables
    Examples:
    INPUT Z
    INPUT A,B,C

     

    PLOT (x expr) (y expr)
    Puts a white pixel at given position

     

    PEEK (var) (addr expr)
    Stores value from memory address to variable

     

    POKE (addr expr) (expr)
    Stores value into memory at address

     

    RETURN
    Returns from subroutine

     

    LIST
    Displays the program lines

     

    DEBUG
    Toggles printing currently executed line as the program runs

     

    ERASE
    Erases the program

     

    CLEAR
    Resets all variables to 0

     

    END
    Returns to the command line

     
    Edited 3 times by lesio. Last: 15th February
  • AlexFinn
    6th February Member 0 Permalink

    I'll make shure to read alll of that when i start reading my book front to back

  • nukers473
    7th February Member 1 Permalink

    this is very cool! do you have a github/something similar with the C code?

  • lesio
    10th February Member 0 Permalink

    Thanks :)
    No repository with the code yet though