I think I figured out what your issue is …
ACKREGS is #define'd as 'union REGS' which is a 16-bit DOS specific struct in C:\BC4\INCLUDE\DOS.H,
however the author of mouse.c wrote their code against a different DPMI structure than the one supplied with Borland 4.0. It seems they distributed Open Watcom's DOS4GW.EXE DPMI extender and wrote their code mostly with Borland but against Watcom's DPMI structure. Go figure
When your compiler says 'regs.w' is undefined, it's referring to the word part of the union defined in the DOS4GW DPMI structure (which is not the same as Borland's).
union REGS { /* Compatible with DPMI structure, except cflag */
struct DWORDREGS d;
#ifdef _NAIVE_DOS_REGS
struct WORDREGS x;
#else
#ifdef _BORLAND_DOS_REGS
struct DWORDREGS x;
#else
struct DWORDREGS_W x;
#endif
#endif
struct WORDREGS w;
struct BYTEREGS h;
};
Borland's structure only has WORDREGS x instead of w:
struct WORDREGS {
unsigned int ax, bx, cx, dx, si, di, cflag, flags;
};
struct BYTEREGS {
unsigned char al, ah, bl, bh, cl, ch, dl, dh;
};
union REGS {
struct WORDREGS x;
struct BYTEREGS h;
};
So you have a few options:
1. Inside mouse.c, change all the instances of 'regs.w' to 'regs.x' and then change the ACKINT from int386 to the correct instruction
*OR*
2. Find the correct dos.h include file for the DPMI provided in the ACK book and include that instead of the one from Borland C++ 4.0
I was able to compile everything in FDEMO successfully using option 1 above, but only on this old 32-bit Windows XP system I had laying around, and Borland 4.0 warned me that using it on Windows NT was at my own risk.
To compile, I had to make the following changes in mouse.c and fdemo.c
// MOUSE.C
// Changed by Steve S., instead of int386 use intr
#ifdef __BORLANDC__
#define ACKREGS union REGS
#define ACKINT(n,r) intr(n,r)
#else
#define ACKREGS union REGPACK
#define ACKINT(n,r) intr(n,r)
#endif
// Changed by Steve S., instead of regs.w.ax use regs.x.ax (repeat this modification throughout the file)
yesno = regs.x.ax;
// FDEMO.C
// Changed by Steve S., I had to add 'huge' keyword as this is greater than 256 * 256 bytes
extern huge long zdTable[VIEW_WIDTH][200];
I recommend you return to Borland 4.0, revert everything you did to try to get past the 'regs.w undefined' error and try to find the matching DOS4GW DPMI includes (that or try the hacks I show above).