Microsoft KB Archive/49781

How to Hide the Cursor in COBOL 3.00 Using Assembler Routine

PSS ID Number: Q49781 Article last modified on 01-01-1990

3.00 3.00a MS-DOS

Summary: The following code example shows how to hide the cursor in COBOL by calling an assembly-language routine. This information applies to Microsoft COBOL Versions 3.00 and 3.00a, Microsoft Macro Assembler Version 5.10, and Microsoft QuickC with Quick Assembler Version 2.01.

More Information: A blinking cursor is a TEXT mode hardware feature that shows the active location on the display screen. Since the blinking cursor is a hardware-created feature, COBOL software has only limited control over it. Changes to the cursor can be controlled by the services of the ROM BIOS (i.e., size, location, visibility). This ROM BIOS service is interrupt 10 Hex, services 01 Hex through 03 Hex (i.e., in decimal notation, interrupt 16, services 1 through 3). Since Microsoft COBOL cannot make calls to the BIOS (or can make very limited calls to the BIOS), it is necessary to interface with an assembly routine (for COBOL Versions 2.x, 3.00, and 3.00a) or with some high-level language (for COBOL Versions 3.00 and 3.00a).

Code Example
Compile the COBOL source code as follows: COBOL cobolsource; Compile the assembler source code as follows (using Macro Assembler Version 5.10): MASM assemblersource; Compile the assembler source code as follows (using QuickC with Quick Assembler Version 2.01): QCL assemblersource COBOL source code is as follows: $SET LITLINK $SET RTNCODE-SIZE(4) $SET VSC2 IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. 01 JUNK1 PIC X(20). 01 JUNK2 PIC X(20). PROCEDURE DIVISION. MAIN-LEVEL. DISPLAY “Accepting a 20 character string.”. DISPLAY “NOTICE: You can see the cursor on the”. DISPLAY “ACCEPT.”. ACCEPT JUNK1. DISPLAY “Accepting another 20 character string.”. DISPLAY “CALLing assembly routine to hide the”. DISPLAY “cursor.”. DISPLAY “NOTICE: You cannot see the cursor on the”. DISPLAY “ACCEPT.”. CALL “hidecursor”. ACCEPT JUNK2. DISPLAY “First string:”,JUNK1. DISPLAY “Second string:”,JUNK2. STOP RUN. Assembly source code is as follows: .MODEL LARGE .CODE PUBLIC hidecursor hidecursor PROC FAR push bp mov bp,sp mov ah,1 ;load service to ah register. mov ch,32 ;set bit 5 of ch register. ;any value that sets bit 5 ;will work. int 16 ;call interrupt 16H. pop bp ret hidecursor ENDP END

Copyright Microsoft Corporation 1990.