From 13cf2942019564c0b9edbb7024a6a914491b9ce6 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sat, 11 Apr 2020 15:11:36 -0400 Subject: [PATCH] rc2014/acia: adjust to latest developments --- drv/acia.fs | 12 ++++++++++++ drv/acia.z80 | 38 +++++++++++++++++++++----------------- forth/fmt.fs | 2 +- recipes/rc2014/Makefile | 21 ++++++++++++++------- recipes/rc2014/pre.fs | 2 +- 5 files changed, 49 insertions(+), 26 deletions(-) diff --git a/drv/acia.fs b/drv/acia.fs index a744576..2de4836 100644 --- a/drv/acia.fs +++ b/drv/acia.fs @@ -15,6 +15,18 @@ ACIA_MEM: Address in memory that can be used variables shared 0x20 CONSTANT ACIABUFSZ +( Points to ACIA buf ) +: ACIA( [ ACIA_MEM 4 + LITN ] ; +( Points to ACIA buf end ) +: ACIA) [ ACIA_MEM 6 + LITN ] ; +( Read buf pointer. Pre-inc ) +: ACIAR> [ ACIA_MEM LITN ] ; +( Write buf pointer. Post-inc ) +: ACIAW> [ ACIA_MEM 2 + LITN ] ; +( This means that if W> == R>, buffer is full. + If R>+1 == W>, buffer is empty. ) + + : ACIA$ H@ DUP DUP ACIA( ! ACIAR> ! 1 + ACIAW> ! ( write index starts one position later ) diff --git a/drv/acia.z80 b/drv/acia.z80 index 0d33d8b..2903ec5 100644 --- a/drv/acia.z80 +++ b/drv/acia.z80 @@ -3,18 +3,16 @@ ACIA_CTL : ACIA_CTL [ LITN ] ; ACIA_IO : ACIA_IO [ LITN ] ; -( Points to ACIA buf ) -: ACIA( [ ACIA_MEM 4 + LITN ] ; -( Points to ACIA buf end ) -: ACIA) [ ACIA_MEM 6 + LITN ] ; -( Read buf pointer. Pre-inc ) -: ACIAR> [ ACIA_MEM LITN ] ; -( Write buf pointer. Post-inc ) -: ACIAW> [ ACIA_MEM 2 + LITN ] ; -( This means that if W> == R>, buffer is full. - If R>+1 == W>, buffer is empty. ) +ACIA_MEM +: ACIA_MEM [ LITN ] ; +( Memory layout + +0 ACIAR> + +2 ACIAW> + +4 ACIA( + +6 ACIA) +) -(entry) ~ACIA +(xentry) ~ACIA AF PUSHqq, HL PUSHqq, DE PUSHqq, @@ -24,9 +22,11 @@ ACIA_IO 0x01 ANDn, ( is ACIA rcv buf full? ) JRZ, L2 FWR ( end, no, wrong interrupt cause. ) - ACIAW> LDHL(nn), + ( +2 == ACIAW> ) + ACIA_MEM 2 + LDHL(nn), ( is it == to ACIAR>? ) - DE ACIAR> LDdd(nn), + ( +0 == ACIAR> ) + DE ACIA_MEM LDdd(nn), ( carry cleared from ANDn above ) DE SBCHLss, JRZ, L3 FWR ( end, buffer full ) @@ -38,13 +38,17 @@ ACIA_IO ( advance W> ) HL INCss, - ACIAW> LD(nn)HL, - DE ACIA) LDdd(nn), + ( +2 == ACIAW> ) + ACIA_MEM 2 + LD(nn)HL, + ( +6 == ACIA) ) + DE ACIA_MEM 6 + LDdd(nn), DE SUBHLss, JRNZ, L4 FWR ( skip ) ( end of buffer reached ) - ACIA( LDHL(nn), - ACIAW> LD(nn)HL, + ( +4 == ACIA( ) + ACIA_MEM 4 + LDHL(nn), + ( +2 == ACIAW> ) + ACIA_MEM 2 + LD(nn)HL, L4 FSET ( skip ) L3 FSET L2 FSET ( end ) diff --git a/forth/fmt.fs b/forth/fmt.fs index ffc9afd..c9378f2 100644 --- a/forth/fmt.fs +++ b/forth/fmt.fs @@ -1,4 +1,4 @@ -( requires core, parse ) +( requires core, parse, cmp ) : _ 999 SWAP ( stop indicator ) diff --git a/recipes/rc2014/Makefile b/recipes/rc2014/Makefile index bfd3d0a..a987775 100644 --- a/recipes/rc2014/Makefile +++ b/recipes/rc2014/Makefile @@ -4,8 +4,18 @@ FDIR = $(BASEDIR)/forth EDIR = $(BASEDIR)/emul/forth STAGE2 = $(EDIR)/stage2 EMUL = $(BASEDIR)/emul/hw/rc2014/classic +BOOTSRCS = conf.fs \ + $(FDIR)/xcomp.fs \ + $(EDIR)/xcomp.fs \ + $(FDIR)/boot.fs \ + $(FDIR)/z80c.fs \ + $(BASEDIR)/drv/acia.z80 \ + $(FDIR)/icore.fs \ + $(EDIR)/xstop.fs + PATHS = pre.fs \ $(FDIR)/core.fs \ + $(FDIR)/cmp.fs \ $(FDIR)/str.fs \ $(FDIR)/parse.fs \ $(BASEDIR)/drv/acia.fs \ @@ -18,16 +28,13 @@ STRIPFC = $(BASEDIR)/tools/stripfc .PHONY: all all: $(TARGET) -$(TARGET): boot.bin z80c.bin $(SLATEST) $(PATHS) - cat boot.bin z80c.bin > $@ +$(TARGET): z80c.bin $(SLATEST) $(PATHS) + cp z80c.bin $@ $(SLATEST) $@ cat $(PATHS) | $(STRIPFC) >> $@ -z80c.bin: boot.bin - cat conf.fs $(FDIR)/z80c.fs $(BASEDIR)/drv/acia.z80 $(FDIR)/icore.fs | $(STAGE2) | tee $@ > /dev/null - -boot.bin: conf.fs - cat conf.fs $(FDIR)/boot.fs | $(STAGE2) | tee $@ > /dev/null +z80c.bin: conf.fs + cat $(BOOTSRCS) | $(STAGE2) > $@ $(SLATEST): $(MAKE) -C $(BASEDIR)/tools diff --git a/recipes/rc2014/pre.fs b/recipes/rc2014/pre.fs index ce990dd..7aac20a 100644 --- a/recipes/rc2014/pre.fs +++ b/recipes/rc2014/pre.fs @@ -1 +1 @@ -96 RAM+ HERE ! +128 RAM+ HERE !