BBC BASIC
The version of BBC BASIC (1.32) supplied with RISC OS 5.00 on the IYONIX pc
contains several enhancements over earlier versions. In particular it
provides full support for the ARMv5TE instruction set.
The main changes are listed below, but note that you must not make use of the
new features in programs which are intended for use on older computers as BBC
BASIC 1.32 is only available on the IYONIX pc at present.
Full support for ARMv5TE instruction set and new LDC CP0,C0,[R0],{opt} syntax.
ALIGN now forces any unused bytes to zero when assembling at
both P% and O%. This is better than leaving possibly uninitialised
memory behind (which makes diffs very difficult).
The assembler now correctly recognises the new 'LR' special variable
when the L is lower-case.
The assembler has the 'SP' (13) special variable defined.
QUIT <expression> has been added to allow a return code to be passed
back to the called when BASIC exits. This is the only sensible way
for a BASIC program to set Sys$ReturnCode on exit (alternative methods fail
when BASIC removes it's environment handlers).
The MODE command can now be used to set the screen mode using a specified resolution
and colour depth:
MODE <width>,<height>,<bpp>[,<frame rate>]
For example:
MODE 1280, 1024, 32, 70
bpp may be 1, 2, 4, 6, 8, 16 or 32. 8 selects a full palette 256-colour mode,
6 an old-style one.
The MODE command now uses OS_ScreenMode 0, rather than *WimpMode.
COLOUR and GCOL both allow colour numbers rather than old-style
colours. Also, background colours can be set with R,G,B forms.
COLOUR [OF f] [ON b]
COLOUR [[OF] r,g,b] [ON r,g,b]
GCOL [OF [<action>],f] [ON [<action>],b]
GCOL [[OF] [<action>,]r,g,b] [ON [<action>,]r,g,b]
For COLOUR R,G,B, the OF is unnecessary, but provided for uniformity.
For GCOL R,G,B, OF tightens up the usage of <action> - without it
<action> is passed in to both R3 and R4 of ColourTrans_SetGCOL for
backwards compatibility (some may have used GCOL 128,r,g,b to
set the background colour - although this ends up setting reserved
flags in the ColourTrans_SetGCOL call).
VDU variables may now be read by using VDU as a function, for example:
screen_size% = VDU(7) :REM Number of bytes in screen buffer
BASIC will now surrender application space if possible at certain
moments: during SYS calls (as long as no string parameters are
passed in), MODE changes, OSCLI and * commands. Also, it will not
refuse requests to grow application space (although it will not
expand into the extra space).
Application space is only surrendered if no library is INSTALLed,
HIMEM is set to the top of BASIC's memory, and BASIC's memory extends
to the top of the application slot.
This permits easy MODE changes etc outside the desktop. Note the
effect that now outside the desktop, with screen memory at <300K and
no free pool, MODE 28 will work, while VDU 22,28 will not. This
restores some long lost BBC MOS behaviour.
The new DIM LOCAL statement has been added:
DIM <numeric variable> LOCAL <numeric expression>
DIM LOCAL allocates space from the BASIC stack rather than from the
heap. This means that the space allocated is automatically freed on
exit from the PROC or FN in which it was claimed.
As with all LOCAL statements, it must appear in a PROC or FN definition
and cannot appear inside a structure which uses the stack (i.e. NEXT)
or after a LOCAL ERROR.
Much like the manner in which "DIM foo% -1" returns the value of FSA
without allocating space, "DIM foo% LOCAL -1" returns the value of SP
at the time of the request, without allocating any space from the stack.
This can be useful in computing the free space between the top of the
BASIC heap and the bottom of the stack. Of course, the stack is used by
BASIC while interpreting the program, so the contents of memory below
foo% should always be treated as undefined.
One caveat of using DIM LOCAL is that the stack cannot be moved while
there are DIM LOCALs defined. END= will return an error and any
Service_Memory calls will be claimed for the duration of the DIM LOCAL.
Setting TIME$ now works with territories where %w3, %dy or %m3 are
unusual lengths.
TRACE PROC (and TRACE FN) now flush BASIC's cache of PROC and FN names to
ensure that all calls are reported - in earlier versions the cached ones
would not appear in the trace output.
BASIC will now return an error if it fails for any reason, eg if it can't
start due to lack of RAM (previous versions would go into an infinite loop).
Syntax errors in WHEN statement were not detected in previous versions
of BASIC if the first part of the expression (before the error) evaluated
to a value which did not match the case.
 |
| © 2006 IYONIX Ltd |
32-bit RISC OS |
|