]> git.sur5r.net Git - cc65/blob - libsrc/apple2/syschdir.s
48bbc2eed60e30f3f7a538418caa4d7df87de273
[cc65] / libsrc / apple2 / syschdir.s
1 ;
2 ; Oliver Schmidt, 17.04.2005
3 ;
4 ; unsigned char __fastcall__ _syschdir (const char* name);
5 ;
6
7         .export         __syschdir
8         .import         pushname, popname
9         .import         __cwd
10
11         .include        "zeropage.inc"
12         .include        "mli.inc"
13
14 __syschdir:
15         ; Push name
16         jsr     pushname
17         bne     oserr
18
19         ; Set pushed name
20         lda     sp
21         ldx     sp+1
22         sta     mliparam + MLI::PREFIX::PATHNAME
23         stx     mliparam + MLI::PREFIX::PATHNAME+1
24
25         ; Change directory
26         lda     #SET_PREFIX_CALL
27         ldx     #PREFIX_COUNT
28         jsr     callmli
29         bcs     cleanup
30
31         ldy     #$01
32 :       lda     (sp),y
33         sta     __cwd-1,y
34         beq     cleanup
35         iny
36         bne     :-              ; Branch always
37
38         ; Cleanup name
39 cleanup:jsr     popname         ; Preserves A
40
41 oserr:  rts