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

Block explorer upgraded to block editor!

This commit is contained in:
Virgil Dupras 2020-04-16 15:59:43 -04:00
parent 5067d40e3b
commit 57e20f0532
8 changed files with 42 additions and 21 deletions

View File

@ -4,7 +4,7 @@ This is a Forth-style filesystems which is very simple. It is a
list of 1024 bytes block, organised in 16 lines of 64 columns list of 1024 bytes block, organised in 16 lines of 64 columns
each. You refer to blocks by numbers. You show them with LIST. each. You refer to blocks by numbers. You show them with LIST.
You interpret them with LOAD. For a convenient way to browse You interpret them with LOAD. For a convenient way to browse
blocks, see Block Explorer at B100. blocks, see Block editor at B100.
Conventions: When you see "(cont.)" at the bottom right of a Conventions: When you see "(cont.)" at the bottom right of a
block, it means that the next block continues the same kind of block, it means that the next block continues the same kind of

View File

@ -1,4 +1,4 @@
MASTER INDEX MASTER INDEX
3 Usage 30 Dictionary 3 Usage 30 Dictionary
70 Implementation notes 100 Block explorer 70 Implementation notes 100 Block editor

18
blk/100
View File

@ -1,10 +1,16 @@
Block explorer Block editor
This is an application to conveniently browse the contents of This is an application to conveniently browse the contents of
the disk blocks. You can launch it with "102 LOAD". the disk blocks and edit them. You can load it with "102 LOAD".
USAGE: When loaded, the Forth interpreter is replaced by the Browse mode: If you execute BROWSE, the Forth interpreter is
explorer interpreter. Typing "Q" quits the program. replaced by browser's loop. Typing "Q" quits the browser.
Typing a decimal number followed by space or return lists the In this mode, typing a decimal number followed by space or
contents of that block. B for previous block, N for next. return lists the contents of that block. B for previous block,
N for next.
When not in browse mode, your prompt is a regular Forth prompt
with editor words loaded.
(cont.)

2
blk/101 Normal file
View File

@ -0,0 +1,2 @@
T ( n -- ): select line n for editing.
P xxx(return): put typed line on selected line.

19
blk/102
View File

@ -1,14 +1,13 @@
103 LOAD 103 LOAD 104 LOAD
VARIABLE _K
: PGM : BROWSE
100 _LIST 100 _LIST
BEGIN BEGIN
KEY KEY CASE
DUP 'Q' = IF DROP EXIT THEN 'Q' OF DROP EXIT ENDOF
DUP 58 ( '9'+1 ) < IF _NUM 'B' OF B ENDOF
ELSE 'N' OF N ENDOF
_K ! _K (find) IF EXECUTE THEN _NUM
THEN ENDCASE
AGAIN AGAIN
; PGM ;

View File

@ -5,5 +5,6 @@ VARIABLE ACC
IF _LIST 0 THEN IF _LIST 0 THEN
ACC ! ACC !
; ;
: B BLK> @ 1- DUP BLK> ! _LIST ; : L BLK> @ _LIST ;
: N BLK> @ 1+ DUP BLK> ! _LIST ; : B BLK> @ 1- BLK> ! L ;
: N BLK> @ 1+ BLK> ! L ;

13
blk/104 Normal file
View File

@ -0,0 +1,13 @@
( Line numbers for the user are 1-based, but in code, they're
0-based. )
VARIABLE EDPOS
: _bpos 64 * BLK( + ;
: T 1- DUP EDPOS ! _bpos (print) CRLF ;
: P
EDPOS @ _bpos C<
64 0 DO ( bpos c )
DUP 0xd = IF DROP 0 THEN
2DUP SWAP I + C!
DUP IF DROP C< THEN
LOOP
;

View File

@ -20,7 +20,7 @@
; ;
: BLK@ : BLK@
DUP BLK> = IF DROP EXIT THEN DUP BLK> @ = IF DROP EXIT THEN
DUP BLK> ! BLK@* @ EXECUTE DUP BLK> ! BLK@* @ EXECUTE
; ;