Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!sri-spam!ames!sdcsvax!ucsdhub!hp-sdd!hplabs!sdcrdcf!trwrb!scgvaxd!wlbr!etn-rad!jru From: jru@etn-rad.UUCP (John Unekis) Newsgroups: comp.sources.wanted,comp.lang.c,comp.sys.ibm.pc Subject: Re: C / IBM REQUIREMENTS...... Message-ID: <262@etn-rad.UUCP> Date: Thu, 27-Aug-87 11:55:53 EDT Article-I.D.: etn-rad.262 Posted: Thu Aug 27 11:55:53 1987 Date-Received: Sun, 30-Aug-87 04:10:23 EDT References: <6050@ut-ngp.UUCP> Reply-To: jru@etn-rad.UUCP (0000-John Unekis) Organization: Eaton Inc. IMSD, Westlake Village, CA Lines: 29 Xref: mnetor comp.sources.wanted:2069 comp.lang.c:4001 comp.sys.ibm.pc:7245 In article <6050@ut-ngp.UUCP> marshek@ut-ngp.UUCP (The Genie) writes: > >Anybody out there have any stuff to do a peek & poke function in C ? >(The peek & poke of BASIC). ... Simple, use a pointer variable, and the large model switch on the compiler. char *p; declares a pointer to a byte int *p; declares a pointer to a word to access a physical address, you must construct it in the form of a segment and offset. The segment is put in the most significant word of the pointer, the offset is put in the least significant part. The physical address you will reach is the addition of the two with the segment left shifted by four bits (one hex digit) i.e. segment YYYY0 +offset + xxxx ------- -------- physical Ynnnx address setting the pointer to a constant such as p = (char *) 0xA1112225; would reach physical address (hex) A3335 to 'peek' you would simply say variable = *p; to 'poke' you would say *p = value; -------------------------------------------------------------- hope this helps ihnp4!wlbr!etn-rad!jru