1
0
mirror of https://github.com/cc65/cc65.git synced 2024-11-14 05:05:45 +00:00
cc65/libsrc/cbm/cbm_open.s
cuz 574ac2393b Rewrote cbm_open and cbm_read in assembler saving about 80 bytes total.
git-svn-id: svn://svn.cc65.org/cc65/trunk@1318 b7a2c559-68d2-44c3-8de9-860c34a00d81
2002-06-22 10:58:24 +00:00

45 lines
1.1 KiB
ArmAsm

;
; Ullrich von Bassewitz, 22.06.2002
;
; Original C code by Marc 'BlackJack' Rintsch, 18.03.2001
;
; unsigned char __fastcall__ cbm_open (unsigned char lfn,
; unsigned char device,
; unsigned char sec_addr,
; const char* name);
; /* Opens a file. Works just like the BASIC command.
; * Returns 0 if opening was successful, otherwise an errorcode (see table
; * below).
; */
; {
; cbm_k_setlfs(lfn, device, sec_addr);
; cbm_k_setnam(name);
; return _oserror = cbm_k_open();
; }
;
.export _cbm_open
.import popa
.import _cbm_k_setlfs, _cbm_k_setnam, _cbm_k_open
.import __oserror
_cbm_open:
pha
txa
pha ; Save name
jsr popa ; Get sec_addr
jsr _cbm_k_setlfs ; Call SETLFS, pop all args
pla
tax
pla ; Get name
jsr _cbm_k_setnam
jsr _cbm_k_open
sta __oserror
rts