![Hitachi H8/3152 Hardware Manual Download Page 68](http://html.mh-extra.com/html/hitachi/h8-3152/h8-3152_hardware-manual_140481068.webp)
64
In this case, system operation can be stopped by writing 1 to the HLT flag, or the external systems
can be notified of the abnormal execution by outputting a signal to an I/O pin.
--- Example of program in UDF interrupt routine ---
UDFentry:
BTST #7,@TCSR ; reconfirmation
BEQ ERROR
MOV.W @(2,SP), R0
MOV.W #H'1000, R1
MOV.W #H'1FFF, R2
CMP.W R0, R1 ; if (H'1000<=PC<=H'1FFF) then PASS
BHS ERROR
CMP.W R0, R2
BLO ERROR
RTE
ERROR:
MOV.B #H'FF, R0L
MOV.B R0L, @TCSR ; system halt
--- End ---
H'1000
MOV
UDF interrupt
ADD
Application program area
*2
H'1FFF
SP
SP+1
SP+2
SP+3
(CCR)
CCR
PCH
*1
PCL
*1
Stack area
PC marked with *1 points to address marked with *2
Figure 5.4 Memory Contents for Checking Application Execution