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

  1. PROC maus:
  2.  rem ** MAUS ** ein beispielprg. zur Verwendung von einer seriellen
  3.  rem PC-Maus am Psion Serie3a
  4.  global bit$(6,128),sp%
  5.  global a%,b&,p%(5),x%,y%,a$(5),k%,b%,w2%,xx%,yy%
  6.  a%=ioopen(k%,"TTY:A",$0300)
  7.  rsset:(8,0,8,1,4) :rem 1200 8n1
  8.  sp%=createsprite
  9.  usesprite sp%
  10.  bit$(3)="M:\pic\sprites\kreuz.pic"   : rem <<<<<<<<<<<<<<<<<<<<<
  11.  appendsprite 8,bit$()
  12.  drawsprite 240,80
  13.  x%=240 :y%=80
  14.  xx%=x% :yy%=y%
  15.  do
  16.   possprite xx%,yy%
  17.   if p%(1)=131 :gat xx%+3,yy%+3 :glineto x%+3,y%+3 :endif
  18.   xx%=x% :yy%=y%
  19.   mouse:
  20. rem  giprint num$(x%,-3)+","+num$(y%,-3)
  21.  until key$="x"
  22.  giprint "end" :pause 0 :stop
  23. endp
  24. proc rsset:(ba%,pa%,da%,st%,ha%)
  25.  local frame%,srchar%(6),du%,er%
  26.  frame%=da%-5
  27.  srchar%(1)=ba% or (ba%*256)
  28.  srchar%(2)=frame% or (pa%*256)
  29.  srchar%(3)=(ha% and 255) or $1100
  30.  srchar%(4)=$13
  31.  er%=iow(k%,7,srchar%(1),du%)
  32.  if er% :raise er% :endif
  33. endp
  34. proc mouse:
  35.   a$=rept$(chr$(0),5)
  36.   key
  37.   b%=addr(a$)+1
  38.   a%=ioread(k%,b%,5)
  39.   p%(1)=peekb(b%)
  40.   p%(2)=peekb(b%+1)
  41.   p%(3)=peekb(b%+2)
  42.   p%(4)=peekb(b%+3)
  43.   p%(5)=peekb(b%+4)
  44. rem  print num$(p%(1),-3),num$(p%(2),-3),num$(p%(3),-3),num$(p%(4),-3),num$(p%(5),-3)
  45.   if (p%(2)>0 and p%(2)<128) :x%=x%+p%(2) :endif
  46.   if (p%(4)>0 and p%(4)<128) :x%=x%+p%(4) :endif
  47.   if p%(2)>128 :x%=x%-(256-p%(2)) :endif
  48.   if p%(4)>128 :x%=x%-(256-p%(4)) :endif
  49.   if (p%(3)>0 and p%(3)<128) :y%=y%-p%(3) :endif
  50.   if (p%(5)>0 and p%(5)<128) :y%=y%-p%(5) :endif
  51.   if p%(3)>128 :y%=y%+(256-p%(3)) :endif
  52.   if p%(5)>128 :y%=y%+(256-p%(5)) :endif
  53.   if p%(1)=135 :gat x%,y% :endif
  54.   if x%>477 :x%=476 :endif
  55.   if x%<-3 :x%=-3 :endif
  56.   if y%>157 :y%=156 :endif
  57.   if y%<-3 :y%=-3 :endif
  58. endp
  59.  
  60.