Interfacing with a MAX690A Watch Dog Timer

/* Program WATCHDOG.C
** Illustrates an interface with a MAX690A Watch Dog Timer.  If
** the MAX690A does not receve a state change on WDI within nominally
** 1.6 secs, the reset goes low for 200 ms, rebooting the Flashlite.
** Flashlite V25                 MAX690
** P1.7 ------------------------> Watchdog Input
** RESET <----------------------- Reset
** In the program, an LED on P2.0 is pulsed on and off for an ever
** increasing time.  Without the call to watchdog() in pause(), the
** MAX690A resets the processor.  Note that the implementation of the
** watchdog() function is one of simply toggling P1.7
** copyright, Peter H. Anderson, Baltimore, MD, October, '00

#include <stdio.h>
#include <dos.h>

typedef unsigned char byte;

#define SEG 0xf000

#define P1_OFFSET 0xff08
#define PM1_OFFSET 0xff09
#define PMC1_OFFSET 0xff0a

#define P2_OFFSET 0xff10
#define PM2_OFFSET 0xff11
#define PMC2_OFFSET 0xff12

void pause(int dt);
void watchdog(void);

/* note global */
byte far *p1, far *pm1, far *pmc1;
byte far *p2, far *pm2, far *pmc2;

void main(void)
   int delay_time=10;

   p1=MK_FP(SEG, P1_OFFSET);
   pm1=MK_FP(SEG, PM1_OFFSET);
   pmc1=MK_FP(SEG, PMC1_OFFSET);

   p2=MK_FP(SEG, P2_OFFSET);
   pm2=MK_FP(SEG, PM2_OFFSET);
   pmc2=MK_FP(SEG, PMC2_OFFSET);

   *pmc1 = 0x00;
   *pmc2 = 0x00;

   *pm1 = 0x7f;   /* most sig bit is an input */
   *pm2 = 0xfe;   /* least sig bit an imput */

      *p2 = 0x01;
      *p2 = 0x00;
      delay_time += 10;

void pause(int dt)
   int n;
   for (n=0; n<dt; n++)
      watchdog();       /* call to reset the MAX690 */

void watchdog(void)
   *p1 = *p1 ^ 0x80;    /* toggle most sign bit */