Screen Output of Numerical Data and Textual Strings from SpectraLab Scripts


General Information

If necessary, SpectraLab scripts may display numerical and textual information in a special window, so-called WinCRT window, which opens automatically upon executing any of display functions specified below. Besides its specific WinCRT functions, SpectraLab also redefines the standard Forth . (dot), F. (F-dot) and CR operators for output in WinCRT window instead of Forth console (which is hidden while running SpectraLab). It is done, in a part, for compatibility with programming examples found in Forth tutorials. However, the words  ." and  .( are not redefined and should not be used from SpectraLab. Use TYPE$ operator instead.

Basics of Using Textual Strings in Forth

According to ANS Forth standard, textual strings are transferred to standard text output and processing functions through the stack of integers as two numbers specifying the address in the memory where the actual string is located and the length of this string. The standard word s" may be used to create such a string. This word must be followed by a space, the string itself and a double-quote character ("), which closes the string. Thus, the script s" Hello, World!" TYPE$" prints "Hello, World!" in the WinCRT window. Upon executing this script, the operator s" allocates space in the memory, places the string there, and then puts its address and length at the top of the stack. Then the operator TYPE$ (see its definition below) takes this information from the stack and prints the string in WinCRT window. More information on operations with strings may be found in Forth tutorials and Win32Forth documentation (see the respective sections of this Help).

Description of WinCRT Output Functions

 CRT_CLOSED ( -- / -- )
    Checks the status of WinCRT window - returns TRUE if it is closed and FALSE otherwise
 NOCRT ( -- / -- )
    Closes WinCRT window
 CRT ( -- / -- )
    Opens WinCRT window
 ?i_ ( n1 / -- )
    Types an integer in WinCRT window. The value is taken from the stack of integers.
 . ( n1 / -- )
    Synonym of ?i_ - redefines the standard "." function of WinForth
 ?f_ ( F1 / -- )
    Types a floating point value in WinCRT window. The value is taken from F-stack
 F. ( F1 / -- )
    Synonym of ?i_ - redefines the standard "F." function of WinForth
 TYPE$ ( addr len / -- )
    Types a string in WinCRT window. The string is in the stack (addr len)
 XYTYPE$  ( addr len n1 n2 \ -- )
    Types a string in WinCRT window at x and y coordinates given by n1 and n2
 CCR ( -- / -- )
    Sends <Carriage Return> to WinCRT window (goes to the next line)
 CR ( -- / -- )
    Equivalent of CCR - redefines the standard CR function of WinForth
 ?F ( F1 / -- )
    Types a floating point value and goes to the next line
 ?I ( n1 / -- )
    Writes an integer and goes to the next line
 ?S ( addr len / -- )
    Types a string and goes to the next line
 CLEARCRT ( -- / -- )
    Clears WinCRT window