1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-05 08:50:56 +11:00

recipes/trs80: wip

This commit is contained in:
Virgil Dupras 2020-04-28 07:51:41 -04:00
parent b8ea515612
commit f97df4614e
8 changed files with 55 additions and 36 deletions

8
blk/160 Normal file
View File

@ -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".

12
blk/162 Normal file
View File

@ -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

View File

@ -3,7 +3,7 @@ OUT [nA, (C)r] IN [An, r(C)]
SET [br] RES [br] BIT [br] SET [br] RES [br] BIT [br]
RL [r] RLC [r] SLA [r] RLA RLCA RL [r] RLC [r] SLA [r] RLA RLCA
RR [r] RRC [r] SRL [r] RRA RRCA RR [r] RRC [r] SRL [r] RRA RRCA
CALL [nn] DJNZ CALL [nn] RST [n] DJNZ
JP [nn, (HL), (IX), (IY)] JP [nn, (HL), (IX), (IY)]
JR [, Z, NZ, C, NC] JR [, Z, NZ, C, NC]

View File

@ -8,3 +8,4 @@
OR A, OR A,
; ;
0x04 OP1r INCr, 0x05 OP1r DECr, 0x04 OP1r INCr, 0x05 OP1r DECr,
0xc7 OP1r RSTn,

View File

@ -6,3 +6,4 @@
: PUSHZ, BC 0 LDddnn, IFZ, BC INCss, THEN, BC PUSHqq, ; : PUSHZ, BC 0 LDddnn, IFZ, BC INCss, THEN, BC PUSHqq, ;
: HLZ, A H LDrr, L ORr, ; : HLZ, A H LDrr, L ORr, ;
: DEZ, A D LDrr, E ORr, ; : DEZ, A D LDrr, E ORr, ;
: LDDE(HL), E (HL) LDrr, HL INCss, D (HL) LDrr, ;

10
blk/302
View File

@ -1,16 +1,12 @@
L1 BSET L1 BSET PC ORG @ 0x0f + ! ( compiledWord )
PC ORG @ 0x0f + ! ( compiledWord )
( 1. Push current IP to RS ( 1. Push current IP to RS
2. Set new IP to the second atom of the list 2. Set new IP to the second atom of the list
3. Execute the first atom of the list. ) 3. Execute the first atom of the list. )
IY PUSHqq, HL POPqq, ( <-- IP ) IY PUSHqq, HL POPqq, ( <-- IP )
0x11 BCALL, ( 11 == pushRS ) 0x11 BCALL, ( 11 == pushRS )
EXDEHL, ( HL points to PFA ) EXDEHL, ( HL points to PFA )
( While we increase, dereference into DE for execute call ( While we inc, dereference into DE for execute call later. )
later. ) LDDE(HL),
E (HL) LDrr,
HL INCss,
D (HL) LDrr,
HL INCss, HL INCss,
HL PUSHqq, IY POPqq, ( --> IP ) HL PUSHqq, IY POPqq, ( --> IP )
JR, L3 BWR ( execute-B301 ) JR, L3 BWR ( execute-B301 )

View File

@ -1,30 +1,8 @@
SHELLAPPS = zasm ed TARGET = stage1.bin
APPTARGETS = ${SHELLAPPS:%=cfsin/%} EDIR = ../../emul
CFSTARGETS = $(APPTARGETS) cfsin/user.h STAGE2 = $(EDIR)/stage2
TARGET = os.bin
BASEDIR = ../..
ZASM = $(BASEDIR)/emul/zasm/zasm
KERNEL = $(BASEDIR)/kernel
APPS = $(BASEDIR)/apps
CFSPACK = $(BASEDIR)/tools/cfspack/cfspack
.PHONY: all .PHONY: all
all: $(TARGET) floppy.cfs all: $(TARGET)
$(TARGET): glue.asm $(TARGET): xcomp.fs $(STAGE2)
$(ZASM) $(KERNEL) $(APPS) < glue.asm > $@ cat xcomp.fs | $(STAGE2) > $@
$(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)

23
recipes/trs80/xcomp.fs Normal file
View File

@ -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!