CR   EMIT   PAGE   SPACE   SPACES   AT-XY   >PR   BL

CR ( ---)

Show a new line return. Example:

: .result ( ---)
    ." Port analys result" cr
    . "pool detectors" cr ;

Definition of cr

\ as defined on FlashForth
: cr 
    $0d emit    \ ASCII 13 (CR)
    $0a emit    \ ASCII 10 (LF)
  ;

EMIT ( x -- )

If x is a graphic character in the implementation-defined character set, display x. The effect of EMIT for all other values of x is implementation-defined.

When passed a character whose character-defining bits have a value between hex 20 and 7E inclusive, the corresponding standard character is displayed. Because different output devices can respond differently to control characters, programs that use control characters to perform specific functions have an environmental dependency. Each EMIT deals with only one character.

65 emit    \ display A
66 emit    \ display B

AT-XY ( u1 u2 -- )

the next character displayed will appear in column u1, row u2 of the user output device, the upper left corner of which is column zero, row zero.

PAGE ( ---)

Specific gForth

Erases the screen.

On FlashForth for ARDUINO, if you use Tera Term as terminal, you can set PAGE like this:

\ start escape sequence
: .esc ( ---)
    27 emit  ;  \ send ESC char
 
\ start escape[ sequence
: .esc[ ( ---)
    .esc
    [char] [ emit  ;  \ send ESC[ char
 
\ set cursor at x y position on screen terminal
: at-xy ( x y ---)
    .esc[
    .#c             \ send y position
    [char] ; emit
    .#c             \ send x position
    [char] H emit ;
 
\ clear entire screen
: page ( ---)
    .esc[ ." 2J"
    0 0 at-xy ;
 

Specific ESP32forth

The word page send 30 carriage returns. Definition of page

: page  ( -- )  
    30 for cr next 
    ;

SPACE ( ---)

Display one space.

: space  ( -- )
    bl emit 
    ;

SPACES ( n -- )

If n is greater than zero, display n spaces.

BL ( -- 32 )

: bl  ( -- 32 )
    32 ;