home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / developmen / oplexamp / LINKOPL.TXT < prev    next >
Text File  |  1994-05-22  |  2KB  |  62 lines

  1.  
  2. > Can anyone tell me if (and how) it is possible to start Remote Link from
  3. > within OPL?
  4.  
  5. For the S3a, you can use code like the following:
  6.  
  7. PROC islink:
  8.   local ax%,bx%,cx%,dx%,si%,di%,fl%
  9.   local link$(14),pid%,cline$(8)
  10.   link$="ROM::LINK.IMG"
  11.   cline$="-b19200"+chr$(0)    rem must get leading byte count right
  12.   bx%=addr(link$)+1
  13.   cx%=addr(cline$)
  14.   di%=addr(pid%)
  15.   ax%=$0100        rem for FilExecute
  16.   fl%=os($87,addr(ax%))
  17.   if fl% and 1
  18.     print "Error:",err$(ax% and $ff)
  19.   else
  20.     bx%=pid%
  21.     ax%=$0600      rem for ProcResume
  22.     fl%=os($88,addr(ax%))
  23.     if (fl% and 1)
  24.       print "Error:",err$(ax% and $ff)
  25.     else
  26.       print "Link started and has PID",hex$(bx%)
  27.     endif
  28.   endif
  29.   get
  30. ENDP
  31.  
  32. For the S3, there's no LINK.IMG in the mother rom so you have to specify 
  33. LOC::C:\IMG\LINK.IMG as the filename to run instead.  And you'll have to 
  34. specify a slower baud rate (the -b parameter).
  35.  
  36. If you try to use this code when Link is already running, you'll get a 
  37. misleading result, since Link will happily start again, and then 
  38. terminate itself (with "File already exists" error).  So you'll in 
  39. general also need a function like
  40.  
  41. PROC islink:
  42.   local ax%,bx%,cx%,dx%,si%,di%,fl%
  43.   local link$(8)
  44.   link$="LINK.*"
  45.   bx%=addr(link$)+1
  46.   ax%=$0100      rem for ProcIdByName
  47.   fl%=os($88,addr(ax%))
  48.   if fl% and 1
  49.     print "Link not running"
  50.   else
  51.     print "Link running and has PID",hex$(ax%)
  52.   endif
  53.   get
  54. ENDP
  55.  
  56. Finally, in order to stop link, use ProcTerminate (O/S service $0d88), 
  57. passing BX as the PID of the process to terminate, and 0 in AL.
  58.  
  59. Regards, DavidW
  60.  
  61.  
  62.