Changes to existing cc65 source to support Synertek Systems Sym-1

This commit is contained in:
Wayne Parham 2021-05-09 16:51:17 -05:00
parent 6e79379405
commit 044a0838a3
6 changed files with 64 additions and 22 deletions

View File

@ -36,6 +36,7 @@ including
- the Lynx console.
- the Ohio Scientific Challenger 1P.
- the Commander X16.
- the Synertek Syetms Sym-1.
The libraries are fairly portable, so creating a version for other 6502s
shouldn't be too much work.

View File

@ -34,6 +34,7 @@ TARGETS = apple2 \
sim6502 \
sim65c02 \
supervision \
sym1 \
telestrat
DRVTYPES = emd \
@ -148,18 +149,26 @@ GEOSDIRS = common \
runtime \
system
# MACHINE set independently of TARGET lets us easily define new targets
# without changing target.h and target.c in cc65/src/common. Useful
# for initial testing of ports to new systems.
ifeq ($(TARGET),apple2enh)
SRCDIR = apple2
OBJPFX = a2
DRVPFX = a2e
MACHINE = $(TARGET)
else ifeq ($(TARGET),atarixl)
SRCDIR = atari
OBJPFX = atr
DRVPFX = atrx
MACHINE = $(TARGET)
else ifeq ($(TARGET),sim65c02)
SRCDIR = sim6502
MACHINE = $(TARGET)
else
SRCDIR = $(TARGET)
MACHINE = $(TARGET)
endif
SRCDIRS = $(SRCDIR)
@ -173,16 +182,26 @@ ifeq ($(TARGET),$(filter $(TARGET),$(GEOS)))
SRCDIRS += $(addprefix geos-common/,$(GEOSDIRS))
endif
SRCDIRS += common \
conio \
dbg \
em \
joystick \
mouse \
runtime \
serial \
tgi \
zlib
ifeq ($(TARGET),sym1)
SRCDIRS += common \
conio \
dbg \
em \
runtime \
serial \
sym1
else
SRCDIRS += common \
conio \
dbg \
em \
joystick \
mouse \
runtime \
serial \
tgi \
zlib
endif
vpath %.s $(SRCDIRS)
vpath %.c $(SRCDIRS)
@ -231,7 +250,7 @@ $1_DRVS = $$(patsubst $$($1_DYNPAT),$$($1_DRVPAT),$$($1_DYNS))
$$($1_STCPAT): $$($1_SRCPAT)
@echo $$(TARGET) - $$< - static
@$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
@$$(CA65) -t $$(MACHINE) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
OBJS += $$($1_STCS)
DEPS += $$($1_STCS:.o=.d)
@ -263,15 +282,15 @@ export CC65_HOME := $(abspath ..)
define ASSEMBLE_recipe
$(if $(QUIET),,@echo $(TARGET) - $<)
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
@$(CA65) -t $(MACHINE) $(CA65FLAGS) --create-dep $(@:.o=.d) -o $@ $<
endef # ASSEMBLE_recipe
define COMPILE_recipe
$(if $(QUIET),,@echo $(TARGET) - $<)
@$(CC65) -t $(TARGET) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
@$(CA65) -t $(TARGET) -o $@ $(@:.o=.s)
@$(CC65) -t $(MACHINE) $(CC65FLAGS) --create-dep $(@:.o=.d) --dep-target $@ -o $(@:.o=.s) $<
@$(CA65) -t $(MACHINE) -o $@ $(@:.o=.s)
endef # COMPILE_recipe
@ -283,7 +302,7 @@ endef # COMPILE_recipe
$(EXTRA_OBJPAT): $(EXTRA_SRCPAT) | ../libwrk/$(TARGET) ../lib
@echo $(TARGET) - $(<F)
@$(CA65) -t $(TARGET) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
@$(CA65) -t $(MACHINE) $(CA65FLAGS) --create-dep $(@:../lib/%.o=../libwrk/$(TARGET)/%.d) -o $@ $<
../lib/$(TARGET).lib: $(OBJS) | ../lib
$(AR65) a $@ $?

View File

@ -135,31 +135,37 @@ LDFLAGS_tgidemo_atarixl = --start-addr 0x4000
%: %.s
.c.o:
$(CC) $(CFLAGS) -Ors --codesize 500 -T -g -t $(SYS) $<
$(CC) $(CFLAGS) -Ors --codesize 500 -T -g -t $(MACHINE) $<
$(AS) $(<:.c=.s)
.s.o:
$(AS) $(ASFLAGS) -t $(SYS) $<
$(AS) $(ASFLAGS) -t $(MACHINE) $<
.PRECIOUS: %.o
.o:
ifeq ($(SYS),vic20)
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -C vic20-32k.cfg -m $@.map $^ $(SYS).lib
else ifeq ($(SYS),sym1)
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@.bin -C sym1.cfg -m $@.map $^ $(SYS).lib
else
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(SYS) -m $@.map $^ $(SYS).lib
$(LD) $(LDFLAGS_$(@F)_$(SYS)) $(LDFLAGS) -o $@ -t $(MACHINE) -m $@.map $^ $(SYS).lib
endif
# --------------------------------------------------------------------------
# Lists of subdirectories
# disasm depends on cpp
DIRLIST = tutorial geos
ifneq ($(SYS),sym1)
DIRLIST = tutorial geos
endif
# --------------------------------------------------------------------------
# Lists of executables
EXELIST_c64 = \
helloworld \
ascii \
enumdevdir \
fire \
@ -175,6 +181,7 @@ EXELIST_c64 = \
tgidemo
EXELIST_apple2 = \
helloworld \
ascii \
diodemo \
enumdevdir \
@ -190,6 +197,7 @@ EXELIST_apple2 = \
EXELIST_apple2enh = $(EXELIST_apple2)
EXELIST_atari = \
helloworld \
ascii \
gunzip65 \
hello \
@ -208,6 +216,12 @@ EXELIST_atari2600 = \
EXELIST_supervision = \
supervisionhello
EXELIST_sym1 = \
helloworld \
symHello \
symTiny \
symDisplay
# Unlisted targets will try to build everything.
# That lets us learn what they cannot build, and what settings
# we need to use for programs that can be built and run.
@ -215,12 +229,13 @@ ifndef EXELIST_$(SYS)
EXELIST_$(SYS) := ${patsubst %.c,%,$(wildcard *.c)}
endif
define SUBDIR_recipe
define SUBDIR_recipe
@$(MAKE) -C $(dir) --no-print-directory $@
endef # SUBDIR_recipe
# --------------------------------------------------------------------------
# Rules to make the binaries and the disk
@ -352,9 +367,10 @@ zip:
# Clean-up rules
mostlyclean:
@$(DEL) *.lbl *.map *.o *.s 2>$(NULLDEV)
@$(DEL) *.lbl *.map *.bin *.hex *.o *.s 2>$(NULLDEV)
clean: mostlyclean
@$(DEL) $(EXELIST_$(SYS)) $(DISK_$(SYS)) 2>$(NULLDEV)
@$(DEL) multdemo.? ovrldemo.? 2>$(NULLDEV)
$(foreach dir,$(DIRLIST),$(SUBDIR_recipe))
@$(foreach dir,$(DIRLIST),$(SUBDIR_recipe))

View File

@ -290,6 +290,9 @@ static void SetSys (const char* Sys)
cbmsys ("__CX16__");
break;
case TGT_NONE:
break;
default:
AbEnd ("Unknown target system type %d", Target);
}

View File

@ -174,6 +174,7 @@ static const TargetEntry TargetMap[] = {
{ "sim6502", TGT_SIM6502 },
{ "sim65c02", TGT_SIM65C02 },
{ "supervision", TGT_SUPERVISION },
{ "sym1", TGT_SYM1 },
{ "telestrat", TGT_TELESTRAT },
{ "vic20", TGT_VIC20 },
};
@ -215,6 +216,7 @@ static const TargetProperties PropertyTable[TGT_COUNT] = {
{ "gamate", CPU_6502, BINFMT_BINARY, CTNone },
{ "c65", CPU_4510, BINFMT_BINARY, CTPET },
{ "cx16", CPU_65C02, BINFMT_BINARY, CTPET },
{ "sym1", CPU_6502, BINFMT_BINARY, CTNone },
};
/* Target system */

View File

@ -85,6 +85,7 @@ typedef enum {
TGT_GAMATE,
TGT_C65,
TGT_CX16,
TGT_SYM1,
TGT_COUNT /* Number of target systems */
} target_t;