Browse Source

editor: implement F

pull/102/head
Virgil Dupras 4 years ago
parent
commit
2a578b3352
9 changed files with 27 additions and 17 deletions
  1. +2
    -4
      blk/064
  2. +1
    -2
      blk/101
  3. +1
    -1
      blk/102
  4. +3
    -6
      blk/104
  5. +6
    -1
      blk/105
  6. +1
    -3
      blk/106
  7. +12
    -0
      blk/107
  8. +1
    -0
      blk/464
  9. BIN
      emul/forth.bin

+ 2
- 4
blk/064 View File

@@ -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








+ 1
- 2
blk/101 View File

@@ -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.





+ 1
- 1
blk/102 View File

@@ -1,5 +1,5 @@
152 LOAD ( extras )
103 106 LOADR
103 107 LOADR

: BROWSE
100 _LIST


+ 3
- 6
blk/104 View File

@@ -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 -- )

+ 6
- 1
blk/105 View File

@@ -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


+ 1
- 3
blk/106 View File

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


+ 12
- 0
blk/107 View 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
- 0
blk/464 View File

@@ -8,5 +8,6 @@
( Whether buffer is dirty )
: BLKDTY 6 BLKMEM+ ;
: BLK( 8 BLKMEM+ ;
: BLK) BLK( 1024 + ;



BIN
emul/forth.bin View File


Loading…
Cancel
Save