mirror of
https://github.com/cc65/cc65.git
synced 2025-01-26 02:30:17 +00:00
New target supervision
git-svn-id: svn://svn.cc65.org/cc65/trunk@2497 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
e08261dff3
commit
6afee6fb05
@ -107,6 +107,10 @@ More special thanks to:
|
||||
|
||||
Stefan contributed several code snippets for the C64 and Apple ][.
|
||||
|
||||
* Peter Trauner <peter.trauner@utanet.at>
|
||||
|
||||
Peter added minimal Supervision support.
|
||||
|
||||
|
||||
|
||||
Thanks to
|
||||
|
113
include/supervision.h
Normal file
113
include/supervision.h
Normal file
@ -0,0 +1,113 @@
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
/* supervision.h */
|
||||
/* */
|
||||
/* Supervision specific definitions */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* 2003 Peter Trauner (trap@utanet.at) */
|
||||
/* */
|
||||
/* */
|
||||
/* This software is provided "as-is," without any expressed or implied */
|
||||
/* warranty. In no event will the authors be held liable for any damages */
|
||||
/* arising from the use of this software. */
|
||||
/* */
|
||||
/* Permission is granted to anyone to use this software for any purpose, */
|
||||
/* including commercial applications, and to alter and redistribute it */
|
||||
/* freely, subject to the following restrictions: */
|
||||
/* */
|
||||
/* 1. The origin of this software must not be misrepresented; you must not */
|
||||
/* claim that you wrote the original software. If you use this software */
|
||||
/* in a product, an acknowledgment, in the product's documentation, */
|
||||
/* would be appreciated, but is not required. */
|
||||
/* 2. Alterred source versions must be marked plainly as such, */
|
||||
/* and must not be misrepresented as being the original software. */
|
||||
/* 3. This notice may not be removed or alterred */
|
||||
/* from any source distribution. */
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _SUPERVISION_H
|
||||
#define _SUPERVISION_H
|
||||
|
||||
|
||||
|
||||
/* Check for errors */
|
||||
#if !defined(__SUPERVISION__)
|
||||
# error This module may only be used when compiling for the Supervision!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Data */
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
|
||||
struct __sv_lcd {
|
||||
unsigned char width;
|
||||
unsigned char height;
|
||||
unsigned char xpos;
|
||||
unsigned char ypos;
|
||||
};
|
||||
#define SV_LCD ((struct __sv_lcd*)0x2000)
|
||||
|
||||
struct __sv_tone {
|
||||
unsigned delay;
|
||||
unsigned char control;
|
||||
unsigned char timer;
|
||||
};
|
||||
#define SV_RIGHT ((struct __sv_tone*)0x2010)
|
||||
#define SV_LEFT ((struct __sv_tone*)0x2014)
|
||||
|
||||
struct __sv_noise {
|
||||
unsigned char volume; /* and frequency */
|
||||
unsigned char timer;
|
||||
unsigned char control;
|
||||
};
|
||||
#define SV_NOISE ((struct __sv_noise*)0x2028)
|
||||
|
||||
struct __io_port {
|
||||
unsigned char in;
|
||||
unsigned char out;
|
||||
};
|
||||
#define IO_PORT ((struct __io_port*)(0x2021)
|
||||
|
||||
struct __sv_dma {
|
||||
unsigned start;
|
||||
unsigned char size;
|
||||
unsigned char control;
|
||||
unsigned char on;
|
||||
};
|
||||
#define SV_DMA ((struct __sv_dma*)0x2018)
|
||||
|
||||
#define SV_CONTROL (*(unsigned char*)0x2020)
|
||||
|
||||
#define SV_BANK (*(unsigned char*)0x2026)
|
||||
#define SV_BANK_COMBINE(nmi,irq_timer,irq_dma,lcd_on, timer_prescale, bank) \
|
||||
((nmi)?1:0)|((irq_timer)?2:0)|((irq_dma)?4:0)|((lcd_on)?8:0) \
|
||||
|((timer_prescale)?0x10:0)|((bank)<<5)
|
||||
|
||||
#define SV_VIDEO ((unsigned char*)0x4000)
|
||||
#define SV_TIMER_COUNT (*(unsigned char*)0x2023)
|
||||
|
||||
|
||||
|
||||
/* Counters incremented asynchronously!
|
||||
* If you want more complex, copy the crt0.s file from the libsrc/supervision
|
||||
* directory and code them yourself (in assembler)
|
||||
*/
|
||||
extern unsigned char sv_nmi_counter;
|
||||
extern unsigned char sv_timer_irq_counter;
|
||||
extern unsigned char sv_timer_dma_counter;
|
||||
|
||||
|
||||
|
||||
/* End of supervision.h */
|
||||
#endif
|
||||
|
||||
|
@ -13,19 +13,20 @@ CC = ../../src/cc65/cc65
|
||||
LD = ../../src/ld65/ld65
|
||||
|
||||
# List of all targets
|
||||
ALLTARGETS = apple2 \
|
||||
atari \
|
||||
atmos \
|
||||
c16 \
|
||||
c128 \
|
||||
c64 \
|
||||
cbm510 \
|
||||
cbm610 \
|
||||
geos \
|
||||
nes \
|
||||
pet \
|
||||
plus4 \
|
||||
vic20 \
|
||||
ALLTARGETS = apple2 \
|
||||
atari \
|
||||
atmos \
|
||||
c16 \
|
||||
c128 \
|
||||
c64 \
|
||||
cbm510 \
|
||||
cbm610 \
|
||||
geos \
|
||||
nes \
|
||||
pet \
|
||||
plus4 \
|
||||
supervision \
|
||||
vic20
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
|
||||
@ -81,22 +82,6 @@ atmoslib:
|
||||
done
|
||||
mv atmos/crt0.o atmos.o
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Vic20
|
||||
|
||||
vic20lib:
|
||||
for i in vic20 cbm common runtime conio dbg em joystick tgi zlib; do \
|
||||
AS=$(AS) \
|
||||
CC=$(CC) \
|
||||
LD=$(LD) \
|
||||
AFLAGS="-t vic20 -I../../asminc" \
|
||||
CFLAGS="-Osir -g -T -t vic20 --forget-inc-paths -I. -I../../include" \
|
||||
$(MAKE) -C $$i || exit 1; \
|
||||
$(AR) a vic20.lib $$i/*.o;\
|
||||
done
|
||||
mv vic20/crt0.o vic20.o
|
||||
cp vic20/*.joy .
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# C16, C116
|
||||
|
||||
@ -261,6 +246,37 @@ plus4lib:
|
||||
mv plus4/crt0.o plus4.o
|
||||
cp plus4/*.joy .
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Supervision
|
||||
|
||||
supervisionlib:
|
||||
for i in supervision common runtime; do \
|
||||
CC=$(CC) \
|
||||
AS=$(AS) \
|
||||
LD=$(LD) \
|
||||
AFLAGS="-t supervision -I../../asminc" \
|
||||
CFLAGS="-Osir -g -T -t supervision --forget-inc-paths -I. -I../../include" \
|
||||
$(MAKE) -C $$i || exit 1; \
|
||||
$(AR) a supervision.lib $$i/*.o;\
|
||||
done
|
||||
mv supervision/crt0.o supervision.o
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Vic20
|
||||
|
||||
vic20lib:
|
||||
for i in vic20 cbm common runtime conio dbg em joystick tgi zlib; do \
|
||||
AS=$(AS) \
|
||||
CC=$(CC) \
|
||||
LD=$(LD) \
|
||||
AFLAGS="-t vic20 -I../../asminc" \
|
||||
CFLAGS="-Osir -g -T -t vic20 --forget-inc-paths -I. -I../../include" \
|
||||
$(MAKE) -C $$i || exit 1; \
|
||||
$(AR) a vic20.lib $$i/*.o;\
|
||||
done
|
||||
mv vic20/crt0.o vic20.o
|
||||
cp vic20/*.joy .
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Dummy targets
|
||||
|
||||
|
35
libsrc/supervision/Makefile
Normal file
35
libsrc/supervision/Makefile
Normal 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
81
libsrc/supervision/crt0.s
Normal 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
|
||||
|
||||
|
76
libsrc/supervision/supervision.inc
Normal file
76
libsrc/supervision/supervision.inc
Normal 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
|
@ -215,7 +215,11 @@ static void SetSys (const char* Sys)
|
||||
DefineNumericMacro ("__NES__", 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
case TGT_SUPERVISION:
|
||||
DefineNumericMacro ("__SUPERVISION__", 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
AbEnd ("Unknown target system type %d", Target);
|
||||
}
|
||||
|
||||
|
@ -158,6 +158,7 @@ void TgtTranslateInit (void)
|
||||
case TGT_LUNIX: memcpy (Tab, CTNone, sizeof (Tab)); break;
|
||||
case TGT_ATMOS: memcpy (Tab, CTNone, sizeof (Tab)); break;
|
||||
case TGT_NES: memcpy (Tab, CTNone, sizeof (Tab)); break;
|
||||
case TGT_SUPERVISION: memcpy (Tab, CTNone, sizeof (Tab)); break;
|
||||
default:
|
||||
AbEnd ("Internal error: Target system unknown (%d)", Target);
|
||||
}
|
||||
@ -219,4 +220,4 @@ void TgtTranslateSet (unsigned Index, unsigned char C)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user