Microsoft KB Archive/61405

COBOL Can Call Interrupt 10H, Function 1H to Turn Off Cursor

PSS ID Number: Q61405 Article last modified on 05-01-1990

3.00 3.00a MS-DOS

Summary: In Microsoft COBOL versions 3.00 and 3.00a, you can turn off the text cursor by calling interrupt 10H, function 01H (Set cursor type). An interrupt is called from COBOL via the special subprogram X“84”. Interrupt 10H, function 01H requires that the following registers be set: AH (high byte of AX) = 01H CH (high byte of CX) = starting scan line for cursor CL (low byte of CX) = ending scan line for cursor To change the shape of the cursor, CH and CL can be any number from 0 to 15, depending on which text mode the computer is currently in, and the specified range of lines will be displayed. However, if CH is set to 32, the cursor will be turned off. To turn the cursor back on, another call to interrupt 10H, function 01H would be needed, with the appropriate scan lines set. The information in this article applies to Microsoft COBOL Compiler versions 3.00 and 3.00a for MS-DOS.

More Information: For more information on 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.” For more information on interrupt 10H, function 01H, see Page 501 of “Advanced MS-DOS Programming, Second Edition,” by Ray Duncan (Microsoft Press, 1988). The following program, CURSOR.CBL, demonstrates how to turn the cursor on and off in COBOL 3.00 and 3.00a. Compile and LINK as follows: COBOL CURSOR.CBL ; LINK CURSOR ; The following is the program CURSOR.CBL:

$SET ANS85 DATA DIVISION. WORKING-STORAGE SECTION. 01 AX. *  Function 01H. 05 A-H     PIC X VALUE X&quot;01&quot;. 05 A-L     PIC X.   01 BX. 05 B-H     PIC X.      05 B-L      PIC X.   01 CX. *  Initialize CH to turn cursor off. 05 C-H     PIC X VALUE X&quot;20&quot;. 05 C-L     PIC X.   01 DX. 05 D-H     PIC X.      05 D-L      PIC X.  *   Interrupt 10H. 01 INTERRUPT  PIC X VALUE X&quot;10&quot;. *  Load registers with CALL X&quot;84&quot; parameters. 01 FLAG       PIC X VALUE X&quot;FF&quot;. *  Used to monitor keyboard. 01 ANY-KEY    PIC 99 COMP-X VALUE 0. PROCEDURE DIVISION. *   Clear the screen. CALL X&quot;E4&quot;. DISPLAY &quot;Cursor is on by default, hit space to continue&quot;. *   Wait until a space is entered. PERFORM UNTIL ANY-KEY = 32 CALL X&quot;83&quot; USING ANY-KEY END-PERFORM. MOVE 0 TO ANY-KEY. *   Turn cursor off. CALL X&quot;84&quot; USING INTERRUPT, FLAG, AX, BX, CX, DX. DISPLAY &quot;Cursor is now off, hit space to continue&quot;. *   Wait until a space is entered. PERFORM UNTIL ANY-KEY = 32 CALL X&quot;83&quot; USING ANY-KEY END-PERFORM. *   Function 1. MOVE X&quot;01&quot; TO A-H. *   Set starting line for cursor. MOVE X&quot;06&quot; TO C-H. *   Set ending line for cursor. MOVE X&quot;07&quot; TO C-L. *   Turn cursor back on. CALL X&quot;84&quot; USING INTERRUPT, FLAG, AX, BX, CX, DX. DISPLAY &quot;Cursor is back on&quot;. STOP RUN. Copyright Microsoft Corporation 1990.