Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!gatech!emory!platt From: platt@emory.uucp (Dan Platt) Newsgroups: comp.sys.ibm.pc,comp.lang.c Subject: Re: Looking for C functions to access PC memory Message-ID: <2312@emory.uucp> Date: Sat, 7-Nov-87 16:38:41 EST Article-I.D.: emory.2312 Posted: Sat Nov 7 16:38:41 1987 Date-Received: Tue, 10-Nov-87 05:04:45 EST References: <24261F3U@PSUVMB> Reply-To: platt@emory.UUCP (Dan Platt) Organization: Emory University Lines: 39 Xref: mnetor comp.sys.ibm.pc:9892 comp.lang.c:5330 In article <24261F3U@PSUVMB> F3U@PSUVMB.BITNET writes: >I am looking for some functions when called from a C program, will: > 1) read (peek) memory directly when supplied with > an address. Returns with the value at specified address. > and > 2) write (poke) memory directly when supplied with an > address and a byte value. > >I am using Microsoft C 4.0 on an AT&T 6300 PLUS. Routines >in C or Assembler OK. The way I did it was to define a routine that loads a pointer with a value pointed to by a segment/offset... __________________________________________________________________ far char * mem_pt(seg,offst) /* this may be coerced */ short seg,offst; { union { struct { short: ofst,sg; /* these may be backwards */ } vals; far char * ptr; } pointr; pointr.vals.sg= seg; pointr.vals.ofst=offst; return(pointr.ptr); } ____________________________________________________________________ This was off the top of my head, and may be a little off on syntax, but not by much. Hope this is a help. Dan