Calling DOS and BIOS Interrupts with FORTRAN and MASM

Last reviewed: February 15, 1996
Article ID: Q71471
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 5.0 and 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0 and 5.1

SUMMARY

To obtain the application note "Calling DOS and BIOS Interrupts with FORTRAN and MASM," call Microsoft Product Support Services. This application note contains preassembled versions of the MASM routines used to call DOS and BIOS interrupts.

The text of this application note is also available in the Microsoft Software Library. Download HF0405.EXE, a self-extracting file, from the Microsoft Software Library (MSL) on the following services:

  • Microsoft Download Service (MSDL)

          Dial (206) 936-6735 to connect to MSDL
          Download HF0405.EXE (size: 58988 bytes) 
    
  • Internet (anonymous FTP)

          ftp ftp.microsoft.com
          Change to the \softlib\mslfiles directory
          Get HF0405.EXE (size: 58988 bytes) 
    

MORE INFORMATION

The following is the text of the application note:

   Microsoft Product Support Services Application Note (Text File)
    HF0405: CALLING DOS AND BIOS INTERRUPTS WITH FORTRAN AND MASM
                                                   Revision Date: 8/91
                                                       1 Disk Included

This information applies to Microsoft FORTRAN versions 5.0 and 5.1.

 --------------------------------------------------------------------
| INFORMATION PROVIDED IN THIS DOCUMENT AND ANY SOFTWARE THAT MAY    |
| ACCOMPANY THIS DOCUMENT (collectively referred to as an            |
| Application Note) IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      |
| KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO    |
| THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A     |
| PARTICULAR PURPOSE. The user assumes the entire risk as to the     |
| accuracy and the use of this Application Note. This Application    |
| Note may be copied and distributed subject to the following        |
| conditions: 1) All text must be copied without modification and    |
| all pages must be included; 2) If software is included, all files  |
| on the disk(s) must be copied without modification [the MS-DOS(R)  |
| utility DISKCOPY is appropriate for this purpose]; 3) All          |
| components of this Application Note must be distributed together;  |
| and 4) This Application Note may not be distributed for profit.    |
|                                                                    |
| Copyright 1991 Microsoft Corporation. All Rights Reserved.         |
| Microsoft, MS-DOS, and the Microsoft logo are registered           |
| trademarks and Windows is a trademark of Microsoft Corporation.    |
 --------------------------------------------------------------------

This application note illustrates how to access DOS interrupts without using the functions INTDOS and INTDOSX. DOS and BIOS interrupts can be called by specifying the interrupt number and the input register values within the main program. INTERRUPT and INTERRUPTX differ from the INTDOS and INTDOSX routines included with FORTRAN in that interrupts other than interrupt 21 can be called.

Included on the enclosed "Calling DOS and BIOS Interrupts with FORTRAN and MASM" disk are the following files. These files define the INTERRUPT and INTERRUPTX functions and provide two FORTRAN sample programs demonstrating how these functions are called.

File           Description
----           -----------

INTERRPT.ASM   The assembly source listing of the INTERRUPT and
               INTERRUPTX routines.

INTERRPT.INC   An include file for INTERRUPT and INTERRUPTX. This
               file contains the INTERFACE to the assembly routines
               and the register structures needed for INTERRUPT and
               INTERRUPTX.

INTERRPT.OBJ   The preassembled version of INTERRPT.ASM to be linked
               with programs calling INTERRUPT or INTERRUPTX.

INT.FOR        FORTRAN sample program that demonstrates how to use the
               INTERRUPT function call. INT.FOR uses INT 21, function
               2A hex to get the system date.

INTX.FOR       FORTRAN sample program using segment registers that
               demonstrates how to use the INTERRUPTX function call.
               INTXFOR uses INT 21, function 41 hex to delete a file.

INT.EXE        Executable version of INT.FOR example.

INTX.EXE       Executable version of INTX.FOR example.

The two assembly language routines included in INTERRPT.ASM are as follows:

  1. INTERRUPT(INTNUM,INREGS,OUTREGS) invokes the interrupt specified by INTNUM using the values of INREGS and returns the result of the interrupt call in OUTREGS.

  2. INTERRUPTX(INTNUM,INREGS,OUTREGS) invokes the system in the same manner as INTERRUPT but accepts segment register values.

To use the INTERRUPT and INTERRUPTX functions, the statement

   INCLUDE 'INTERRPT.INC'

must be located at the top of the source file where a call is made to the assembly language procedures. The two statement function definitions documented at the end of the INTERRPT.INC file must be uncommented and added to the source code of any FORTRAN program, function, or subroutine block where the assembly language procedures are called.

The statement functions documented at the end of INTERRPT.INC are shown below. These statement functions must appear before any executable statements. INTERRPT.OBJ must then be linked with the object file produced from compiling the main program.

   gethibyte (dataword) = dataword / 256
   getlobyte (dataword) = iand(dataword , 255)

Microsoft cannot guarantee that the information stated here regarding how to use INTERRUPT and INTERRUPTX will allow you to perform all MS- DOS system or BIOS calls correctly because this information has not been tested rigorously and is not considered a feature of the product.


Additional reference words: 5.10 appnote hf0405.exe S13012 softlib
KBCategory: kbprg kbfile kbappnote
KBSubcategory: FORTLngIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 15, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.