recipes/trs80: making progress on floppy drivers

This commit is contained in:
Virgil Dupras 2020-04-30 16:10:35 -04:00
parent 65f359bda4
commit 07f807edee
11 changed files with 71 additions and 19 deletions

View File

@ -5,4 +5,4 @@ moment, they are thin layer over the drivers provided by
TRSDOS' SVC.
Load the Z80 words with "492 LOAD" and the high level part
with "494 LOAD".
with "498 LOAD".

17
blk/492
View File

@ -1,16 +1 @@
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 )
0x28 RSTn,
;CODE
CODE BYE
HL 0 LDddnn,
A 0x16 LDrn, ( @EXIT )
0x28 RSTn,
493 496 LOADR

16
blk/493 Normal file
View File

@ -0,0 +1,16 @@
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 )
0x28 RSTn,
;CODE
CODE BYE
HL 0 LDddnn,
A 0x16 LDrn, ( @EXIT )
0x28 RSTn,

7
blk/494 Normal file
View File

@ -0,0 +1,7 @@
CODE DCSTAT ( drv -- f )
BC POPqq,
chkPS,
A 0x28 LDrn, ( @DCSTAT )
0x28 RSTn,
PUSHZ,
;CODE

10
blk/495 Normal file
View File

@ -0,0 +1,10 @@
CODE RDSEC ( drv cylsec addr -- f )
HL POPqq,
DE POPqq,
BC POPqq,
chkPS,
A 0x31 LDrn, ( @RDSEC )
0x28 RSTn,
PUSHZ,
;CODE

11
blk/496 Normal file
View File

@ -0,0 +1,11 @@
CODE WRSEC ( drv cylsec addr -- f )
HL POPqq,
DE POPqq,
BC POPqq,
chkPS,
A 0x35 LDrn, ( @WRSEC )
0x28 RSTn,
PUSHZ,
;CODE

1
blk/498 Normal file
View File

@ -0,0 +1 @@
499 500 LOADR

16
blk/499 Normal file
View File

@ -0,0 +1,16 @@
: _err ABORT" FDerr" ;
: _cylsec ( sec -- cs, return sector/cylinder for given secid )
( 4 256b sectors per block, 10 sec per cyl, 40 cyl max )
10 /MOD ( sec cyl )
DUP 39 > IF _err THEN
256 * + ( cylsec )
;
: FD@! ( wref blk -- )
1 DCSTAT NOT IF _err THEN
4 * ( wr sec )
4 0 DO ( wr sec )
DUP I + _cylsec ( wr sec cs )
I 256 * BLK( + ( wr sec cs addr )
1 ROT ROT ( wr sec drv cs addr )
4 PICK EXECUTE NOT IF _err THEN
LOOP 2DROP ;

4
blk/500 Normal file
View File

@ -0,0 +1,4 @@
: FD@ ['] RDSEC SWAP FD@! ;
: FD! ['] WRSEC SWAP FD@! ;
: FD$ ['] FD@ BLK@* ! ['] FD! BLK!* ! ;

1
blk/501 Normal file
View File

@ -0,0 +1 @@

View File

@ -18,6 +18,7 @@ H@ 256 /MOD 2 PC! 2 PC!
( Update LATEST )
PC ORG @ 8 + !
," CURRENT @ HERE ! "
422 463 XPACKR ( core cmp print parse readln fmt )
," : _ RDLN$ (ok) ; _ "
422 470 XPACKR ( core cmp print parse readln fmt blk )
499 500 XPACKR ( trs80.fs )
," : _ BLK$ FD$ (ok) RDLN$ ; _ "
H@ 256 /MOD 2 PC! 2 PC!