home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / prolog / library / prolo_c / exampl66.pro < prev    next >
Text File  |  1986-10-06  |  1KB  |  39 lines

  1. /* Program 66 */
  2. /*
  3.   BIOS predicate demo.
  4.   Try the goal dosver(X).
  5. */
  6.  
  7. predicates
  8.  
  9.   dosver(real)
  10.   diskspace(integer,real,real)
  11.   makedir(STRING)
  12.   removedir(STRING)
  13.  
  14. clauses
  15.  
  16.   dosver(VERSION):-
  17.     AX=$3000,     /* AH gets DOS function number in HEX */
  18.     bios($21,reg(AX,0,0,0,0,0,0,0),reg(VN,_,_,_,_,_,_,_)),
  19.     L=VN div 256,H=VN-256*L,VERSION=H+L/100.
  20.  
  21. /*
  22.   DISK must contain the number of the drive to search.  0=Default, 1=A:,
  23.   2=B:, etc.  Example--Goal: diskspace(0,Tot,Free).
  24. */
  25.  
  26.   diskspace(DISK,TOTALSPACE,FREESPACE):-
  27.     AX=$3600,
  28.     bios($21,reg(AX,0,0,DISK,0,0,0,0),reg(RX,BX,CX,DX,_,_,_,_)),
  29.     FREESPACE=1.0*BX*CX*RX,TOTALSPACE=1.0*DX*CX*RX.
  30.  
  31.   makedir(NAME):-
  32.     ptr_dword(NAME,DS,DX),  /* get the segment:offset for NAME (DS:DX) */
  33.     AX=$3900,
  34.     bios($21,reg(AX,0,0,DX,0,0,DS,0),_).
  35.  
  36.   removedir(NAME):-
  37.     ptr_dword(NAME,DS,DX),  /* get the segment:offset for NAME (DS:DX) */
  38.     AX=$3A00,
  39.     bios($21,reg(AX,0,0,DX,0,0,DS,0),_).