PT630 Programming Reference Guide
Page 44 of 59
------------------------------------------------------------------------------------------------------------------
1.5.28.10 Insert / Delete Data Block to / from File at the Current Position
Entry Parameter: AH = 42H
AL = 7
; insert
8
; delete
BX
=
file
handle
CX = block length in bytes
Return Value: 1) If the function is successful:
Carry flag = clear
DX:AX = pointer to current file position (not changed)
2) If the function fails:
Carry flag = set
DX:AX = pointer to current file position (not changed)
Note:
For insertion, the content of the inserted data block is undefined.
1.5.28.11 Rename File
Entry Parameter: AH = 56H
DS:DX
;
pointer
to
old
file
name
string
ES:DI ;
pointer
to
new
file
name
string
Return Value: if success, AH = 0 and CARRY flag is cleared
if failed, AH = 1 and CARRY flag is set
Example:
int TS_rename_file(char *inf,char far *outf)
{
segregs.ds = FP_SEG(inf);
regs.x.dx = FP_OFF(inf);
segregs.es = FP_SEG(outf);
regs.x.di = FP_OFF(outf);
regs.h.ah=0x56;
int86x(0x21,®s,®s,&segregs);
if ((regs.x.cflag & 0x01) == 0) return(regs.x.ax);
else return(-1);
}
1.5.28.12 Create New File
Entry Parameter: AH = 5BH
DS:DX
; pointer to file name string
Return Value:
if success, CARRY flag is cleared
AX = file Handle
if failed, CARRY flay is set
AX = 04H ; too many open files
50H ; file exists
Note:
If the specified file already exists, the function fails.
Example
:
int TS_create_new_file(char *fn)
{
regs.h.ah=0x5B;
segregs.ds = FP_SEG(fn);
regs.x.dx = FP_OFF(fn);
if ((regs.x.cflag & 0x01) == 1) return(-1);
else return(regs.x.ax);
}