diff --git a/Makefile b/Makefile index d5a522871..b4882cc31 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all mostlyclean clean: +all mostlyclean clean install: @$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@ @@ -14,6 +14,6 @@ lib: %: @$(MAKE) -C libsrc --no-print-directory $@ -.PHONY: all mostlyclean clean avail unavail bin lib +.PHONY: all mostlyclean clean install avail unavail bin lib .SUFFIXES: diff --git a/asminc/atari.inc b/asminc/atari.inc index da926af81..7b647fd0a 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -318,7 +318,7 @@ APPMHI = $0E ;APPLICATIONS MEMORY HI LIMIT INTZBS = $10 ;INTERRUPT HANDLER -POKMSK = $10 ;SYSTEM MASK FOR POKEY IRQ ENABLE +POKMSK = $10 ;SYSTEM MASK FOR POKEY IRQ ENABLE (shadow of IRQEN) BRKKEY = $11 ;BREAK KEY FLAG RTCLOK = $12 ;REAL TIME CLOCK (IN 16 MSEC UNITS> BUFADR = $15 ;INDIRECT BUFFER ADDRESS REGISTER diff --git a/cfg/apple2-asm.cfg b/cfg/apple2-asm.cfg index e70ed4484..1e187764c 100644 --- a/cfg/apple2-asm.cfg +++ b/cfg/apple2-asm.cfg @@ -8,13 +8,15 @@ SYMBOLS { __LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__; } MEMORY { + ZP: start = $0080, size = $001A, define = yes; HEADER: file = %O, start = $0000, size = $0004; RAM: file = %O, start = %S, size = $C000 - %S; } SEGMENTS { - EXEHDR: load = HEADER, type = ro, optional = yes; - CODE: load = RAM, type = rw, optional = yes, define = yes; - RODATA: load = RAM, type = ro, optional = yes; - DATA: load = RAM, type = rw, optional = yes; - BSS: load = RAM, type = bss, optional = yes, define = yes; + ZEROPAGE: load = ZP, type = zp, optional = yes; + EXEHDR: load = HEADER, type = ro, optional = yes; + CODE: load = RAM, type = rw, optional = yes, define = yes; + RODATA: load = RAM, type = ro, optional = yes; + DATA: load = RAM, type = rw, optional = yes; + BSS: load = RAM, type = bss, optional = yes, define = yes; } diff --git a/cfg/atari-asm.cfg b/cfg/atari-asm.cfg index 4e87a8884..4ff7c3173 100644 --- a/cfg/atari-asm.cfg +++ b/cfg/atari-asm.cfg @@ -24,6 +24,7 @@ SEGMENTS { RODATA: load = RAM, type = ro optional = yes; DATA: load = RAM, type = rw optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; - ZEROPAGE: load = ZP, type = zp; + ZEROPAGE: load = ZP, type = zp, optional = yes; + EXTZP: load = ZP, type = zp, optional = yes; # to enable modules to be able to link to C and assembler programs AUTOSTRT: load = TRAILER, type = ro, optional = yes; } diff --git a/cfg/atari-cart.cfg b/cfg/atari-cart.cfg index 10674dc49..db9486a9f 100644 --- a/cfg/atari-cart.cfg +++ b/cfg/atari-cart.cfg @@ -24,7 +24,7 @@ SEGMENTS { DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes; CARTHDR: load = CARTID, type = ro; - ZEROPAGE: load = ZP, type = zp; + ZEROPAGE: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes; } FEATURES { diff --git a/cfg/c64-asm.cfg b/cfg/c64-asm.cfg index 0924cdb56..1ab80be8e 100644 --- a/cfg/c64-asm.cfg +++ b/cfg/c64-asm.cfg @@ -5,6 +5,7 @@ SYMBOLS { __LOADADDR__: type = import; } MEMORY { + ZP: file = "", start = $0002, size = $001A, define = yes; LOADADDR: file = %O, start = %S - 2, size = $0002; RAM: file = %O, start = %S, size = $D000 - %S; } @@ -15,4 +16,5 @@ SEGMENTS { RODATA: load = RAM, type = ro, optional = yes; DATA: load = RAM, type = rw, optional = yes; BSS: load = RAM, type = bss, optional = yes; + ZEROPAGE: load = ZP, type = zp, optional = yes; } diff --git a/include/atari.h b/include/atari.h index ff23526ee..82cd07330 100644 --- a/include/atari.h +++ b/include/atari.h @@ -169,9 +169,16 @@ extern char *_getdefdev(void); /* get default floppy device */ /* global variables */ extern unsigned char _dos_type; /* the DOS flavour */ +#ifndef __ATARIXL__ extern void atr130_emd[]; extern void atrstd_joy[]; /* referred to by joy_static_stddrv[] */ extern void atrmj8_joy[]; +extern void atrjoy_mou[]; +extern void atrst_mou[]; /* referred to by mouse_static_stddrv[] */ +extern void atrami_mou[]; +extern void atrtrk_mou[]; +extern void atrtt_mou[]; +extern void atrrdev_ser[]; extern void atr3_tgi[]; extern void atr4_tgi[]; extern void atr5_tgi[]; @@ -187,6 +194,32 @@ extern void atr11_tgi[]; extern void atr14_tgi[]; extern void atr15_tgi[]; extern void atr15p2_tgi[]; +#else +extern void atrx130_emd[]; +extern void atrxstd_joy[]; /* referred to by joy_static_stddrv[] */ +extern void atrxmj8_joy[]; +extern void atrxjoy_mou[]; +extern void atrxst_mou[]; /* referred to by mouse_static_stddrv[] */ +extern void atrxami_mou[]; +extern void atrxtrk_mou[]; +extern void atrxtt_mou[]; +extern void atrxrdev_ser[]; +extern void atrx3_tgi[]; +extern void atrx4_tgi[]; +extern void atrx5_tgi[]; +extern void atrx6_tgi[]; +extern void atrx7_tgi[]; +extern void atrx8_tgi[]; /* referred to by tgi_static_stddrv[] */ +extern void atrx8p2_tgi[]; +extern void atrx9_tgi[]; +extern void atrx9p2_tgi[]; +extern void atrx10_tgi[]; +extern void atrx10p2_tgi[]; +extern void atrx11_tgi[]; +extern void atrx14_tgi[]; +extern void atrx15_tgi[]; +extern void atrx15p2_tgi[]; +#endif /* provide old names for backwards compatibility */ #ifdef ATARI_COMPAT_PRE_2_11 diff --git a/libsrc/Makefile b/libsrc/Makefile index fb716067b..cbc778f11 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -50,10 +50,18 @@ endif .SUFFIXES: -.PHONY: all lib $(TARGETS) mostlyclean clean +.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): @@ -65,6 +73,21 @@ mostlyclean: clean: $(call RMDIR,../wrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES))) +install: + $(foreach dir,$(INSTALLDIRS),$(INSTALL_recipe)) + +########## + +define INSTALL_recipe + +$(if $(prefix),,$(error variable `prefix' must be set)) +$(INSTALL) -d $(subst ..,$(DESTDIR)$(datadir),$(dir)) +$(INSTALL) -m644 $(dir)/* $(subst ..,$(DESTDIR)$(datadir),$(dir)) + +endef + +########## + else # TARGET CA65FLAGS = diff --git a/libsrc/apple2/crt0.s b/libsrc/apple2/crt0.s index 27c44f016..a140a7249 100644 --- a/libsrc/apple2/crt0.s +++ b/libsrc/apple2/crt0.s @@ -107,7 +107,7 @@ exit: ldx #$02 txs ; Re-init stack pointer ; We're done - jmp (done) + jmp done .segment "INIT" @@ -148,8 +148,8 @@ init: ldx #zpspace-1 ; No BASIC.SYSTEM so quit to ProDOS dispatcher instead lda #quit - sta done - stx done+1 + sta done+1 + stx done+2 ; No BASIC.SYSTEM so use addr of ProDOS system global page lda #<$BF00 @@ -202,8 +202,8 @@ q_param:.byte $04 ; param_count .data - ; Location to jump to when we're done -done: .addr DOSWARM + ; Final jump when we're done +done: jmp DOSWARM ; Potentially patched at runtime .segment "ZPSAVE" diff --git a/libsrc/apple2/exec.s b/libsrc/apple2/exec.s index 914e10c50..c486306bb 100644 --- a/libsrc/apple2/exec.s +++ b/libsrc/apple2/exec.s @@ -161,8 +161,8 @@ setbuf: lda #$00 ; Low byte ; Call loader stub after C libary shutdown lda #target - sta done - stx done+1 + sta done+1 + stx done+2 ; Initiate C libary shutdown jmp _exit diff --git a/libsrc/apple2/reboot.s b/libsrc/apple2/reboot.s index 89c34bdf0..8ee1ba067 100644 --- a/libsrc/apple2/reboot.s +++ b/libsrc/apple2/reboot.s @@ -16,6 +16,6 @@ initreboot: ; Quit to PWRUP lda #<$FAA6 ldx #>$FAA6 - sta done - stx done+1 + sta done+1 + stx done+2 rts diff --git a/libsrc/atari/joy_stat_stddrv.s b/libsrc/atari/joy_stat_stddrv.s index cbaf344d0..4528aa20d 100644 --- a/libsrc/atari/joy_stat_stddrv.s +++ b/libsrc/atari/joy_stat_stddrv.s @@ -7,8 +7,16 @@ ; .export _joy_static_stddrv + .ifdef __ATARIXL__ + .import _atrxstd_joy + .else .import _atrstd_joy + .endif .rodata + .ifdef __ATARIXL__ +_joy_static_stddrv := _atrxstd_joy + .else _joy_static_stddrv := _atrstd_joy + .endif diff --git a/libsrc/atari/joy_stddrv.s b/libsrc/atari/joy_stddrv.s index f3ab74e7b..e82dadb73 100644 --- a/libsrc/atari/joy_stddrv.s +++ b/libsrc/atari/joy_stddrv.s @@ -10,4 +10,9 @@ .rodata -_joy_stddrv: .asciiz "atrstd.joy" +_joy_stddrv: + .ifdef __ATARIXL__ + .asciiz "atrxstd.joy" + .else + .asciiz "atrstd.joy" + .endif diff --git a/libsrc/atari/mou/atrst.s b/libsrc/atari/mou/atrst.s index 116cecee2..773e171e1 100644 --- a/libsrc/atari/mou/atrst.s +++ b/libsrc/atari/mou/atrst.s @@ -446,6 +446,14 @@ IOCTL: lda #