Rpbasic-52 programming guide, Onerr – Remote Processing BASIC 52 User Manual
Page 88

RPBASIC-52 PROGRAMMING GUIDE
2-69
ONERR
Syntax:
O N E R R line number
Function:
Goes to line number on arith meti c error, b ad arg ume nt, and hardw are erro rs.
Mode:
Run
Use:
ONER R 1000
Cards:
All
D E S C R IP T I ON
The ONER R instruction traps arithmetic errors and hardware problems, transferring control to line number.
O N E R R c a n b e u se d to h a nd l e e r ro r s g e n er a te d d ue t o b a d us e r i n pu t fr o m an d IN P U T i ns t ru c ti o n. O N E R R
is a GOTO, not a GOSU B. Consequently, there is no easy way to resume program execution. The control
and argument stacks are cleared so all GOSUB 's, FOR-NEXT loops, etc. are cleared.
Error codes are stored at external memory location 257 (101H) and are accessed using the XBY instruction.
Code
Error
0AH (10)
D I V I DE B Y Z E R O
14H (20)
A R I T H O V E R F LO W
1EH (30)
A R I T H U N D E R FL O W
28H (40)
B A D A R G U M E N T
32H (50)
H A R D W A R E
EXAMPLE
100 ONERR 1000
110 A=1/0
1000 PRINT "Error code:",XBY(257)
>run
Error code: 10