Microsoft KB Archive/35884

From BetaArchive Wiki

CALL X“nn” Accesses DOS Interrupts, Screen, Keyboard, Ports

PSS ID Number: Q35884 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

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

Summary: There are 22 special functions that use the CALL X“nn” format. These special functions can be used to directly interface with the screen, keyboard, memory, hardware ports, and MS-DOS interrupts. We cannot guarantee that these subprograms will be supported in future releases. They are designed to be used “as is.” These special functions are written in assembly language and are accessed by the CALL statement in the following form CALL special-function-number USING parameter-list where: special-function-number is a single byte parameter-list depends on the special function called Note that Microsoft COBOL Compiler versions earlier than Version 3.0 do not support these types of calls.

More Information: The parameters that you pass in these calls must be loaded immediately prior to the call because some of the functions alter the parameters during execution. You should take great care when using these calls. Calls such as X“84” (DOS interrupt), X“86”/X“96” (set memory value), and X“88”/X“97” (port output) can cause serious problems if the wrong values are passed. See Chapter 8 of the “Microsoft COBOL Compiler Version 3.0: Operating Guide” for specific details on these special functions. There are several articles in this knowledge base that contain instructions on calling specific routines. Note: Parameters used in these calls must be within the first 64K of the Data Division. These calls will not work if the parameters are defined in the linkage section of the program. The special functions available are the following:

Function Command
CALL X“82” Put a character to the screen
CALL X“83” Read a character from the keyboard
CALL X“84” Execute a DOS interrupt
CALL X“85” Examine a 1-byte address location
CALL X“94” Examine a 2-byte address location
CALL X“86” Set a 1-byte address location
CALL X“95” Set a 2-byte address location
CALL X“87” Enter (input from) a hardware port and return a
1-byte value
CALL X“96” Enter (input from) a hardware port and return a
2-byte value
CALL X“88” Output to a hardware port and return a 1-byte value
CALL X“97” Output to a hardware port and return a 2-byte value
CALL X“8C” Split a filename
CALL X“8D” Join a filename
CALL X“91” Make interprogram function calls
CALL X“A7” Perform screen control
CALL X“AF” Conceal password/Accept field/Enable or Disable
user function keys
CALL X“BO” Detect function keys or test printer status
CALL X“B7” Input from and output to the screen
CALL X“D9” Test console status
CALL X“E3” Get screen size
CALL X“E4” Clear screen
CALL X“E5” Sound the beep
CALL X“E6” Move cursor to a defined position
CALL X“F4” Pack byte
CALL X“F5” Unpack byte

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.