Dec 062017
ASM Critical Error (int 24h) handler example.
File INT24GS.ZIP from The Programmer’s Corner in
Category Assembly Language
ASM Critical Error (int 24h) handler example.
File Name File Size Zip Size Zip Type
INT24.TXT 3593 1375 deflated
TPCREAD.ME 199 165 deflated

Download File INT24GS.ZIP Here

Contents of the INT24.TXT file

;Notes -- The Critical Error Handler (int 24h) can be freely set and
; reset by any program that wants to. DOS makes it easy to
; do so by automatically restoring the previous handler upon
; exit. Thus you don't have to worry about cleaning up the
; vector before exiting. You cannot use Int 27h to install
; a critical interrupt handler as a TSR, because DOS also
; restores the old handler with 27h just as it does with a
; normal exit. If you want to, you can change the vector that
; DOS restores to point to your own routine. Upon building the
; PSP, DOS stores the old critical error handler address at offset,
; 12h in the PSP. (More specifically, it is stored in Offset/Segment
; format, (4 bytes) beginning at offset 12h of the PSP. so.....
; if you want to change the vector that DOS restores, put your own
; handler's segment at PSP + 14h and its offset at PSP 12h.
; This (resetting the PSP vector) is only necessary if your program
; goes TSR, and not if it is a stand-alone program.
;The rest of this program deals with the more normal case, installing a
; custom critical error handler for just the currently running program.



MOVDX,OFFSET NEWINT24;load the address of our handler
MOVAX,2524H;into the interrupt vector table
INT21H;and execute the interrupt change

; Here I put the main part of my program,
; doing whatever it is supposed to do
; NOTE: You do NOT have to save & reset the INT 24h
; vector at the end of the program.
; It is automatically restored by DOS
; from the PSP upon exit.
; NOTE: Your program should check the ERRFLAG code
; after performing any operation which can
; produce a critical error (disk, printer, or
; device request) and should take the appropriate
; action (inform the user, abort the program, or
; whatever)


ERRFLAGDB 0;a flag which will be incremented by
; one each time there is a
; a critical error. The main program
; must decide what to do when it
; finds this flag set.
; i.e. continue, alert user, etc.
; (and of course reset the flag to
; zero when finished)

; Here is the interrupt procedure to intercept the critical error handler

; will be upon entry
STI;enable the interrupts which are
; automatically disabled upon entry
INCERRFLAG;set my own error flag for some later
; action by main program
XORAL,AL;tell DOS to ignore the error
IRET;send it back to where it came


; End of the interrupt procedure to intercept the critical error handler


 December 6, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>