Microsoft KB Archive/34811

From BetaArchive Wiki

Calling DOS Interrupts in COBOL 3.0 with CALL X“84”

PSS ID Number: Q34811 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, version 3.0

Summary: DOS interrupts can be called in COBOL Version 3.0 using the CALL statement. This subject is documented on Pages 8-4 and 8-5 in the “Special Features” section of the “Microsoft COBOL 3.0: Operating Guide.”

More Information: The syntax for an interrupt call is as follows: CALL X“84” USING INTRP, FLAG, PAX, PBX, PCX, PDX where INTRP is a DOS interrupt, and FLAG, PAX, PBX, PCX, and PDX are parameters for the call. On entry of the call, FLAG controls whether or not certain registers are loaded as values or offsets of the data segment. On exit of the call, FLAG controls whether or not certain parameters are loaded with the corresponding registers. FLAG is a 1-byte data item (PIC 99 COMP-X) that has the value H“F7” for this example. FLAG looks like the following in binary: High order bits Low order bits 1 1 1 1 0 1 1 1 PDX PCX PBX PAX PDX PCX PBX PAX | | | | | | | | | | | | offset | | | DX CX BC AX DX CX BX AX The Low-order bits of FLAG direct CALL X“84” to load CX, BX, and AX with the contents of PCX, PBX, and PAX on entry. Since the bit representing DX is not set, DS:DX addresses the PDX parameter instead of the value of PDX. The High-order bits of FLAG direct CALL X“84” to load the PDX and PAX with the contents of DX and AX on exit. Note that PDX, PCX, PBX, and PAX are 2-byte data items (PIC 9(4) COMP-X).

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.