home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
prolog
/
library
/
prolo_c
/
exampl66.pro
< prev
next >
Wrap
Text File
|
1986-10-06
|
1KB
|
39 lines
/* Program 66 */
/*
BIOS predicate demo.
Try the goal dosver(X).
*/
predicates
dosver(real)
diskspace(integer,real,real)
makedir(STRING)
removedir(STRING)
clauses
dosver(VERSION):-
AX=$3000, /* AH gets DOS function number in HEX */
bios($21,reg(AX,0,0,0,0,0,0,0),reg(VN,_,_,_,_,_,_,_)),
L=VN div 256,H=VN-256*L,VERSION=H+L/100.
/*
DISK must contain the number of the drive to search. 0=Default, 1=A:,
2=B:, etc. Example--Goal: diskspace(0,Tot,Free).
*/
diskspace(DISK,TOTALSPACE,FREESPACE):-
AX=$3600,
bios($21,reg(AX,0,0,DISK,0,0,0,0),reg(RX,BX,CX,DX,_,_,_,_)),
FREESPACE=1.0*BX*CX*RX,TOTALSPACE=1.0*DX*CX*RX.
makedir(NAME):-
ptr_dword(NAME,DS,DX), /* get the segment:offset for NAME (DS:DX) */
AX=$3900,
bios($21,reg(AX,0,0,DX,0,0,DS,0),_).
removedir(NAME):-
ptr_dword(NAME,DS,DX), /* get the segment:offset for NAME (DS:DX) */
AX=$3A00,
bios($21,reg(AX,0,0,DX,0,0,DS,0),_).