Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!sundc!netxcom!jallen
From: jallen@netxcom.UUCP (John Allen)
Newsgroups: comp.sys.ibm.pc
Subject: Re: MS Windows and Physical memory?
Message-ID: <232@netxcom.UUCP>
Date: Fri, 12-Dec-86 11:02:12 EST
Article-I.D.: netxcom.232
Posted: Fri Dec 12 11:02:12 1986
Date-Received: Mon, 15-Dec-86 05:52:56 EST
References: <105500001@datacube> <9965@cgl.ucsf.edu.ucsfcgl.UUCP>
Reply-To: jallen@netxcom.UUCP (John Allen)
Organization: NetExpress Communications Inc. Vienna, Va.
Lines: 41

In article <9965@cgl.ucsf.edu.ucsfcgl.UUCP> kneller@cgl.ucsf.edu.UUCP (Don Kneller) writes:
>In article <105500001@datacube> berger@datacube.UUCP writes:
>>
>>Has anyone had experience using Microsoft Windows where they need
>>to talk to hardware using pointers?  Does Windows allow explicet
>>pointers to physical memory?
>>
>>For example
>>
>>char *p;
>>
>>	p = 0xa0000; /* Set p to point to some hardware location */
>>
>>	*p = 0xff;	/* Set the register to some value */
>
>I don't know about Windows, but this may not work because pointers may
>not be stored in the same format as longs.  For Microsoft C, the above
>*won't* work.  I assume your trying to reference segment A000, offset 0.
>In MSC you would say FP_SEG(p) = 0xA000; FP_OFF(p) = 0x0;  This is
>definitely not the same as p = 0xA0000.

Well, I *have* done just this in Microsoft C.  The thing to remember is
that "0xA0000" is a 20 bit value, so you must either:

1)  Use the Large model, or

2)  Declare a Far pointer, and enable 'NEAR' and 'FAR' during compile, ie:

	static char far *p = 0xa0000;

(or, in deference to Don's suggestion)

	static char far *p = FP_SEG(0xa000) + FP_OFF(0x0);


John Allen
=========================================================================
NetExpress Communications, Inc.      seismo!{sundc|hadron}!netxcom!jallen
1953 Gallows Road, Suite 300         (703) 749-2238
Vienna, Va., 22180
=========================================================================