editor: implement F
This commit is contained in:
parent
86539d2a03
commit
2a578b3352
6
blk/064
6
blk/064
@ -1,6 +1,8 @@
|
||||
Disk
|
||||
|
||||
BLK> -- a Address of the current block variable.
|
||||
BLK( -- a Beginning addr of blk buf.
|
||||
BLK) -- a Ending addr of blk buf.
|
||||
COPY s d -- Copy contents of s block to d block.
|
||||
FLUSH -- Write current block to disk if dirty.
|
||||
LIST n -- Prints the contents of the block n on screen
|
||||
@ -12,7 +14,3 @@ WIPE -- Empties current block
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
3
blk/101
3
blk/101
@ -1,8 +1,7 @@
|
||||
T ( n -- ): select line n for editing.
|
||||
P xxx: put typed line on selected line.
|
||||
U xxx: insert typed line on selected line.
|
||||
|
||||
|
||||
F xxx: find typed string in block.
|
||||
|
||||
|
||||
|
||||
|
2
blk/102
2
blk/102
@ -1,5 +1,5 @@
|
||||
152 LOAD ( extras )
|
||||
103 106 LOADR
|
||||
103 107 LOADR
|
||||
|
||||
: BROWSE
|
||||
100 _LIST
|
||||
|
9
blk/104
9
blk/104
@ -1,6 +1,7 @@
|
||||
( Cursor position in buffer. EDPOS/64 is line number )
|
||||
VARIABLE EDPOS
|
||||
CREATE EDBUF 64 ALLOT
|
||||
CREATE IBUF 64 ALLOT
|
||||
CREATE FBUF 64 ALLOT
|
||||
: _cpos BLK( + ;
|
||||
: _lpos 64 * _cpos ;
|
||||
: _pln ( lineno -- )
|
||||
@ -9,8 +10,4 @@ CREATE EDBUF 64 ALLOT
|
||||
I C@ DUP 0x20 < IF DROP 0x20 THEN
|
||||
EMIT
|
||||
LOOP ( lno ) 1+ . ;
|
||||
: _zbuf EDBUF 64 0 FILL ;
|
||||
: _type ( -- )
|
||||
C< DUP 0xd = IF DROP EXIT THEN _zbuf EDBUF BEGIN ( c a )
|
||||
C!+ C< SWAP OVER 0x0d = UNTIL ( c a )
|
||||
2DROP ;
|
||||
: _zbuf 64 0 FILL ; ( buf -- )
|
||||
|
7
blk/105
7
blk/105
@ -1,6 +1,11 @@
|
||||
: _type ( buf -- )
|
||||
C< DUP 0xd = IF DROP EXIT THEN OVER DUP _zbuf ( c a )
|
||||
BEGIN ( c a )
|
||||
C!+ C< SWAP
|
||||
OVER 0x0d = UNTIL ( c a ) C! ;
|
||||
( user-facing lines are 1-based )
|
||||
: T 1- DUP 64 * EDPOS ! _pln ;
|
||||
: P _type EDBUF EDPOS @ _cpos 64 MOVE BLK!! ;
|
||||
: P IBUF _type IBUF EDPOS @ _cpos 64 MOVE BLK!! ;
|
||||
: _mvln+ ( ln -- move ln 1 line further )
|
||||
DUP 14 > IF DROP EXIT THEN
|
||||
_lpos DUP 64 + 64 MOVE
|
||||
|
12
blk/107
Normal file
12
blk/107
Normal file
@ -0,0 +1,12 @@
|
||||
: F
|
||||
FBUF _type FBUF EDPOS @ _cpos ( a1 a2 )
|
||||
BEGIN
|
||||
C@+ ROT ( a2+1 c2 a1 ) C@+ ROT ( a2+1 a1+1 c1 c2 )
|
||||
= NOT IF DROP FBUF THEN
|
||||
SWAP OVER C@ 0xd = ( a1 a2 f1 )
|
||||
OVER BLK) = OR ( a1 a2 f1|f2 )
|
||||
UNTIL
|
||||
DUP BLK) < IF BLK( - FBUF + -^ EDPOS ! THEN
|
||||
EDPOS @ 64 / _pln
|
||||
;
|
||||
|
1
blk/464
1
blk/464
@ -8,5 +8,6 @@
|
||||
( Whether buffer is dirty )
|
||||
: BLKDTY 6 BLKMEM+ ;
|
||||
: BLK( 8 BLKMEM+ ;
|
||||
: BLK) BLK( 1024 + ;
|
||||
|
||||
|
||||
|
BIN
emul/forth.bin
BIN
emul/forth.bin
Binary file not shown.
Loading…
Reference in New Issue
Block a user