Make your own free website on Tripod.com


 

4/ BASIC Printer Control Codes


We’ve told you that six control codes are available. In this section we will discuss how to use these control codes. Normally, LPRINT CHR$( ) is used to send the instruction to the TP-10.

CHR$(10)
Line Feed only (no carriage return)

This command advances the paper one line, with the carriage staying inthe current position.

CHR$(13)
Carriage Return with Line Feed

When this command is received, the Printer moves the carriage to the left margin and advances the paper one line.

CHR$(26)
Carriage Return only (no line feed)

When the Printer receives this code, the carriage is moved to the left, but the paper does not advance.

10 LPRINT CHR$(13);: REM TO BE SURE CARRIAGE IS AT LEFT
20 LPRINT "THIS IS IMPORTANT";
30 LPRINT CHR$(26): REM CARRIAGE RETURN ONLY
40 LPRINT CHR$(28) CHR$(17) CHR$(95)

This program will print line 20, return the carriage to the left without advancing the paper, and then print an underline (ASCII code 95) under “THIS IS IMPORTANT”. We will explain CHR$(28) shortly.

CHR$(27) CHR$(14)
Elongated Mode Set

This control code is somewhat different from the other control codes. Only when these two codes are received in succession, does the Printer enter the elongated mode. All the characters after this code sequence will be printed at twice the normal width.

CHR$(27) CHR$(15)
Elongated Mode Clear

This also is a two-code sequence. Upon receipt of this code sequence, the Printer exits the elongated mode and all the characters after this will be printed in normal size.

10 LPRINT “NORMAL”; 
20 LPRINT CHR$(27) CHR$(14); 
30 LPRINT “ELONGATED”;
40 LPRINT CHR$(27) CHR$(15);
50 LPRINT “NORMAL AGAIN”

CHR$(28) CHR$(n) CHR$(m) 
Repeat Printing

This code tells the TP-10 to print the character repeatedly. The first figure n determines the number of repetitions (between 0 and 255: if 0 is input, printing repeats 256 times); the second figure m is the ASCII code for the character to be repeated. Note that the character need not be in code; put ”  “ around the character to be printed.

LPRINT CHR$28) CHR$(10) CHR$(134)

Prints the graphics character 10 times.

LPRINT CHR$(28) CHR$(5) "T"

Prints five T’s. 

Note: When codes other than those defined above are entered, TP-10 either ignores them or prints X.

Ignored codes

  • 0,1,127
  • codes other than 14 or 15 after 27
  • redundant codes — CHR$(27) CHR$(14) while you’re in elongated mode, or CHR$(27) CHR$(15) while you’re in normal mode.

Codes printed as X

  • codes between 2 and 31 which are not defined
  • non-character codes which are specified to be repeated after code CHR$(28)