Although
ARMbasic has
an extremely similar syntax to PBASIC, there are subtle differences, so some legacy code may not compile right away.
- ARMbasic is written for 32-bit hardware, and cannot
utilize code which depends on 16-bit truncation.
- The default data type is 32 bits, rather than 16
bits in PBASIC.
- FOR..NEXT is ambiguous for negative STEP. To clarify
negative steps use DOWNTO
-
The PBASIC syntax of IN0, DIR0, OUT0 has problems
with parameterization. It is replaced by the use of IN(0), DIR(0) and OUT(0).
- The formatted input of many PBASIC words will in many
cases hang waiting for input if it is not of the proper form. Its better
to accept any or all input and then parse it later, but PBASIC does not have
that ability. A simple set of string functions have been added to
ARMbasic to interpret input
- Integer variables do not need to be
declared. This is common to most other BASICs. ARMbasic does not require
simple variables to be declared before use. As of version 6.23 of the
Windows ARMbasic compiler allows the use of DIM xxx AS INTEGER
to declare simple variables, and will enforce that all variables be declared by DIM after that first DIM
declaration.
- As there is much more variable space available,
simple BIT, NIBBLE, BYTE types are not supported. Arrays of BYTE also called
strings are
supported
- Normal BASIC array declarations are supported using
DIM. Unlike PBASIC syntax.
- PIN declaration is replaced by treating pins as an
array IN(x) vs INx. This makes parameterization of pins simpler.
- The standard CONST syntax of most BASICs
is used instead of PBASIC CON syntax
- Multiple statements on a single line are not supported
- The standard PRINT is used and its syntax is used in place of PBASIC
DEBUGOUT
- Simple statements must be completed on a single line, run on statements
are not supported
- The $ suffix is used to declare strings using the DIM
statement
- Strings use a null (char 0) terminator
.
- CLEAR is used to reset all variables and reset the
stack.
- In an interpreter there is an advantage to having functions such as &\ |\ ^\ ** *\ DIG
and DCD But these are easily done in a compiled BASIC and have no performance or
space penalty.
x = NOT (a AND b) ' equivalent to a &\ b
x = a * b >> 16 '
equivalent to a ** b (for 16 bit values)
x = a * b >> 8
' equivalent to a */ b (for 16 bit values)
x = y /1000 mod 10 ' equivalent to y DIG 4
x
=
1<<6 ' equivalent to DCD 6
- HYP, TAN and NCD are not implemented in
ARMbasic
- Many differences will be handled in the PBASIC
translator pre-process step (under development)
- -$hex values are not supported
- Only 1 statement per line is allowed
- run-on statements are not allowed (continuation to the
next line)
- Formatted input is replaced with elementary string functions
- DTMFOUT is not supported.
- ON and BRANCH should be coded using SELECT CASE.
- LOOKUP can use arrays or strings.
- LOOKDOWN should be coded using SELECT CASE
- GET, PUT can be replaced with arrays