148
K
A
DAK
Advanced Topics
Fatal Exit Procedure
AMX allows you to provide a Fatal Exit Procedure of your own by specifying the name
of your procedure in your System Configuration Module (see Chapter 14.5).
Whenever AMX or your application forces a fatal exit, AMX checks to see if you have
provided a Fatal Exit Procedure. If one is present, AMX calls the procedure.
If no Fatal Exit Procedure exists or if the procedure returns to AMX, AMX will disable
the external interrupt system and halt. Only a hardware reset can be used to recover.
The Fatal Exit Procedure must not make any use of AMX or any of its managers.
In general, there is little that the Fatal Exit Procedure can do. It certainly cannot rectify
the situation. Any processing that it does should be done with the interrupts disabled if
possible. If not, all interrupt sources should be reset or otherwise inhibited if hardware
permits. Once all interrupt sources have been eliminated, the external interrupt system
can be enabled. Only then is it acceptable to try restarting your AMX system.
Your Fatal Exit Procedure can be coded in assembly language as a FAR procedure. Upon
entry to your Fatal Exit Procedure, the following conditions exist:
Interrupts are disabled.
All registers are free for use.
AX Fatal error code (see AERFXn definitions)
DS,ES DGROUP segment
SS:SP Stack in effect at the time of the fatal exit
The direction flag is set to forward.
USER_CODE SEGMENT BYTE 'CODE'
;ASSUME CS:USER_CODE
;PUBLIC FATALEX
;
FATALEX PROC FAR
:
Interpret fatal exit code in AX
:
RET ;AMX will halt at AMHALT
;
FATALEX ENDP
;
USER_CODE ENDS