home *** CD-ROM | disk | FTP | other *** search
- /*********
- * PEEKBYTE.C
- *
- * by Leonard Zerman
- *
- * Placed in the public domain by Tom Rettig Associates, 10/22/1990.
- *
- *********/
-
- #include <dos.h>
-
- #include "nandef.h"
- #include "extend.h"
-
- CLIPPER PEEKBYTE()
- {
- int num;
- unsigned int segment;
- unsigned int offset;
- unsigned char far * fptr;
- char retbuff[3];
-
- if(PCOUNT == 2 && ISCHAR(1) && (ISCHAR(2) || ISNUM(2)))
- {
- segment = _tr_htoi(_parc(1));
- offset = ISNUM(2) ? _parni(2) : _tr_htoi(_parc(2));
- fptr = MK_FP(segment, offset);
-
- retbuff[2] = '\0';
- num = *fptr % 16;
- retbuff[1] = num < 10 ? num + '0' : (num - 10) + 'A';
- num = *fptr / 16;
- retbuff[0] = num < 10 ? num + '0' : (num - 10) + 'A';
- _retc(retbuff);
- }
- else
- _retc("-1");
- }
-