]> git.sur5r.net Git - cc65/blob - libsrc/lynx/load.s
Updated to use cbm_kernal.inc. Whitespace cleanups
[cc65] / libsrc / lynx / load.s
1 ;
2 ; Karri Kaksonen, 2010
3 ;
4 ; lynx_load(fileno) is a convenience function that is widely used on the Lynx.
5 ; Basically this opens directory entry fileno and reads the content of the
6 ; file this points to into RAM.
7 ;
8 ; void lynx_load(int fileno)
9 ;
10         .importzp       _FileFileLen
11         .importzp       _FileDestAddr
12         .import         pushax,ldax0sp,pusha0,incsp2
13         .import         _openn
14         .import         _read
15         .export         _lynx_load
16
17 ; ---------------------------------------------------------------
18 ; void __near__ __fastcall__ lynx_load (int)
19 ; ---------------------------------------------------------------
20
21 .segment        "CODE"
22
23 .proc   _lynx_load: near
24
25 .segment        "CODE"
26
27         jsr     pushax
28         jsr     ldax0sp
29         jsr     _openn
30         lda     #$01
31         jsr     pusha0
32         lda     _FileDestAddr
33         ldx     _FileDestAddr+1
34         jsr     pushax
35         lda     _FileFileLen
36         ldx     _FileFileLen+1
37         jsr     _read
38         jmp     incsp2
39
40 .endproc
41