116,7 → 116,21 |
parm [es] \ |
value [ax]; |
|
/* mode 0x3C = create or truncate file ; model 0x3D = open for read |
* returns 0 on failure, file handle otherwise */ |
unsigned short dos_fopen(const char *fname, unsigned char mode); |
|
#pragma aux dos_fopen = \ |
"xor al, al" \ |
"xor cx, cx" \ |
"int 0x21" \ |
"jnc DONE" \ |
"xor ax, ax" \ |
"DONE:" \ |
parm [dx] [ah] \ |
modify [cx] \ |
value [ax]; |
|
unsigned short dos_fclose(unsigned short handle); |
|
#pragma aux dos_fclose = \ |
170,6 → 184,7 |
"xor ax, ax" \ |
"done:" \ |
parm [bx] [cx] [di] \ |
modify [dx] \ |
value [ax] |
|
|
352,25 → 367,9 |
/* if filename not overloaded then use the fname in db */ |
if (saveas == NULL) saveas = db->fname; |
|
_asm { |
push cx |
push dx |
fd = dos_fopen(saveas, 0x3C /* create or truncate file */); |
if (fd == 0) return(-1); |
|
mov ah, 0x3C /* create or truncate file */ |
xor cx, cx /* file attributes */ |
mov dx, saveas /* works only in SMALL/TINY mode */ |
int 0x21 |
jnc DONE |
mov errflag, ax |
DONE: |
mov fd, ax |
|
pop dx |
pop cx |
} |
|
if (errflag != 0) return(-1); |
|
l = db->cursor; |
while (l->prev) l = l->prev; |
|
783,24 → 782,9 |
mdr_dos_truename(db->fname, fname); |
|
/* fopen file */ |
fd = 0; |
_asm { |
push cx |
push dx |
fd = dos_fopen(fname, 0x3D /* open for read */); |
if (fd == 0) err = LOADFILE_FILENOTFOUND; |
|
mov ax, 0x3d00 |
mov dx, fname // works only in SMALL memory model! |
xor cl, cl |
int 0x21 |
mov fd, ax |
jnc done |
mov err, al |
done: |
|
pop dx |
pop cx |
} |
|
if (err != 0) goto SKIPLOADING; |
|
db->lfonly = 1; |