






|
 |
Developers
onHand Manual: W-PsDOS (C bindings)
Disk and directory
- int dos_getcdrvno(void)
Returns the current drive (0=A/MROM,1=B/Flash) [int 21,19]
- int dos_seldrv(int drv)
Sets the current drive (0=A/MROM,1=B/Flash) [int 21,0e]
- int dos_getcdir(int drv,char *buffer)
Returns the current directory in the specified drive
(drv:0=current,1=A/MROM,2=B/Flash) into buffer [int 21,47]
- int dos_chdir(char *dname)
Change the working directory to the specified one [int 21,3b]
- int dos_mkdir(char *dname)
Create a new directory with the specified name [int 21,39]
- int dos_rmdir(char *dname)
Remove the specified directory [int 21,3a]
- int dos_rename(char *oldpath,char *newpath)
Rename or move the file specified from oldpath to newpath (error:11=cannot
move) [int 21,56]
- int dos_delete(char *pfilepath)
Delete the specified file (WARNING: it's recommended to use dos_fdelete() of
rupsys.h instead) [int 21,41]
- int dos_fnd_first(char *path,int attr)
Fills the DTA (see dos_setdta()) with the first matching entry with the
specified attributes (attr:b5...advshr...b0); normal files are always
returned (exception: attr=v). Returns 0 on success [int 21,4e]
- int dos_fnd_next(void)
Fills the DTA with the next matching entry. Returns 0 on success [int 21,4f]
- void *dos_getdta(void)
Returns a pointer to the DTA (a buffer of 44 bytes, see dos_setdta()) [int
21,2f]
- void dos_setdta(void *dtap)
Sets the DTA buffer (char ff_reserved[22];char ff_atrib;short
ff_ftime,ff_fdate;long ff_fsize;char ff_name[13];) [int 21,1a]
- int dos_dfspace(int dno,int *dfdata)
Returns (short
sectorspercluster,freeclustercount,bytespersector,totalclusterindrive) of
drive dno (dno: 0=current,1=A,2=B) into dfdata (to calculate freespace:
(long)dfdata[1]*(long)dfdata[0]*(long)dfdata[2]))[int 21,36]
- void dos_gettdrive(int drv,void *drvp)
Returns info about driver drv in drvp (short sectorspercluster,
bytespersector, cluster per drive; long FAT ID) [int 21,1c]
- void dos_getcdrive(void *drvp)
Issues a dos_gettdrive() on the current drive returning the info about the
drive in drvp [int 21,1b]
File manipulation
- int dos_open(char *pfilepath,int mode)
Opens the file specified in pfilepath for mode (mode:0=r,1=w,2=rw) and
returns a file handle [int 21,3d]
- int dos_close(int handle)
Closes the file specified by handle[int 21,3e]
- int dos_read(int handle,char *pbuffer,int nbytes)
Reads nbytes bytes of data from the file specified by handle to pbuffer
(WARNING: it's recommended to use dos_fread() of rupsys.h instead) [int
21,3f]
- int dos_write(int handle,char *pbuffer,int nbytes)
Writes nbytes bytes of data from pbuffer to the file specified by handle
(WARNING: it's recommended to use dos_fwrite() of rupsys.h instead) [int
21,40]
- long dos_seek(int handle,int whence,long offset)
Moves the file pointer to offset from whence (whence:
0=seek_set,1=seek_cur,2=seek_end) [int 21,42]
- int dos_create(char *pfilepath,int attr)
Create or truncate if exists the specified file using attr (attr: b2...shr...b0,
0=archive) (WARNING: it's recommended to use dos_fcreate() of rupsys.h
instead) [int 21,3c]
- int dos_crnew(char *filename,int attr)
Open a new file, failing if the file already exists and return a file handle
(WARNING: it's recommended to use dos_crnew() of rupsys.h instead) [int
21,5b]
- int dos_crtmp(char *path,int attr)
Creates a temporal file with a unique name. Path must be the directory
(terminated in "\") in which the file will be created. The
application must take care to delete the file after it's not needed anymore
[int 21,5a]
- int dos_fattr(char *pfilepath,int func,int attr)
Get (func=0) or set (func=1) the attributes (b5...advshr...b0) of the file
specified in pfilepath [int 21,43]
- long dos_fltime(int handle,int func,int
packeddate,int packedtime)
Get (func=0, packedxxxx ignored) or Set (func=1) the date and time of the
specified file [21,57]
- int dos_dup_hnd(int handle)
Duplicate file handle, generally just to close one of then hence updating
directory entry [int 21,45]
- int dos_dup_hndsp(int old,int new)
Force duplicate file handle from old to new (closes new first if necessary).
Used for I/O redirection [int 21,46]
- int dos_fparse(unsigned char *fcbp,char *name,int
ctrl)
Fills in a File Control Block (FCB) with the first valid file as specified
in name (wildcards are allowed). Control is a bit mask controlling the
analysis (b4..b7:0, b3...DontClearFCBExtension/DontClearFCBFileName/DontClearFCBDrive...b1,
b0: IgnoreSeparators). Returns 0 if there are no wildcards, 1 if there are
wildcards and -1 if the drive specified in name is invalid. [int 21,29]
Process management
- void dos_exit(int retcode)
Exits the program with errorlevel retcode [int 21,4c]
- void *dos_get_psp(void)
Returns the PSP address for current process [int 21,62]
- int dos_execute(int func,char *filename,char *parblock)
Load (func=3,parblock(words)={load_addr,reserved}) or load and execute (func=0,parblock(words)={reserved,ptr
to PSP+80h,ptr to PSP+50h,ptr to PSP+60h}) the specified program. [int
21,4b]
- int dos_child_ret(int *fway)
Returns the retcode of a subprocess and puts the termination status
(0=normal,1=ctrl-c,2=fatal,3=tsr) in fway [21,4d]
- void dos_procresident(int exitcode,unsigned
long nparag)
Terminate and Stay Resident, keeping in memory nparag 16-byte paragraphs of
the memory block conteinig the PSP [int 21,31]
RTC
- void dos_gettime(char *phour,char *pmin,char *psec,char
*phund)
Returns the current hour, minute and second (normal binary number, not BCD
as in BIOS), phund is ignored (set to 0) [int 21,2c]
- int dos_settime(char hour,char min,char sec,char
hund)
Sets the hour, minute and second (in decimal, not BCD as in BIOS), phund is
ignored [int 21,2d]
- void dos_getdate(char *pweekday,char *pmonth,char *pday,int
*pyear)
Returns the current weekday (1: Monday), day of the month, month number and
year number (normal binary number, not BCD as in BIOS) [int 21,2a]
- int dos_setdate(char month,char day,int year)
Sets the current day of the month, month number and year number (normal
binary number, not BCD as in BIOS) [int 21,2b]
System
DOS-specific
Written with the information provided in the onHand
manuals. Copyleft by dario@softhome.net
This text is distributed under the GNU FDL. Last updated (dd/mm/yyyy):
21/10/2001
|