[comp.sys.intel] iC86 absolute mapping of vars

dario@techunix.BITNET (Dario Ringach) (09/11/90)

Does anyone know how to place an iC86 variable at a specific
absolute address?  Thanks.

tneff@bfmny0.BFM.COM (Tom Neff) (09/11/90)

In article <9779@discus.technion.ac.il> dario%techunix.bitnet@lilac.berkeley.edu (Dario Ringach) writes:
>Does anyone know how to place an iC86 variable at a specific
>absolute address?  Thanks.

One approach would be to initialize a pointer to the variable using an
absolute value, e.g.

	char *bios_copyright = (char *) 0xf8000064;

But if you absolutely must define a name with external scope which the
linker will map to a given absolute address, your best bet is to create
an ASM86 module with the proper absolute origin, and defining the
variable as a FAR symbol.  Assemble with NOTYPE and link with your
program, declaring the symbol in C with the 'far' keyword.

For most purposes I would go with the first method.

hb@ddsw1.MCS.COM (Henry Barta) (09/14/90)

In article <9779@discus.technion.ac.il> dario%techunix.bitnet@lilac.berkeley.edu (Dario Ringach) writes:
>
>Does anyone know how to place an iC86 variable at a specific
>absolute address?  Thanks.

I don't know of any way to do this through the compiler. When I had to
address memory mapped I/O in an embedded system, I declared the variable
as 'extern' in the '.c' file. To locate it, I created an '.asm' file
that listed the same variable name as an 'EXTRN' and then located it
within a segment using an 'ORG' statement. The segment was then placed
at the proper location when the program was located ('XLOC86') following
linking ('XLINK86'). If you are targetting DOS or iRMX you may succeed by
declaring a pointer to the memory location you wish to access and then
dereference it. iC86 has functiona that can be used to assign an address
to the pointer.

hank