From f97df4614e16ffd6c1d9c83896a14e991cd04ace Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 28 Apr 2020 07:51:41 -0400 Subject: [PATCH] recipes/trs80: wip --- blk/160 | 8 ++++++++ blk/162 | 12 ++++++++++++ blk/209 | 2 +- blk/218 | 1 + blk/249 | 1 + blk/302 | 10 +++------- recipes/trs80/Makefile | 34 ++++++---------------------------- recipes/trs80/xcomp.fs | 23 +++++++++++++++++++++++ 8 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 blk/160 create mode 100644 blk/162 create mode 100644 recipes/trs80/xcomp.fs diff --git a/blk/160 b/blk/160 new file mode 100644 index 0000000..06d7576 --- /dev/null +++ b/blk/160 @@ -0,0 +1,8 @@ +TRS-80 Drivers + +Drivers for the TRS-80 keyboard, video and floppy. At the +moment, they are thin layer over the drivers provided by +TRSDOS' SVC. + +Load the Z80 words with "162 LOAD" and the high level part +with "164 LOAD". diff --git a/blk/162 b/blk/162 new file mode 100644 index 0000000..610aaf7 --- /dev/null +++ b/blk/162 @@ -0,0 +1,12 @@ +CODE KEY + A 0x01 LDrn, ( @KEY ) + 0x28 RSTn, + L A LDrr, H 0 LDrn, + HL PUSHqq, +;CODE + +CODE EMIT + BC POPqq ( c == @DSP arg ) + chkPS, + A 0x02 LDrn, ( @DSP ) +;CODE diff --git a/blk/209 b/blk/209 index 7547a52..527dcd7 100644 --- a/blk/209 +++ b/blk/209 @@ -3,7 +3,7 @@ OUT [nA, (C)r] IN [An, r(C)] SET [br] RES [br] BIT [br] RL [r] RLC [r] SLA [r] RLA RLCA RR [r] RRC [r] SRL [r] RRA RRCA -CALL [nn] DJNZ +CALL [nn] RST [n] DJNZ JP [nn, (HL), (IX), (IY)] JR [, Z, NZ, C, NC] diff --git a/blk/218 b/blk/218 index 02d28f1..d734316 100644 --- a/blk/218 +++ b/blk/218 @@ -8,3 +8,4 @@ OR A, ; 0x04 OP1r INCr, 0x05 OP1r DECr, +0xc7 OP1r RSTn, diff --git a/blk/249 b/blk/249 index 8223a05..c63d0f5 100644 --- a/blk/249 +++ b/blk/249 @@ -6,3 +6,4 @@ : PUSHZ, BC 0 LDddnn, IFZ, BC INCss, THEN, BC PUSHqq, ; : HLZ, A H LDrr, L ORr, ; : DEZ, A D LDrr, E ORr, ; +: LDDE(HL), E (HL) LDrr, HL INCss, D (HL) LDrr, ; diff --git a/blk/302 b/blk/302 index fc7f1fe..56881c2 100644 --- a/blk/302 +++ b/blk/302 @@ -1,16 +1,12 @@ -L1 BSET -PC ORG @ 0x0f + ! ( compiledWord ) +L1 BSET PC ORG @ 0x0f + ! ( compiledWord ) ( 1. Push current IP to RS 2. Set new IP to the second atom of the list 3. Execute the first atom of the list. ) IY PUSHqq, HL POPqq, ( <-- IP ) 0x11 BCALL, ( 11 == pushRS ) EXDEHL, ( HL points to PFA ) - ( While we increase, dereference into DE for execute call - later. ) - E (HL) LDrr, - HL INCss, - D (HL) LDrr, +( While we inc, dereference into DE for execute call later. ) + LDDE(HL), HL INCss, HL PUSHqq, IY POPqq, ( --> IP ) JR, L3 BWR ( execute-B301 ) diff --git a/recipes/trs80/Makefile b/recipes/trs80/Makefile index 2dea7f7..e50093c 100644 --- a/recipes/trs80/Makefile +++ b/recipes/trs80/Makefile @@ -1,30 +1,8 @@ -SHELLAPPS = zasm ed -APPTARGETS = ${SHELLAPPS:%=cfsin/%} -CFSTARGETS = $(APPTARGETS) cfsin/user.h -TARGET = os.bin -BASEDIR = ../.. -ZASM = $(BASEDIR)/emul/zasm/zasm -KERNEL = $(BASEDIR)/kernel -APPS = $(BASEDIR)/apps -CFSPACK = $(BASEDIR)/tools/cfspack/cfspack +TARGET = stage1.bin +EDIR = ../../emul +STAGE2 = $(EDIR)/stage2 .PHONY: all -all: $(TARGET) floppy.cfs -$(TARGET): glue.asm - $(ZASM) $(KERNEL) $(APPS) < glue.asm > $@ - -$(CFSPACK): - make -C $(BASEDIR)/tools/cfspack - -floppy.cfs: $(CFSTARGETS) $(CFSPACK) - $(CFSPACK) cfsin > $@ - -$(APPTARGETS): - $(ZASM) $(KERNEL) $(APPS) user.h < $(APPS)/${@:cfsin/%=%}/glue.asm > $@ - -cfsin/user.h: user.h - cp user.h $@ - -.PHONY: clean -clean: - rm -f $(CFSTARGETS) floppy.cfs $(TARGET) +all: $(TARGET) +$(TARGET): xcomp.fs $(STAGE2) + cat xcomp.fs | $(STAGE2) > $@ diff --git a/recipes/trs80/xcomp.fs b/recipes/trs80/xcomp.fs new file mode 100644 index 0000000..2cbeeee --- /dev/null +++ b/recipes/trs80/xcomp.fs @@ -0,0 +1,23 @@ +0x6000 CONSTANT RAMSTART +0xf000 CONSTANT RS_ADDR +212 LOAD ( z80 assembler ) +262 LOAD ( xcomp ) +: CODE XCODE ; +: IMMEDIATE XIMM ; +: (entry) (xentry) ; +: : [ ' X: , ] ; + +CURRENT @ XCURRENT ! + +H@ 256 /MOD 2 PC! 2 PC! +H@ XOFF ! +0x3000 BIN( ! +282 LOAD ( boot.z80 ) +162 LOAD ( trs80.z80 ) +393 LOAD ( icore ) +(entry) _ +( Update LATEST ) +PC XOFF @ 8 + ! +422 463 XPACKR ( core cmp print parse readln fmt ) +," : _ RDLN$ (ok) ; _ " +H@ 256 /MOD 2 PC! 2 PC!