3F Read file

Copy (CX) bytes from current address to DS:DX.

Advance the current address (CX) number of bytes.

Entry Parameters:

AH = 3F

 

 

BX = file handle

 

CX = number of bytes to read

 

DS:DX = segment:offset of buffer area

Returned Values:

if successful:

Carry = clear,

 

AX = number of bytes read, 0 if EOF

 

if fail:

Carry = set, AX = 6

int TS_read_file(int hdl,int cnt,char *str)

{

segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); regs.h.ah=0x3f; regs.x.cx=cnt; regs.x.bx=hdl; int86x(0x21,®s,®s,&segregs);

if ((regs.x.cflag & 0x01) == 0) return(regs.x.ax); else return(-1);

}

40Write file

Copy (CX) bytes from DS:DX to file (BX). Update BX current address and ending address. If CX is assigned with 0 (zero), the system will truncate the file from the current file pointer position. This function can be used by MSC function call chsize().

Entry Parameters:

AH = 40

 

BX = file handle

 

CX = number of bytes to write or 0

 

DS:DX = segment:offset of buffer area

Returned Values:

if successful: Carry = clear,

 

AX = number of bytes read, 0 if full

 

if fail: Carry = set, AX = 6

int TS_write_file(int hdl,int cnt,char *str)

{

segregs.ds = FP_SEG(str); regs.x.dx = FP_OFF(str); regs.h.ah=0x40; regs.x.bx=hdl; regs.x.cx=cnt; int86x(0x21,®s,®s,&segregs);

3-53

Page 54
Image 54
Unitech MR350MKII manual 3F Read file, Write file