Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS/BIOS call from the DOS Cobol program

Status
Not open for further replies.

ivi

Programmer
Oct 23, 2000
3
RU
I am not Cobol programmer but I need to make the program which is callable from the Cobol program (Old Dos MF Cobol v.2.51). Because I can not find an answer how to link the MSVC 1.5x program (obj) to the Cobol project I want to know if it is possible to make calls to the DOS/BIOS functions from a Cobol program? If yes could somebody prvide a chunk of source how to do it?

Thank you,
Victor [sig][/sig]
 
What do you want to do in bios.

I have 3.2 MF Cobol and the documentation for the call's.

It employs a call by number scheme with values passed as parameters.

Let me know what and I'll give you a chunk.
[sig][/sig]
 
That's a long story what I want and I'm afraid my English too poor to explain :) But I will try.
I never wrote any programs in Cobol but I have one customer who have an old DOS Cobol-application (16 bit, of course) with the direct port i/o access. This program was written in Microfocus Cobol V 2.5.22 - that's all I know.
This program should be running under NT which is a protected system and all port i/o operations are prohibited. Well, I wrote VDD and NT kernel-mode driver. My first attempt was based on "non-application port i/o intercept". This way does not requires any changes in Cobol program but works very slow and I was forced to use another way which requires to make changes in the Cobol program.
Windows NT provides the functions RegisterModule, UnregisterModule, and DispatchCall for a 16-bit application (DOS or Win16) to call a 32-bit VDD (the same as DLL). These functions can be included in a 16-bit application program to bridge the gap between the 16- and 32-bit environments. The problem is that our customer can not make these calls directly and I should write some "thunk".

The first way is to write small 16-bit module with the 16-bit "C" compiler then link an *.obj file to the cobol program. The problem is that I do not know what is an *.obj model used in Microfocus Cobol? It is a Microsoft model? Other? How the parameters are passed from the Cobol when some procedure is called? Through the stack? It is a C "stdcall" model? "pascal" model? How this compiler returns the function results? In CPU registers like AX?

The second way seems to be more simple. In VDD I can intercept any call to the DOS/BIOS functions from any DOS program. Then we can make call from the Cobol program to any unused INT number, pass parameteres through the registers, return results in the register also.

So I need this pseudocode:

AL <- Function number (0 - read port, 1 - write port)
BL <- Value to write
DX <- Port address
All other registers are not used
-----
Call INT XX (I will choose this number myself)
-----
Return result in AL
Move result to some variable

Thank you in advance,
Victor [sig][/sig]
 
mvanbro, I am waiting for your answer VERY much...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top