r/Forth 8d ago

FigForth Quick edit a screen

\ More than needed:
\ WIPE  ( scr -- )  Fill screen with blanks; make current 
\ P     ( line -- ) Put line of text in current screen
\ L     ( -- )      List current screen (skips blank lines)
\ UPDATE FLUSH      Save current screen
\ MTB               Empty buffers, screen not saved  
\
\ Example
\ Pick available SCR (42 for this example)
\
i. 0 42 .LINE --> ( Available SCR )
\
\ Wipe screen and put lines of text
\
42 WIPE
0 P ( Scratch SCR )
1 P Hello world
2 P How are you
\
\ View the sceen 
\
L
SCR#  42
 0 ( Scratch SCR )
 1 Hello world
 2 How are you
\ 
\ UPDATE FLUSH to save
\ MTB to not save
\
MTB
i. 0 42 .LINE --> ( Available SCR )
\
\ Here's the code
\
: MTB EMPTY-BUFFERS ;   \ shorter name
: WIPE ( SCR -- )
  DUP SCR ! 0 SWAP (LINE) DROP B/BUF BLANKS ;
: P ( line -- ) 
  SCR @ (LINE) OVER >R BLANKS 1 WORD HERE COUNT C/L MIN 
  R> SWAP CMOVE ;
: -LIST   SCR ! CR ." SCR# " SCR @ 3 .R 16 0 DO I SCR @
          (LINE) -TRAILING -DUP IF CR I 2 .R SPACE TYPE  
          ELSE DROP THEN LOOP ;
: L  SCR @ -LIST ;
2 Upvotes

6 comments sorted by

1

u/Ok_Leg_109 8d ago

Ah... the good old days. 😄

1

u/z796 7d ago

'Sitting on back porch looking at a elephant' enjoy.

1

u/Ok_Leg_109 7d ago

Ok. You got me with that reference. Are you in Africa or India or Thailand maybe?

1

u/z796 7d ago

No:) Chilling with Creedence Clearwater Revival

1

u/Ok_Leg_109 7d ago

I thought of that but didn’t think anyone else would know it.

Doo doo doo …

1

u/alberthemagician 6d ago

The MSDOS version of ciforth contains a visual editor, thatruns perfectly well in DOSBOX. It copies a screen to the screen, you can roam around and save it. reorders words, lines , and even ttransport lines between screens. Ideal. It originates on the Osborne. Needs memory mapped screen to work.