From 044a0838a377fe17559a308bbb10ca21374e4ca1 Mon Sep 17 00:00:00 2001 From: Wayne Parham Date: Sun, 9 May 2021 16:51:17 -0500 Subject: [PATCH] Changes to existing cc65 source to support Synertek Systems Sym-1 --- README.md | 1 + libsrc/Makefile | 49 +++++++++++++++++++++++++++++++-------------- samples/Makefile | 30 ++++++++++++++++++++------- src/cc65/main.c | 3 +++ src/common/target.c | 2 ++ src/common/target.h | 1 + 6 files changed, 64 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 2c84b7430..c1b8a8b59 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/libsrc/Makefile b/libsrc/Makefile index 3fac513af..eee18d0da 100644 --- a/libsrc/Makefile +++ b/libsrc/Makefile @@ -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) - $($(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)) + diff --git a/src/cc65/main.c b/src/cc65/main.c index 0b156fb74..9e9fab6b4 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -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); } diff --git a/src/common/target.c b/src/common/target.c index a21ef2125..a35bf67a8 100644 --- a/src/common/target.c +++ b/src/common/target.c @@ -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 */ diff --git a/src/common/target.h b/src/common/target.h index 50c400e2e..7f85713cf 100644 --- a/src/common/target.h +++ b/src/common/target.h @@ -85,6 +85,7 @@ typedef enum { TGT_GAMATE, TGT_C65, TGT_CX16, + TGT_SYM1, TGT_COUNT /* Number of target systems */ } target_t;