]> git.sur5r.net Git - cc65/blob - libsrc/telestrat/open.s
remove TABs
[cc65] / libsrc / telestrat / open.s
1     .export    _open
2
3     .import    addysp,popax
4
5     .importzp  sp,tmp2,tmp3,tmp1
6
7
8     .include   "telestrat.inc"
9     .include   "errno.inc"
10     .include   "fcntl.inc"
11
12 ; int open (const char* name, int flags, ...);    /* May take a mode argument */
13 .proc _open
14 ; Throw away any additional parameters passed through the ellipsis
15
16     dey                     ; Parm count < 4 shouldn't be needed to be...
17     dey                     ; ...checked (it generates a c compiler warning)
18     dey
19     dey
20     beq         parmok      ; Branch if parameter count ok
21     jsr         addysp      ; Fix stack, throw away unused parameters
22
23 ; Parameters ok. Pop the flags and save them into tmp3
24
25 parmok:
26     jsr         popax       ; Get flagss
27     sta         tmp3        ; save flags
28 ; Get the filename from stack and parse it. Bail out if is not ok
29     jsr         popax       ; Get name
30     ldy         tmp3        ; Get flags again
31     BRK_TELEMON XOPEN       ; launch primitive ROM
32     rts
33 .endproc