diff --git a/blk/130 b/blk/130 index 1d18fc1..53f1914 100644 --- a/blk/130 +++ b/blk/130 @@ -4,7 +4,8 @@ SWAP _cpos FBUF ( len src dst ) ROT MOVE ; : $R ( replace mode ) mode! 'R' EMIT - BEGIN setpos KEY DUP 0x20 >= IF + BEGIN setpos KEY DUP BS? IF -1 EDPOS +! DROP 0 THEN + DUP 0x20 >= IF DUP EMIT EDPOS @ _cpos C! 1 EDPOS +! BLK!! 0 THEN UNTIL mode! SPC contents ; : $O EDPOS @ 0x3c0 ( 15 * 64 ) >= IF EXIT THEN @@ -13,4 +14,3 @@ : $D $H 64 icpy acc@ 0 DO 16 EDPOS @ 64 / DO i _mvln- LOOP LOOP BLK!! contents ; - diff --git a/blk/378 b/blk/378 index 5333eb6..9ade3d1 100644 --- a/blk/378 +++ b/blk/378 @@ -12,3 +12,5 @@ + + diff --git a/blk/387 b/blk/387 index a111a47..cd7491c 100644 --- a/blk/387 +++ b/blk/387 @@ -1,16 +1,16 @@ ( handle backspace: go back one char in IN>, if possible, then emit BS + SPC + BS ) -: (inbs) +: _bs ( already at IN( ? ) IN> @ IN( = IF EXIT THEN IN> @ 1- IN> ! BS SPC BS ; +( del is same as backspace ) +: BS? DUP 0x7f = SWAP 0x8 = OR ; : KEY 85 RAM+ @ ( (key) override ) ?DUP IF EXECUTE ELSE (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/388 b/blk/388 index f915b88..8e25537 100644 --- a/blk/388 +++ b/blk/388 @@ -1,10 +1,9 @@ : (rdlnc) ( -- c ) ( buffer overflow? same as if we typed a newline ) IN> @ IN) = IF 0x0a ELSE KEY THEN ( c ) - DUP 0x7f = IF DROP 0x8 THEN ( del? same as backspace ) DUP 0x0a = IF DROP 0xd THEN ( lf? same as cr ) ( bacspace? handle and exit ) - DUP 0x8 = IF (inbs) EXIT THEN + DUP BS? IF _bs EXIT THEN ( echo back ) DUP EMIT ( c ) ( write and advance ) diff --git a/emul/forth.bin b/emul/forth.bin index 9b8f087..437c3e6 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ