[comp.sys.ibm.pc] mmind patch

bobmon@iuvax.cs.indiana.edu (RAMontante) (03/31/88)

The following diff describes a patch to David Tanguay's excellent "Mastermind"
game.  In his code, the file rawio.c toggles the numlock status so that it
is a numeric keypad.  It doesn't undo this when you quit, though, so that
after the game your cursor arrows are numbers.  This is doubly annoying if
the numlock key has a status LED, which gets out of sync.  This patch just
forces the keypad to Cursors when you quit.  Oh, it also calculates the
pointer in a way acceptable to TurboC.  David's code presumably was acceptable
to MSC, but Turbo thinks he's assigning to an rvalue.

diff original\rawio.c rawio.c
82,83c82
< 	FP_SEG(ptr) = 0x40;
< 	FP_OFF(ptr) = 0x17;
---
> 	ptr = MK_FP(0x40, 0x17);	/* TurboC wants it this way */
86d84
< 
87a86,93
>  * MSC uses this instead of MK_FP???
>  *
>  *	FP_SEG(ptr) = 0x40;
>  *	FP_OFF(ptr) = 0x17;
>  */
> 
> 
> /*
92a99,100
> 	char far *ptr;
> 
94a103,106
> 
> 	/* Turn NumLock back off */
> 	ptr = MK_FP(0x40, 0x17);
> 	*ptr &= 0xDF;

Thanks for a fine game, David Tanguay!