Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!ucbvax!ucsfcgl!cgl.ucsf.edu!kneller From: kneller@cgl.ucsf.edu (Don Kneller) Newsgroups: comp.sys.ibm.pc Subject: Re: Looking for C functions to access PC memory Message-ID: <10484@cgl.ucsf.EDU> Date: Sun, 8-Nov-87 17:36:44 EST Article-I.D.: cgl.10484 Posted: Sun Nov 8 17:36:44 1987 Date-Received: Tue, 10-Nov-87 06:22:27 EST References: <24261F3U@PSUVMB> <2312@emory.uucp> <151@fxgrp.UUCP> Sender: daemon@cgl.ucsf.edu Reply-To: kneller@socrates.ucsf.edu.UUCP (Don Kneller) Organization: UCSF Computer Graphics Lab Lines: 43 >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. In MSC it's probably easiest to use the supplied FP_SEG and FP_OFF macros to do this. This works in all memory models: #include unsigned char peek(segment, offset) unsigned int segment, offset; { unsigned char far *cp; FP_SEG(cp) = segment; FP_OFF(cp) = offset; return *cp; } void poke(segment, offset, value) unsigned int segment, offset; unsigned char value; { unsigned char far *cp; FP_SEG(cp) = segment; FP_OFF(cp) = offset; *cp = value; } ----- Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller INTERNET: kneller@cgl.ucsf.edu BITNET: kneller@ucsfcgl.BITNET