1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-24 14:28:06 +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
each. You refer to blocks by numbers. You show them with LIST.
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
block, it means that the next block continues the same kind of

View File

@ -1,4 +1,4 @@
MASTER INDEX
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
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
explorer interpreter. Typing "Q" quits the program.
Browse mode: If you execute BROWSE, the Forth interpreter is
replaced by browser's loop. Typing "Q" quits the browser.
Typing a decimal number followed by space or return lists the
contents of that block. B for previous block, N for next.
In this mode, typing a decimal number followed by space or
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
VARIABLE _K
103 LOAD 104 LOAD
: PGM
: BROWSE
100 _LIST
BEGIN
KEY
DUP 'Q' = IF DROP EXIT THEN
DUP 58 ( '9'+1 ) < IF _NUM
ELSE
_K ! _K (find) IF EXECUTE THEN
THEN
KEY CASE
'Q' OF DROP EXIT ENDOF
'B' OF B ENDOF
'N' OF N ENDOF
_NUM
ENDCASE
AGAIN
; PGM
;

View File

@ -5,5 +5,6 @@ VARIABLE ACC
IF _LIST 0 THEN
ACC !
;
: B BLK> @ 1- DUP BLK> ! _LIST ;
: N BLK> @ 1+ DUP BLK> ! _LIST ;
: L 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@
DUP BLK> = IF DROP EXIT THEN
DUP BLK> @ = IF DROP EXIT THEN
DUP BLK> ! BLK@* @ EXECUTE
;