Article View: comp.os.msdos.programmer
Article #1547Re: far call in C
From: Kevin D. Quitt
Date: Sat, 07 Jul 1990 18:59
Date: Sat, 07 Jul 1990 18:59
43 lines
2181 bytes
2181 bytes
In article <1990Jul7.100712.7027@ariel.unm.edu> saunders@carina.unm.edu (Richard Saunders CIRT) writes:
>
> Help! Some application interfaces, like XMS and Netware IPX/SPX, are
>called with FAR CALLs instead of software interrupts. This poses no problem
>to assembly language programmers, but I'm working in C and I'm pretty
>inexperienced at 8086 assembly language. I need something similar to int86()
>and int86x() that will let me load the various registers, do a far call, and
>then examine the register contents in Microsoft C 5.0 || Mix Power C.
> Surely I'm not the first to face this problem...
If the XMS and Netware libraries are written for C, then you need
only compile in large model (/AL) or declare the functions your are
using as far functions: e.g.
extern void far function_foo();
If they require values placed in specific registers, then you'll need
an assembly routine - but only one. Declare the function as above, and:
call_far_fn( function_foo, ax, bx, cx, dx );
where call_far_fn is an asembly routine that loads up the registers
as specified, then does the far call, and passes the return value back
to C (generally in AX, or DX:AX).
You could even define a macro like:
#define FN_foo(a, b, c, d) call_far_fn( function_foo, (a), (b), (c), (d))
then invoke it like:
FN_foo( ax, bx, cx, dx );
Good luck!
--
_
Kevin D. Quitt demott!kdq kdq@demott.com
DeMott Electronics Co. 14707 Keswick St. Van Nuys, CA 91405-1266
VOICE (818) 988-4975 FAX (818) 997-1190 MODEM (818) 997-4496 PEP last
96.37% of all statistics are made up.
Technical Details
Message-ID:
<378@demott.COM>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!srhqla!demott!kdqReferences:
<1990Jul7.100712.7027@ariel.unm.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!zaphod.mps.ohio-state.edu!usc!srhqla!demott!kdq From: kdq@demott.COM (Kevin D. Quitt) Newsgroups: comp.os.msdos.programmer,comp.sys.ibm.pc.programmer Subject: Re: far call in C Message-ID: <378@demott.COM> Date: 7 Jul 90 18:59:53 GMT References: <1990Jul7.100712.7027@ariel.unm.edu> Reply-To: kdq@demott.COM (Kevin D. Quitt) Followup-To: comp.os.msdos.programmer Distribution: na Organization: DeMott Electronics Co., Van Nuys CA Lines: 43