⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manual.txt

📁 open source of basic interpreter of 68
💻 TXT
📖 第 1 页 / 共 5 页
字号:
                      jmp       whl001              not equal, exit loop
                                                    other code goes here
                      jmp       whl000              back to top of loop
                 whl001
                 For short transfers, where the branch target is within the
                 relative addressing limit of the target MCU, this code is
                 larger and will run more slowly than necessary.
                 Using the /b option forces SB68k to generate relative
                 branches directly to all targets.  If the /b option is in
                 effect, SB68k would generate the following code for the
                 above example:
                 whl000
                      moveq.l   #$3,d0
                      cmp.l     var003(a5),d0
                      bne  whl001                   if not equal, branch
                                                    other code goes here
                      jmp  whl000                   back to top of loop
                 whl001
                 Note that the branch has reversed sense, and the JMP
                 instruction has disappeared.
                 WARNING:  Branches to addresses beyond the 68000's relative
                 branch limit will result in assembler errors, even though
                 SB68k will not report any compilation errors.  SB68k does
                 not maintain an internal program counter, and will not
                 detect that a branch target is out of range.
                 Beginning users should omit the /b option, and accept the
                 slight increase in size and execution times caused by the
                 default branch code generation.
                 Experienced users may, however, use the /b option to gain
                 improved performance.  In this case, however, you must
                                       Page 7

                 carefully monitor the assembler's output for any errors
                 resulting in out-of-range branches.
                 If your code generates out-of-range branches using the /b
                 option, recompile without the option.  SB68k currently does
                 not support any method for selectively compiling direct
                 branches.
                 Some 68000 target platforms use on-chip firmware to take
                 over the MCU's interrupt vector table.  In this case you
                 need to prevent SB68k from trying to set up a vector table
                 on the target machine.  You can prevent SB68k from creating
                 an interrupt vector table by using the /i option.  The
                 format of this option is:
                      /i
                 If you use the /i option and your SB68k program must use
                 interrupts, you will have to add SB68k code to prepare the
                 appropriate RAM-based jump table.  Refer to the Motorola
                 literature on your target MCU for details.
                 Note that the /i option surpresses ALL changes to the vector
                 area, including the reset vector.  SB68k programs compiled
                 with the /i option must use some resident firmware to
                 transfer control to the start of the program.
                                             Page 8

                 Environment variables
                 SB68k supports the use of two DOS environment variables.
                 These variables can help ease development of multiple
                 projects in SB68k.
                 When SB68k begins execution, it checks for the existence of
                 two environment variables, SB68K_INCLUDE and SB68K_LIBRARY.
                 SB68k assumes SB68K_INCLUDE contains the path to a directory
                 containing custom INCLUDE files.  Similarly, SB68k assumes
                 SB68K_LIBRARY contains the path to a directory containing
                 the standard SB68k library files.  If either of these
                 environment variables does not exist, SB68k defaults to the
                 current directory when searching for any corresponding
                 files.
                 You can assign a path to either of these variables in your
                 AUTOEXEC.BAT file, using DOS' SET command.
                 Example:
                      set  SB68K_INCLUDE=C:\MYPROJ\INC
                      set  SB68K_LIBRARY=C:\SBASIC68\LIB
                 These commands assign paths to the SB68K_INCLUDE and
                 SB68K_LIBRARY environment variables.
                                       Page 9

                 Library files
                 SB68k normally compiles all operations into in-line assembly
                 language source for the target machine.  In some cases,
                 however, a function may translate into so many lines of
                 source code that inserting the code in-line each time the
                 function is used would yield an unacceptably large output
                 file.
                 In these cases, SB68k automatically appends one or more
                 files of assembly language source code to the output file.
                 These files, called library files, contain pre-written
                 source code for performing the corresponding operation.
                 For example, most versions of the 68000 require several
                 lines of assembly language code to perform a 32-bit by 32-
                 bit multiplication.  Rather than insert this large section
                 of assembler source every time your program uses the *
                 operator, SB68k instead compiles a JSR to a library assembly
                 language subroutine.
                 At the end of your output file, SB68k then includes the
                 library file containing the source code for this
                 multiplication subroutine.
                 SB68k only includes library files when necessary, based on
                 your source code.
                 One library file deserves special mention.  SB68k always
                 includes the library file START68K.LIB  during each
                 compilation.  The assembly language source in this file will
                 be executed each time the target machine begins running your
                 SB68k program.  In fact, the code in this file is executed
                 immediately following system reset.
                 If your SB68k application requires changes to the startup
                 library code, you can customize START68K.LIB to include
                 those changes.
                 Note, however, that you should not change any of the labels
                 provided in the original version of START68K.LIB.  Other
                 parts of the SB68k system require that those labels exist,
                 and that they be named exactly as they are.
                                            Page 10

                 Features
                 SB68k is a free-form Basic that supports enough control
                 structures, such as IF-ELSE-ENDIF, that line numbers should
                 not be necessary.  It does not expect nor support line
                 numbers; if you use them, you will get a syntax error back.
                 SB68k does not support GOTO.
                 SB68k generates code that uses the target's largest commonly
                 available accumulator(s).  This means that for the 68000,
                 SB68k uses 32-bit variables and 32-bit math operations.
                 SB68k compiles down to fairly concise assembly language.  It
                 does no optimization from source line to source line.  That
                 is, it does not maintain a history of register usage and
                 attempt to optimize out redundant operations.  Even so, the
                 generated code is quite compact, and will run fast enough to
                 accomodate most projects.
                 For those projects that demand higher performance, SB68k
                 allows you to embed assembly language source directly in
                 your program.  These assembly statements are passed intact
                 to the target assembler.
                 SB68k is case-insensitive with regard to statements, labels,
                 variables, and constants.  The variable FOO may also be
                 referred to as foo, Foo or fOo.
                 SB68k has built-in maximums for several compilation elements
                 such as variables and labels.  These limits are:
                 Depth of FOR-NEXT nesting is 25.  No one should EVER hit
                 this limit.
                 Compilation parsing stack is limited to 60 atoms.  This is
                 an internal limit of the compiler that determines how
                 complex a statement the compiler can parse.  Again, no one
                 should ever hit this limit.
                 Compilation data stack is limited to 60 cells.  This should
                 be sufficient for all programs.
                 Maximum number of variables that a program can declare is
                 400.  Note that an array, no matter how large, counts as one
                 variable.
                 Maximum number of constants is 400.  Maximum number of
                 labels is 500.
                                       Page 11

                 SB68k supports the following Basic functions and operators:
                  rem            starts an SB68k comment
                  '              (single quote) starts an SB68k comment
                  include        includes other SB68k source files
                  org            changes location of generated code
                  data           stores 32-bit values in a ROM table
                  dataw          stores 16-bit values in a ROM table
                  datab          stores 8-bit values in a ROM table
                  copy           copies a block of data between two memory areas
                  =              assignment
                  +              addition
                  -              subtraction; unary negation
                  ~              1's complement
                  *              integer multiply (signed)
                  /              integer divide (signed)
                  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
                  rshft()        shift argument 1 bit to right
                  lshft()        shift argument 1 bit to left
                  rroll()        rotate argument 1 bit to right
                  lroll()        rotate argument 1 bit to left
                  rshftb()       shift argument 1 byte to right
                  lshftb()       shift argument 1 byte to left
                  rrollb()       rotate argument 1 byte to right
                  lrollb()       rotate argument 1 byte to left
                  min()          returns smaller of two values (signed)
                  max()          returns larger of two values (signed)
                  minu()         returns smaller of two values (unsigned)
                  maxu()         returns larger of two values (unsigned)
                  peek()         read 32-bit contents of an address
                  peekw()        read 16-bit contents of an address
                  peekb()        read 8-bit contents of an address
                  poke           write 32-bit value to an address
                  pokew          write 16-bit value to an address
                  pokeb          write 8-bit value to an address
                  swapw          exchange words (16-bits) within a value
                  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
                  elseif         part of an IF-ELSE-ENDIF structure
                  endif          ends an IF-ELSE-ENDIF structure
                                            Page 12

                  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
                  waitwhile      waits while an I/O condition exists
                  waituntil      waits until an I/O condition occurs
                  select         starts a SELECT-CASE structure
                  case           starts a CASE clause within a SELECT-CASE
                  endcase        ends a CASE clause
                  endselect      ends a SELECT-CASE structure
                  exit           leaves loop structure early
                  print          output text to the console
                  printu         output text; numbers print as unsigned
                  printx         output text; numbers print as hexadecimal
                  inkey()        input a character from the console
                  outch          output a character to the console
                  interrupt      marks start of an SB68k ISR
                  const          creates a named constant
                  declare        creates a 32-bit variable or array

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -