Merge remote-tracking branch 'upstream/master' into a5200
This commit is contained in:
129
libsrc/Makefile
129
libsrc/Makefile
@@ -1,3 +1,7 @@
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CBMS = c128 \
|
||||
c16 \
|
||||
c64 \
|
||||
@@ -30,6 +34,27 @@ DRVTYPES = emd \
|
||||
ser \
|
||||
tgi
|
||||
|
||||
OUTPUTDIRS := lib \
|
||||
$(DRVTYPES) \
|
||||
targetutil \
|
||||
asminc \
|
||||
cfg \
|
||||
include \
|
||||
$(subst ../,,$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)))
|
||||
|
||||
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
ifdef CMD_EXE
|
||||
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
|
||||
MKDIR = mkdir $(subst /,\,$1)
|
||||
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
|
||||
else
|
||||
MKDIR = mkdir -p $1
|
||||
RMDIR = $(RM) -r $1
|
||||
endif
|
||||
|
||||
# Every target requires its individual vpath setting but the vpath directive
|
||||
# acts globally. Therefore each target is built in a separate make instance.
|
||||
|
||||
@@ -39,60 +64,55 @@ ifeq ($(words $(MAKECMDGOALS)),1)
|
||||
endif
|
||||
endif
|
||||
|
||||
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
|
||||
|
||||
ifeq ($(shell echo),)
|
||||
MKDIR = mkdir -p $1
|
||||
RMDIR = $(RM) -r $1
|
||||
else
|
||||
MKDIR = mkdir $(subst /,\,$1)
|
||||
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
|
||||
endif
|
||||
|
||||
.SUFFIXES:
|
||||
|
||||
.PHONY: all lib $(TARGETS) mostlyclean clean install
|
||||
|
||||
ifndef TARGET
|
||||
|
||||
datadir = $(prefix)/share/cc65
|
||||
|
||||
INSTALLDIRS = ../asminc ../cfg ../include \
|
||||
$(filter-out $(wildcard ../include/*.*),$(wildcard ../include/*)) \
|
||||
../lib ../targetutil $(addprefix ../,$(DRVTYPES))
|
||||
|
||||
INSTALL = install
|
||||
|
||||
all lib: $(TARGETS)
|
||||
|
||||
$(TARGETS):
|
||||
@$(MAKE) --no-print-directory $@
|
||||
|
||||
mostlyclean:
|
||||
$(call RMDIR,../wrk)
|
||||
$(call RMDIR,../libwrk)
|
||||
|
||||
clean:
|
||||
$(call RMDIR,../wrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
|
||||
$(call RMDIR,../libwrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES)))
|
||||
|
||||
ifdef CMD_EXE
|
||||
|
||||
install:
|
||||
$(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe))
|
||||
|
||||
##########
|
||||
else # CMD_EXE
|
||||
|
||||
INSTALL = install
|
||||
|
||||
define INSTALL_recipe
|
||||
|
||||
$(if $(prefix),,$(error variable `prefix' must be set))
|
||||
$(INSTALL) -d $(subst ..,$(DESTDIR)$(datadir),$(dir))
|
||||
$(INSTALL) -m644 $(dir)/*.* $(subst ..,$(DESTDIR)$(datadir),$(dir))
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
|
||||
$(INSTALL) -m644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
|
||||
|
||||
endef
|
||||
endef # INSTALL_recipe
|
||||
|
||||
##########
|
||||
install:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(INSTALL_recipe))
|
||||
|
||||
endif # CMD_EXE
|
||||
|
||||
define ZIP_recipe
|
||||
|
||||
@cd .. && zip cc65 $(dir)/*.*
|
||||
|
||||
endef # ZIP_recipe
|
||||
|
||||
zip:
|
||||
$(foreach dir,$(OUTPUTDIRS),$(ZIP_recipe))
|
||||
|
||||
$(TARGETS):
|
||||
@$(MAKE) --no-print-directory $@
|
||||
|
||||
else # TARGET
|
||||
|
||||
CA65FLAGS =
|
||||
CC65FLAGS = -Osir -W error
|
||||
CC65FLAGS = -Or -W error
|
||||
|
||||
EXTZP = cbm510 \
|
||||
cbm610 \
|
||||
@@ -100,9 +120,12 @@ EXTZP = cbm510 \
|
||||
|
||||
MKINC = $(GEOS) \
|
||||
atari \
|
||||
atarixl \
|
||||
nes
|
||||
|
||||
TARGETUTIL = apple2 \
|
||||
TARGETUTIL = apple2 \
|
||||
apple2enh \
|
||||
atari \
|
||||
geos-apple
|
||||
|
||||
GEOSDIRS = common \
|
||||
@@ -160,7 +183,7 @@ vpath %.c $(SRCDIRS)
|
||||
OBJS := $(patsubst %.s,%.o,$(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.s)))
|
||||
OBJS += $(patsubst %.c,%.o,$(foreach dir,$(SRCDIRS),$(wildcard $(dir)/*.c)))
|
||||
|
||||
OBJS := $(addprefix ../wrk/$(TARGET)/,$(sort $(notdir $(OBJS))))
|
||||
OBJS := $(addprefix ../libwrk/$(TARGET)/,$(sort $(notdir $(OBJS))))
|
||||
|
||||
DEPS = $(OBJS:.o=.d)
|
||||
|
||||
@@ -168,30 +191,28 @@ EXTRA_SRCPAT = $(SRCDIR)/extra/%.s
|
||||
EXTRA_OBJPAT = ../lib/$(TARGET)-%.o
|
||||
EXTRA_OBJS := $(patsubst $(EXTRA_SRCPAT),$(EXTRA_OBJPAT),$(wildcard $(SRCDIR)/extra/*.s))
|
||||
|
||||
ZPOBJ = ../wrk/$(TARGET)/zeropage.o
|
||||
ZPOBJ = ../libwrk/$(TARGET)/zeropage.o
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(EXTZP)))
|
||||
ZPOBJ += ../wrk/$(TARGET)/extzp.o
|
||||
ZPOBJ += ../libwrk/$(TARGET)/extzp.o
|
||||
endif
|
||||
|
||||
ifeq ($(SRCDIR),$(filter $(SRCDIR),$(MKINC)))
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(MKINC)))
|
||||
include $(SRCDIR)/Makefile.inc
|
||||
endif
|
||||
|
||||
ifeq ($(SRCDIR),$(filter $(SRCDIR),$(TARGETUTIL)))
|
||||
ifeq ($(TARGET),$(filter $(TARGET),$(TARGETUTIL)))
|
||||
include $(SRCDIR)/targetutil/Makefile.inc
|
||||
endif
|
||||
|
||||
##########
|
||||
|
||||
define DRVTYPE_template
|
||||
|
||||
$1_SRCDIR = $$(SRCDIR)/$1
|
||||
$1_OBJDIR = ../wrk/$$(TARGET)/$1
|
||||
$1_OBJDIR = ../libwrk/$$(TARGET)/$1
|
||||
$1_DRVDIR = ../$1
|
||||
|
||||
$1_OBJPAT = $$($1_OBJDIR)/$$(OBJPFX)%.o
|
||||
$1_DRVPAT = $$($1_DRVDIR)/$$(DRVPFX)%.$1
|
||||
$1_STCPAT = ../wrk/$$(TARGET)/$$(DRVPFX)%-$1.o
|
||||
$1_STCPAT = ../libwrk/$$(TARGET)/$$(DRVPFX)%-$1.o
|
||||
|
||||
$1_OBJS := $$(patsubst $$($1_SRCDIR)/%.s,$$($1_OBJDIR)/%.o,$$(wildcard $$($1_SRCDIR)/*.s))
|
||||
|
||||
@@ -219,9 +240,7 @@ OBJS += $$($1_STCS)
|
||||
|
||||
DEPS += $$($1_OBJS:.o=.d)
|
||||
|
||||
endef
|
||||
|
||||
##########
|
||||
endef # DRVTYPE_template
|
||||
|
||||
$(foreach drvtype,$(DRVTYPES),$(eval $(call DRVTYPE_template,$(drvtype))))
|
||||
|
||||
@@ -233,31 +252,25 @@ LD65 := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
|
||||
|
||||
export CC65_HOME := $(abspath ..)
|
||||
|
||||
##########
|
||||
|
||||
define ASSEMBLE_recipe
|
||||
|
||||
$(if $(TRAVIS),,@echo $(TARGET) - $<)
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
|
||||
|
||||
endef
|
||||
|
||||
##########
|
||||
endef # ASSEMBLE_recipe
|
||||
|
||||
define COMPILE_recipe
|
||||
|
||||
$(if $(TRAVIS),,@echo $(TARGET) - $<)
|
||||
$(if $(QUIET),,@echo $(TARGET) - $<)
|
||||
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
|
||||
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
|
||||
|
||||
endef
|
||||
endef # COMPILE_recipe
|
||||
|
||||
##########
|
||||
|
||||
../wrk/$(TARGET)/%.o: %.s | ../wrk/$(TARGET)
|
||||
../libwrk/$(TARGET)/%.o: %.s | ../libwrk/$(TARGET)
|
||||
$(ASSEMBLE_recipe)
|
||||
|
||||
../wrk/$(TARGET)/%.o: %.c | ../wrk/$(TARGET)
|
||||
../libwrk/$(TARGET)/%.o: %.c | ../libwrk/$(TARGET)
|
||||
$(COMPILE_recipe)
|
||||
|
||||
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
|
||||
@@ -267,7 +280,7 @@ $(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../lib
|
||||
../lib/$(TARGET).lib: $(OBJS) | ../lib
|
||||
$(AR65) a $@ $?
|
||||
|
||||
../wrk/$(TARGET) ../lib ../targetutil:
|
||||
../libwrk/$(TARGET) ../lib ../targetutil:
|
||||
@$(call MKDIR,$@)
|
||||
|
||||
$(TARGET): $(EXTRA_OBJS) ../lib/$(TARGET).lib
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
DEPS += ../wrk/$(TARGET)/loader.d
|
||||
DEPS += ../libwrk/$(TARGET)/loader.d
|
||||
|
||||
../wrk/$(TARGET)/loader.o: $(SRCDIR)/targetutil/loader.s | ../wrk/$(TARGET)
|
||||
../libwrk/$(TARGET)/loader.o: $(SRCDIR)/targetutil/loader.s | ../libwrk/$(TARGET)
|
||||
$(ASSEMBLE_recipe)
|
||||
|
||||
../targetutil/loader.system: ../wrk/$(TARGET)/loader.o $(SRCDIR)/targetutil/loader.cfg | ../targetutil
|
||||
../targetutil/loader.system: ../libwrk/$(TARGET)/loader.o $(SRCDIR)/targetutil/loader.cfg | ../targetutil
|
||||
$(LD65) -o $@ -C $(filter %.cfg,$^) $(filter-out %.cfg,$^)
|
||||
|
||||
$(TARGET): ../targetutil/loader.system
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
LOADER.SYSTEM - an Apple][ ProDOS 8 loader for cc65 programs (Oliver Schmidt)
|
||||
=============================================================================
|
||||
|
||||
|
||||
Background
|
||||
----------
|
||||
|
||||
Apple][ ProDOS 8 system programs (filetype SYS) are always loaded into memory
|
||||
starting at location $2000. This poses the problem of how to make efficient
|
||||
use of the memory in the range $0800-$2000. The usual approach of relocation
|
||||
has two downsides:
|
||||
- Relocating e.g. 30 kB from $2000-$9800 to $0800-$8000 takes a considerable
|
||||
amount of time.
|
||||
- Really large programs just don't fit into memory when loaded starting at
|
||||
location $2000.
|
||||
|
||||
The relocation can be eliminated by loading the major part(s) of the program
|
||||
from disk right to the final location by a rather small system program.
|
||||
|
||||
LOADER.SYSTEM is such a small program. In fact it's so small that it fits into
|
||||
a single block in the ProDOS 8 file system making it a so-called seedling file,
|
||||
which are loaded really fast. LOADER.SYSTEM can load cc65 programs into memory
|
||||
anywhere in the range $0800-$BB00 (44,75 kB).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Link the cc65 program to the start address $0803 (or any other address) and
|
||||
store it as binary program (filetype BIN). This is in fact no different from
|
||||
a binary program to be run by BASIC.SYSTEM's BRUN command in the usual way.
|
||||
|
||||
If however the cc65 program isn't run by BASIC.SYSTEM but is rather run by
|
||||
LOADER.SYSTEM then it behaves like a system program which means:
|
||||
- It uses memory up to the ProDOS 8 system global page located at $BF00.
|
||||
- It supports the ProDOS 8 startup file mechanism (mapped to argv[1]).
|
||||
- It quits to the ProDOS 8 dispatcher.
|
||||
|
||||
Obviously LOADER.SYSTEM has to be told which cc65 program to run. Unfortunately
|
||||
the ProDOS 8 dispatcher has no notion of system program parameters so the usual
|
||||
approach would have been to make LOADER.SYSTEM bring up yet another menu to
|
||||
select the cc65 program to run.
|
||||
|
||||
But to allow to select the cc65 program directly from the ProDOS 8 dispatcher
|
||||
anyway LOADER.SYSTEM detects the path to the cc65 program from its own path by
|
||||
just removing the '.SYSTEM' from its name. So if you want to run the cc65
|
||||
program MYPROGRAM you'll need a copy of LOADER.SYSTEM in the same directory
|
||||
being renamed to MYPROGRAM.SYSTEM.
|
||||
|
||||
This means you will end up with a copy of LOADER.SYSTEM for every cc65 program
|
||||
to be run by it. But as LOADER.SYSTEM is a ProDOS 8 seedling file using up only
|
||||
a single block in the ProDOS 8 file system this should be no issue.
|
||||
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
In case you want to build 'loader.system' from the source code yourself you can
|
||||
do so using the following commands:
|
||||
|
||||
ca65 loader.s
|
||||
ld65 -C loader.cfg -o loader.system loader.o
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
The file 'loader.system' as generated by the cc65 linker with the command above
|
||||
does NOT include the 4-byte address/length header that is generated for Apple][
|
||||
programs by default. This is because ProDOS 8 system programs are always loaded
|
||||
into memory starting at location $2000.
|
||||
|
||||
The recommended way to transfer 'loader.system' from your native file system to
|
||||
a ProDOS 8 file system disk image is to use AppleCommander which is available at
|
||||
http://applecommander.sourceforge.net/
|
||||
|
||||
If you want to put the file 'loader.system' onto a disk image 'mydisk.dsk' as
|
||||
system program MYPROGRAM.SYSTEM you can do so using the following command:
|
||||
|
||||
java -jar ac.jar -p mydisk.dsk MYPROGRAM.SYSTEM sys < loader.system
|
||||
37
libsrc/atari/cashdr.s
Normal file
37
libsrc/atari/cashdr.s
Normal file
@@ -0,0 +1,37 @@
|
||||
;
|
||||
; Cassette boot file header
|
||||
;
|
||||
; Christian Groessler, chris@groessler.org, 2014
|
||||
;
|
||||
|
||||
;DEBUG = 1
|
||||
|
||||
.ifndef __ATARIXL__
|
||||
|
||||
.include "atari.inc"
|
||||
|
||||
.import __BSS_RUN__, __STARTADDRESS__, _cas_init
|
||||
.export _cas_hdr
|
||||
|
||||
.assert ((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) < $101, error, "File to big to load from cassette"
|
||||
|
||||
|
||||
; for a description of the cassette header, see De Re Atari, appendix C
|
||||
|
||||
.segment "CASHDR"
|
||||
|
||||
_cas_hdr:
|
||||
.byte 0 ; ignored
|
||||
.byte <((__BSS_RUN__ - __STARTADDRESS__ + 127) / 128) ; # of 128-byte records to read
|
||||
.word __STARTADDRESS__ ; load address
|
||||
.word _cas_init ; init address
|
||||
|
||||
.ifdef DEBUG
|
||||
lda #33
|
||||
ldy #80
|
||||
sta (SAVMSC),y
|
||||
.endif
|
||||
clc
|
||||
rts
|
||||
|
||||
.endif ; .ifdef __ATARIXL__
|
||||
31
libsrc/atari/casinit.s
Normal file
31
libsrc/atari/casinit.s
Normal file
@@ -0,0 +1,31 @@
|
||||
;
|
||||
; Cassette boot file init routine
|
||||
;
|
||||
; Christian Groessler, chris@groessler.org, 2014
|
||||
;
|
||||
|
||||
;DEBUG = 1
|
||||
|
||||
.ifndef __ATARIXL__
|
||||
|
||||
.include "atari.inc"
|
||||
|
||||
.import start
|
||||
.export _cas_init
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
_cas_init:
|
||||
.ifdef DEBUG
|
||||
lda #34
|
||||
ldy #81
|
||||
sta (SAVMSC),y
|
||||
.endif
|
||||
|
||||
lda #<start
|
||||
sta DOSVEC
|
||||
lda #>start
|
||||
sta DOSVEC+1
|
||||
rts
|
||||
|
||||
.endif ; .ifdef __ATARIXL__
|
||||
@@ -100,8 +100,8 @@ start:
|
||||
|
||||
; Initialize conio stuff
|
||||
|
||||
dey ; Set X to $FF
|
||||
sty CH
|
||||
dey ; Set Y to $FF
|
||||
sty CH ; remove keypress which might be in the input buffer
|
||||
|
||||
; Push arguments and call main
|
||||
|
||||
|
||||
9
libsrc/atari/targetutil/Makefile.inc
Normal file
9
libsrc/atari/targetutil/Makefile.inc
Normal file
@@ -0,0 +1,9 @@
|
||||
DEPS += ../libwrk/$(TARGET)/w2cas.d
|
||||
|
||||
../libwrk/$(TARGET)/w2cas.o: $(SRCDIR)/targetutil/w2cas.c | ../libwrk/$(TARGET)
|
||||
$(COMPILE_recipe)
|
||||
|
||||
../targetutil/w2cas.com: ../libwrk/$(TARGET)/w2cas.o ../lib/$(TARGET).lib | ../targetutil
|
||||
$(LD65) -o $@ -t $(TARGET) $^
|
||||
|
||||
$(TARGET): ../targetutil/w2cas.com
|
||||
186
libsrc/atari/targetutil/w2cas.c
Normal file
186
libsrc/atari/targetutil/w2cas.c
Normal file
@@ -0,0 +1,186 @@
|
||||
/* w2cas.c -- write file to cassette
|
||||
*
|
||||
* This program writes a boot file (typically linked with
|
||||
* 'atari-cassette.cfg') to the cassette.
|
||||
* Only files < 32K are supported, since the loading of
|
||||
* larger files requires a special loader inside the program.
|
||||
*
|
||||
* Christian Groessler, chris@groessler.org, 2014
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <6502.h>
|
||||
#include <atari.h>
|
||||
#include <conio.h>
|
||||
|
||||
static int verbose = 1;
|
||||
static char C_dev[] = "C:";
|
||||
|
||||
static struct __iocb *findfreeiocb(void)
|
||||
{
|
||||
struct __iocb *iocb = &IOCB; /* first IOCB (#0) */
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (iocb->handler == 0xff)
|
||||
return iocb;
|
||||
iocb++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
char *filename, *x;
|
||||
char buf[20];
|
||||
FILE *file;
|
||||
unsigned char *buffer;
|
||||
size_t filen, buflen = 32768l + 1;
|
||||
struct regs regs;
|
||||
struct __iocb *iocb = findfreeiocb();
|
||||
int iocb_num;
|
||||
|
||||
if (! iocb) {
|
||||
fprintf(stderr, "couldn't find a free iocb\n");
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
iocb_num = (iocb - &IOCB) * 16;
|
||||
if (verbose)
|
||||
printf("using iocb index $%02X ($%04X)\n", iocb_num, iocb);
|
||||
|
||||
if (argc < 2) {
|
||||
printf("\nfilename: ");
|
||||
x = fgets(buf, 19, stdin);
|
||||
printf("\n");
|
||||
if (! x)
|
||||
return 1;
|
||||
if (*x && *(x + strlen(x) - 1) == '\n')
|
||||
*(x + strlen(x) - 1) = 0;
|
||||
filename = x;
|
||||
}
|
||||
else {
|
||||
filename = *(argv+1);
|
||||
}
|
||||
|
||||
/* allocate buffer */
|
||||
buffer = malloc(buflen);
|
||||
if (! buffer) {
|
||||
buflen = _heapmaxavail(); /* get as much as we can */
|
||||
buffer = malloc(buflen);
|
||||
if (! buffer) {
|
||||
fprintf(stderr, "cannot alloc %ld bytes -- aborting...\n", (long)buflen);
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (verbose)
|
||||
printf("buffer size: %ld bytes\n", (long)buflen);
|
||||
|
||||
/* open file */
|
||||
file = fopen(filename, "rb");
|
||||
if (! file) {
|
||||
free(buffer);
|
||||
fprintf(stderr, "cannot open '%s': %s\n", filename, strerror(errno));
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* read file -- file length must be < 32K */
|
||||
if (verbose)
|
||||
printf("reading input file...\n");
|
||||
filen = fread(buffer, 1, buflen, file);
|
||||
if (! filen) {
|
||||
fprintf(stderr, "read error\n");
|
||||
file_err:
|
||||
fclose(file);
|
||||
free(buffer);
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
if (filen > 32767l) {
|
||||
fprintf(stderr, "file is too large (must be < 32768)\n");
|
||||
goto file_err;
|
||||
}
|
||||
if (filen == buflen) { /* we have a buffer < 32768 and the file fits into it (and is most probably larger) */
|
||||
fprintf(stderr, "not enough memory\n");
|
||||
goto file_err;
|
||||
}
|
||||
if (verbose)
|
||||
printf("file size: %ld bytes\n", (long)filen);
|
||||
|
||||
/* close input file */
|
||||
fclose(file);
|
||||
|
||||
/* open cassette */
|
||||
if (verbose)
|
||||
printf("opening cassette...\n");
|
||||
iocb->buffer = C_dev;
|
||||
iocb->aux1 = 8; /* open for output */
|
||||
iocb->aux2 = 128; /* short breaks and no stop between data blocks */
|
||||
iocb->command = IOCB_OPEN;
|
||||
regs.x = iocb_num;
|
||||
regs.pc = 0xe456; /* CIOV */
|
||||
|
||||
_sys(®s);
|
||||
if (regs.y != 1) {
|
||||
fprintf(stderr, "CIO call to open cassette returned %d\n", regs.y);
|
||||
free(buffer);
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* write file */
|
||||
if (verbose)
|
||||
printf("writing to cassette...\n");
|
||||
iocb->buffer = buffer;
|
||||
iocb->buflen = filen;
|
||||
iocb->command = IOCB_PUTCHR;
|
||||
regs.x = iocb_num;
|
||||
regs.pc = 0xe456; /* CIOV */
|
||||
|
||||
_sys(®s);
|
||||
if (regs.y != 1) {
|
||||
fprintf(stderr, "CIO call to write file returned %d\n", regs.y);
|
||||
free(buffer);
|
||||
|
||||
iocb->command = IOCB_CLOSE;
|
||||
regs.x = iocb_num;
|
||||
regs.pc = 0xe456; /* CIOV */
|
||||
_sys(®s);
|
||||
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* free buffer */
|
||||
free(buffer);
|
||||
|
||||
/* close cassette */
|
||||
iocb->command = IOCB_CLOSE;
|
||||
regs.x = iocb_num;
|
||||
regs.pc = 0xe456; /* CIOV */
|
||||
_sys(®s);
|
||||
|
||||
if (regs.y != 1) {
|
||||
fprintf(stderr, "CIO call to close cassette returned %d\n", regs.y);
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* all is fine */
|
||||
printf("success\n");
|
||||
if (_dos_type != 1)
|
||||
cgetc();
|
||||
return 0;
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
; Driver for the 1351 proportional mouse. Parts of the code are from
|
||||
; the Commodore 1351 mouse users guide.
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-12-29, 2009-09-26
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -83,6 +84,8 @@ YMax: .res 2 ; Y2 value of bounding box
|
||||
OldValue: .res 1 ; Temp for MoveCheck routine
|
||||
NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
INIT_save: .res 1
|
||||
|
||||
.rodata
|
||||
|
||||
; Default values for above variables
|
||||
@@ -94,8 +97,8 @@ NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
.word SCREEN_WIDTH/2 ; XPos
|
||||
.word 0 ; XMin
|
||||
.word 0 ; YMin
|
||||
.word SCREEN_WIDTH ; XMax
|
||||
.word SCREEN_HEIGHT ; YMax
|
||||
.word SCREEN_WIDTH - 1 ; XMax
|
||||
.word SCREEN_HEIGHT - 1 ; YMax
|
||||
.endproc
|
||||
|
||||
.code
|
||||
@@ -107,6 +110,14 @@ NewValue: .res 1 ; Temp for MoveCheck routine
|
||||
|
||||
INSTALL:
|
||||
|
||||
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
|
||||
; That allows direct access to the VIC-IIe's sprite registers.
|
||||
|
||||
lda INIT_STATUS
|
||||
sta INIT_save
|
||||
lda #%11000000
|
||||
sta INIT_STATUS
|
||||
|
||||
; Initialize variables. Just copy the default stuff over
|
||||
|
||||
ldx #.sizeof(DefVars)-1
|
||||
@@ -133,13 +144,17 @@ INSTALL:
|
||||
|
||||
ldx #$00
|
||||
txa
|
||||
rts ; Run into UNINSTALL instead
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; No return code required (the driver is removed from memory on return).
|
||||
|
||||
UNINSTALL = HIDE ; Hide cursor on exit
|
||||
UNINSTALL:
|
||||
jsr HIDE ; Hide cursor on exit
|
||||
lda INIT_save
|
||||
sta INIT_STATUS
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
;
|
||||
; Driver for a "joystick mouse".
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-04-05, 2009-09-26
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -85,6 +86,8 @@ XMax: .res 2 ; X2 value of bounding box
|
||||
YMax: .res 2 ; Y2 value of bounding box
|
||||
Buttons: .res 1 ; Button mask
|
||||
|
||||
INIT_save: .res 1
|
||||
|
||||
; Temporary value used in the int handler
|
||||
|
||||
Temp: .res 1
|
||||
@@ -99,8 +102,8 @@ Temp: .res 1
|
||||
.word SCREEN_WIDTH/2 ; XPos
|
||||
.word 0 ; XMin
|
||||
.word 0 ; YMin
|
||||
.word SCREEN_WIDTH ; XMax
|
||||
.word SCREEN_HEIGHT ; YMax
|
||||
.word SCREEN_WIDTH - 1 ; XMax
|
||||
.word SCREEN_HEIGHT - 1 ; YMax
|
||||
.byte 0 ; Buttons
|
||||
.endproc
|
||||
|
||||
@@ -113,6 +116,14 @@ Temp: .res 1
|
||||
|
||||
INSTALL:
|
||||
|
||||
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
|
||||
; That allows direct access to the VIC-IIe's sprite registers.
|
||||
|
||||
lda INIT_STATUS
|
||||
sta INIT_save
|
||||
lda #%11000000
|
||||
sta INIT_STATUS
|
||||
|
||||
; Initialize variables. Just copy the default stuff over
|
||||
|
||||
ldx #.sizeof(DefVars)-1
|
||||
@@ -145,7 +156,11 @@ INSTALL:
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; No return code required (the driver is removed from memory on return).
|
||||
|
||||
UNINSTALL = HIDE ; Hide cursor on exit
|
||||
UNINSTALL:
|
||||
jsr HIDE ; Hide cursor on exit
|
||||
lda INIT_save
|
||||
sta INIT_STATUS
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
;
|
||||
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
||||
; Driver for a potentiometer "mouse", e.g. Koala Pad
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||
; Stefan Haubenthal, 2006-08-20
|
||||
; 2006-08-20, Stefan Haubenthal
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -82,6 +83,8 @@ XMax: .res 2 ; X2 value of bounding box
|
||||
YMax: .res 2 ; Y2 value of bounding box
|
||||
Buttons: .res 1 ; Button mask
|
||||
|
||||
INIT_save: .res 1
|
||||
|
||||
; Temporary value used in the int handler
|
||||
|
||||
Temp: .res 1
|
||||
@@ -96,8 +99,8 @@ Temp: .res 1
|
||||
.word SCREEN_WIDTH/2 ; XPos
|
||||
.word 0 ; XMin
|
||||
.word 0 ; YMin
|
||||
.word SCREEN_WIDTH ; XMax
|
||||
.word SCREEN_HEIGHT ; YMax
|
||||
.word SCREEN_WIDTH - 1 ; XMax
|
||||
.word SCREEN_HEIGHT - 1 ; YMax
|
||||
.byte 0 ; Buttons
|
||||
.endproc
|
||||
|
||||
@@ -110,6 +113,14 @@ Temp: .res 1
|
||||
|
||||
INSTALL:
|
||||
|
||||
; Disable the BASIC interpreter's interrupt-driven sprite-motion code.
|
||||
; That allows direct access to the VIC-IIe's sprite registers.
|
||||
|
||||
lda INIT_STATUS
|
||||
sta INIT_save
|
||||
lda #%11000000
|
||||
sta INIT_STATUS
|
||||
|
||||
; Initialize variables. Just copy the default stuff over
|
||||
|
||||
ldx #.sizeof(DefVars)-1
|
||||
@@ -142,7 +153,11 @@ INSTALL:
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; No return code required (the driver is removed from memory on return).
|
||||
|
||||
UNINSTALL = HIDE ; Hide cursor on exit
|
||||
UNINSTALL:
|
||||
jsr HIDE ; Hide cursor on exit
|
||||
lda INIT_save
|
||||
sta INIT_STATUS
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; Driver for a "joystick mouse".
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||
; 2010-02-08, Greg King
|
||||
; 2014-03-17, Greg King
|
||||
;
|
||||
; The driver prevents the keyboard from interfering by changing the
|
||||
; keyboard's output port into an input port while the driver reads its
|
||||
@@ -118,8 +118,8 @@ Temp: .res 1
|
||||
.word SCREEN_WIDTH/2 ; XPos
|
||||
.word 0 ; XMin
|
||||
.word 0 ; YMin
|
||||
.word SCREEN_WIDTH ; XMax
|
||||
.word SCREEN_HEIGHT ; YMax
|
||||
.word SCREEN_WIDTH - 1 ; XMax
|
||||
.word SCREEN_HEIGHT - 1 ; YMax
|
||||
.byte 0 ; Buttons
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
;
|
||||
; Driver for a potentiometer "mouse" e.g. Koala Pad
|
||||
; Driver for a potentiometer "mouse", e.g. Koala Pad
|
||||
;
|
||||
; Ullrich von Bassewitz, 2004-03-29, 2009-09-26
|
||||
; Stefan Haubenthal, 2006-08-20
|
||||
; 2006-08-20, Stefan Haubenthal
|
||||
; 2009-09-26, Ullrich von Bassewitz
|
||||
; 2014-03-17, Greg King
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
@@ -96,8 +97,8 @@ Temp: .res 1
|
||||
.word SCREEN_WIDTH/2 ; XPos
|
||||
.word 0 ; XMin
|
||||
.word 0 ; YMin
|
||||
.word SCREEN_WIDTH ; XMax
|
||||
.word SCREEN_HEIGHT ; YMax
|
||||
.word SCREEN_WIDTH - 1 ; XMax
|
||||
.word SCREEN_HEIGHT - 1 ; YMax
|
||||
.byte 0 ; Buttons
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
DEPS += ../wrk/$(TARGET)/convert.d
|
||||
DEPS += ../libwrk/$(TARGET)/convert.d
|
||||
|
||||
../wrk/$(TARGET)/convert.o: TARGET = apple2enh
|
||||
../libwrk/$(TARGET)/convert.o: TARGET = apple2enh
|
||||
|
||||
../wrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../wrk/$(TARGET)
|
||||
../libwrk/$(TARGET)/convert.o: $(SRCDIR)/targetutil/convert.c | ../libwrk/$(TARGET)
|
||||
$(COMPILE_recipe)
|
||||
|
||||
../lib/apple2enh.lib:
|
||||
@$(MAKE) --no-print-directory apple2enh
|
||||
|
||||
../targetutil/convert.system: ../wrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../targetutil
|
||||
../targetutil/convert.system: ../libwrk/$(TARGET)/convert.o ../lib/apple2enh.lib | ../targetutil
|
||||
$(LD65) -o $@ -C apple2enh-system.cfg $^
|
||||
|
||||
$(TARGET): ../targetutil/convert.system
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
.import __STARTOFDIRECTORY__
|
||||
.import __RAM_START__
|
||||
.import __CODE_SIZE__,__DATA_SIZE__,__RODATA_SIZE__
|
||||
.import __STARTUP_SIZE__,__INIT_SIZE__
|
||||
.import __STARTUP_SIZE__,__INIT_SIZE__,__LOWCODE_SIZE__
|
||||
.import __BLOCKSIZE__
|
||||
.export __DEFDIR__: absolute = 1
|
||||
|
||||
@@ -21,7 +21,7 @@ off0=__STARTOFDIRECTORY__+(__DIRECTORY_END__-__DIRECTORY_START__)
|
||||
blocka=off0/__BLOCKSIZE__
|
||||
; Entry 0 - first executable
|
||||
block0=off0/__BLOCKSIZE__
|
||||
len0=__STARTUP_SIZE__+__INIT_SIZE__+__CODE_SIZE__+__DATA_SIZE__+__RODATA_SIZE__
|
||||
len0=__STARTUP_SIZE__+__INIT_SIZE__+__CODE_SIZE__+__DATA_SIZE__+__RODATA_SIZE__+__LOWCODE_SIZE__
|
||||
.byte <block0
|
||||
.word off0 & (__BLOCKSIZE__ - 1)
|
||||
.byte $88
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
../tgi/nes-64-56-2.tgi: ../wrk/nes/clrscr.o \
|
||||
../wrk/nes/cputc.o \
|
||||
../wrk/nes/get_tv.o \
|
||||
../wrk/nes/gotoxy.o \
|
||||
../wrk/nes/popa.o \
|
||||
../wrk/nes/ppu.o \
|
||||
../wrk/nes/ppubuf.o \
|
||||
../wrk/nes/setcursor.o
|
||||
../tgi/nes-64-56-2.tgi: ../libwrk/nes/clrscr.o \
|
||||
../libwrk/nes/cputc.o \
|
||||
../libwrk/nes/get_tv.o \
|
||||
../libwrk/nes/gotoxy.o \
|
||||
../libwrk/nes/popa.o \
|
||||
../libwrk/nes/ppu.o \
|
||||
../libwrk/nes/ppubuf.o \
|
||||
../libwrk/nes/setcursor.o
|
||||
|
||||
Reference in New Issue
Block a user