mirror of
https://github.com/cc65/cc65.git
synced 2025-01-21 15:32:41 +00:00
Loading and saving memory areas on cbm platforms
git-svn-id: svn://svn.cc65.org/cc65/trunk@625 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
7c4bcbd569
commit
16fded6d0c
@ -94,6 +94,19 @@
|
||||
|
||||
|
||||
|
||||
/* Kernel level functions */
|
||||
void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV,
|
||||
unsigned char SA);
|
||||
void __fastcall__ cbm_k_setnam (const char* Name);
|
||||
unsigned __fastcall__ cbm_k_load (unsigned char flag, unsigned addr);
|
||||
unsigned __fastcall__ cbm_k_save(unsigned int start, unsigned int end);
|
||||
|
||||
/* BASIC-like functions */
|
||||
unsigned int cbm_load(const char* name, char device, unsigned int addr);
|
||||
unsigned int cbm_save(const char* name, char device,
|
||||
unsigned int start, unsigned int end);
|
||||
|
||||
|
||||
/* End of cbm.h */
|
||||
#endif
|
||||
|
||||
|
@ -11,14 +11,14 @@
|
||||
%.o: %.s
|
||||
@$(AS) -g -o $@ $(AFLAGS) $<
|
||||
|
||||
C_OBJS =
|
||||
C_OBJS = cbm_load.o cbm_save.o
|
||||
|
||||
S_OBJS = ctype.o getenv.o gotoxy.o gotox.o gotoy.o where.o\
|
||||
clock.o chline.o cvline.o cclear.o revers.o\
|
||||
c_readst.o c_close.o c_open.o c_ckout.o c_clrch.o c_bsout.o\
|
||||
c_basin.o c_clall.o c_iobase.o c_setnam.o c_setlfs.o c_acptr.o\
|
||||
c_ciout.o c_untlk.o c_unlsn.o c_listen.o c_talk.o c_load.o\
|
||||
oserror.o
|
||||
c_save.o oserror.o
|
||||
|
||||
all: $(C_OBJS) $(S_OBJS)
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; unsigned __fastcall__ cbm_load (unsigned char flag, unsigned addr);
|
||||
; unsigned __fastcall__ cbm_k_load (unsigned char flag, unsigned addr);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_load
|
||||
.export _cbm_k_load
|
||||
.import popa
|
||||
.importzp ptr1
|
||||
|
||||
_cbm_load:
|
||||
_cbm_k_load:
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
jsr popa ; get flag
|
||||
@ -23,4 +23,3 @@ _cbm_load:
|
||||
rts
|
||||
@Ok: txa
|
||||
rts
|
||||
|
||||
|
28
libsrc/cbm/c_save.s
Normal file
28
libsrc/cbm/c_save.s
Normal file
@ -0,0 +1,28 @@
|
||||
;
|
||||
; Marc 'BlackJack' Rintsch, 11.06.1999
|
||||
;
|
||||
; unsigned __fastcall__ cbm_k_save(unsigned int start, unsigned int end);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_k_save
|
||||
.import popax
|
||||
.importzp ptr1, tmp1
|
||||
|
||||
_cbm_k_save:
|
||||
sta tmp1 ; store end address
|
||||
stx tmp1+1
|
||||
jsr popax ; pop start address
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
lda #ptr1
|
||||
ldx tmp1
|
||||
ldy tmp1+1
|
||||
jsr SAVE
|
||||
ldx #0
|
||||
bcc @Ok
|
||||
inx
|
||||
rts
|
||||
@Ok: txa
|
||||
rts
|
@ -1,18 +1,18 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; void __fastcall__ cbm_setlfs (unsigned char LFN,
|
||||
; void __fastcall__ cbm_k_setlfs (unsigned char LFN,
|
||||
; unsigned char DEV,
|
||||
; unsigned char SA);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_setlfs
|
||||
.export _cbm_k_setlfs
|
||||
.import popa
|
||||
.importzp tmp1
|
||||
|
||||
_cbm_setlfs:
|
||||
_cbm_k_setlfs:
|
||||
sta tmp1 ; Save SA
|
||||
jsr popa ; Get DEV
|
||||
tax
|
||||
|
@ -1,15 +1,15 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 03.06.1999
|
||||
;
|
||||
; void __fastcall__ cbm_setnam (const char* Name);
|
||||
; void __fastcall__ cbm_k_setnam (const char* Name);
|
||||
;
|
||||
|
||||
.include "cbm.inc"
|
||||
|
||||
.export _cbm_setnam
|
||||
.export _cbm_k_setnam
|
||||
.importzp ptr1
|
||||
|
||||
_cbm_setnam:
|
||||
_cbm_k_setnam:
|
||||
sta ptr1 ; Store pointer to file name
|
||||
stx ptr1+1
|
||||
ldy #$FF
|
||||
|
20
libsrc/cbm/cbm_load.c
Normal file
20
libsrc/cbm/cbm_load.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Marc 'BlackJack' Rintsch, 06.03.2001
|
||||
*
|
||||
* unsigned int cbm_load(const char* name, char device, unsigned int addr);
|
||||
*/
|
||||
|
||||
#include <cbm.h>
|
||||
|
||||
/* loads file "name" from given device to given address or to the load address
|
||||
* of the file if addr is 0
|
||||
*/
|
||||
unsigned int cbm_load(const char* name, char device, unsigned int addr)
|
||||
{
|
||||
/* LFN is set to 0 but it's not needed for loading.
|
||||
* (BASIC V2 sets it to the value of the SA for LOAD)
|
||||
*/
|
||||
cbm_k_setlfs(0, device, ((addr == 0) ? 1 : 0));
|
||||
cbm_k_setnam(name);
|
||||
return cbm_k_load(0, addr);
|
||||
}
|
18
libsrc/cbm/cbm_save.c
Normal file
18
libsrc/cbm/cbm_save.c
Normal file
@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Marc 'BlackJack' Rintsch, 11.03.2001
|
||||
*
|
||||
* unsigned int cbm_save(const char* name,
|
||||
* char device,
|
||||
* unsigned int start,
|
||||
* unsigned int end);
|
||||
*/
|
||||
|
||||
#include <cbm.h>
|
||||
|
||||
unsigned int cbm_save(const char* name, char device,
|
||||
unsigned int start, unsigned int end)
|
||||
{
|
||||
cbm_k_setlfs(0, device, 0);
|
||||
cbm_k_setnam(name);
|
||||
return cbm_k_save(start, end);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user