BBC BASIC version 5 or later - that is to say Acorn's ARM BASIC V & VI, 6502 Advanced BASIC, BB4W, BBCSDL, BBCTTY, Brandy BASIC and BBC BASIC (Z80) v5 - accepts the LOCAL ERROR and ON ERROR LOCAL statements. These allow the current error-handling status to be 'temporarily' changed and later restored using RESTORE ERROR.
However these statements operate slightly differently in the different versions of BASIC, as follows:
Code: Select all
---------------------------------------------------------------------------------------------------------
| | Acorn BASICs | Brandy BASIC | RTR's BASICs |
---------------------------------------------------------------------------------------------------------
| LOCAL ERROR | Saves both the ON ERROR | Saves only the ON ERROR | Does nothing (is ignored). |
| | destination & the previous | destination to the stack. | |
| | nesting level to the stack.| | |
---------------------------------------------------------------------------------------------------------
| ON ERROR LOCAL | Records the current nesting| Saves the previous nesting | Saves both the ON ERROR |
| | level then sets up a new | level to the stack, records| destination & the previous |
| | ON ERROR destination. | the current nesting level | nesting level to the stack,|
| | | then sets up a new | records the current nesting|
| | | ON ERROR destination. | level then sets up a new |
| | | | ON ERROR destination. |
---------------------------------------------------------------------------------------------------------
Note that because LOCAL ERROR is ignored by my BASICs it may be omitted, but if you want your program(s) to be compatible with other versions of BBC BASIC it should be included.