
#define LOWORD(lWord) ((WORD)(lWord))
#define HIWORD(lWord) ((WORD)((LONG)(lWord) >> 16))
class RegInst {
static RegInst *MappedInst;
int | Valid; |
int | Mapped; |
int | MapSpace; |
unsigned int PageStart, PageCount; UBYTE *SuggestedAddr;
protected: INST Inst; UBYTE *BaseAddr; void Unmap(void);
public:
RegInst(UWORD lAddr = 0); ~ RegInst(void);
int | IsValid(void) { return (this != NULL && Valid); } |
INST | GetInstID(void) { return Inst; } |
void | SetMapping(int mapSpace, unsigned int pageStart, unsigned int pageCount, |
UBYTE *suggestedAddr); | |
void | Map(void); |
UBYTE bGet(UWORD offset) { if (!Mapped) Map(); return ibpeek((UBYTE *) (BaseAddr+offset)); }
void bSet(UWORD offset, UBYTE value = 0) { if (!Mapped) Map(); ibpoke((UBYTE *) (BaseAddr+offset),value); }
UWORD wGet(UWORD offset) { if (!Mapped) Map(); return iwpeek((UWORD *) (BaseAddr+offset)); }
void wSet(UWORD offset, UWORD value = 0) { if (!Mapped) Map(); iwpoke((UWORD *) (BaseAddr+offset),value); }
void wMGet(UWORD offset, UWORD *dest, ULONG count) {
if (!Mapped) Map(); iwpopfifo(Inst,(UWORD *) (BaseAddr+offset),dest,count,1);
}
void wMSet(UWORD offset, UWORD *src, ULONG count) {
if (!Mapped) Map(); iwpushfifo(Inst,(UWORD *) (BaseAddr+offset),src,count,1);
}
void lMGet(UWORD offset, ULONG *dest, ULONG count) {
if (!Mapped) Map(); ilpopfifo(Inst,(ULONG *) (BaseAddr+offset),dest,count,1);
}
void lMSet(UWORD offset, ULONG *src, ULONG count) {
if (!Mapped) Map(); ilpushfifo(Inst,(ULONG *) (BaseAddr+offset),src,count,1);
}
};
Continued on Next Page
78 Using the Digitizer | Chapter 2 |