home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR19 / SNIP0693.ZIP / SERIAL.PRG < prev    next >
Text File  |  1992-09-03  |  1KB  |  35 lines

  1. Function C_SerialR
  2.          Para pDisk
  3.          Local RetVal:='',I,pB:='',IDBuffer:=Space(6)
  4.          Reg_AX('6900') // DOS function
  5.          Reg_AL(0)      // 0-Get/1-Set
  6.          Reg_BL(pDisk)  // Drive (0=current,1=A,2=B,etc)
  7.          Reg_DS(Seg(@IDbuffer ))   // place to return data
  8.          Reg_DX(Off(@IDbuffer ))   //
  9.          Interrupt('21')  // call DOS
  10.          RetVal:=Subs(IDBuffer,3,4)
  11.          For I:=Len(RetVal) to 1 Step -1
  12.              pB+=Dec2Hex(Asc(Subs(RetVal,I,1)))
  13.          Next
  14.          RetVal:=pB
  15.          Return RetVal
  16.  
  17. Function C_SerialW
  18.          Para pDisk,pMsg
  19.          Local IDBuffer:='',I,pB:=''
  20.          pMsg:=Subs(pMsg,1,8)
  21.          For I:=1 to Len(pMsg)Step 2
  22.              IDBuffer:=IDBuffer+Chr(Hex2Dec(Subs(pMsg,I,2)))
  23.          Next
  24.          For I:=Len(IDBuffer) to 1 Step -1
  25.              pB+=Subs(IDBuffer,I,1)
  26.          Next
  27.          IDBuffer:='  '+pB
  28.          Reg_AX('6900') // DOS function
  29.          Reg_AL(1)      // 0-Get/1-Set
  30.          Reg_BL(pDisk)  // Drive (0=current,1=A,2=B,etc)
  31.          Reg_DS(Seg(@IDbuffer ))   // place to return data
  32.          Reg_DX(Off(@IDbuffer ))   //
  33.          Interrupt('21')  // call DOS
  34.          Return NIL
  35.