Merge remote-tracking branch 'upstream/master' into cassette

Conflicts:
	asminc/atari.inc
	libsrc/atari/mou/atrst.s
This commit is contained in:
Christian Groessler
2014-01-30 10:48:13 +01:00
17 changed files with 158 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
all mostlyclean clean: all mostlyclean clean install:
@$(MAKE) -C src --no-print-directory $@ @$(MAKE) -C src --no-print-directory $@
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
@@ -14,6 +14,6 @@ lib:
%: %:
@$(MAKE) -C libsrc --no-print-directory $@ @$(MAKE) -C libsrc --no-print-directory $@
.PHONY: all mostlyclean clean avail unavail bin lib .PHONY: all mostlyclean clean install avail unavail bin lib
.SUFFIXES: .SUFFIXES:

View File

@@ -318,7 +318,7 @@ APPMHI = $0E ;APPLICATIONS MEMORY HI LIMIT
INTZBS = $10 ;INTERRUPT HANDLER 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 BRKKEY = $11 ;BREAK KEY FLAG
RTCLOK = $12 ;REAL TIME CLOCK (IN 16 MSEC UNITS> RTCLOK = $12 ;REAL TIME CLOCK (IN 16 MSEC UNITS>
BUFADR = $15 ;INDIRECT BUFFER ADDRESS REGISTER BUFADR = $15 ;INDIRECT BUFFER ADDRESS REGISTER

View File

@@ -8,10 +8,12 @@ SYMBOLS {
__LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__; __LOADSIZE__: type = weak, value = __BSS_RUN__ - __CODE_RUN__;
} }
MEMORY { MEMORY {
ZP: start = $0080, size = $001A, define = yes;
HEADER: file = %O, start = $0000, size = $0004; HEADER: file = %O, start = $0000, size = $0004;
RAM: file = %O, start = %S, size = $C000 - %S; RAM: file = %O, start = %S, size = $C000 - %S;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp, optional = yes;
EXEHDR: load = HEADER, type = ro, optional = yes; EXEHDR: load = HEADER, type = ro, optional = yes;
CODE: load = RAM, type = rw, optional = yes, define = yes; CODE: load = RAM, type = rw, optional = yes, define = yes;
RODATA: load = RAM, type = ro, optional = yes; RODATA: load = RAM, type = ro, optional = yes;

View File

@@ -24,6 +24,7 @@ SEGMENTS {
RODATA: load = RAM, type = ro optional = yes; RODATA: load = RAM, type = ro optional = yes;
DATA: load = RAM, type = rw optional = yes; DATA: load = RAM, type = rw optional = yes;
BSS: load = RAM, type = bss, define = yes, 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; AUTOSTRT: load = TRAILER, type = ro, optional = yes;
} }

View File

@@ -24,7 +24,7 @@ SEGMENTS {
DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes; DATA: load = ROM, run = RAM, type = rw, define = yes, optional = yes;
BSS: load = RAM, type = bss, define = yes, optional = yes; BSS: load = RAM, type = bss, define = yes, optional = yes;
CARTHDR: load = CARTID, type = ro; CARTHDR: load = CARTID, type = ro;
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp, optional = yes;
EXTZP: load = ZP, type = zp, optional = yes; EXTZP: load = ZP, type = zp, optional = yes;
} }
FEATURES { FEATURES {

View File

@@ -5,6 +5,7 @@ SYMBOLS {
__LOADADDR__: type = import; __LOADADDR__: type = import;
} }
MEMORY { MEMORY {
ZP: file = "", start = $0002, size = $001A, define = yes;
LOADADDR: file = %O, start = %S - 2, size = $0002; LOADADDR: file = %O, start = %S - 2, size = $0002;
RAM: file = %O, start = %S, size = $D000 - %S; RAM: file = %O, start = %S, size = $D000 - %S;
} }
@@ -15,4 +16,5 @@ SEGMENTS {
RODATA: load = RAM, type = ro, optional = yes; RODATA: load = RAM, type = ro, optional = yes;
DATA: load = RAM, type = rw, optional = yes; DATA: load = RAM, type = rw, optional = yes;
BSS: load = RAM, type = bss, optional = yes; BSS: load = RAM, type = bss, optional = yes;
ZEROPAGE: load = ZP, type = zp, optional = yes;
} }

View File

@@ -169,9 +169,16 @@ extern char *_getdefdev(void); /* get default floppy device */
/* global variables */ /* global variables */
extern unsigned char _dos_type; /* the DOS flavour */ extern unsigned char _dos_type; /* the DOS flavour */
#ifndef __ATARIXL__
extern void atr130_emd[]; extern void atr130_emd[];
extern void atrstd_joy[]; /* referred to by joy_static_stddrv[] */ extern void atrstd_joy[]; /* referred to by joy_static_stddrv[] */
extern void atrmj8_joy[]; 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 atr3_tgi[];
extern void atr4_tgi[]; extern void atr4_tgi[];
extern void atr5_tgi[]; extern void atr5_tgi[];
@@ -187,6 +194,32 @@ extern void atr11_tgi[];
extern void atr14_tgi[]; extern void atr14_tgi[];
extern void atr15_tgi[]; extern void atr15_tgi[];
extern void atr15p2_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 */ /* provide old names for backwards compatibility */
#ifdef ATARI_COMPAT_PRE_2_11 #ifdef ATARI_COMPAT_PRE_2_11

View File

@@ -50,10 +50,18 @@ endif
.SUFFIXES: .SUFFIXES:
.PHONY: all lib $(TARGETS) mostlyclean clean .PHONY: all lib $(TARGETS) mostlyclean clean install
ifndef TARGET 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) all lib: $(TARGETS)
$(TARGETS): $(TARGETS):
@@ -65,6 +73,21 @@ mostlyclean:
clean: clean:
$(call RMDIR,../wrk ../lib ../targetutil $(addprefix ../,$(DRVTYPES))) $(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 else # TARGET
CA65FLAGS = CA65FLAGS =

View File

@@ -107,7 +107,7 @@ exit: ldx #$02
txs ; Re-init stack pointer txs ; Re-init stack pointer
; We're done ; We're done
jmp (done) jmp done
.segment "INIT" .segment "INIT"
@@ -148,8 +148,8 @@ init: ldx #zpspace-1
; No BASIC.SYSTEM so quit to ProDOS dispatcher instead ; No BASIC.SYSTEM so quit to ProDOS dispatcher instead
lda #<quit lda #<quit
ldx #>quit ldx #>quit
sta done sta done+1
stx done+1 stx done+2
; No BASIC.SYSTEM so use addr of ProDOS system global page ; No BASIC.SYSTEM so use addr of ProDOS system global page
lda #<$BF00 lda #<$BF00
@@ -202,8 +202,8 @@ q_param:.byte $04 ; param_count
.data .data
; Location to jump to when we're done ; Final jump when we're done
done: .addr DOSWARM done: jmp DOSWARM ; Potentially patched at runtime
.segment "ZPSAVE" .segment "ZPSAVE"

View File

@@ -161,8 +161,8 @@ setbuf: lda #$00 ; Low byte
; Call loader stub after C libary shutdown ; Call loader stub after C libary shutdown
lda #<target lda #<target
ldx #>target ldx #>target
sta done sta done+1
stx done+1 stx done+2
; Initiate C libary shutdown ; Initiate C libary shutdown
jmp _exit jmp _exit

View File

@@ -16,6 +16,6 @@ initreboot:
; Quit to PWRUP ; Quit to PWRUP
lda #<$FAA6 lda #<$FAA6
ldx #>$FAA6 ldx #>$FAA6
sta done sta done+1
stx done+1 stx done+2
rts rts

View File

@@ -7,8 +7,16 @@
; ;
.export _joy_static_stddrv .export _joy_static_stddrv
.ifdef __ATARIXL__
.import _atrxstd_joy
.else
.import _atrstd_joy .import _atrstd_joy
.endif
.rodata .rodata
.ifdef __ATARIXL__
_joy_static_stddrv := _atrxstd_joy
.else
_joy_static_stddrv := _atrstd_joy _joy_static_stddrv := _atrstd_joy
.endif

View File

@@ -10,4 +10,9 @@
.rodata .rodata
_joy_stddrv: .asciiz "atrstd.joy" _joy_stddrv:
.ifdef __ATARIXL__
.asciiz "atrxstd.joy"
.else
.asciiz "atrstd.joy"
.endif

View File

@@ -446,6 +446,14 @@ IOCTL: lda #<MOUSE_ERR_INV_IOCTL ; We don't support ioclts for now
IRQ: IRQ:
; Turn mouse polling IRQ back on in case it disabled itself due to CRITIC
; flag being set.
lda POKMSK
ora #%00000001 ; timer 1 enable
sta POKMSK
sta IRQEN
; Check for a pressed button and place the result into Buttons ; Check for a pressed button and place the result into Buttons
ldx #0 ldx #0
@@ -514,7 +522,12 @@ IRQ:
; T1Han: Local IRQ routine to poll mouse ; T1Han: Local IRQ routine to poll mouse
; ;
T1Han: tya T1Han: lda CRITIC ; if CRITIC flag is set, disable the
bne disable_me ; high frequency polling IRQ, in order
; not to interfere with SIO I/O (e.g.
; floppy access)
tya
pha pha
txa txa
pha pha
@@ -695,3 +708,22 @@ mmexit: sty oldval
pla pla
rti rti
.endif .endif
; Disable the interrupt source which caused us to be called.
; The interrupt will be enabled again by the "IRQ" routine.
; The "IRQ" routine, despite its name, is called from the
; vertical blank NMI interrupt *only* if the CRITIC flag has
; been cleared.
disable_me:
lda POKMSK
and #%11111110 ; timer 1 disable
sta IRQEN
sta POKMSK
.ifdef __ATARIXL__
rts
.else
pla
rti
.endif

View File

@@ -7,8 +7,16 @@
; ;
.export _tgi_static_stddrv .export _tgi_static_stddrv
.ifdef __ATARIXL__
.import _atrx8_tgi
.else
.import _atr8_tgi .import _atr8_tgi
.endif
.rodata .rodata
.ifdef __ATARIXL__
_tgi_static_stddrv := _atrx8_tgi
.else
_tgi_static_stddrv := _atr8_tgi _tgi_static_stddrv := _atr8_tgi
.endif

View File

@@ -10,4 +10,9 @@
.rodata .rodata
_tgi_stddrv: .asciiz "atr8.tgi" _tgi_stddrv:
.ifdef __ATARIXL__
.asciiz "atrx8.tgi"
.else
.asciiz "atr8.tgi"
.endif

View File

@@ -12,19 +12,14 @@ PROGS = ar65 \
sim65 \ sim65 \
sp65 sp65
ifdef prefix bindir := $(prefix)/bin
CA65_INC = $(prefix)/lib/cc65/asminc datadir := $(if $(prefix),$(prefix)/share/cc65,$(abspath ..))
CC65_INC = $(prefix)/lib/cc65/include
LD65_LIB = $(prefix)/lib/cc65/lib CA65_INC = $(datadir)/asminc
LD65_OBJ = $(prefix)/lib/cc65/lib CC65_INC = $(datadir)/include
LD65_CFG = $(prefix)/lib/cc65/cfg LD65_LIB = $(datadir)/lib
else LD65_OBJ = $(datadir)/lib
CA65_INC := $(abspath ../asminc) LD65_CFG = $(datadir)/cfg
CC65_INC := $(abspath ../include)
LD65_LIB := $(abspath ../lib)
LD65_OBJ := $(abspath ../lib)
LD65_CFG := $(abspath ../cfg)
endif
CFLAGS += -MMD -MP -O -std=c89 -I common \ CFLAGS += -MMD -MP -O -std=c89 -I common \
-Wall -Wextra -Wno-char-subscripts -Werror $(USER_CFLAGS) \ -Wall -Wextra -Wno-char-subscripts -Werror $(USER_CFLAGS) \
@@ -33,9 +28,11 @@ CFLAGS += -MMD -MP -O -std=c89 -I common \
LDLIBS += -lm LDLIBS += -lm
INSTALL = install
.SUFFIXES: .SUFFIXES:
.PHONY: all bin $(PROGS) mostlyclean clean avail unavail .PHONY: all bin $(PROGS) mostlyclean clean install avail unavail
all bin: $(PROGS) all bin: $(PROGS)
@@ -45,6 +42,11 @@ mostlyclean:
clean: clean:
$(RM) -r ../wrk ../bin $(RM) -r ../wrk ../bin
install:
$(if $(prefix),,$(error variable `prefix' must be set))
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) ../bin/* $(DESTDIR)$(bindir)
avail: avail:
$(foreach prog,$(PROGS),$(AVAIL_recipe)) $(foreach prog,$(PROGS),$(AVAIL_recipe))