Browse Source

editor: implement I command

Also, made LIST properly handle full 64-chars lines not ending with
a null or CR. Previously, such a line would be accompanied by its
following line, duplicating that line's output.
pull/102/head
Virgil Dupras 4 years ago
parent
commit
58ece9f9a1
6 changed files with 22 additions and 5 deletions
  1. +1
    -1
      blk/101
  2. +1
    -1
      blk/102
  3. +1
    -1
      blk/105
  4. +15
    -0
      blk/108
  5. +4
    -2
      blk/456
  6. BIN
      emul/forth.bin

+ 1
- 1
blk/101 View File

@@ -2,7 +2,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.
I xxx: insert typed string at cursor





+ 1
- 1
blk/102 View File

@@ -1,5 +1,5 @@
50 LOAD+ ( B152, extras )
1 5 LOADR+
1 6 LOADR+

: BROWSE
0 ACC ! L


+ 1
- 1
blk/105 View File

@@ -1,5 +1,5 @@
: _type ( buf -- )
C< DUP 0xd = IF DROP EXIT THEN OVER DUP _zbuf ( c a )
C< DUP 0xd = IF 2DROP EXIT THEN OVER DUP _zbuf ( c a )
BEGIN ( c a )
C!+ C< SWAP
OVER 0x0d = UNTIL ( c a ) C! ;


+ 15
- 0
blk/108 View File

@@ -0,0 +1,15 @@
: _ilen ( length of str in IBUF )
IBUF BEGIN C@+ EOL? UNTIL IBUF - 1- ;
: I
IBUF _type EDPOS @ 64 /MOD ( cno lno )
1+ 64 * _cpos ( cno next-line-ptr )
SWAP 63 -^ _ilen ( nlp nb-of-chars-to-move ilen )
2DUP > IF
SWAP OVER - 1+ ( nlp ilen nbc ) 0 DO ( a ilen )
SWAP 1- 2DUP -^ ( ilen a-1 a-ilen-1 ) C@ OVER C!
SWAP ( a ilen )
LOOP
ELSE DROP ( ilen becomes nbc )
THEN
SWAP DROP IBUF EDPOS @ _cpos ROT MOVE
;

+ 4
- 2
blk/456 View File

@@ -1,10 +1,12 @@
: .2 DUP 10 < IF SPC THEN . ;
: EOL? ( c -- f ) DUP 0xd = SWAP NOT OR ;
: LIST
BLK@
16 0 DO
I 1+ .2 SPC
64 I * BLK( + (print)
64 I * BLK( + DUP 64 + SWAP DO
I C@ DUP EOL? IF DROP LEAVE ELSE EMIT THEN
LOOP
NL
LOOP
;


BIN
emul/forth.bin View File


Loading…
Cancel
Save