From RWilson@acorn.co.uk Fri Sep 11 10:07:50 1992 From: RWilson@acorn.co.uk Newsgroups: comp.sys.acorn Subject: Really! BASIC V in 3.10 Date: 10 Sep 92 17:35:38 GMT ARM BBC BASIC V: changes between 1.04 and 1.05 (1) BASIC V is internationalised. @% can be set to print "," instead of ".". All messages are printed via BASICTrans (see TransDoc). (2) INSTALL was treated as a statement permitting a variety of lethal, innocent looking BASIC programs along the lines of: 10 INSTALL"foo" which wipes out a substantial portion of the interpreter's stack: an error, local array or any structure causes mayhem. 1.05 series interpreters treat programs like this as bad: an error is issued if the INSTALL is encountered. INSTALL is now implemented as a command (and it is therefore impossible to edit the line containing an INSTALL to the state that a 1.04 interpreter left it). (3) ADR with bit 1 clear in OPT (0, 2, ..) will no longer give an error in the circumstance when the label is out of range. (Also bad immediate fields will not fault). (4) Fatal errors are *only* 0 (5) @% goes ANSI C @% is now reported by LVAR in ANSI printf format - one of g, e or f formats followed by the field width, a dot and the precision. @% is also settable using this format - @%="G10.9" corresponds to the default. There is now a HELP message on @% and the formats. Partial setting of @% is supported: @%="+":REM turn on STR$ @%="G":REM go to G format (turns off STR$) @%="10":REM set just the field width for current format (turns off STR$) @%=".5":REM set just the precision for current format (turns of STR$) @%="+F10":REM turn on STR$, go to F format and set field width 10 @%="E10.3":REM go to E format, field width 10, 3 digits in total @%="+F20.4":REM turn on STR$, go to F, field width 20, 4 digits after '.' Spaces cannot be used. LET @%= does not cope with the string form. Replace "." with "," to get "," used as the decimal point character. (6) Improved error messages from libraries The interpreter will tag the error message with the name of the library which caused the error message (found from the REM on the first line of a library. (7) INPUT# floating values Both the 5 byte real (&80, value) and the 8 byte real (&88, value) are accepted by the interpreter. (8) Sped up array statements The following have been sped up by some factor between 3 and 10: foo()= foo%()= foo()=fie() foo%()=fie%() DIM foo(, foo$(, foo%( (9) END= may be used almost anywhere Useable anywhere except with INSTALLed libraries, nested within EVAL or LOCAL ERROR, nested within assignments to local arrays, nested local arrays. Example: 10DIM A(10) 20A(1)=10 30PROCb 40PRINTA(1) 50END 60DEF PROCb 70LOCAL A() 80DIM A(2) 90A(1)=EXP1 100PROCMoveEnd(&40000) 110PRINTA(1) 120ENDPROC 130DEF PROCMoveEnd(a) 140LOCAL A() 150DIM A(10) 160A(1)=PI 170END=a 180PRINT A(1) 190ENDPROC is incorrect since there is a nested local array in PROCb. A direct call to PROCMoveEnd with no other nested A() would be OK. The interpreter is capable of detecting the above situation, but can be confused by an EVAL which contains a END=. HIMEM gets reset, local arrays cleared if faulty. (10) TRACE to file TRACE output can be directed to a file with TRACE TO "": all TRACE output is sent to the file until TRACE CLOSE is issued [the interpreter will close the trace file before exit]. Note that errors found when writing to this file will result in it being closed and forgotten about. The variable TRACE allows the programmer to output other things to the trace file (e.g. with IF TRACE THEN BPUT#TRACE,"X is "+STR$X) Note that TRACE now allows line number and PROC tracing to be on together: TRACE PROC:TRACE ON (say). (11) TEXTLOAD and TEXTSAVE commands TEXTLOAD TEXTSAVE[O ,] As well as the obvious, TEXTLOAD (and BASIC -load) are safer in that they have (generally) more free memory to convert the program in than BASIC 1.04 which is stuck with 4096 bytes. (12) CRUNCH command CRUNCH Strips various spaces from program. bit 0 = 1: spaces before statements bit 1 = 1: spaces in statements bit 2 = 1: REM statements (except on first line) bit 3 = 1: empty statements bit 4 = 1: empty lines Notes: (a) Programs with -quit set will be CRUNCH %1111 and LIBRARY and INSTALL sub programs will be CRUNCH %1111. CRUNCH %10 may make a program uneditable. OVERLAYs will not be CRUNCHed. (b) BASIC V 1.04 cannot read assembler statements that have been crunched: such things as EORR4,R4,R5 give it terminal heart burn. (c) The interpreter has been optimised for fully crunched programs. (d) CRUNCHing away empty lines will give problems to programs with GOTO (GOSUB, IF THEN, RESTORE) in them which rely on the target being an empty line (or line of empty statements or REM statement). RESTORE+ might give a problem if intervening lines are removed. (13) Bugs fixed 17-Nov-88 Fixed TAN1E-5 bug (misread the flow chart in Cody and Waite!) 02-Dec-88 -1^-10 blew up 14-Mar-89 " unlistable token " not terminated by >&7F 15-Jun-89 F1XSUB, F1SUB could return -0 which various xxSTAs can't cope with 17-Jul-89 Difference between IF THENELSE and IF THEN ELSE fixed 18-Aug-89 Cache not being flushed on errors could cause problems with EVAL 12-Oct-89 Bug in printing 0 in E mode removed 17-Oct-89 INT-(3*2^30) didn't give error 19-Oct-89 Assembler OPT not reset on -chain or -quit 24-Oct-89 A()=B() messed up 03-Nov-89 Change to ADVAL to return all 32 bits 11-Dec-89 TRACE TO "printer:" didn't work because of the type setting [Plus other things which I have forgotten!]