home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / documentation / documents / a252bas < prev    next >
Internet Message Format  |  1999-04-27  |  31KB

  1. From: RWilson@acorn.co.uk
  2. Subject: BASIC V in 3.10
  3. Date: 10 Sep 92 16:28:16 GMT
  4.  
  5. ARM BBC BASIC V: changes between 1.02 and 1.04
  6.  
  7. (1) OVERLAY
  8.  
  9. OVERLAY allows a single set of programs (referred to by a pre-initialised
  10. string array) to be loaded into common memory. The LVAR command lists the
  11. first line of libraries or installed libraries; the order of listing is also
  12. the order of searching - which is simply (a) search current program (b)
  13. search any LIBRARYs, last mentioned first (the order shown by LVAR) (c)
  14. search any INSTALLed libraries, again last mentioned first (d) search the
  15. OVERLAY library, starting with the current overlay in core (if there is one)
  16. and then linearly from the start of the OVERLAY array.
  17.  
  18. The OVERLAY statement takes a string array and allocates a single block of
  19. store large enough to hold any single one of the programs: at this stage no
  20. program is actually loaded. The programs referred to in the string array will
  21. be searched for procedure and functions and, once this has been found, the
  22. interpreter will load in the right overlay in order to execute it. One cannot
  23. call items in other overlays from an overlay library (even implicitly via the
  24. main program or other libraries). The search time can be reduced by setting
  25. the approriate element of the array to a null string when that library no
  26. longer needs to be consulted. It is important not to confuse the interpreter
  27. by changing the names in the string array! Another OVERLAY statement will
  28. work (after forgetting all the referenced procedures) but the store used by
  29. the first one will be lost: however, one can add new strings to the existing
  30. array provided the programs referred to are no larger than the largest one
  31. given to the OVERLAY statement.
  32.  
  33. DIM A$(10)
  34. A$(1)="adfs:&.Assistant":A$(2)="net:$.Matrices":A$(3)="net:$.PlotLib"
  35. OVERLAY A$()
  36.  
  37. (2) Save and restore DATA pointer (onto the stack)
  38.  
  39. Since DATA statements can be used in procedure libraries (by using RESTORE
  40. +), transparent use of the DATA pointer is also provided. The current value
  41. can be saved onto the stack just like the error status.
  42.  
  43. LOCAL DATA (may be used anywhere, unlike LOCAL A etc)
  44.    Makes the use of DATA local; i.e. saves the DATA pointer on the stack.
  45.  
  46. RESTORE DATA
  47.    Restore DATA pointer from the stack. An error will occur if the next
  48. thing on the stack is not a DATA pointer.
  49.  
  50. Returning from a function or procedure will restore any DATA pointer it
  51. finds on the stack. LOCAL DATA must be the last thing to be made local in a
  52. procedure or function (apart from LOCAL ERROR).
  53.  
  54. REM "safe" routine for reading in an array
  55. DEF PROCRead(A())
  56. REM going to use local DATA so save status
  57. LOCAL DATA
  58. REM set pointer
  59. RESTORE +0
  60. DATA 1,2,3,4,5,6,7,&99
  61. REM do the job!
  62. ENDPROC
  63. REM end of procedure will restore error status
  64.  
  65. (3) Array initialisation
  66.  
  67. A$()=<factor>,<expression>,<expression> ..
  68. A%()=<factor>,<expression>,<expression> ..
  69. A()=<factor>,<expression>,<expression> ..
  70.  
  71. Array initialisation can be done with all elements the same (A()=1) or with
  72. element by element initialisation (A()=1,2,3,4,5,6 etc.). The element by
  73. element form will leave any unspecified values alone. The order of values
  74. given in the list is "last subscript changes quickest" i.e. for DIM A(2,1),
  75. they would be A(0,0); A(0,1); A(1,0); A(1,1); A(2,0); A(2,1) in order.
  76.  
  77. (4) SUMLEN
  78.  
  79. SUMLEN which returns the sum of the lengths of all the strings in a string
  80. array.
  81.  
  82. (5) MOD
  83.  
  84. MOD which returns the modulus (square root of the sum of the squares of each
  85. element) of a numeric array.
  86.  
  87. Example of (3), (4) and (5):
  88.  
  89. transformation()=1,0,0,0,1,0,0,0,1
  90. coordinate()=coordinate().transformation()
  91. PRINT"There are ";SUMLEN(A$())" characters."
  92. normalisedvector()=vector()/MODvector()
  93.  
  94. (6) ERROR EXT
  95.  
  96. ERROR EXT <number>,<string> passes an error to the caller's error handler
  97.  
  98. (7) QUIT
  99.  
  100. QUIT function: TRUE if BASIC has been called with -quit on command line
  101.  
  102. (8) Store allocation
  103.  
  104. When a string is stored, the current space is immediately used if the number
  105. of words is compatible; otherwise the space is deallocated: it is stored on
  106. the appropriate member of an array of free lists, each list having one size
  107. in words. This makes allocation of the new space for a string very quick:
  108. check the free list corresponding to the desired length, if there is an
  109. entry, take it; otherwise use new space. Use of contiguous store has been
  110. disabled in 1.03 since it gives rise to some strange side effects: programs
  111. running on 1.03 may use fractionally more store than on 1.02, but generally
  112. long term use of strings will result in less used memory.
  113.  
  114. (9) Revised error descriptions
  115.  
  116.  0,"Silly!"
  117.  0,"No room to do this renumber"
  118.  0,"Line numbers larger than 65279 would be generated by this renumber"
  119.  0,"No room"
  120.  0,"Line too long"
  121.  0,"Stopped"
  122.  0,"Invalid LISTO option"
  123.  0,"Invalid TWINO option"
  124.  0,"Corruption of stack"
  125.  0,"Error control status not found on stack for RESTORE ERROR"
  126.  0,"Missing incore name"
  127.  0,"LIST/TWIN found line number reference"
  128.  0,"HELP has no information on this keyword"
  129.  0,"Incorrect in-core file description"
  130.  1,"No such mnemonic"
  131.  1,"No such suffix on EQU"
  132.  2,"Bad immediate constant"
  133.  2,"Bad address offset"
  134.  2,"Assembler limit reached"
  135.  2,"Bad shift"
  136.  3,"Bad register"
  137.  3,"Duplicate register in multiply"
  138.  4,"Missing ="
  139.  4,"Missing = in FOR statement"
  140.  4,"Mistake"
  141.  5,"Missing ,"
  142.  6,"Type mismatch: number needed"
  143.  6,"Type mismatch: numeric variable needed"
  144.  6,"Type mismatch: numeric array needed"
  145.  6,"Type mismatch: string needed"
  146.  6,"Type mismatch: string variable needed"
  147.  6,"Type mismatch: string array needed"
  148.  6,"Type mismatch: array needed"
  149.  6,"Type mismatch between arrays"
  150.  6,"Can't assign to array of this size"
  151.  6,"Array type mismatch as parameter"
  152.  6,"Can't SWAP arrays of different types"
  153.  7,"Not in a function"
  154.  8,"Too low a value for $<number>"
  155.  9,"Missing """
  156.  10,"DIM() function needs an array"
  157.  10,"No room to do matrix multiply with source(s) the same as destination"
  158.  10,"Impossible dimension"
  159.  10,"No end of dimension list )"
  160.  10,"Bad DIM statement"
  161.  10,"Can't DIM negative amount"
  162.  10,"Arrays cannot be redimensioned"
  163.  11,"No room for this DIM"
  164.  11,"No room for this dimension"
  165.  11,"Attempt to allocate insufficient memory"
  166.  12,"Items can only be made local in a function or procedure"
  167.  13,"Not in a procedure"
  168.  14,"Reference array incorrect"
  169.  14,"Unknown array"
  170.  14,"Unknown array in DIM() function"
  171.  14,"Undimensioned array"
  172.  15,"Subscript out of range"
  173.  15,"Incorrect number of subscripts"
  174.  16,"Syntax error"
  175.  17,"Escape"
  176.  18,"Division by zero"
  177.  19,"String too long"
  178.  20,"Number too big"
  179.  20,"Number too big for arc Sine or arc Cosine"
  180.  21,"Negative root"
  181.  22,"Logarithm range"
  182.  23,"Accuracy lost in Sine/Cosine/Tangent"
  183.  24,"Exponent range"
  184.  26,"Unknown or missing variable"
  185.  26,"Can't use array reference here"
  186.  27,"Missing )"
  187.  27,"Missing ("
  188.  27,"Missing ]"
  189.  27,"Missing {"
  190.  27,"Missing }"
  191.  28,"Bad Hex"
  192.  28,"Hex number too large"
  193.  28,"Bad Binary"
  194.  29,"No such function/procedure"
  195.  30,"Bad call of function/procedure"
  196.  31,"Arguments of function/procedure incorrect"
  197.  31,"Invalid RETURN actual parameter"
  198.  31,"Invalid array actual parameter"
  199.  32,"Not in a FOR loop"
  200.  33,"Can't match FOR"
  201.  34,"Bad FOR control variable"
  202.  35,"The step cannot be zero"
  203.  36,"Missing TO"
  204.  37,"No room for function/procedure call"
  205.  38,"Not in a subroutine"
  206.  39,"ON syntax"
  207.  40,"ON range"
  208.  41,"No such line"
  209.  42,"Out of data"
  210.  42,"DATA pointer not found on stack for RESTORE DATA"
  211.  43,"Not in a REPEAT loop"
  212.  44,"Too many nested structures"
  213.  45,"Missing #"
  214.  46,"Not in a WHILE loop"
  215.  47,"Missing ENDCASE"
  216.  48,"OF missing from CASE statement"
  217.  48,"CASE..OF statement must be the last thing on a line"
  218.  49,"Missing ENDIF"
  219.  50,"Bad MOUSE variable"
  220.  51,"Too many input expressions for SYS"
  221.  51,"Too many output variables for SYS"
  222.  52,"Can't install library"
  223.  52,"Bad program used as function/procedure library"
  224.  52,"No room for library"
  225.  
  226. (10) New assembler feature
  227.  
  228. Bit 3 in OPT (opts 8-15) controls an assembler area limit check: the
  229. assembler will check the variable L% to decide if it can deposit information
  230. at the current address (P% or O% depending on OPT as usual) (Note that DIM
  231. P% 1,L% -1 will assign L% a word address (which DIM likes returning) and so
  232. can take a full word of assembly).
  233.  
  234. (11) More exported routines from CALL
  235.  
  236. The value in r14 can be returned to with MOV PC,R14 but it also points to an
  237. array of useful values:
  238.  
  239.  B CALL2REAL ;0th entry in table is return address
  240. ;the following values are words containing an offset from ARGP (R8)
  241. ;word aligned 256 bytes
  242.  & STRACC ;string accumulator
  243. ;word aligned words offset from ARGP
  244.  & PAGE ;current program PAGE
  245.  & TOP ;current program TOP
  246.  & LOMEM ;current variable start
  247.  & HIMEM ;current stack end
  248.  & MEMLIMIT ;limit of available memory
  249.  & FSA ;free space start (high water mark/FD stack limit)
  250.  & TALLY ;value of COUNT
  251.  & TIMEOF ;offset from TIME readable by OSWORD
  252.  & ESCWORD ;exception flag word (contains escflg, trcflg)
  253.  & WIDTHLOC ;value of WIDTH-1
  254. ;internal BASIC routines
  255.  B VARIND ;get value of lv
  256.  B STOREA ;store value into lv
  257.  B STSTORE ;store string into type 128 strings
  258.  B LVBLNK ;convert string "variable name" to lv address and type
  259.  B CREATE ;create new variable
  260.  B EXPR ;use expression analyser on string
  261.  B MATCH ;lexical analyse source string to destination string
  262.  B TOKENADDR ;pointer to string for particular token
  263.  & 0 ;stop point for ****** Minerva programs
  264. ;new on BASIC V 1.03
  265.  & 9 ;length of extensions
  266.  B FSTA ;store fp in r0-r3 as 5 bytes at r9
  267.  B FLDA :load fp from r9 as 5 bytes into r0-r3
  268.  B FADD ;add fp in r0-r3 to 5 bytes at r9, result in r0-r3
  269.  B FSUB ;subtract fp in r0-r3 from 5 bytes at r9, result in r0-r3
  270.  B FMUL ;multiply fp in r0-r3 by 5 bytes at r9, result in r0-r3
  271.  B FDIV ;divide fp in 5 bytes at r9 by r0-r3, result in r0-r3
  272.  B FLOAT ;float an integer in r0 to an fp in r0-r3
  273.  B FIX ;fix an fp in r0-r3 to an integer in r0
  274.  B FSQRT ;square root of r0-r3
  275.  
  276. Note that the list is held in two different forms: the first section is
  277. exactly like BASIC 1.02: a list terminated by zero. The list could not be
  278. simply extended because of some unfortunate assumptions bound into poorly
  279. written application programs, so a second list has been tacked on the end.
  280. A client can check the number of extensions field (i.e. the field after the
  281. zero) and it will be 0 or negative if there aren't any.
  282.  
  283. The pointer TIMEOF is particularly interesting. On Arthur this location
  284. holds a meaningless value; on other systems it holds the offset which should
  285. be subtracted from the time read from the system if one wishes to agree
  286. with the value given by PRINT TIME. However the next three words offset from
  287. the argument register after TIMEOF (i.e. [R8,TIMEOF+4] etc.) contain:
  288.  
  289. LOCALARLIST: a pointer to a list of local arrays.
  290. INSTALLLIST: a pointer to the list of installed libraries.
  291. LIBRARYLIST: a pointer to the list of libraries.
  292.  
  293. The local array list is not going to be much use, but the ability to scan the
  294. libraries allows (say) find commands to be installed which can find a
  295. procedure whereever it is. The list consists of a pointer (0 is the end of
  296. the list) to a word (which is the next pointer) and a BASIC program in
  297. internal form immediately following the word. The list is organised in the
  298. search order.
  299.  
  300. The internal routines are only guarenteed to work in processor user mode.
  301. The following functions are provided:
  302.  
  303. VARIND: entry with r0=address of lv, r9=type of lv, r12=LINE.
  304. Returns with r0..r3 as the value, r9 the type of the value as follows:
  305.  
  306. r9         type    where
  307. 0          string  in STRACC, r2 points to end (r2-STRACC is length)
  308. &40000000  integer in r0
  309. &80000000  float   in r0..r3
  310.  
  311. Uses no other registers (including stack). Possible error if asked to take
  312. value of an array fred(): will need r12 valid for this error to be reported
  313. correctly.
  314.  
  315. STOREA: entry with r0..r3 value, r9=type of value and r4=address of lv,
  316. r5=type of lv, r8=ARGP, r12=LINE (for errors) and r13=SP (for out of store
  317. chcek on string allocation). Will convert between various formats e.g.
  318. integer and float or produce an error if conversion is impossible.
  319. Returns with r0..r7 destroyed. Stack not used.
  320.  
  321. STSTORE: entry with r4=address of lv, r2=length (address of end), r3=address
  322. of start, r8=ARGP, r12=LINE (for out of store error) and r13=SP (for out of
  323. store check). The string must start on a word boundary, the length must be
  324. 255 or less.
  325. Uses r0, r1, r5, r6, r7. Preserves input registers. Stack not used.
  326.  
  327. LVBLNK: entry with r11 pointing to start of string, r8=ARGP, r12=LINE (many
  328. errors possible e.g. subscript error in array) and r13=stack (will be used
  329. for evaluation of subscript list: calls EXPR). The string will be processed
  330. to read one variable name and provide an address and type which can be given
  331. to VARIND.
  332. Returns with NE status if a variable has been found. Address in r0, type (see
  333. above) in r9. If there is an EQ status then if the carry is set it cannot
  334. possibly be a variable else if the carry is clear it could be, but isn't
  335. known to the interpreter (and registers are set to values for CREATE).
  336. Uses all registers.
  337.  
  338. CREATE: create a variable. Input is the failure of LVBLNK to find something.
  339. Thus we have r10=first char of item, r3=second char of item or 0, r4 and r11
  340. pointers to start and end of other chars, r8=ARGP, r12=LINE, r13=STACK, r9
  341. contains the number of zero bytes on the end. It is recommended that CREATE
  342. is called immediately after a failed LVBLNK only.
  343. Uses all registers. Return parameters as LVBLNK.
  344.  
  345. The LVBLNK and CREATE routines can be combined together to provide a routine
  346. which checks for a variable to assign to and creates it if necessary:
  347.  
  348. SAFELV STMFD SP!,{R14}
  349.        BL LVBLNK
  350.        LDMNEFD SP!,{PC}
  351.        LDMCSFD SP!,{PC}
  352.        BL CREATE
  353.        LDMFD SP!,{PC}
  354.  
  355. EXPR: entry with r11 pointing to start of string, r8=ARGP, r12=LINE, r13=STACK.
  356. EXPR stops after reading one expression (like those in the PRINT statement).
  357. Uses all registers. The value is returned like VARIND. If status EQ it read a
  358. string, if status NE and plus it read an integer word (in r0) if status NE
  359. and minus it read a floating point value (in r0..r3). r9 contains the type:
  360. the status can be recreated by TEQ r9,#0. r10 contains the delimiting
  361. character, r11 points to the one after.
  362.  
  363. MATCH: entry with r1=source string (terminated by ASCII CR=13),
  364. r2=destination string, r3=MODE, r4=CONSTA, r13=STACK. Note that MATCH does
  365. not need ARGP or LINE. The MODE value is 0 for LEFT MODE (i.e. before an
  366. equals sign) and 1 for RIGHT MODE (after an equals sign or in an expression).
  367. The CONSTA value is 0 for don't pack constants using token &8D, &8D itself
  368. for pack. Both MODE and CONSTA will be updated during use of the routine
  369. e.g. GOTO will change CONSTA to &8D to read the constant, PRINT will change
  370. MODE to 1 to read the expression. Starting values of MODE=0 and CONSTA=0
  371. will lexcially analyse a statement; MODE=1 and CONSTA=0 an expression;
  372. MODE=0 and CONSTA=&8D is used to extract line numbers in command mode and
  373. probably has little use. MODE affects the values assigned to tokens for
  374. HIMEM etc.
  375. Uses r0-r5. r1 and r2 are left pointing after the CR codes in the strings.
  376. r5 contains status about failures to analyse the line correctly: it can be
  377. used or disregarded: values >= &1000 imply mismatched brackets, bit 8 set
  378. implies a line number was found that was too large to be put into a &8D
  379. constant and if r5 AND 255 equals 1 it implies mismatched string quotes.
  380.  
  381. TOKENADDR: entry with r0 as the token value, r12=pointer to next byte of
  382. token string. The value in r12 is only used when the address of a two byte
  383. token is required. No other register are used or required.
  384. Returns r1 as the pointer to the first character of a string, terminated by a
  385. value >=&7F (which is the first byte of the token value). r0 is set to the
  386. address of the start of the token table itself. r12 will have been
  387. incremented by 1 if a two byte token was used.
  388.  
  389. FSTA: Saves the five byte form of a floating point number. Entry with r0-r3
  390. as the floating point value, r9=address of destination. Stack not used. No
  391. error possible. r2 altered (but this does not affect the fp value of r0-r3).
  392.  
  393. FLDA: Loads the five byte form of a floating point number. Entry with address
  394. in r9. Exit with r0-r3 as floating point value. Stack not used. No error
  395. possible.
  396.  
  397. FADD: Add floating point value in r0-r3 to five byte form at r9. Result in
  398. r0-r3. Stack not used. Overflow error possible. Uses r4-r7.
  399.  
  400. FSUB: Subtract floating point value in r0-r3 from five byte form at r9.
  401. Result in r0-r3. Stack not used. Overflow error possible. Uses r4-r7.
  402.  
  403. FMUL: Multiply floating point value in r0-r3 by five byte form at r9. Result
  404. in r0-r3. Stack not used. Overflow error possible. Uses r4-r7.
  405.  
  406. FDIV: Divide five byte form at r9 by floating point value in r0-r3. Result
  407. in r0-r3. Stack not used. Divide by zero and overflow error possible. Uses
  408. r4-r7.
  409.  
  410. FLOAT: Float an integer in r0 to a floating point value in r0-r3. Stack not
  411. used, no error possible. Sets type field in r9 to FLOATING (&80000000).
  412.  
  413. FIX: Fix a floating point value in r0-r3 to an integer in r0. Stack not used.
  414. Overflow error possible. Sets type field in r9 to INTEGER (&40000000).
  415.  
  416. FSQRT: Square root of floating point value in r0-r3 return in r0-r3. Uses
  417. r4-r7.
  418.  
  419. (12) Sped up areas
  420.  
  421. Simple expressions (indeed very complex ones have been slowed down!). SYS
  422. statement, especially where no results (no TO) are required. String
  423. allocation (by varying amounts depending on what is happening).
  424.  
  425. (13) Bugs fixed
  426.  
  427. 18-Sep-87   division by power of 2 did not check under/overflow.
  428. 24-Sep-87   LOCAL A()
  429. 28-Sep-87   A()=const
  430. 08-Dec-87   LOCAL A():DIM A(1,1) messed stack due to bug in DIM re type (also
  431.             misallocates integer arrays!).
  432. 04-Jan-88   LINE INPUT had sense of LINE flag wrong - misbehaved for A,B ans.
  433. 05-Jan-88   HIMEM=HIMEM wouldn't work.
  434. 08-Feb-88   CREATE was uncallable due to LVBLNK loosing R4.
  435. 26-Feb-88   STRACC postion changed for Arthur 2.00.
  436. 29-Feb-88   $A="" check for <&8000.
  437. 07-Mar-88   50IF<false>THEN50 unescapeable
  438. 12-May-88   INPUT#,a$ at end of file gives end of file message.
  439. 23-May-88   ATN of a large power of 2 went wrong.
  440. 01-Sep-88   WHILE <no sd> failed in TRACE state due to moving LINE in SLOWMUNG
  441. 05-Oct-88   EXP .00001 corrected
  442.  
  443. [Plus other things which I have forgotten!]
  444.  
  445.  
  446. From: RWilson@acorn.co.uk
  447. Subject: Really! BASIC V in 3.10
  448. Date: 10 Sep 92 17:35:38 GMT
  449.  
  450. ARM BBC BASIC V: changes between 1.04 and 1.05
  451.  
  452. (1) BASIC V is internationalised. @% can be set to print "," instead of ".".
  453. All messages are printed via BASICTrans (see TransDoc).
  454.  
  455. (2) INSTALL was treated as a statement permitting a variety of lethal, innocent
  456. looking BASIC programs along the lines of:
  457.  
  458.   10 INSTALL"foo"
  459.  
  460. which wipes out a substantial portion of the interpreter's stack: an error,
  461. local array or any structure causes mayhem. 1.05 series interpreters treat
  462. programs like this as bad: an error is issued if the INSTALL is encountered.
  463. INSTALL is now implemented as a command (and it is therefore impossible to edit
  464. the line containing an INSTALL to the state that a 1.04 interpreter left it).
  465.  
  466. (3) ADR with bit 1 clear in OPT (0, 2, ..) will no longer give an error in the
  467. circumstance when the label is out of range. (Also bad immediate fields will
  468. not fault).
  469.  
  470. (4) Fatal errors are *only* 0
  471.  
  472. (5) @% goes ANSI C
  473.  
  474. @% is now reported by LVAR in ANSI printf format - one of g, e or f formats
  475. followed by the field width, a dot and the precision. @% is also settable
  476. using this format - @%="G10.9" corresponds to the default. There is now a
  477. HELP message on @% and the formats.
  478.  
  479. Partial setting of @% is supported:
  480.  
  481. @%="+":REM turn on STR$
  482. @%="G":REM go to G format (turns off STR$)
  483. @%="10":REM set just the field width for current format (turns off STR$)
  484. @%=".5":REM set just the precision for current format (turns of STR$)
  485. @%="+F10":REM turn on STR$, go to F format and set field width 10
  486. @%="E10.3":REM go to E format, field width 10, 3 digits in total
  487. @%="+F20.4":REM turn on STR$, go to F, field width 20, 4 digits after '.'
  488.  
  489. Spaces cannot be used. LET @%= does not cope with the string form. Replace
  490. "." with "," to get "," used as the decimal point character.
  491.  
  492. (6) Improved error messages from libraries
  493.  
  494. The interpreter will tag the error message with the name of the library
  495. which caused the error message (found from the REM on the first line of a
  496. library.
  497.  
  498. (7) INPUT# floating values
  499.  
  500. Both the 5 byte real (&80, value) and the 8 byte real (&88, value) are
  501. accepted by the interpreter.
  502.  
  503. (8) Sped up array statements
  504.  
  505. The following have been sped up by some factor between 3 and 10:
  506.  
  507. foo()=<expression>
  508. foo%()=<expression>
  509. foo()=fie()
  510. foo%()=fie%()
  511. DIM foo(, foo$(, foo%(
  512.  
  513. (9) END= may be used almost anywhere
  514.  
  515. Useable anywhere except with INSTALLed libraries, nested within EVAL or LOCAL
  516. ERROR, nested within assignments to local arrays, nested local arrays.
  517.  
  518. Example:
  519.  
  520.    10DIM A(10)
  521.    20A(1)=10
  522.    30PROCb
  523.    40PRINTA(1)
  524.    50END
  525.    60DEF PROCb
  526.    70LOCAL A()
  527.    80DIM A(2)
  528.    90A(1)=EXP1
  529.   100PROCMoveEnd(&40000)
  530.   110PRINTA(1)
  531.   120ENDPROC
  532.   130DEF PROCMoveEnd(a)
  533.   140LOCAL A()
  534.   150DIM A(10)
  535.   160A(1)=PI
  536.   170END=a
  537.   180PRINT A(1)
  538.   190ENDPROC
  539.  
  540. is incorrect since there is a nested local array in PROCb. A direct call to
  541. PROCMoveEnd with no other nested A() would be OK. The interpreter is capable of
  542. detecting the above situation, but can be confused by an EVAL which contains a
  543. END=.
  544.  
  545. HIMEM gets reset, local arrays cleared if faulty.
  546.  
  547. (10) TRACE to file
  548.  
  549. TRACE output can be directed to a file with TRACE TO "<file name>": all TRACE
  550. output is sent to the file until TRACE CLOSE is issued [the interpreter will
  551. close the trace file before exit]. Note that errors found when writing to this
  552. file will result in it being closed and forgotten about. The variable TRACE
  553. allows the programmer to output other things to the trace file (e.g. with
  554. IF TRACE THEN BPUT#TRACE,"X is "+STR$X)
  555.  
  556. Note that TRACE now allows line number and PROC tracing to be on together:
  557. TRACE PROC:TRACE ON (say).
  558.  
  559. (11) TEXTLOAD and TEXTSAVE commands
  560.  
  561. TEXTLOAD <string expression>
  562. TEXTSAVE[O <expression>,] <string expression>
  563.  
  564. As well as the obvious, TEXTLOAD (and BASIC -load) are safer in that they have
  565. (generally) more free memory to convert the program in than BASIC 1.04 which is
  566. stuck with 4096 bytes.
  567.  
  568. (12) CRUNCH command
  569.  
  570. CRUNCH <expression> Strips various spaces from program.
  571. bit 0 = 1: spaces before statements
  572. bit 1 = 1: spaces in statements
  573. bit 2 = 1: REM statements (except on first line)
  574. bit 3 = 1: empty statements
  575. bit 4 = 1: empty lines
  576.  
  577. Notes:
  578.  
  579. (a) Programs with -quit set will be CRUNCH %1111 and LIBRARY and INSTALL sub
  580. programs will be CRUNCH %1111. CRUNCH %10 may make a program uneditable.
  581. OVERLAYs will not be CRUNCHed.
  582.  
  583. (b) BASIC V 1.04 cannot read assembler statements that have been crunched: such
  584. things as EORR4,R4,R5 give it terminal heart burn.
  585.  
  586. (c) The interpreter has been optimised for fully crunched programs.
  587.  
  588. (d) CRUNCHing away empty lines will give problems to programs with GOTO (GOSUB,
  589. IF THEN, RESTORE) in them which rely on the target being an empty line (or line
  590. of empty statements or REM statement). RESTORE+ might give a problem if
  591. intervening lines are removed.
  592.  
  593. (13) Bugs fixed
  594.  
  595. 17-Nov-88   Fixed TAN1E-5 bug (misread the flow chart in Cody and Waite!)
  596. 02-Dec-88   -1^-10 blew up
  597. 14-Mar-89   " unlistable token " not terminated by >&7F
  598. 15-Jun-89   F1XSUB, F1SUB could return -0 which various xxSTAs can't cope with
  599. 17-Jul-89   Difference between IF THENELSE and IF THEN ELSE fixed
  600. 18-Aug-89   Cache not being flushed on errors could cause problems with EVAL
  601. 12-Oct-89   Bug in printing 0 in E mode removed
  602. 17-Oct-89   INT-(3*2^30) didn't give error
  603. 19-Oct-89   Assembler OPT not reset on -chain or -quit
  604. 24-Oct-89   A()=B() messed up
  605. 03-Nov-89   Change to ADVAL to return all 32 bits
  606. 11-Dec-89   TRACE TO "printer:" didn't work because of the type setting
  607.  
  608. [Plus other things which I have forgotten!]
  609.  
  610.  
  611. From: RWilson@acorn.co.uk
  612. Subject: BASIC V all time bug list
  613. Date: 10 Sep 92 16:25:01 GMT
  614.  
  615. . > BugList
  616.  
  617.                  Bugs that have been mended
  618.  
  619. Date        Description of fault
  620.  
  621. 20-Jul-86   WHILE loop was checking the line number to see if it was a token or
  622.             ENDWHILE or end of line.
  623. 06-Aug-86   Nested block IF structures implemented.
  624. 07-Aug-86   In the assembler, "LDRB first" and similar failed to read because
  625.             it trashed the position.
  626. 14-Aug-86   In the assembler, LDR Rn,label had the U/D bit sense inverted.
  627. 14-Aug-86   In the assembler EQUB, EQUW, EQUD implemented.
  628. 14-Aug-86   In the assembler pre indexing writeback implemented.
  629. 14-Aug-86   Direct function calls supported in assembler for macros.
  630. 15-Aug-86   FNRET did not pull strange things from stack.
  631. 15-Aug-86   LOCAL ERROR added as synonym for ON ERROR TO.
  632. 15-Aug-86   ENDFN and FNRET process any error status they find on stack.
  633. 18-Aug-86   += and -= implemented.
  634. 19-Aug-86   Comments in assembler were not spotted before opcode.
  635. 19-Aug-86   Assembler listings were wrong for comments and labels only.
  636. 19-Aug-86   Assembler listings could not cope with comments including commands
  637.             e.g. \LOAD IT!
  638. 20-Aug-86   Assembler couldn't branch to unaligned addresses.
  639. 10-Sep-86   += now works for strings, also.
  640. 30-Oct-86   LEFT$(A$) means LEFT$(A$,LENA$-1); RIGHT$(A$) means RIGHT$(A$,1).
  641. 18-Nov-86   -chain, -load, -help added to startup.
  642. 24-Nov-86   ^ in assembler set wrong bit.
  643. 24-Nov-86   MOVEQ dealt with.
  644. 24-Nov-86   misc corrections to help messages.
  645. 08-Dec-86   O% in assembler incremented.
  646. 08-Dec-86   RETURN etc. in direct mode no longer cause address exception.
  647. 12-Jan-87   APPEND added.
  648. 13-Jan-87   SYS added.
  649. 13-Jan-87   line number range extended to 65279.
  650. 16-Jan-87   LISTIF OPENIN no longer finds CASE.
  651. 16-Jan-87   ; added to SYS.
  652. 22-Jan-87   LVAR no longer says RETURN real array.
  653. 22-Jan-87   LISTO2 indents IF THEN ELSE ENDIF.
  654. 22-Jan-87   RENUMBER 10,65270 doesn't complain.
  655. 22-Jan-87   TRACE ON will trace lines whose number is greater than &FE00.
  656. 22-Jan-87   SWAP A(),B() etc. now work.
  657. 23-Jan-87   CALL with parameters.
  658. 29-Jan-87   -quit as a command line option.
  659. 29-Jan-87   SAVE with date stamp does "B" option.
  660. 02-Feb-87   Assembler accepts ranges in LDM etc.
  661. 16-Feb-87   missing parameters allowed in SYS.
  662. 19-Feb-87   COLOUR a,p,r,g,b implemented.
  663. 23-Feb-87   RECORD, ON ERROR TO, ON ERROR RESTORE eliminated.
  664. 05-Mar-87   A$+="JIM" bug introduced when STRACC moved removed.
  665. 11-Mar-87   REM as first character in assembler line wasn't printed properly.
  666. 11-Mar-87   LDR R0,[R0,-R0] couldn't be assembled.
  667. 13-Mar-87   "A"="AB" bug introduced when register names in STNCMP changed.
  668. 16-Mar-87   Line too long spotted.
  669. 16-Mar-87   "fred"="" bug introduced when register names in STNCMP changed.
  670. 16-Mar-87   bug in INSTR two parameter introduced when SPULL used R3.
  671. 17-Mar-87   COLOUR a,r,g,b instead of COLOUR a,p,r,g,b.
  672. 06-Apr-87   bug in BPUT#handle,""; fixed.
  673. 06-Apr-87   OF value changed.
  674. 10-Apr-87   ALIGN in assembler fixed.
  675. 10-Apr-87   No room message added to string allocation (and about time!)
  676. 14-Apr-87   a()+=1 error message fixed - by making it work!
  677. 14-Apr-87   refence spelling corrected.
  678. 14-Apr-87   Detection of unknown arrays in array operations corrected.
  679. 22-Apr-87   PRINT#X,"HELLO" bug due to moving STRACC.
  680. 18-May-87   LOCAL a$() etc. didn't recover space used by elements.
  681. 11-Aug-87   nested LOCAL A$() got space recovery wrong.
  682. 11-Aug-87   didn't call osbyte &da, called &d0, in error handler
  683. 11-Aug-87   RND seed was non-word aligned.
  684. 28-Aug-87   OPT 4+ ALIGNments corrected.
  685. 01-Sep-87   CLEAR when PAGE changed removed (but not the ROM version).
  686. 11-Sep-87   Detection of insufficient space for library.
  687. 11-Sep-87   RESTORE and TRACE OFF removeed from low level error handler.
  688. 11-Sep-87   SYS x,y TO ;V% allowed.
  689. 18-Sep-87   division by power of 2 did not check under/overflow.
  690. 24-Sep-87   LOCAL A() destroyed when nested LOCAL A$() fixed.
  691. 28-Sep-87   A()=const destroyed by cache mechanism.
  692. 08-Dec-87   LOCAL A():DIM A(1,1) messed stack due to bug in DIM re type (also
  693.             misallocates integer arrays!).
  694. 04-Jan-88   LINE INPUT had sense of LINE flag wrong - misbehaved for A,B ans.
  695. 05-Jan-88   HIMEM=HIMEM wouldn't work.
  696. 08-Feb-88   CREATE was uncallable due to LVBLNK loosing R4.
  697. 26-Feb-88   STRACC postion changed for Arthur 2.00.
  698. 29-Feb-88   $A="" check for <&8000.
  699. 07-Mar-88   50IF<false>THEN50 unescapeable due to cache.
  700. 12-May-88   INPUT#,a$ at end of file gives end of file message.
  701. 23-May-88   ATN of a large power of 2 went wrong.
  702. 01-Sep-88   WHILE <no sd> failed in TRACE state due to moving LINE in SLOWMUNG
  703. 20-Sep-88   EXP1E-5 bug fixed - epsmin coded as wrong number
  704. 17-Nov-88   Fixed TAN1E-5 bug (misread the flow chart in Cody and Waite!)
  705. 02-Dec-88   -1^-10 blew up
  706. 14-Mar-89   " unlistable token " not terminated by >&7F
  707. 15-Jun-89   F1XSUB, F1SUB could return -0 which various xxSTAs can't cope with
  708. 17-Jul-89   Difference between IF THENELSE and IF THEN ELSE fixed
  709. 18-Aug-89   Cache not being flushed on errors could cause problems with EVAL
  710. 12-Oct-89   Problem printing 0 in e mode.
  711. 17-Oct-89   INT-(3*2^30) didn't give error
  712. 19-Oct-89   BYTESM not reset on -chain or -quit
  713. 24-Oct-89   A()=B() messed up
  714. 03-Nov-89   Change to ADVAL to return all 32 bits
  715. 29-Nov-89   Altered fatal error to 0 only
  716. 06-Dec-89   error bit in OPT for ADR didn't work
  717. 11-Dec-89   INSTALL was a statement when it should have been a command
  718. 11-Dec-89   TRACE TO "printer:" didn't work because of the type setting
  719. 17-Jan-90   CRUNCH messed up EOR sample,sample,#1 and AND etc.
  720. 19-Jan-90   FIX of maximum negative integer (a very long standing bug)
  721. 19-Jan-90   BASIC64 printing -ve numbers rounded in the wrong place
  722. 01-Feb-90   BASIC64 fp read inaccurate - changed to E precision
  723. 20-Feb-90   LISTO3 indented SUM (due to checking for TESCFN as well as TESCSTMT)
  724. 01-Mar-90   RESTORE DATA pulled one too many words off the stack
  725. 08-Aug-90   COUNT not cleared on -run, -quit programs
  726. 30-May-91   String concatenation via += failed to check maximum length properly.
  727. 03-Jun-91   Assembler couldn't do CRUNCH'd BL FNE....
  728. 05-Jun-91   Auto CRUNCH removed from BASIC V (not VI)
  729. 10-Jun-91   Bug in printing 1E9-.5 removed from BASIC VI
  730. 10-Jun-91   BASIC V AutoCRUNCHes if BASIC$Crunch is defined
  731. 10-Jun-91   COUNT not cleared on -chain programs
  732. 28-Jun-91   redesigned assembler condition code checking
  733. 28-Jun-91   change TRACE so numbers and PROC can be on simultaneously
  734. 21-Jan-92   'technical error' - ADVAL gets R2 value wrong - irrelevant on RISC OS
  735. 21-Jan-92   1 S cycle removed from INKEY (INTEGZ rather than INTEGY)
  736. 27-Jan-92   @% += and -= reimplemented
  737. 27-Jan-92   CRUNCH of ) next to ! and ? disallowed
  738. 12-Mar-92   10 registers allowed for SYS
  739. 12-Mar-92   BBC MOS emulation removed from BASIC VI
  740. 23-Mar-92   TEXTLOAD failed to do a NEW before merging the text (code copied
  741.             from FROMAT into LOADFILEFINAL)
  742. 18-Aug-92   floating point comparison of positive numbers with zero exponent
  743.             against zero returned wrong sign
  744.  
  745.