Microsoft KB Archive/40721

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 19:22, 12 August 2020 by X010 (talk | contribs) (X010 moved page Microsoft KB Archive/Q40721 to Microsoft KB Archive/40721 without leaving a redirect: Text replacement - "Microsoft KB Archive/Q" to "Microsoft KB Archive/")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

COBOL 3.00 or 3.00a Call X“84” to Get Available Memory

PSS ID Number: Q40721 Article last modified on 02-28-1990

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

Summary: The CALL X“84” special subprogram can be called to execute a MS-DOS interrupt. The code example below uses Interrupt Hex 21, with Function Hex 48 to allocate a memory block. This example can be used in Microsoft COBOL Versions 3.00 and 3.00a to determine the amount of RAM available. This information can be used to determine if sufficient memory exists for a CALL to a particular subprogram. For more information on CALLing the X“84” special subprogram, see the “Microsoft COBOL Version 3.0: Operating Guide,” Pages 8-4 and 8-5. For documentation of the register arguments required for MS-DOS interrupts, please see the book “Advanced MS-DOS Programming, Second Edition,” by Ray Duncan (Microsoft Press, 1988).

More Information:

Code Example

You must initialize the proper register values prior to each CALL X“84”. The following program example should be compiled and LINKed, accepting the defaults, without a COBOL.DIR file: $SET NOOSVS SPECIAL-NAMES. CONSOLE IS CRT. WORKING-STORAGE SECTION. 01 dos-int pic X value X“21”. 01 AX pic XXXX value X“4800”. 01 BX pic XXXX value X“ffff”. 01 CX pic XXXX. 01 DX pic XXXX. 01 flag pic X value X“FF”. 01 MemSize pic 9(8) comp-X. 01 RetSize pic 9(8) comp-X. PROCEDURE DIVISION. DISPLAY SPACES UPON CRT. call x“84” using dos-int, flag, AX, BX, CX, DX. MOVE BX to RetSize. Multiply RetSize BY 16 GIVING MemSize. Exhibit MemSize. Exhibit RetSize. STOP RUN.

Copyright Microsoft Corporation 1990.