New target supervision

git-svn-id: svn://svn.cc65.org/cc65/trunk@2497 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-10-10 16:44:20 +00:00
parent e08261dff3
commit 6afee6fb05
8 changed files with 361 additions and 31 deletions

View File

@@ -0,0 +1,35 @@
#
# cc65 makefile for the supervision specific modules
#
.SUFFIXES: .o .s .c
#--------------------------------------------------------------------------
# Rules
%.o: %.c
@$(CC) $(CFLAGS) $<
@$(AS) -o $@ $(AFLAGS) $(*).s
%.o: %.s
@$(AS) -g -o $@ $(AFLAGS) $<
#--------------------------------------------------------------------------
# Object files
C_OBJS =
S_OBJS = crt0.o
#--------------------------------------------------------------------------
# Targets
.PHONY: all clean zap
all: $(C_OBJS) $(S_OBJS)
clean:
@$(RM) $(C_OBJS:.c=.s) $(C_OBJS) $(S_OBJS)
zap: clean

81
libsrc/supervision/crt0.s Normal file
View File

@@ -0,0 +1,81 @@
;
; Startup code for cc65 (supervision version)
;
; This must be the *first* file on the linker command line
;
.export _exit
.import _main
.import initlib, donelib, copydata
.import zerobss
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
.include "zeropage.inc"
.include "supervision.inc"
.export _sv_irq_timer_counter, _sv_irq_dma_counter
.export _sv_nmi_counter
.bss
_sv_irq_dma_counter: .byte 0
_sv_irq_timer_counter: .byte 0
_sv_nmi_counter: .byte 0
.code
reset:
jsr zerobss
; initialize data
jsr copydata
lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1 ; Set argument stack ptr
stz sp ; #<(__RAM_START__ + __RAM_SIZE__)
jsr initlib
jsr _main
_exit: jsr donelib
exit: jmp exit
.proc irq
pha
lda sv_irq_source
and #SV_IRQ_REQUEST_TIMER
beq not_timer
lda sv_timer_quit
inc _sv_irq_timer_counter
not_timer:
lda sv_irq_source
and #SV_IRQ_REQUEST_DMA
beq not_dma
lda sv_dma_quit
inc _sv_irq_dma_counter
not_dma:
pla
rti
.endproc
.proc nmi
inc _sv_nmi_counter
rti
.endproc
; removing this segment gives only a warning
.segment "FFF0"
.proc reset32kcode
lda #(6<<5)
sta sv_bank
; now the 32kbyte image can reside in the top of 64kbyte, 128kbyte roms
jmp reset
.endproc
.segment "VECTOR"
.word nmi
.word reset32kcode
.word irq

View File

@@ -0,0 +1,76 @@
; supervision symbols
; supervision 65c02s
; in cc65 up to 2.9.1 65c02 means 65c02s
.pc02
lcd_addr = $4000
LCD_LINESIZE = $30
LCD_WIDTH = 160
LCD_HEIGHT = 160
; 2 bit per pixel, packed
lcd_width = $2000
lcd_height = $2001
lcd_xpos = $2002 ; in pixel, bit 0+1 not used
lcd_ypos = $2003 ; weird
sv_port_r = $2021
sv_port_w = $2022
sv_timer_count = $2023
; read for quitting
sv_timer_quit = $2024
; bit 0 timer, bit 1 dma
sv_irq_source = $2027
SV_IRQ_REQUEST_TIMER = 1
SV_IRQ_REQUEST_DMA = 2
; bit 5,6,7 select bank at 0x8000
sv_bank = $2026
SV_NMI_ENABLE_ON = 1
SV_IRQ_ENABLE_TIMER = 2
SV_IRQ_ENABLE_DMA = 4
SV_LCD_ON = 8
SV_TIMER_MODE_240Hz = $10 ; else 15360
; low activ/pressed
sv_control = $2020
SV_RIGHT = 1
SV_LEFT = 2
SV_DOWN = 4
SV_UP = 8
SV_BUTTONB = $10
SV_BUTTONA = $20
SV_SELECT = $40
SV_START = $80
; frequency=125000/counter
sv_audio_right_counter = $2010 ;word
sv_audio_left_counter = $2014
SV_AUDIO_ON =$40
;bits 0..3 volume
; bit 4 ?
; bit 5 ?
sv_audio_right_control = $2012
sv_audio_left_control = $2016
; write activates tone for x/60 sec (0 means 256)
sv_audio_right_timer = $2013
sv_audio_left_timer = $2017
;read for irq quitting
sv_dma_quit = $2025
sv_dma_on = $201c
; bit 7 true start, false stop
sv_dma_start = $2018 ; word
sv_dma_size = $201a ; *32 samples
sv_dma_control = $201b
; bit 0,1 speed: 0 15360, 11 15360/4
; bit 2,3 volume: 0 silent, 11 loud
sv_noise_volume = $2028 ; and frequency
sv_noise_timer = $2029
sv_noise_control = $202a