home *** CD-ROM | disk | FTP | other *** search
/ Boot Disc 8 / boot-disc-1997-04.iso / PDA_Soft / Psion / sounds / TSMP2.OPL < prev    next >
Text File  |  1994-04-06  |  1KB  |  75 lines

  1. PROC tsmp:
  2.   global pcb%,buf%(500)
  3.   deldrv:
  4.   askrun:
  5.   loaddrv:
  6.   opench:
  7.   setmode:(-1)
  8.   main:
  9.   ioclose(pcb%)
  10. ENDP
  11.  
  12. PROC deldrv:
  13.   local s$(4)
  14.   s$="SMP"
  15.   call($0885,addr(s$)+1,0,$dd01)
  16. ENDP
  17.  
  18. PROC askrun:
  19.   if alert("SMP: deleted","Start sampling?","Exit","Continue")=1
  20.     stop
  21.   endif
  22. ENDP
  23.  
  24. PROC loaddrv:
  25.   local off%(6),f$(130),r%
  26.   local ax%,bx%,cx%,dx%,si%,di%,fl%
  27.   f$=parse$("\sys$samp.LDD",cmd$(1),off%(1))
  28.   bx%=addr(f$)+1
  29.   ax%=$0600
  30.   fl%=os($85,addr(ax%))
  31.   ax%=ax% or $ff00
  32.   if (fl% and 1) and (ax% <> -32)
  33.     alert("Failed to load SYS$SAMP.LDD",err$(ax%))
  34.     stop
  35.   endif
  36. ENDP
  37.  
  38. PROC opench:
  39.   local r%
  40.   r%=IOOPEN(pcb%,"SMP:",-1)
  41.   if r%
  42.     alert("Failed to open channel to SMP:",err$(r%))
  43.     stop
  44.   endif
  45. ENDP
  46.  
  47. PROC setmode:(mo%)
  48.   IOW(pcb%,7,#mo%,#0)
  49. ENDP
  50.  
  51. PROC main:
  52.   local p%,pend%,l%,alaw%,c%
  53.   c%=0
  54.   while 1
  55.     p%=addr(buf%(1))
  56.     l%=1000
  57.     IOW(pcb%,13,#p%,l%)
  58.     if c%=0
  59.       c%=1
  60.       continue
  61.     endif
  62.     pend%=p%+l%
  63.     while p%<pend%
  64.       alaw%=peekb(p%)
  65.       alaw%=(not alaw%) and $7f
  66.       if alaw%>64
  67.         print "Sound detected",c%
  68.         c%=c%+1
  69.         break
  70.       endif
  71.       p%=p%+1
  72.     endwh
  73.   endwh
  74. ENDP
  75.