From Bob Stout · 1996-04-09 17:54 · #73579 in EMULATE
In reply to Watcom C++ 10.5 by Jeff Siegel
In a message of <Apr 03 13:00>, Jeff Siegel (1:342/1017@fidonet) writes:
>Hi, I just got Watcom C++ and was trying to compile some code for a dos
>game. I keep getting errors that the compiler says is undefined symbols.
>The symbols are "peek" and "peekb". I looked in the help files and looked
>through some header files, but couldn't find these commands. Does anyone
>know where they are or any commands that substitute these two commands?
Jeff...
PEEK and POKE are BASIC commands that no self-repsecting C programmer would use! ;-) Having said that, they are supported in compilers from Borland and Mix, but not Watcom or Microsoft. Earlier versions of Symantec/Zortech support them, but the syntax differs from Borland. Later versions of Symantec support the Borland syntax.
Now that you've had your history lesson, here's code from SNIPPETS that will allow you to port your code...
>>>>>>>>>> CSplit: Version 2.1 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin part 1/3 >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file PCHWIO.H >>>>>>>>>>
/*
** PCHWIO.H - SNIPPETS header file for portable hardware I/O access \
\
under DOS
**
** public domain by Bob Stout
*/
#ifndef PCHWIO__H
#define PCHWIO__H
#include <dos.h>
#include "extkword.h"
#if defined(__TURBOC__) || defined(__POWERC)
#ifndef inp
#define inp inportb
#endif
#ifndef outp
#define outp outportb
#endif
#ifndef inpw
#define inpw inport
#endif
#ifndef outpw
#define outpw outport
#endif
#elif defined(__ZTC__)
#include <int.h>
#define enable int_on
#define disable int_off
#if !defined(__SC__)
void FAR * getvect(unsigned intnum);
void setvect(unsigned intnum, void (INTERRUPT FAR *handler)());
#else
#define getvect _dos_getvect
#define setvect _dos_setvect
#endif
#else /* assume MSC/QC/WC */
#include <conio.h>
#if defined(__WATCOMC__)
#include <i86.h>
#endif
#define enable _enable
#define disable _disable
#define getvect _dos_getvect
#define setvect _dos_setvect
#endif
#if defined(_MSC_VER) || defined(__WATCOMC__) || \
(defined(__ZTC__) && !defined(__SC__))
unsigned char peekb(unsigned seg, unsigned ofs);
unsigned peek(unsigned seg, unsigned ofs);
void pokeb(unsigned seg, unsigned ofs, unsigned char ch);
void poke(unsigned seg, unsigned ofs, unsigned num);
#endif /* peek(), poke() */
#endif /* PCHWIO__H */
>>>>>>>>>> CSplit: End file PCHWIO.H >>>>>>>>>>
>>>>>>>>>> CSplit: Begin file PCHWIO.C >>>>>>>>>>
/*
** PCHWIO.C - SNIPPETS portable hardware I/O access under DOS
**
** public domain by Bob Stout
*/
#include "pchwio.h"
#include "mk_fp.h"
#if defined(__ZTC__) && !defined(__SC__)
void FAR * getvect(unsigned intnum)
{
unsigned seg, off;
int_getvector(intnum, &off, &seg);
return MK_FP(seg, off);
}
void setvect(unsigned intnum, void (INTERRUPT FAR *handler)())
{
unsigned seg = FP_SEG(handler), off = FP_OFF(handler);
>>>>>>>>>> CSplit: End part 1/3 crc: ede0 >>>>>>>>>>
--- QM v1.00
* Origin: MicroFirm : Down to the C in chips (1:106/2000.6)