Was this helpful?
Cursor Motion Command
The cursor motion (cm) command sends the cursor motion string (called the cursor position string in some guides) to the terminal when the cursor is moved from one location to another. As such, the string must accept two parameters: an x-coordinate and an y-coordinate, whose values are obtained by counting the number of rows/spaces from the top-left corner of the screen. Because these values must be sent along with the string at run time, special place markers must be left in the string to tell the forms system where to place the x and y coordinates.
To implement this, find the cursor-addressing scheme described in the guide for your terminal. Then substitute the special place marker characters (described below) in the spot where numbers are expected. Also, be sure to include any special modifiers (described below) in the description if they are needed.
Listed here are place markers and their cursor-addressing options (modifiers):
%2
Place marker for a decimal integer of two places.
%3
Place marker for a decimal integer of three places.
%.
Place marker for a binary value character.
%+N
Place marker for a binary value character, with the value of the character N added to it.
%%
Produces a single %.
%r
Reverses the order of the coordinates. Normally the column marker is substituted into the first place marker. If your terminal cursor positioning string expects the row first, include a %r before the first place marker in the cursor motion sequence.
%B
BCD (16*(x/10)) + (x mod 10) Parameter values are transformed according to this formula.
%n
Perform an exclusive OR on the row and column values with the octal value 0140 before generating the string for cursor motion. (This is used only for the DM2500 terminal.)
%D
Reverse coding (x‑2*(x mod 16)) Parameter values are transformed according to this formula. (This is used only for Delta Data terminals.)
Example 1: rti100, a Fictitious Terminal
The cursor motion string listed in the user's guide for the rti100 (a fictitious terminal) is ESC|x;y, where x and y are two‑digit integers specifying the column and the row, respectively. The rti100 is an example of a terminal that uses a (0,0) origin, so x and y must be one less than the whole number that represents the position on the screen. Thus, to move the cursor to column 8 row 17 on the rti100, you would enter ESC|07;16. The termcap entry is:
cm=\E|%2;%2
The \E maps to ESC and %2 is the place marker that maps to a decimal integer of two places.
Example 2: vt100
The cursor motion string for the VT100 is ESC[x;yH, where x and y are two‑digit integers specifying the column and row, respectively. The VT100, as opposed to Example 1 above, positions the cursor relative to a origin of (1,1). Thus, to move the cursor to column 8 row 17 on the VT100, enter ESC[08;17H. The termcap entry is:
cm=\E[%i%2;%2H
The \E maps to ESC, %2 maps to a decimal integer of two places, and the %i signifies that the VT100 uses a (1,1) origin. The default setting for the cm string is for a (0,0) origin. If your terminal uses a (1,1), origin you must explicitly state that by placing a %i somewhere inside the cm string.
Example 3: Datamedia 3045
The cursor motion string for Datamedia 3045 is ESC Y y x; where y and x are characters whose binary values are offset by 20 hex. (For this terminal, the row must be given before the column.)
To move the cursor to the position (19,11) on this terminal, you must include the sequence ESCY2*. The ESCY is the first part of the sequence. The 2 is the ASCII character with hexadecimal value 32, which is the same as 12 hex plus the 20 hex offset. Note that 12 hex corresponds to column 19 on the screen. The * is the ASCII character with a hexadecimal value of 2A, which equals 0A hex plus the 20 hex offset. Again, 0A hex corresponds to row 11 on the screen.
The cm string for this terminal is:
cm=\EY%r%+%+
The \E maps to ESC, %r is a modifier that tells the forms system that the row and column parameters are reversed, and %+ is the place marker for a character offset by a blank (which has the ASCII value of 20 hex).
Example 4: Delta Data 5000
The cursor motion string for the delta data 5000 is Control‑Oxy, where x and y are characters whose binary values must be offset by 3A hex, and converted according to the reverse coding formula:
(x‑2*(x mod 16))
The cm string for this terminal is:
cm=^O%D%+9%D%+9
The ^O stands for Control‑O, %D indicates that the parameters must be transformed according to the reverse coding formula, and %+9 is the place marker for a character offset by 3A hex (ASCII character 9).
Terminal
Entry Listed in Guide
Example Usage on Terminal Mode
Example of the Termcap Description
rti100
ESC|x;y
ESC|02;07
cm=\E|%2;%2
vt100
ESC[x;yH
ESC[03;08H
cm=5\E[%i%2;%2H
dm3045
ESCYyx
ESCY2*
cm=\EY%r%+%+
delta
Control‑Oxy
Control‑ORS
cm=^O%D%+9%
D%+9
Last modified date: 11/28/2023