Next: Single-key input, Previous: Displaying characters and strings, Up: Other I/O
If you are outputting to a terminal, you may want to control the positioning of the cursor:
at-xyu1 u2 – facility “at-x-y”
Position the cursor so that subsequent text output will take place at column u1, row u2 of the display. (column 0, row 0 is the top left-hand corner of the display).
In order to know where to position the cursor, it is often helpful to know the size of the screen:
form– urows ucols gforth “form”
The number of lines and columns in the terminal. These numbers may
change with the window size. Note that it depends on the OS whether
this reflects the actual size and changes with the window size
(currently only on Unix-like OSs). On other OSs you just get a
default, and can tell Gforth the terminal size by setting the
LINES before starting
And sometimes you want to use:
page– facility “page”
Clear the display and set the cursor to the top left-hand corner.
Note that on non-terminals you should use
12 emit, not
page, to get a form feed.