home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
s
/
snip1292.zip
/
MSC_PEEK.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-06
|
925b
|
49 lines
/*
** For MSC which lacks these very basic (sic) functions
**
** public domain by Bob Stout
*/
#include <dos.h>
#ifndef MK_FP
#define MK_FP(seg,offset) \
((void _far *)(((unsigned long)(seg)<<16) | (unsigned)(offset)))
#endif
unsigned char peekb(unsigned seg, unsigned ofs)
{
unsigned char far *ptr;
FP_SEG(ptr) = seg;
FP_OFF(ptr) = ofs;
return *ptr;
}
unsigned peek(unsigned seg, unsigned ofs)
{
unsigned far *ptr;
FP_SEG(ptr) = seg;
FP_OFF(ptr) = ofs;
return *ptr;
}
void pokeb(unsigned seg, unsigned ofs, unsigned char ch)
{
unsigned char far *ptr;
FP_SEG(ptr) = seg;
FP_OFF(ptr) = ofs;
*ptr = ch;
}
void poke(unsigned seg, unsigned ofs, unsigned num)
{
unsigned far *ptr;
FP_SEG(ptr) = seg;
FP_OFF(ptr) = ofs;
*ptr = num;
}