1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-18 00:07:21 +00:00
cc65/libsrc/lynx/load.s
uz d993b332a4 Lynx update including file routines that access a file system on a cartridge
by Karri Kaksonen.


git-svn-id: svn://svn.cc65.org/cc65/trunk@4892 b7a2c559-68d2-44c3-8de9-860c34a00d81
2010-12-29 10:37:57 +00:00

42 lines
856 B
ArmAsm

;
; Karri Kaksonen, 2010
;
; lynx_load(fileno) is a convenience function that is widely used on the Lynx.
; Basically this opens directory entry fileno and reads the content of the
; file this points to into RAM.
;
; void lynx_load(int fileno)
;
.importzp _FileFileLen
.importzp _FileDestAddr
.import pushax,ldax0sp,pusha0,incsp2
.import _openn
.import _read
.export _lynx_load
; ---------------------------------------------------------------
; void __near__ __fastcall__ lynx_load (int)
; ---------------------------------------------------------------
.segment "CODE"
.proc _lynx_load: near
.segment "CODE"
jsr pushax
jsr ldax0sp
jsr _openn
lda #$01
jsr pusha0
lda _FileDestAddr
ldx _FileDestAddr+1
jsr pushax
lda _FileFileLen
ldx _FileFileLen+1
jsr _read
jmp incsp2
.endproc