|
Top Document: comp.os.msdos.programmer FAQ part 4/5 Previous Document: Next Document: See reader questions & answers on this topic! - Help others by sharing your knowledge Date: 7 Feb 2002 14:50:10 -0400 First check the library that came with your compiler. Many vendors have some variant of peek and poke functions. For example: * In Turbo Pascal, use the pseudo-arrays Mem, MemW, and MemL. Be sure you use the correct array for the size of data you want to access: byte, word, or double word. Alternatively, use pointers. * In Turbo C/Borland C, and in recent versions of Microsoft C, use MK_FP; in older versions of Microsoft C, use FP_OFF and FP_SEG. (Caution: Turbo C and Turbo C++ also have FP_OFF and FP_SEG macros, but they can't be used to construct a pointer.) Be sure to pick the right data type: probably "unsigned char far *" if you're planning to access bytes and "unsigned short far *" for words. (The "far" isn't needed if your memory model uses 32-bit data pointers, but including it does no harm.) By the way, it's not useful to talk about "portable" ways to do this. Any operation that is tied to a specific memory address is not likely to work on another kind of machine. User Contributions:Top Document: comp.os.msdos.programmer FAQ part 4/5 Previous Document: Next Document: Part1 - Part2 - Part3 - Part4 - Part5 - Single Page [ Usenet FAQs | Web FAQs | Documents | RFC Index ] Send corrections/additions to the FAQ Maintainer: jeffrey@carlyle.org (Jeffrey Carlyle)
Last Update March 27 2014 @ 02:11 PM
|

Comment about this article, ask questions, or add new information about this topic: