first changes for atari5200 target

This commit is contained in:
Christian Groessler
2014-03-01 17:20:09 +01:00
parent 9c95306a69
commit c8f7f2f161
19 changed files with 608 additions and 218 deletions

View File

@@ -12,6 +12,7 @@ GEOS = geos-apple \
TARGETS = apple2 \
apple2enh \
atari5200 \
atari \
atarixl \
atmos \

View File

@@ -0,0 +1,13 @@
; Cartridge entry point
;
; Christian Groessler, 01-Mar-2014
.export __CART_ENTRY__: absolute = 1
.import __CARTSIZE__, start
.forceimport __CART_YEAR__, __CART_NAME__
.segment "CARTENTRY"
.word start ; entry point
.assert (__CARTSIZE__ = $4000 || __CARTSIZE__ = $8000), error, "Cartridge size must either be $4000 or $8000"

View File

@@ -0,0 +1,11 @@
; default cartridge name
;
; Christian Groessler, 01-Mar-2014
.include "atari5200.mac"
.export __CART_NAME__: absolute = 1
.segment "CARTNAME"
scrcode " cc65 compiled"

View File

@@ -0,0 +1,12 @@
; Cartridge copyright year
;
; Christian Groessler, 01-Mar-2014
.include "atari5200.mac"
.export __CART_YEAR__: absolute = 1
.segment "CARTYEAR"
scrcode "98"

55
libsrc/atari5200/crt0.s Normal file
View File

@@ -0,0 +1,55 @@
;
; Startup code for cc65 (Atari5200 version)
;
; by Christian Groessler (chris@groessler.org), 2014
;
.export _exit, start
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import __RAM_START__, __RAM_SIZE__
.import __RESERVED_MEMORY__
.import initlib, donelib, callmain
.import zerobss, copydata
.include "zeropage.inc"
.include "atari5200.inc"
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
start:
; Clear the BSS data
jsr zerobss
; initialize data
jsr copydata
; setup the stack
lda #<(__RAM_START__ + __RAM_SIZE__)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1 ; Set argument stack ptr
; Call module constructors
jsr initlib
; Push arguments and call main()
jsr callmain
; Call module destructors. This is also the _exit entry.
_exit: jsr donelib ; Run module destructors
; Reset the NES
jmp start

5
libsrc/atari5200/ctype.s Normal file
View File

@@ -0,0 +1,5 @@
; Character specification table.
;
; same as for "atari" target
.include "../atari/ctype.s"

View File

@@ -0,0 +1,17 @@
;
; Christian Groessler, 01-Mar-2014
;
; void _randomize (void);
; /* Initialize the random number generator */
;
.export __randomize
.import _srand
.include "atari5200.inc"
__randomize:
ldx VCOUNT ; Use vertical line counter as high byte
lda RTCLOK+1 ; Use clock as low byte
jmp _srand ; Initialize generator

41
libsrc/atari5200/y2k.inc Normal file
View File

@@ -0,0 +1,41 @@
;-----------------------------------------------------------
; Y2K FIX by Alan Davis, Dennis Debro, and Ronen Habot
;-----------------------------------------------------------
Y2K LDY #$00 ; Copy BIOS opening screen to RAM
LDA #$FD
STA TEMPH
LDA #$58 ; Assume 2 port system
LDX $FD32
CPX #$E8 ; Is this a 4 port?
BNE Y2K0 ; Jump if not
LDA #$42 ; Yes, 4 port system
Y2K0 STA TEMPL
Y2K1 LDA (TEMPL),Y
STA $0600,Y
INY
BNE Y2K1
LDY #$50
INC TEMPH
Y2K2 LDA (TEMPL),Y
STA $0700,Y
DEY
BPL Y2K2
LDA #$D4 ; Point to copyright string
STA $0724
LDA #$BF
STA $0725
LDX #$0B ; Store NOP's @ end
LDA #$EA
Y2K3 STA $0732,X
DEX
BPL Y2K3
LDA #$60 ; Store RTS opcode @ end
STA $0750
JSR $0600 ; Show title screen
LDY #$00 ; Clear RAM from $0600-$3FFF
STY $80
LDA #$06
STA $81
JSR CLRRAM
RTS