home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 8 / boot-disc-1997-04.iso / PDA_Soft / Psion / utils / Mouse / MAUS3.OPL < prev    next >
Text File  |  1993-12-12  |  2KB  |  76 lines

  1. PROC maus:
  2.  rem ** MAUS ** ein Beispielprg. zur Verwendung
  3.  rem einer seriellen PC-Maus an dem Serie3
  4.  rem von Marko Schuster '93
  5.  global a%,b&,p%(5),x%,y%,a$(5),k%,w%,w2%,xx%,yy%,b%
  6.  a%=ioopen(k%,"TTY:A",$0300)
  7.  rsset:(8,0,8,1,4) :rem 1200 8n1
  8.  gupdate off
  9.  x%=120 :y%=40 :cursor 1,0,1,1
  10.  w2%=gcreatebit(4,4)
  11.  guse w2%
  12.  gcopy 1,x%,y%,4,4,3
  13.  w%=gcreatebit(4,4) :gcls
  14.  gat 0,0 :glineto 4,4
  15.  gat 0,0 :glineto 3,0
  16.  gat 0,0 :glineto 0,3
  17.  xx%=x% :yy%=y%
  18.  do
  19.   pfeil:
  20.   xx%=x% :yy%=y%
  21.   mouse:
  22. rem  giprint num$(x%,-3)+","+num$(y%,-3)
  23.  until key$="x"
  24.  giprint "end" :pause 0 :stop
  25. endp
  26. proc rsset:(ba%,pa%,da%,st%,ha%)
  27.  local frame%,srchar%(6),du%,er%
  28.  frame%=da%-5
  29.  srchar%(1)=ba% or (ba%*256)
  30.  srchar%(2)=frame% or (pa%*256)
  31.  srchar%(3)=(ha% and 255) or $1100
  32.  srchar%(4)=$13
  33.  er%=iow(k%,7,srchar%(1),du%)
  34.  if er% :raise er% :endif
  35. endp
  36. proc mouse:
  37.   a$=rept$(chr$(0),5)
  38.   key
  39.   b%=addr(a$)+1
  40.   a%=ioread(k%,b%,5)
  41.   p%(1)=peekb(b%)
  42.   p%(2)=peekb(b%+1)
  43.   p%(3)=peekb(b%+2)
  44.   p%(4)=peekb(b%+3)
  45.   p%(5)=peekb(b%+4)
  46. rem  print num$(p%(1),-3),num$(p%(2),-3),num$(p%(3),-3),num$(p%(4),-3),num$(p%(5),-3)
  47.   if (p%(2)>0 and p%(2)<128) :x%=x%+p%(2) :endif
  48.   if (p%(4)>0 and p%(4)<128) :x%=x%+p%(4) :endif
  49.   if p%(2)>128 :x%=x%-(256-p%(2)) :endif
  50.   if p%(4)>128 :x%=x%-(256-p%(4)) :endif
  51.   if (p%(3)>0 and p%(3)<128) :y%=y%-p%(3) :endif
  52.   if (p%(5)>0 and p%(5)<128) :y%=y%-p%(5) :endif
  53.   if p%(3)>128 :y%=y%+(256-p%(3)) :endif
  54.   if p%(5)>128 :y%=y%+(256-p%(5)) :endif
  55.   if p%(1)=135 :gat x%,y% :endif
  56.   if x%>239 :x%=239 :endif
  57.   if x%<0 :x%=0 :endif
  58.   if y%>79 :y%=79 :endif
  59.   if y%<0 :y%=0 :endif
  60. endp
  61. proc pfeil:
  62.  gat xx%+1,yy%+1
  63.  gcopy w2%,0,0,4,4,3
  64.  if p%(1)=131 :gat xx%,yy% :glineto x%,y% :endif
  65.  guse w2%
  66.  gcopy 1,x%+1,y%+1,4,4,3
  67.  guse 1
  68.  gat x%+1,y%+1
  69.  if p%(1)<>131
  70.   gcopy w%,0,0,4,4,2
  71.  endif
  72.  gat x%,y%
  73.  gupdate
  74. endp
  75.  
  76.