/************************************
 * LIGHTPEN - Test lgtpen() function *
 ************************************/

//use -h option on command line
#include <screen.h02>
#include <lgtpen.h02>

char aa,xx,yy;

void prtlbl(aa,yy,xx) {
  setpos(aa,yy);
  putchr(xx); putchr(':');
}

void prtbyt(aa,yy,xx) {
  setpos(aa,yy);
  prbyte(xx);
}

char px,py,pt;
char lx,ly,lt;

main:
  clrscr();

  if (!#LGTPNS) goto exit;

  prtlbl(1,1,'X');
  prtlbl(1,2,'Y');
  prtlbl(1,3,'T');

loop:
  if (getkey() == #ESCKEY) goto exit;
  px,py,pt = lgtpen();
  if (px<>lx) {prtbyt(4,1,px); lx=px;}
  if (py<>ly) {prtbyt(4,2,py); ly=py;}
  if (pt<>lt) {prtbyt(4,3,pt); lt=pt;}
  goto loop;
