4 ; This function reads the directory entry for file "name".
6 ; The name is actually plain ASCII string starting from
7 ; "0", "1", up to "4095" which is the largest file number we can handle.
9 ; open() does not take part in what kind of cart we have. If it is RAM
10 ; you may also be able to write into it. Therefore we allow both reads
11 ; and writes in this routine.
13 ; int open(const char *name, int flags, ...)
15 ; As helper functions we also provide.
16 ; void openn(int fileno)
23 .import addysp,popax,pushax,decsp6,pusha0,pusheax,ldaxysp
24 .import aslax3,axlong,tosaddeax,steaxysp,stax0sp,incsp8
27 .importzp _FileStartBlock
28 .importzp _FileCurrBlock
29 .importzp _FileBlockOffset
30 .import __STARTOFDIRECTORY__
40 .dword __STARTOFDIRECTORY__
42 ; ---------------------------------------------------------------
43 ; int __near__ open (__near__ const unsigned char*, int)
44 ; ---------------------------------------------------------------
61 and #(O_RDWR | O_CREAT)
64 cmp #(O_WRONLY | O_CREAT)
81 ; ---------------------------------------------------------------
82 ; void __near__ __fastcall__ openn (int)
83 ; ---------------------------------------------------------------
95 lda _startofdirectory+3
97 lda _startofdirectory+2
99 ldx _startofdirectory+1
100 lda _startofdirectory