🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc
Article #42695

Re: POKE, PEEK, FAR POINTER

#42695
From: Fred Smith
Date: Mon, 19 Feb 1990 14:41
43 lines
1545 bytes
In article <848@dukempd.phy.duke.edu> fang@dukempd.phy.duke.edu (Fang Zhong) writes:
>
>	I am relatively new to PC-AT and MS C.  I am asking helps from the net.
>
>	Here is something I have tried and it did not work.
>
>	unsigned far *addr;
>	unsigned seg, offset, byte;
>
>	addr = NULL;
>	addr += seg*16 + offset;
>	*addr = byte;
>	printf("%u\n"), *addr);
>
>	Any helps are appreciated very much.
>
>-- 
>	Fang Zhong				1-919-684-8247
>	Duke University Dept. of Physics	fang@phy.duke.edu
>	Durham, N.C.      27706			




MIcrosoft C has a pair of macros called FP_SEG and FP_OFF which are
designed for manipulating the segment:offset values of a far pointer.
You could try something like this:

unsigned far *addr;

FP_SEG(addr) = (segment value);
FP_OFF(addr) = (offset value);

to initialize the address of each place you want to read/write. 

You could also look at the definitions of those two macros (in dos.h, I 
think) to see what they are doing if you not only want it to work, but
also to UNDERSTAND it!

good luck!]]


Fred
Technical Details
Message-ID: <8389@cg-atla.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!cg-atla!fredex
References: <848@dukempd.phy.duke.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!cg-atla!fredex
From: fredex@cg-atla.UUCP (Fred Smith)
Newsgroups: comp.sys.ibm.pc
Subject: Re: POKE, PEEK, FAR POINTER
Keywords: ON a AT with Microsoft C
Message-ID: <8389@cg-atla.UUCP>
Date: 19 Feb 90 14:41:55 GMT
References: <848@dukempd.phy.duke.edu>
Reply-To: fredex@cg-atla.UUCP (Fred Smith)
Organization: Agfa Compugraphic Division
Lines: 43