VE: Add H and L

Also, add MODE indirection.
This commit is contained in:
Virgil Dupras 2020-06-04 19:20:40 -04:00
parent 878df2d53b
commit 2bf4db59ed
4 changed files with 14 additions and 10 deletions

View File

@ -1 +1,3 @@
'H' goes to the beginning of the line, 'L' to the end.
'w' moves forward by a word. 'W' moves backward by a word.

View File

@ -1,6 +1,5 @@
CREATE CMD 2 C, '$' C, 0 C,
VARIABLE ACC
VARIABLE POS
VARIABLE MODE VARIABLE ACC VARIABLE POS
: 0acc 0 ACC ! ;
: acc@ ACC @ 1 MAX 0acc ;
: num ACC @ SWAP _pdacc IF DROP ELSE ACC ! THEN ;

View File

@ -7,9 +7,5 @@
: $[ BLK> @ acc@ - selblk ;
: $] BLK> @ acc@ + selblk ;
: $h -1 cmv ; : $l 1 cmv ; : $k -64 cmv ; : $j 64 cmv ;
: $w POS @ BLK( + acc@ 0 DO
BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL LOOP
1- BLK( - 1023 MIN POS ! ;
: $W POS @ BLK( + acc@ 0 DO
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP
1+ BLK( - DUP 0< IF DROP 0 THEN POS ! ;
: $H 0acc POS @ 0x3c0 AND POS ! ;
: $L 0acc POS @ 0x3f OR POS ! ;

11
blk/128
View File

@ -1,7 +1,14 @@
: $w POS @ BLK( + acc@ 0 DO
BEGIN C@+ WS? UNTIL BEGIN C@+ WS? NOT UNTIL LOOP
1- BLK( - 1023 MIN POS ! ;
: $W POS @ BLK( + acc@ 0 DO
BEGIN C@- WS? UNTIL BEGIN C@- WS? NOT UNTIL LOOP
1+ BLK( - DUP 0< IF DROP 0 THEN POS ! ;
: modeM EXECUTE ;
: handle ( c -- f )
DUP '0' '9' =><= IF num 0 EXIT THEN
DUP CMD 2+ C! CMD FIND IF EXECUTE ELSE DROP THEN
DUP CMD 2+ C! CMD FIND IF MODE @ EXECUTE ELSE DROP THEN
UPPER 'Q' = ;
: VE clrscr 0acc 0 POS ! contents
: VE clrscr 0acc 0 POS ! ['] modeM MODE ! contents
BEGIN status setpos KEY handle UNTIL 18 aty ;