After typing a word or number you may enter it using the space bar, or alternatively the enter (some may know it as carriage return) key. The keyboard normally continues in text entry mode, expecting you to enter another word or number. However, when in the Interpreter, the word you just entered may run another application which can redefine keyboard operation until you return to the Interpreter, as we'll see later.
To erase a word or number before you have entered it, use the backspace key. To exit text entry mode, use the escape key. This doesn't do anything in the Interpreter, but some applications, such as the Editor, can "call" the text entry mode and in those cases you need to indicate when you are through by using "escape".
When you begin typing a word or number, the keyboard software needs to determine which you are entering. Like classical Forth, colorForth allows you to define words that start with numeric digits, or even words that consist entirely of numeric digits. The keyboard software makes its decision with the first key you strike:
0..9
then you are entering a number; the key is interpreted as a digit, that digit is displayed on top of the stack, and a "num" annunciator is displayed in the hint area. Subsequent keystrokes must be digits and will be "shifted" into the displayed number using the current radix. The -
key negates the number being entered and may be used repeatedly to toggle its sign.
a..z !'*+ ,-./ ;?@
then you are entering a word; the character is displayed to the left of the hint area, a Shannon coded value consisting of that character is displayed on the top of the stack, and a "text" annunciator is displayed in the hint area. Subsequent keystrokes may be any colorForth character and will be appended to the displayed word to the left of the hint area as well as being added to the Shannon coded representation on the stack. If another number appears on the stack while you are typing, this informs you that the last character you typed caused the Shannon coded value to exceed one 32-bit number. That's all right, but is important to know about when creating Forth definitions.
-
to be an alphabetic character when it's the first keystroke seen. Thus, simply typing -123
is results in a word, not a number. To enter a negative number, the minus sign has to be entered some time after the first digit. So you can enter the value that was desired above as 123-
. -
... to justify this.
`
key. This is typically on a button immediately to the left of 1
. After pressing it, the "text" annunciator turns on in the hint area, and the next character entered will be taken to be the first character of a word.
F1
key. Actually this key toggles between decimal and hexadecimal mode. The F1
key is recognized any time the hint area shows just the "qwer" annunciator, or both "qwer" and "num". It instantly sets the other mode, affecting the stack display and subsequent digit entry.
0..9
, but once number entry has begun any of the hex digits 0..9 a..f
or the minus sign may be entered. Thus, to enter the hex equivalent of 255, type 0ff
.