51

W One-time horizontal tabs

Suppose you need to move to a position across the page, but you only need to do it once. It doesn’t make much sense to set up a tab to use only one time. There is an easier way.

The solution is called a one-timetab. Table 4-8 shows the three commands.

Table

4-8

One-time horzontal tabs

Function

Control code

One-time horizontal tab of n

(ESC) “f” 0 CHR$(n)

spaces

 

Absolute horizontal tab

(ESC) “$” CHR$(nl) CHR$(nZ)

Relative horizontal tab

(ESC) ‘I\” CHR$(nl) CHR$(n2)

The first command in Table 4-8 moves the print head n col- umns to the right. It has the same effect as sending n spaces to the printer.

The absolute horizontal tab command moves the print head to a specified position on the page. The position that you want the print head to move to (measured from the left margin) is specified by the values of nl and n2 using the formula nl + n2

x 256.

Try this program to see how this works.

10 ’ Demo of absolute horizontal tabs

20FOR I=60 TO 70 STEP 2

30LPRINT I ;“i-H+” ;

40LPRINT CHR$(~~) ;“$“;CHR$(I) ;CHR$(O) ;

50LPRINT “Horizontal tab. ”

60NEXT I

70 END

In this program, the print head is positioned before the “H” in “Horizontal” is printed.

Page 57
Image 57
Star Micronics NP-IO manual Try this program to see how this works