1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 12:18:07 +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]
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]

View File

@ -8,3 +8,4 @@
OR A,
;
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, ;
: HLZ, A H LDrr, L 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
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 )

View File

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

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!