C. Writing Termcap Descriptions : Eleven Basic Commands : Cursor Motion Command
 
Share this page                  
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.)