Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1573 → Rev 1574

/sved/trunk/libc.c
57,42 → 57,6
}
 
 
unsigned short mdr_dos_read(unsigned short handle, void far *buf, unsigned short count, unsigned short *bytes) {
unsigned short res = 0;
unsigned short resax = 0;
unsigned short buf_off = FP_OFF(buf);
unsigned short buf_seg = FP_SEG(buf);
 
_asm {
push bx,
push cx
push dx
 
mov ah, 0x3f
mov bx, handle
mov cx, count
mov dx, buf_off
push ds
mov ds, buf_seg
int 0x21
pop ds
 
jnc done
mov res, ax
 
done:
mov resax, ax
 
pop dx
pop cx
pop bx
}
 
*bytes = resax;
return(res);
}
 
 
unsigned short mdr_dos_write(unsigned short handle, const void far *buf, unsigned short count, unsigned short *bytes) {
unsigned short res = 0;
unsigned short resax = 0;
/sved/trunk/libc.h
8,7 → 8,6
void bzero(void *ptr, size_t len);
void fmemmove(void far *dst, const void far *src, size_t len);
unsigned short mdr_dos_resizeblock(unsigned short siz, unsigned short segn);
unsigned short mdr_dos_read(unsigned short handle, void far *buf, unsigned short count, unsigned short *bytes);
unsigned short mdr_dos_write(unsigned short handle, const void far *buf, unsigned short count, unsigned short *bytes);
 
#endif
/sved/trunk/sved.c
128,7 → 128,20
parm [bx] \
value [ax];
 
unsigned short dosfread(unsigned short handle, void *buf, unsigned short count, unsigned short *bytes);
 
#pragma aux dosfread = \
"mov ah, 0x3f" \
"int 0x21" \
"jc done" \
"mov [di], ax" \
"xor ax, ax" \
"done:" \
parm [bx] [dx] [cx] [di] \
value [ax]
 
 
 
/*****************************************************************************
* functions *
*****************************************************************************/
732,7 → 745,7
for (eolfound = 0;;) {
unsigned short consumedbytes;
 
if ((mdr_dos_read(fd, buff, sizeof(buff), &len) != 0) || (len == 0)) break;
if ((dosfread(fd, buff, sizeof(buff), &len) != 0) || (len == 0)) break;
buffptr = buff;
 
FINDLINE: