diff --git a/blk/064 b/blk/064 index abad1c3..dc1403a 100644 --- a/blk/064 +++ b/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 - - - - diff --git a/blk/101 b/blk/101 index 8ee99e6..2089d4b 100644 --- a/blk/101 +++ b/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. diff --git a/blk/102 b/blk/102 index 7d9b549..4207cd7 100644 --- a/blk/102 +++ b/blk/102 @@ -1,5 +1,5 @@ 152 LOAD ( extras ) -103 106 LOADR +103 107 LOADR : BROWSE 100 _LIST diff --git a/blk/104 b/blk/104 index 0dc69e8..8357dfa 100644 --- a/blk/104 +++ b/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 -- ) diff --git a/blk/105 b/blk/105 index be76b66..c62e3c5 100644 --- a/blk/105 +++ b/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 diff --git a/blk/106 b/blk/106 index 5219028..2029994 100644 --- a/blk/106 +++ b/blk/106 @@ -1,7 +1,5 @@ : U 15 EDPOS @ 64 / - 0 DO 14 I - _mvln+ - LOOP - P + LOOP P ; - diff --git a/blk/107 b/blk/107 new file mode 100644 index 0000000..61d2a71 --- /dev/null +++ b/blk/107 @@ -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 +; + diff --git a/blk/464 b/blk/464 index b239bce..a7f9e3a 100644 --- a/blk/464 +++ b/blk/464 @@ -8,5 +8,6 @@ ( Whether buffer is dirty ) : BLKDTY 6 BLKMEM+ ; : BLK( 8 BLKMEM+ ; +: BLK) BLK( 1024 + ; diff --git a/emul/forth.bin b/emul/forth.bin index cc41813..9cc0dfb 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ