home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!uwm.edu!linac!att!cbnewsm!cbnewsl!att-out!rutgers!mcdhup!src4src!wozzle!alane
- From: alane@wozzle.linet.org (J. Alan Eldridge)
- Newsgroups: comp.lang.c
- Subject: Re: Peek/Poke in C
- Message-ID: <mLF0VB1w165w@wozzle.linet.org>
- Date: 24 Dec 92 00:08:57 GMT
- References: <pal.724673747@regent.e-technik.tu-muenchen.de>
- Organization: Disorganization
- Lines: 27
-
- pal@regent.e-technik.tu-muenchen.dbp.de (Peter Loibl) writes:
-
- > ericwebb@blackwlf.gwinnett.com (eric webb) writes:
- >
- > >Hi again.. does anyone know how to do equivalent of BASIC's PEEK & POKE
- > >statements in C?
- >
- > I am sorry for my ignorance, but what are PEEK and POKE doing? If you
- > describe their task, then this would be lots of help for all the
- > "C-Gurus" here.
-
- peek and poke are to access absolute memory addresses under DOS.
-
- most DOS compilers support them either through intrinsic (builtin)
- functions or macros that call builtin functions.
-
- For example, TopSpeed C++ does this:
-
- #define poke(a,b,c) (*((int far *)MK_FP((a),(b))) = (int)(c))
- #define pokeb(a,b,c) (*((char far *)MK_FP((a),(b))) = (char)(c))
- #define peek(a,b) (*((int far *)MK_FP((a),(b))))
- #define peekb(a,b) (*((char far *)MK_FP((a),(b))))
-
- where a is a segment (or selector), b is an offset, and c is a value.
-
- alane@wozzle.linet.org (J. Alan Eldridge)
- Fido: The University of Walamaloo 1:272/38.473
-