Microsoft KB Archive/71471

= HF0405.exe-Calling DOS & BIOS Interrupts w/FORTRAN & MASM =

Article ID: 71471

Article Last Modified on 8/4/2004

-

APPLIES TO


 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1
 * Microsoft FORTRAN Compiler 5.0
 * Microsoft FORTRAN Compiler 5.1

-



This article was previously published under Q71471



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



MORE INFORMATION
The following file is available for download from the Microsoft Download Center:

hf0405.exe

For additional information about how to download Microsoft Support files, click the following article number to view the article in the Microsoft Knowledge Base:

119591 How to Obtain Microsoft Support Files from Online Services

Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help to prevent any unauthorized changes to the file. 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 &quot;AS IS&quot; 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.   |
 * 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 &quot;Calling DOS and BIOS Interrupts with FORTRAN and MASM&quot; 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.

Keywords: kbinfo kbdownload kbfile KB71471

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.