Difference between revisions of "Error messages"
m |
m (1 revision) |
(No difference)
|
Revision as of 23:58, 28 August 2013
BBC computer errors are an 8-bit number and a string.
+---------------------------+ | error number, 1 byte | +---------------------------+ | error string, 1-254 bytes | +---------------------------+ | &00 | +---------------------------+
Error numbers < 128 (ie, b7=0) are language errors, error numbers > 127 (ie b7=1) are non-language (ie MOS, filing system, utility, etc.) errors. As BASIC's errors are all <64 (ie b7=0, b6=0), any error numbers used within a program for its own purposes should be 64-127 (ie b7=0, b6=1).
While the text of an error message can vary between situations, the error number must be consistant. For example, error 214 (&D6) is File not found, the string can vary between File not found, Not found, XXXX not found and File 'XXXX' not found. However, the error number is consistantly 214.
Raising an error
6502
BRK EQUB err_num EQUS err_string$ EQUB 0
Z80
RST &38 DEFB err_num DEFM err_string$ DEFB 0
6809/6811/6812
SWI DEFB err_num DEFM err_string$ DEFB 0
80x86
INT &4F DEFB err_num DEFM err_string$ DEFB 0
PDP-11
EMT 15 DEFB err_num DEFM err_string$ DEFB 0
32016
Errors cannot be generated within PanOS, but they can be returned to the caller:
ADDR PanErrorBlock,R0 ; Point R0 to error block MOV [R0],R1 ; R1=error number SEF ; Set error flag RET 0 ; Return to caller .PanErrorBlock EQUW err_num16bit EQUB LEN err_string$ EQUS err_string$
ARM
ADR R0,ArmErrorBlock ; ARM error block is word, string, &00 SWI "OS_GenerateError" ; &2B .ArmErrorBlock EQUD err_num32bit ; error numbers < 256 are the same as 8-bit error numbers EQUS err_string$ EQUB 0
BBC BASIC
In BASICs that support the ERROR
command (BASIC V and some earlier versions):
ERROR err_num,err_string$