Maintenance of $X and $Y

In GT.M, the following factors affect the maintenance of the virtual cursor position ($X and $Y):

Each device has a WIDTH and a LENGTH that define the virtual "page." The WIDTH determines the maximum size of a record for a device, while the LENGTH determines how many records fit on a page. GT.M starts a new record when the current record size ($X) reaches the maximum WIDTH and the device has WRAP enabled. When the current line ($Y) reaches the maximum LENGTH, GT.M starts a new page.

GT.M has several format control characters that allow the manipulation of the virtual cursor. For all I/O devices, the GT.M format control characters do the following:

!: Sets $X to zero (0) and increments $Y, and terminates the logical record in progress. The definition of "logical record" varies from device to device, and is discussed in each device section.

#: Sets $X and $Y to zero (0), and terminates the logical record in progress.

?n: If n is greater than $X, writes n-$X spaces to the device, bringing $X to n. If n is less than or equal to $X, ?n has no effect. When WRAP is enabled and n exceeds the WIDTH of the line, WRITE ?n increments $Y and sets $X equal to n#WIDTH, where # is the GT.M modulo operator.

GT.M provides two modes of character filtering. When filtering is enabled, certain <CTRL> characters and/or escape sequences have special effects on the cursor position (e.g., <BS> (ASCII 8) may decrement $X, if $X is non-zero). For more information on write filtering, refer to the section on the [NO]FILTER deviceparameter later in this chapter.