Microsoft KB Archive/62210

COBOL Can Call Interrupt to Set Screen Border Color

PSS ID Number: Q62210 Article last modified on 05-25-1990

3.00 3.00a MS-DOS

Summary: Microsoft COBOL versions 3.00 and 3.00a can call an interrupt to change the color of the screen border. These versions of COBOL can call interrupts via the special subprogram X“84”. The interrupt in question is 10Hex, function 10Hex, subfunction 01Hex. It requires the following registers for input: AH (upper byte of AX) = 10H AL (lower byte of AX) = 01H BH (upper byte of BX) = border color AH holds the function number, AL the subfunction, and BH the new color for the border. The border color can be changed in graphics modes as well as text modes. This information applies to Microsoft COBOL Compiler versions 3.00 and 3.00a for MS-DOS.

More Information: For more information about calling interrupts from COBOL 3.00 and 3.00a, see Pages 8-4 and 8-5 of the “Microsoft COBOL Compiler 3.0: Operating Guide” included with the product. For more information about interrupt 10H, function 10H, subfunction 01H, see Page 512 of “Advanced MS-DOS Programming, Second Edition,” by Ray Duncan (Microsoft Press, 1988). The sample program below sets the color of the screen border to each of the 16 default colors (0-15). It does this in a loop until you press a key. Note: Compile the code below with the ANS85 directive.

Code Example
DATA DIVISION. WORKING-STORAGE SECTION. 01 AX. *  Function 10H 05 A-H      PIC 99   COMP-X VALUE 16. *  Subfunction 01H 05 A-L      PIC 99   COMP-X VALUE 1. 01 BX. 05 B-H      PIC 99   COMP-X. 05 B-L      PIC 99   COMP-X. 01 CX. 05 C-H      PIC 99   COMP-X. 05 C-L      PIC 99   COMP-X. 01 DX. 05 D-H      PIC 99   COMP-X. 05 D-L      PIC 99   COMP-X. * Initialize to interrupt 10H 01 Interrupt   PIC X           VALUE X&quot;10&quot;. * Load actual registers with passed parameters 01 Flag        PIC X           VALUE X&quot;FF&quot;. * Flag whether the user pressed a key, initialize to 0 01 KeyWaiting  PIC 99   COMP-X VALUE 0. PROCEDURE DIVISION. *   When KeyWaiting NOT = 0, the user pressed a key PERFORM UNTIL KeyWaiting NOT = 0 *      Check if key is waiting in the buffer CALL X&quot;D9&quot; USING KeyWaiting *      Circulate through the default 16 colors PERFORM VARYING B-H FROM 0 BY 1 UNTIL B-H > 15 *         Call the interrupt to set the border color CALL X&quot;84&quot; USING Interrupt, Flag, AX, BX, CX, DX         END-PERFORM END-PERFORM. STOP RUN. Copyright Microsoft Corporation 1990.