MASM syntax for a far call.

Ross Oliver rosso at sco.COM
Wed Feb 8 19:11:33 AEST 1989


In article <62 at elgar.UUCP> ag at 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 <function address> 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.



More information about the Comp.unix.xenix mailing list