diff --git a/blk/050 b/blk/050 index 80df44d..1c3616a 100644 --- a/blk/050 +++ b/blk/050 @@ -7,6 +7,7 @@ Memory C@ a -- c Set c to byte at address a C@+ a -- a+1 c Fetch c from a and inc a. C! c a -- Store byte c in address a +C!+ c a -- a+1 Store byte c in a and inc a. CURRENT -- a Set a to wordref of last added entry. CURRENT* -- a A pointer to active CURRENT*. Useful when we have multiple active dicts. diff --git a/blk/104 b/blk/104 index 10984e0..0dc69e8 100644 --- a/blk/104 +++ b/blk/104 @@ -1,5 +1,6 @@ ( Cursor position in buffer. EDPOS/64 is line number ) VARIABLE EDPOS +CREATE EDBUF 64 ALLOT : _cpos BLK( + ; : _lpos 64 * _cpos ; : _pln ( lineno -- ) @@ -7,7 +8,9 @@ VARIABLE EDPOS I EDPOS @ _cpos = IF '^' EMIT THEN I C@ DUP 0x20 < IF DROP 0x20 THEN EMIT - LOOP ( lno ) - 1+ . ; -( user-facing lines are 1-based ) -: T 1- DUP 64 * EDPOS ! _pln ; + 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 ; diff --git a/blk/105 b/blk/105 index aab4e3e..be76b66 100644 --- a/blk/105 +++ b/blk/105 @@ -1,16 +1,7 @@ -: P - EDPOS @ _cpos C< - 64 0 DO ( bpos c ) - DUP 0xd = IF DROP 0 THEN - 2DUP SWAP I + C! - DUP IF DROP C< THEN - LOOP - 2DROP - BLK!! -; - +( user-facing lines are 1-based ) +: T 1- DUP 64 * EDPOS ! _pln ; +: P _type EDBUF 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/155 b/blk/155 index 9d380a4..c8f89c8 100644 --- a/blk/155 +++ b/blk/155 @@ -1,6 +1,4 @@ : FILL ( a n b -- ) SWAP 2 PICK + ( a b a+n ) ROT ( b a+n a ) DO ( b ) DUP I C! - LOOP -; - + LOOP DROP ; diff --git a/blk/436 b/blk/436 index ae2d4ea..1bbd442 100644 --- a/blk/436 +++ b/blk/436 @@ -10,3 +10,5 @@ ( a -- a+1 c ) : C@+ DUP C@ SWAP 1+ SWAP ; +( c a -- a+1 ) +: C!+ SWAP OVER C! 1+ ; diff --git a/emul/forth.bin b/emul/forth.bin index 3316bad..3f040bc 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ