1 /*
2  *	Open a file DOR to enable getting of stats
3  *
4  *	djm 13/3/2000 - Hacked from fopen
5  *
6  * -----
7  * $Id: opendor.c,v 1.4 2016-03-06 20:36:13 dom Exp $
8  */
9 
10 
11 #include <z88.h>
12 
opendor(char * filename)13 int opendor(char *filename)
14 {
15 #asm
16 	INCLUDE	"fileio.def"
17 ;Create some room on the stack for the filename to be expanded into..
18 	pop	bc
19 	pop	de	;filename
20 	push	de
21 	push	bc
22 	push	ix	;callers ix
23         ld      hl,-10
24         add     hl,sp
25         ld      sp,hl
26         ex      de,hl 	;de=buffer, hl=filename
27         ld      c,8     ;max chars to expand..
28         ld      a,OP_DOR	;Open as DOR
29         ld      b,0     ;absolute page
30         call_oz(gn_opf)
31         ex      af,af  ;keep our flags!
32         ld      hl,10
33         add     hl,sp
34         ld      sp,hl   ;restore our stack (we did nothing to it!)
35 	push	ix
36 	pop	hl
37 	pop	ix	;restore callers ix
38         ex      af,af	;exit we carry set for failure
39 	ret	nc
40 	ld	hl,0
41 #endasm
42 }
43 
44