Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!sharkey!edsews!uunet!sco!rosso From: rosso@sco.COM (Ross Oliver) Newsgroups: comp.unix.xenix Subject: Re: MASM syntax for a far call. Message-ID: <1545@viscous.sco.COM> Date: 8 Feb 89 09:11:33 GMT References: <62@elgar.UUCP> Reply-To: uunet!sco!rosso (Ross Oliver) Distribution: usa Organization: SCO Technical Support Lines: 39 In article <62@elgar.UUCP> ag@elgar.UUCP (Keith Gabryelski) writes: >As you can see, I couldn't figure out the MASM assembler syntax for a >far call. I used `db's instead. > >I was informed by a SCO hack [Brian Chapman] that what I did was >similar to what is found in their source code. > >It seems the far call is hardly ever used in the SCO XENIX system and >as such has never been fully implemented in the MASM assembler. Actually, far calls are fully implemented in Masm, and in fact are used exclusively in large model programs. Normally, you would use the PROC FAR directive to declare a function that must be reached with a far call, then use CALL FAR PTR to make the call. For example, here is your basic "Hello world" program, in stripped-down large model 286 assembly: EXTRN _printf:FAR $SG103 DB 'Hello world!', 0aH, 00H _main PROC FAR push ds push OFFSET DGROUP:$SG103 call FAR PTR _printf leave ret _main ENDP However, in Keith's example, the DB kludge must be used to force Masm to make a far call to a numeric rather than a symbolic address. I suspect that is the reason for its use in the XENIX kernel as well. Ross Oliver Technical Support The Santa Cruz Operation, Inc.