Newsgroups: comp.robotics
Path: cantaloupe.srv.cs.cmu.edu!europa.chnt.gtegsc.com!news.sprintlink.net!psgrain!agora!news
From: marvin@agora.rdrop.com (Marvin Green)
Subject: SBASIC for the 68HC11. Cool Tool!
X-Newsreader: WinVN 0.99.3
Sender: news@agora.rdrop.com (David Greenman)
Nntp-Posting-Host: slip-d0.rdrop.com
Organization: RainDrop Laboratories
Message-ID: <DB449o.6nM@agora.rdrop.com>
Mime-Version: 1.0
Date: Sun, 2 Jul 1995 23:36:59 GMT
Lines: 102

SBASIC BASIC COMPILER FOR THE 68HC11.

SBasic is a cross-compiler for a subset of the Basic language.
Source files containing SBasic statements are compiled into a source
file of assembly language for the target machine, the 68HC11.

Karl Lunts SBasic creates fast tight code. It is also very easy to
develop clean structured programs, perfect for robotics.  The wealth 
of commands and features make SBasic a great choice for programming
the 68HC11.

Creating SBasic code for the 68HC11 is a four step process.

1.  Write your code to a text file.
2.  Compile your text file using the SBasic compiler.
3.  Compile the assembly code file into a *.s19 file using
    Motorola's ASMHC11 compiler.
4.  Down Load the *.S19 file to the 68HC11.

* Steps 2 and 3 can be automated with a batch file.

When you are finished, you will have four files:

myfile.BAS              This is the BASIC program you wrote.
myfile.ASC              This file is created when you run SBasic.
myfile.LST              Compiler list created by the assember.
myfile.S19              Machine code created by the assembler.
                        This is the code you send to the 68HC11.

SBasic supports the following Basic functions and operators:

      rem            starts an SBasic comment
      '              (single quote) starts an SBasic comment
      include        includes other SBasic source files
      data           stores 16-bit values in a ROM table
      datab          stores 8-bit values in a ROM table
      =              assignment
      +              addition
      -              subtraction; unary negation
      *              integer multiply
      /              integer divide
      mod            integer modulus
      and            boolean AND
      or             boolean OR
      xor            boolean XOR
      =              test, equal
      <              test, less-than
      >              test, greater-than
      <>, ><         test, not-equal
      <*             test, unsigned less-than
      >*             test, unsigned greater-than
      peek()         read 16-bit contents of an address
      peekb()        read 8-bit contents of an address
      poke           write 16-bit value to an address
      pokeb          write 8-bit value to an address
      for            starts a FOR-NEXT iterative loop
      to             signed test in a FOR-NEXT loop
      to*            unsigned test in a FOR-NEXT loop
      step           optional part of a FOR-NEXT loop
      next           ends a FOR-NEXT loop
      if             starts an IF-ELSE-ENDIF structure
      else           part of an IF-ELSE-ENDIF structure
      endif          ends an IF-ELSE-ENDIF structure
      while          starts a WHILE-WEND structure
      wend           ends a WHILE-WEND structure
      do             starts a DO-LOOP structure
      while          optional part of a DO-LOOP structure
      until          optional part of a DO-LOOP structure
      loop           ends a DO-LOOP structure
      exit           leaves loop structure early
      print          output text to the console
      inkey$()       input a character from the console
      outch          output a character to the console
      interrupt      marks start of an SBasic ISR
      const          creates a named constant
      declare        creates a single 16-bit variable
      addr()         returns address of a label
      push           pushes a value onto the SB data stack
      pop()          pops a value from the SB data stack
      pull()         synonym for pop()
      interrupts     enables or disables system interrupts
      gosub          invokes an SBasic subroutine
      return         returns from an ISR or subroutine
      end            ends an SBasic program


SBasic has many unique features including a data stack, addressable labels
and access to interrupts.  These features help make SBasic perfect to set 
up a state machine or multitasking.
 
Instead of going into great detail on the many features of SBasic,
I suggest that you download a copy and take a look at the excellent
manual that comes with SBasic.

ftp://cherupakha.media.mit.edu/pub/incoming/karl_lunt

______________________________________________________________________
Marvin Green                                          Home of Zippy 
821 SW 14th                                           Larry, and other             
Troutdale, OR  97060                                  happy Robots.
(503) 666-5907            marvin@agora.rain.com

