From 411cf4de1c9ddf0c5a92fad922ef9ddb6d661b85 Mon Sep 17 00:00:00 2001 From: Leo C Date: Sun, 11 Oct 2015 10:51:46 +0200 Subject: [PATCH] Generate version string and print it on boot. --- .gitignore | 6 +----- cbios/.gitignore | 5 ++++- cbios/Makefile | 56 +++++++++++++++++++++++++++++++++++++++++------- cbios/boot.180 | 7 +++--- 4 files changed, 57 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 5b6b28c..198acb1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -/cpm3bin -/cpm3src -/forensic -/for2 - +/no_vcs diff --git a/cbios/.gitignore b/cbios/.gitignore index babe1d8..659ccd6 100644 --- a/cbios/.gitignore +++ b/cbios/.gitignore @@ -6,4 +6,7 @@ *.rel *.hex *.spr -cpm3.sys +cpm3_*.sys +*.zip +autorevision.cache +version.inc diff --git a/cbios/Makefile b/cbios/Makefile index 7324f37..f8018d0 100644 --- a/cbios/Makefile +++ b/cbios/Makefile @@ -7,8 +7,30 @@ SRC += scb.180 INC := config.inc z180reg.inc z180.lib + OBJ := $(SRC:.180=.rel) + +$(foreach X,$(subst =,:=,$(filter VCS_%,\ + $(shell autorevision -t sh -o $(CURDIR)/autorevision.cache))),$(eval $X)) + +VERS := $(shell echo "$(VCS_TAG)" | sed -e 's/hexrel-/0./g' -e 's/^v//g') + +ifneq ($(VCS_TICK),"0") + VERS := $(VERS).$(subst ",,$(VCS_TICK)) +endif +ifneq ($(VCS_BRANCH),"master") + VERS := $(VERS)-$(subst ",,$(VCS_BRANCH)) +endif +ifeq ($(VCS_WC_MODIFIED),"1") + VERS := $(VERS)-dirty +endif + + +SYSFILE = cpm3_$(VERS).sys +MAPFILE = bnkbios3_$(VERS).map +ZIPFILE = cpm3_$(VERS).zip + #CP/M emulator CPMEMU = zxcc @@ -37,11 +59,23 @@ LN_DATA = F000 .phony: all all: sys -map: bnkbios3.map -sys: cpm3.sys +.phony: sys bios map +sys: $(SYSFILE) bios: bnkbios3.spr +map: $(MAPFILE) + +.phony: bin-dist +bin-dist: $(ZIPFILE) $(OBJ): $(INC) +boot.rel: version.inc + +version.inc: autorevision.cache + @echo update $@ + @echo "defvers macro\r\n\ + db '$(VERS)'\r\n\ + endm\r" > $@ + comma:= , empty:= @@ -102,15 +136,16 @@ PSEG = $(call SEGMENT-ADDR, 1) DSEG = $(call SEGMENT-ADDR, 2) #(call SEGMENT-ADDR,SEGNUM) -SEGMENT-ADDR = $(shell dd if=cpm3.sys bs=128 count=1 skip=1 2>/dev/null |\ +SEGMENT-ADDR = $(shell dd if=$(SYSFILE) bs=128 count=1 skip=1 2>/dev/null |\ awk -vn=$(strip $1) '/BNKBIOS3/ {if (++seg == n) print $$3}') -bnkbios3.map: cpm3.sys - ld80 -o /dev/null -ms bnkbios3.map -P $(PSEG) -D $(DSEG) $(OBJ) +$(MAPFILE): $(SYSFILE) + ld80 -o /dev/null -ms $@ -P $(PSEG) -D $(DSEG) $(OBJ) -cpm3.sys: bnkbios3.spr gencpm.dat +$(SYSFILE): bnkbios3.spr gencpm.dat zxcc gencpm -AUTO + @mv cpm3.sys $@ @echo @@ -122,12 +157,17 @@ bnkbios3.spr : $(OBJ) @$(cpm-asm) +$(ZIPFILE): $(SYSFILE) $(MAPFILE) + @rm -f $@ + zip -9 $@ $(SYSFILE) $(MAPFILE) + + .phony: clean realclean clean: - rm -f $(OBJ) $(OBJ:.rel=.lst) $(OBJ:.rel=.sym) + rm -f *.rel *.lst *.sym version.inc realclean: clean - rm -f *.prn *~ + rm -f *.map *.prn *~ #================================================================== diff --git a/cbios/boot.180 b/cbios/boot.180 index 7e8c063..5b55c29 100644 --- a/cbios/boot.180 +++ b/cbios/boot.180 @@ -13,6 +13,7 @@ extrn @civec,@covec,@aivec,@aovec,@lovec extrn @cbnk,?move,?xmove + include version.inc include config.inc include z180reg.inc @@ -77,9 +78,9 @@ hwini_skip: ld (@cbnk),a ; right now in bank 0 call pr.inln ; print signon message - db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS',13,10,0 - - call pr.inln + db 13,10,13,10,'CP/M Version 3.0, Z180-Stamp BIOS v' + defvers + db 13,10 db 'Estimated CPU clock [Hz]: ',0 ld hl,(f_cpu) -- 2.39.2