ARM Extending ARM BBC BASIC
MDFS::Software.BBCBasic.RISCOS.BasPlus/htm Search

Adding functionality to ARM BASIC

Prompted by a discussion on comp.sys.acorn.programmer I decided to see if I could add BBC BASIC for Windows functionality to ARM BBC BASIC. I'm working on Castle's source for BASIC 1.37 available at the RISC OS Open site.

  • BasPlus.zip (213K, 16-Feb-2009): the current source. See the file Docs.Manual for details.
  • BasP137.zip (48K, 16-Feb-2009): just the binaries. See the file Manual for details.

    The extensions are as follows, in approximately the order I'm tackling them:
    Commands
  • $$<num>=<str>  
  • DONE:  null-terminated string indirection
  • PROC(<num>)[(parameter list)]  
  • DONE:  Call a procedure indirectly
  • WAIT <num>  
  • DONE:  Wait for centisecond delay
  • \  
  • DONE: Skip to next line
  • PLOT <num>,<num> 
  • DONE: Do PLOT 69,<num>,<num>
  • EXIT WHILE  
  • DONE: Exit current WHILE loop
  • EXIT REPEAT  
  • DONE: Exit current REPEAT loop
  • EXIT FOR  
  • DONE: Exit current FOR loop
  • EXIT FOR <var>  
  • Exit specified FOR loop
  • PROCname(PROCname|FNname)  
  • Pass a procedure/function to a procedure
  • PRIVATE var[,var...]  
  • Declare variables private to function or procedure
  • DIM struct{<members>}  
  • Define a structure
  • DIM struct{}=struct{}  
  • Define with a prototype
  • PRIVATE struct[,struct...]  
  • Declare structures private to function or procedure
  • name.name=  
  • Assign structure member
  • RECTANGLE SWAP <num>,<num>,<num>[,<num>] TO <num>,<num>
  •  
    Functions
  • $$<num>  
  • DONE:  null-terminated string indirection
  • ^<identifier>  
  • DONE:  Address of identifier
  • FN(<num>)[(parameter list)]  
  • DONE:  Call a function indirectly
  • FNname(PROCname|FNname)  
  • Pass a procedure/function to a procedure
  • DIM(struct{})  
  • Return size of structure
  • name.name  
  • Read structure member value
  • GET$(<num>,<num>)  
  • Read a character from the specified character position
  • GET(<num>,<num>)  
  • Read a character from the specified character position
    The following are from PDP11 BASIC, I may or may not add these:
  • STR$/<num>  
  • Return string representation in binary
  • STR$=<num>  
  • Return string representation in octal
  • &o  
  • Octal number
  • GET(<num>)  
  • Read a value from the specified I/O port
  • address|offset  
  • Real diadic indirection
     
    Compound Operators
  • AND=  
  • DONE:  Bitwise AND
  • DIV=  
  • DONE:  Integer division
  • EOR=  
  • DONE:  Bitwise exclusive-OR
  • MOD=  
  • DONE:  Modulus
  • OR=  
  • DONE:  Bitwise OR
  • *=  
  • Multiplication
  • /=  
  • Division
     
    Array Operations
  • array() = array() [AND|DIV|EOR|MOD|OR] array()
  • array() [AND|DIV|EOR|MOD|OR]= <expr>
  • Changes to ARM BBC BASIC source code
    ====================================
    15-Feb-2009:
    - EXIT WHILE|REPEAT|FOR working, EXIT FOR <var> not yet done.
    
    12-Feb-2009:
    - PLOY x,y does same as PLOT 69,x,y to plot single point
    - EXIT WHILE working, trying to generalise code to allow EXIT REPEAT|FOR
      to use same code.
    
    09-Feb-2009:
    - Line continuation fully working
    
    06-Feb-2009:
    - Syntax checked for EXIT [FOR|REPEAT|WHILE]
    - Line continuation character working for expressions
      Not fully working on PROC calls with arrays
    
    01-Feb-2009:
    - ^PROCname() and ^FNname() enforced, to match BBFW syntax
    - WAIT<cr> bug fixed, WAIT 0 same as WAIT with no parameter
    
    29-Jan-2009:
    - FN/PROC lookup working as subroutine, ^PROCname and ^FNname works
      Indirect PROC(<num>) and FN(<num>) also works, allows, eg:
      DIM pr%(3):pr%()=^PROCone, ^PROCtwo, ^PROCthree, ^PROCfour
      PROC(pr%(GET AND 3))
    - WAIT <num> waits <num> ticks
    
    26-Jan-2009:
    - AND=, OR=, EOR=, MOD=, DIV= done.
    
    24-Jan-2009:
    - FN/PROC lookup now a subroutine so ^ can call it.
      Causing stack corruption, so changes commented out.
    - $$<address>=<str> - store nul-terminated string.
    - <str>=$$<address> - fetch nul-terminated string.
    
    18-Jan-2009:
    - Added ^ (address-of) function, <num>=^<var>.
      Returns the address of the data block of <var>.
      Eg, fred%=6:PRINT !^fred% displays 6.
          jim$="hi":PRINT ~!^fred% displays address of start of "hi" string.
      Doesn't yet do ^PROCname and ^FNname.
    
    13-Jan-2009:
    - Get source code assembleable:
      Ensure all LNK commands are of the form LNK s.filename, not LNK filename.s
      LookUpHelp turned off, OwnErrors turned on, my machine doesn't have enough
        BasicTrans messages
      Change startup banner to VeRsIoN to be quickly identifyable
    
    - Add tokens for PRIVATE, EXIT.
      Added dispatch address in command and function dispatch tables.
      Added tokens to tokeniser/detokeniser.
      Wrote stub code.
      NB: BASICTrans 1.00 falls over with extra tokens, must RmKill BASICTrans
        before running
    

    HOME   DOCUMENTS   LINKS   RECENT CHANGES
    Best viewed with Any Browser Valid HTML 4.0! Authored by J.G.Harston - Last update: 26-Nov-2012