Article ID: 37345 - View products that this article applies to.
This article was previously published under Q37345
The ROM BIOS Interrupt 19 decimal (13 hex), with function 2, returns the status of a specified disk if it is unable to read the specified sector. This interrupt can be used to determine if the drive door is open, if the disk is formatted, if the disk is write-protected, and many other conditions. The code generated for this is smaller than a similar program using ON ERROR GOTO statements to trap disk errors.
Note that ROM BIOS and MS-DOS Interrupts are not allowed in MS OS/2 protected mode.
ROM BIOS Interrupt call 19 provides a set of functions to access the disk driver. Interrupt 19 with function 2 reads one or more sectors from disk into memory. Interrupt 19 with function 0 (reset disk system) should be called after a failed floppy disk Read, Write, Verify, or Format request before retrying the operation. For more information about this and other interrupts for IBM ROM BIOS and MS-DOS, see "Advanced MS-DOS Programming, Second Edition," by Ray Duncan (Microsoft Press, 1988).
Unlike other MS-DOS interrupt functions that access the disk drive using CALL INTERRUPT or CALL INTERRUPTX in Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b, or 4.5; or Microsoft Basic Compiler for MS-DOS or MS OS/2 (real mode only), versions 6.0 or 6.0b; Interrupt 19 with function 2 and 0 does NOT cause a system hang if a critical error occurs (such as if a drive door is open or a disk is not formatted).
Note: The CALL INTERRUPT or CALL INTERRUPTX statement hanging upon critical disk errors is a known problem with the INTERRUPT and INTERRUPTX routines in Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b, and 4.5; and Microsoft Basic Compiler for MS-DOS and MS OS/2 (real mode only), versions 6.0 and 6.0b. This problem was corrected in Microsoft Basic PDS for MS-DOS and MS OS/2 (real mode only), version 7.0. For information on how to modify the INTERRUPT and INTERRUPTX routines so that critical errors will not hang the machine in Microsoft QuickBasic for MS-DOS, versions 4.0, 4.0b, and 4.5; and Microsoft Basic Compiler for MS-DOS and MS OS/2 (real mode only), versions 6.0 and 6.0b; query the Knowledge Base on the following keyword:
QB4CRITListed below is a code example for calling ROM BIOS Interrupt call 19 decimal (13h) with functions 0 and 2. In order to run this program in the QB.EXE environment for Microsoft QuickBasic (or QBX.EXE for Microsoft Basic PDS), you must invoke QB /L QB.QLB (or QBX /L QBX.QLB for Microsoft Basic PDS). To link this program into an .EXE program, you must link with QB.LIB (or QBX.LIB for Basic PDS) (which is done automatically when you choose the Make EXE File command from the File menu in the environment).
Article ID: 37345 - Last Review: August 16, 2005 - Revision: 2.1
Contact us for more help
Connect with Answer Desk for expert help.