Dec 142017
Routines showing replacement INT24 (critical error) in TP 4.0+.
File INT24.ZIP from The Programmer’s Corner in
Category Pascal Source Code
Routines showing replacement INT24 (critical error) in TP 4.0+.
File Name File Size Zip Size Zip Type
INT24.DOC 3612 1656 deflated
INT24.PAS 8623 2683 deflated
WP.DOC 4983 1854 deflated

Download File INT24.ZIP Here

Contents of the INT24.DOC file

(* INT24 -- A unit for trapping DOS critical errors (INT 24) for retries.

Version 1.01 - 01/02/1987 - First general release

Scott Bussinger
Professional Practice Systems
110 South 131st Street
Tacoma, WA 98444
Compuserve 72247,2671

Turbo Pascal version 4.0 added a paticularily nice feature in that it
automatically installs a critical error handler (INT 24) to keep DOS from
putting up the familiar 'Abort, Retry, Ignore?' messages. Instead of putting
a message in the middle of your nice screens, you can now detect the errors
and act on them yourself. Unfortunately, you've also lost the ability to retry
an error and let execution continue after fixing the problem without lots of
programming effort. This UNIT provides a special handler to display an error
message on critical errors and allow the user to attempt to correct the
problem and try it again. If the user decides not to retry it, the program
returns the normal error codes for critical errors. The unit automatically
saves the users screen so that the error message doesn't mess up any screen
displays. To include this unit in your program, add Int24 to the USES clause
in your main program.
In general, when a critical error occurs, the INT24 unit first saves a copy
of the users screen. It thens blanks the screen, warbles at the user and
displays an error message in the middle that explains what happened and waits
for the user to hit a key. If 'A', 'Q', ^C, Esc or ^Break is hit, the screen
is restored and an error code is returned to the program. If any other key is
hit, the screen is displayed and the operation tried again. If the error has
not been corrected, the message will appear again.
The unit also allows you to install a special critical error handler in
addition to the default handler in case you want to check for special cases
on an individual basis (e.g. to not allow retries on write-protect errors).
This demonstration program requires some special routines to play with the
cursor and write directly to the screen. You must either use Brian Foley's
FASTWR unit and my own CURSORS unit (both of these public domain packages are
available on Compuserve) or use the TPCrt unit from Turbo Power Software's
Turbo Professional package (Turbo Power Software can be reached in CA at
(408)438-8608). The program uses conditional compilation to choose between
the two alternatives. To use with the Turbo Professional routines include a
line at the beginning of the INT24 unit before compiling.

If you compile this file, the resulting program will attempt to create a
file on drive A. Try leaving the disk out and running the program. Then try
it with a disk in. Now try it with a disk with a write-protect tab
attached. Try both continuing without fixing the problem and then try
aborting by hitting ^C. Now run the program again (still with the write-
protect tab) and remove the disk before hitting the key. Then one last time
removing the write-protect tab when the program suggests it. *)

program Test;

uses Int24;


var I: Integer;

procedure FileTest;
var F: file;
writeln('Testing for critical errors by writing to drive A:');
I := IOResult;
I := IOResult;
I := IOResult;
if I <> 0
writeLn('Create failure on A:FILE : IOResult=',I)
writeln('A:FILE created.');
I := IOResult;
I := IOResult


 December 14, 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>