I suppose we need to built an exception handler now ! In the QL you build a table of vectors for the following exceptions :
Address error
Illegal
Divide by zero
CHK
TRAPV
Privilege
Trace
Interrupt level 7
Trap #5
Trap #6
Trap #7
Trap #8
Trap #9
Trap #10
Trap #11
Trap #12
Trap #13
Trap #14
Trap #15
And then tell QDOS to use this table for your job. Any exceptions that are generated and that are mentioned above will be handled by your own routine. Of all of these, the address error needs to have special treatment because it has the extra data on the stack.
The problem being that if your instruction caused an error, what happens when you handle the exception and RTE - does the program fail again because it tried to execute the same instruction again ? Sometimes is the only answer.
The following code will be very useful when you first start writing assembler as it will trap the exceptions mentioned above and attempt to allow you to carry on. This example should be run on a 68000 or 68008 ONLY. I do not have the data for exception handling on a 68020 or above so Gold Cards, Super Gold Cards etc may cause problems. I don't know.