mirror of
https://github.com/cc65/cc65.git
synced 2025-08-08 22:25:28 +00:00
Added support for the Oric atmos (with some help by Debrune Jérôme
<jede@oric.org>) git-svn-id: svn://svn.cc65.org/cc65/trunk@1297 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -12,13 +12,14 @@ AR = ../src/ar65/ar65
|
|||||||
|
|
||||||
# List of all targets
|
# List of all targets
|
||||||
ALLTARGETS = apple2lib \
|
ALLTARGETS = apple2lib \
|
||||||
atarilib \
|
atarilib \
|
||||||
c64lib \
|
atmoslib \
|
||||||
c128lib \
|
c64lib \
|
||||||
|
c128lib \
|
||||||
cbm510lib \
|
cbm510lib \
|
||||||
cbm610lib \
|
cbm610lib \
|
||||||
geoslib \
|
geoslib \
|
||||||
petlib \
|
petlib \
|
||||||
plus4lib
|
plus4lib
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@@ -60,6 +61,22 @@ atarilib:
|
|||||||
$(AR) a atari.lib $$i/*.o;\
|
$(AR) a atari.lib $$i/*.o;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
# Oric Atmos
|
||||||
|
|
||||||
|
atmoslib:
|
||||||
|
for i in atmos common runtime; do \
|
||||||
|
CC=$(CC) \
|
||||||
|
AS=$(AS) \
|
||||||
|
CFLAGS="-Osir -g -T -t atmos -I../../include" \
|
||||||
|
AFLAGS="-t atmos -I../../asminc" \
|
||||||
|
$(MAKE) -C $$i || exit 1; \
|
||||||
|
done
|
||||||
|
mv atmos/crt0.o atmos.o
|
||||||
|
for i in atmos common runtime; do \
|
||||||
|
$(AR) a atmos.lib $$i/*.o;\
|
||||||
|
done
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# C64
|
# C64
|
||||||
|
|
||||||
|
20
libsrc/atmos/Makefile
Normal file
20
libsrc/atmos/Makefile
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# makefile for CC65 runtime library
|
||||||
|
#
|
||||||
|
|
||||||
|
.SUFFIXES: .o .s .c
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
@$(CC) $(CFLAGS) $<
|
||||||
|
@$(AS) -o $@ $(AFLAGS) $(*).s
|
||||||
|
|
||||||
|
%.o: %.s
|
||||||
|
@$(AS) -g -o $@ $(AFLAGS) $<
|
||||||
|
|
||||||
|
OBJS = crt0.o
|
||||||
|
|
||||||
|
all: $(OBJS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@rm -f $(OBJS)
|
||||||
|
|
88
libsrc/atmos/crt0.s
Normal file
88
libsrc/atmos/crt0.s
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
;
|
||||||
|
; Startup code for cc65 (Oric version)
|
||||||
|
;
|
||||||
|
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||||
|
;
|
||||||
|
; This must be the *first* file on the linker command line
|
||||||
|
;
|
||||||
|
|
||||||
|
.export _exit
|
||||||
|
.import initlib, donelib
|
||||||
|
.import push0, _main, zerobss
|
||||||
|
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||||
|
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
; Define and export the ZP variables for the Oric runtime
|
||||||
|
|
||||||
|
.exportzp sp, sreg, regsave
|
||||||
|
.exportzp ptr1, ptr2, ptr3, ptr4
|
||||||
|
.exportzp tmp1, tmp2, tmp3, tmp4
|
||||||
|
.exportzp regbank, zpspace
|
||||||
|
|
||||||
|
.zeropage
|
||||||
|
|
||||||
|
zpstart = *
|
||||||
|
sp: .res 2 ; Stack pointer
|
||||||
|
sreg: .res 2 ; Secondary register/high 16 bit for longs
|
||||||
|
regsave: .res 2 ; slot to save/restore (E)AX into
|
||||||
|
ptr1: .res 2
|
||||||
|
ptr2: .res 2
|
||||||
|
ptr3: .res 2
|
||||||
|
ptr4: .res 2
|
||||||
|
tmp1: .res 1
|
||||||
|
tmp2: .res 1
|
||||||
|
tmp3: .res 1
|
||||||
|
tmp4: .res 1
|
||||||
|
regbank: .res 6 ; 6 byte register bank
|
||||||
|
|
||||||
|
zpspace = * - zpstart ; Zero page space allocated
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
|
; ------------------------------------------------------------------------
|
||||||
|
; Actual code
|
||||||
|
|
||||||
|
; Clear the BSS data
|
||||||
|
|
||||||
|
jsr zerobss
|
||||||
|
|
||||||
|
; Save system stuff and setup the stack
|
||||||
|
|
||||||
|
tsx
|
||||||
|
stx spsave ; save system stk ptr
|
||||||
|
|
||||||
|
lda #<(__RAM_START__ + __RAM_SIZE__)
|
||||||
|
sta sp
|
||||||
|
lda #>(__RAM_START__ + __RAM_SIZE__)
|
||||||
|
sta sp+1 ; Set argument stack ptr
|
||||||
|
|
||||||
|
; Call module constructors
|
||||||
|
|
||||||
|
jsr initlib
|
||||||
|
|
||||||
|
; Pass an empty command line
|
||||||
|
|
||||||
|
jsr push0 ; argc
|
||||||
|
jsr push0 ; argv
|
||||||
|
|
||||||
|
ldy #4 ; Argument size
|
||||||
|
jsr _main ; call the users code
|
||||||
|
|
||||||
|
; Call module destructors. This is also the _exit entry.
|
||||||
|
|
||||||
|
_exit: jsr donelib ; Run module destructors
|
||||||
|
|
||||||
|
; Restore system stuff
|
||||||
|
|
||||||
|
ldx spsave
|
||||||
|
txs
|
||||||
|
|
||||||
|
; Back to BASIC
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
.bss
|
||||||
|
spsave: .res 1
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user