Menu

high-level Basic language interpreter

Nick Metcalfe

The features of the Mega 80 are made available by an implementation of the Basic programming language. This has been styled to resemble the user experience offered by the first generation of home microcomputers.

The Basic interpreter is targeted to be at least Level II compatible. Many special functions of the Mega 80 will also be available as Basic statements.

The current list of features includes :-
Basic line buffer and editor
Basic interpreter

  • command parser
  • capable print command
  • goto command
  • gosub, return commands
  • improved if command (then optional)
  • for/to/step, next commands
  • run command
  • list command
  • expression evaluator now includes correct conditionals
  • primitive variables
  • Basic program text storage
  • label table handling
  • unconditional branching
  • text attributes (bold, inverse, underline, italic)
  • set pixel
  • draw line

todo(*=done) :-
Reorganization

* - move modifiers flag control and ctl-alt-del action to framebuffer
- rewire, test and hopefully reassign framebuffer x-pins to SPI

Basic - must haves
variables

    • proper variable/function name table handling
    • string storage & garbage collector
  • multidimensional and string arrays with storage
  • dim statement

Control
-do/loop while/until
-while/wend

Statements

    • new
    • let
    • clear[,x] where x is string space
    • edit
    • &H, &B immediate prefixes
    • delete (lines) statement
    • control-c checking
  • input command
    • rem
  • data/read/restore
    • cls
  • eval
    functions
  • def fn functions
    memory manipulators
    • peek
    • poke
      special variables
  • err -- error number
  • erl -- error line
    • mem -- free text space
      bit manipulators
    • bitwise operators ( <<, >> )
    • bitwise conditionals (and, or, xor, not, bit)
  • in/out routines for port
  • wait a[,x] -- a = anded byte, x = xored byte

Easier routines
Graphic routines

    • set(x,y)
    • reset(x,y)
    • point(x,y)
    • locate r,c
  • pos(r|c)
    Other simpler stuff
  • randomize
    • rnd()
    • inkey$()
    • abs()
    • sgn()
    • asc()
    • chr$()
    • hex$()
    • len()
    • instr()
    • left$()
    • right$()
    • mid$()
    • str$()
    • string$()
    • val()
    • attributes() ? -- alters bits in user_flag
  • get

Really desirable but may be tricky

  • on pin goto/gosub
  • on key goto/gosub
    Error handling
    • on error goto x
    • resume
      Debugging
    • break
    • step
    • cont

Basic - optionals

  • call
  • varptr
  • renumber statement(external?)
  • erase (arrays) statement
  • line input
  • write
  • bin$()
  • mid$ -- statement
  • space$()
  • swap var, var
  • timer -- tics since turn on

Filesystem drivers

  • i2c thru keyboard
  • nvram comms
    File / com port handling
    • fh = open ("filename", "mode") -- mode = ro[b], rw[b], a[b], filename = "com:", "con:", name

    • error = seek(#fh, byte) -- error = 0, ok; error = EOF
    • byte = loc(#fh)
    • bytes = lof(#fh)
    • print #fh, arg, arg,....
    • input #fh, var, var,....
    • close (#fh)
    • eof(#fn)
      Optionals
    • write #fh... -- prints separators on top of standard print
    • line input #fh, $var
      File commands
    • load "filename"[,r] -- r retains variables and merges program
    • save "filename"[,a] -- a being for ascii save
    • bload "filename"[,address]
    • bsave "filename"[,address]
    • dir
    • cd
    • del

I/O stuff

  • basic driver hooks
  • sound? timer controlled frequency/duration lists?
  • all pin frequency/duty cycle for servos
  • pwm/one-shot
  • counter
  • adc stuff(basic driver?)
  • stepper motor stuff
  • modulation/demodulation
  • freq counting
  • rtc
  • encryption / compression
  • flexible serial parameters to allow midi
  • async timing / distance sensor

MongoDB Logo MongoDB