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