1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-02 08:30:55 +11:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Virgil Dupras
792c781614 editor: add cursor pos tracking and display 2020-04-30 20:42:07 -04:00
Virgil Dupras
07f807edee recipes/trs80: making progress on floppy drivers 2020-04-30 16:10:35 -04:00
15 changed files with 104 additions and 43 deletions

View File

@ -1,5 +1,5 @@
152 LOAD ( extras ) 152 LOAD ( extras )
103 105 LOADR 103 106 LOADR
: BROWSE : BROWSE
100 _LIST 100 _LIST

27
blk/104
View File

@ -1,16 +1,13 @@
( Line numbers for the user are 1-based, but in code, they're ( Cursor position in buffer. EDPOS/64 is line number )
0-based. )
VARIABLE EDPOS VARIABLE EDPOS
: _bpos 64 * BLK( + ; : _cpos BLK( + ;
: T 1- DUP EDPOS ! _bpos (print) CRLF ; : _lpos 64 * _cpos ;
: P : _pln ( lineno -- )
EDPOS @ _bpos C< DUP _lpos DUP 64 + SWAP DO ( lno )
64 0 DO ( bpos c ) I EDPOS @ _cpos = IF '^' EMIT THEN
DUP 0xd = IF DROP 0 THEN I C@ DUP 0x20 < IF DROP 0x20 THEN
2DUP SWAP I + C! EMIT
DUP IF DROP C< THEN LOOP ( lno )
LOOP 1+ . ;
2DROP ( user-facing lines are 1-based )
BLK!! : T 1- DUP 64 * EDPOS ! _pln ;
;

21
blk/105
View File

@ -1,11 +1,16 @@
: _mvln+ ( ln -- move ln 1 line further ) : P
DUP 14 > IF DROP EXIT THEN EDPOS @ _cpos C<
_bpos DUP 64 + 64 MOVE 64 0 DO ( bpos c )
DUP 0xd = IF DROP 0 THEN
2DUP SWAP I + C!
DUP IF DROP C< THEN
LOOP
2DROP
BLK!!
; ;
: U : _mvln+ ( ln -- move ln 1 line further )
15 EDPOS @ - 0 DO DUP 14 > IF DROP EXIT THEN
14 I - _mvln+ _lpos DUP 64 + 64 MOVE
LOOP
P
; ;

7
blk/106 Normal file
View File

@ -0,0 +1,7 @@
: U
15 EDPOS @ 64 / - 0 DO
14 I - _mvln+
LOOP
P
;

View File

@ -5,4 +5,4 @@ moment, they are thin layer over the drivers provided by
TRSDOS' SVC. TRSDOS' SVC.
Load the Z80 words with "492 LOAD" and the high level part 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 493 496 LOADR
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,

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