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