diff --git a/blk/420 b/blk/420 index 70ceb17..98a8627 100644 --- a/blk/420 +++ b/blk/420 @@ -1 +1 @@ -1 7 LOADR+ ( xcomp core high ) +1 12 LOADR+ ( xcomp core high ) diff --git a/blk/426 b/blk/426 index 60f0030..5e25854 100644 --- a/blk/426 +++ b/blk/426 @@ -1,14 +1,12 @@ -( LITN has to be defined after the last immediate usage of - it to avoid bootstrapping issues ) -: LITN 32 , , ( 32 == NUMBER ) ; +: RDLNMEM+ 0x57 RAM+ @ + ; +( current position in INBUF ) +: IN> 0 RDLNMEM+ ; +( points to INBUF ) +: IN( 2 RDLNMEM+ ; +( points to INBUF's end ) +: IN) 0x40 ( buffer size ) 2+ RDLNMEM+ ; -: IMMED? 1- C@ 0x80 AND ; - -( ';' can't have its name right away because, when created, it - is not an IMMEDIATE yet and will not be treated properly by - xcomp. ) -: _ - ['] EXIT , - R> DROP ( exit : ) -; IMMEDIATE +( flush input buffer ) +( set IN> to IN( and set IN> @ to null ) +: (infl) 0 IN( DUP IN> ! ! ; diff --git a/blk/427 b/blk/427 index e109431..f3eb716 100644 --- a/blk/427 +++ b/blk/427 @@ -1,16 +1,16 @@ -XCURRENT @ ( to PSP ) -: : - (entry) - ( We cannot use LITN as IMMEDIATE because of bootstrapping - issues. Same thing for ",". - 32 == NUMBER 14 == compiledWord ) - [ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C, - BEGIN - WORD - (find) - ( is word ) - IF DUP IMMED? IF EXECUTE ELSE , THEN - ( maybe number ) - ELSE (parse) LITN THEN - AGAIN ; -( from PSP ) ';' SWAP 4 - C! +( handle backspace: go back one char in IN>, if possible, then + emit SPC + BS ) +: (inbs) + ( already at IN( ? ) + IN> @ IN( = IF EXIT THEN + IN> @ 1- IN> ! + SPC BS +; + +: KEY + 85 RAM+ @ ( (key) override ) + DUP IF EXECUTE ELSE DROP (key) THEN ; + + +( cont.: read one char into input buffer and returns whether we + should continue, that is, whether CR was not met. ) diff --git a/blk/449 b/blk/428 similarity index 100% rename from blk/449 rename to blk/428 diff --git a/blk/450 b/blk/429 similarity index 100% rename from blk/450 rename to blk/429 diff --git a/blk/451 b/blk/430 similarity index 64% rename from blk/451 rename to blk/430 index 47ccec0..38c1c92 100644 --- a/blk/451 +++ b/blk/430 @@ -2,11 +2,11 @@ : RDLN$ ( 57 == rdln's memory ) H@ 0x57 RAM+ ! - ( 2 for IN>, plus 2 for extra bytes after buffer: 1 for + ( plus 2 for extra bytes after buffer: 1 for the last typed 0x0a and one for the following NULL. ) - INBUFSZ 4 + ALLOT + IN) IN> - 2+ ALLOT (infl) - ['] RDLN< 0x0c RAM+ ! + LIT< RDLN< (find) DROP 0x0c RAM+ ! 1 0x06 RAM+ ! ( 06 == C DROP ( exit : ) +; IMMEDIATE + diff --git a/blk/432 b/blk/432 new file mode 100644 index 0000000..e109431 --- /dev/null +++ b/blk/432 @@ -0,0 +1,16 @@ +XCURRENT @ ( to PSP ) +: : + (entry) + ( We cannot use LITN as IMMEDIATE because of bootstrapping + issues. Same thing for ",". + 32 == NUMBER 14 == compiledWord ) + [ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] C, + BEGIN + WORD + (find) + ( is word ) + IF DUP IMMED? IF EXECUTE ELSE , THEN + ( maybe number ) + ELSE (parse) LITN THEN + AGAIN ; +( from PSP ) ';' SWAP 4 - C! diff --git a/blk/447 b/blk/447 deleted file mode 100644 index f436650..0000000 --- a/blk/447 +++ /dev/null @@ -1,13 +0,0 @@ -64 CONSTANT INBUFSZ -: RDLNMEM+ 0x57 RAM+ @ + ; -( current position in INBUF ) -: IN> 0 RDLNMEM+ ; -( points to INBUF ) -: IN( 2 RDLNMEM+ ; -( points to INBUF's end ) -: IN) INBUFSZ 2+ RDLNMEM+ ; - -( flush input buffer ) -( set IN> to IN( and set IN> @ to null ) -: (infl) 0 IN( DUP IN> ! ! ; - diff --git a/blk/448 b/blk/448 deleted file mode 100644 index f3eb716..0000000 --- a/blk/448 +++ /dev/null @@ -1,16 +0,0 @@ -( handle backspace: go back one char in IN>, if possible, then - emit SPC + BS ) -: (inbs) - ( already at IN( ? ) - IN> @ IN( = IF EXIT THEN - IN> @ 1- IN> ! - SPC BS -; - -: KEY - 85 RAM+ @ ( (key) override ) - DUP IF EXECUTE ELSE DROP (key) THEN ; - - -( cont.: read one char into input buffer and returns whether we - should continue, that is, whether CR was not met. ) diff --git a/emul/forth.bin b/emul/forth.bin index fee6f76..79cdcc5 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ