Authors
Publication
Pub Details
Date
Pages
We had quite a few enquiries at the last meeting on using a large printer from Basic. I have given a solution, verbally, before but it seems there is still a great of confusion. Here is an example program and description to help pave your path to gaining the use you desire from your printer.
First, a word of caution. The example program assumes that you have an Epson or compatible printer. Each printer has its own set of codes to place it into certain modes of operation. You may have to search your printer manual for the correct codes but the principle will be the same as described here.
You can send two kinds of information to your printer, text or control codes. Most dot-matrix printers also have bit-image graphics mode but we will not discuss that today.
Text is sent as ASCII character codes. You can find a table of these codes in many books. Only printable characters (letters & puntuation) can be sent in this manner. The used is:
LPRINT "Hello there!"
Often, you will want to format the text in some special mode, such as expanded characters or italics. This is where we need the control codes.
Control codes are simply codes that tell the printer to shift gears. Most are sent after a special control code, called Escape. This is so the printer knows that you are sending it a control codes, instead of text. It is these codes that must be supplied by the manufacturer of the printer, as they have not been completely standardized.
The typical method of sending the control codes is by pressing the Escape key and another key at the same time. Unfortunately, the Timex does not have an Escape key.
The other method of sending these control codes must used. It is:
LPRINT CHR$ 27; CHR$ 52
You lprint the character code for Escape, which is 27, then whatever character codes are needed follow it. The above example will turn on the italics mode for Epson printers.
You must refer to your printer manual for the neccessary control codes for your printer.
There are some standard control codes. They will appear on the ASCII chart as the unprintable character codes, Ø-31. These are sent without the Escape code.
You must also be careful how you terminate your control code line. Just as in Basic, anything other than a semi-colon will cause the printing to begin on the next line.
Experiment some. If you are still having difficulty, bring your printer manual to the next meeting. We will discuss the problem, then.
Products
Media
Image Gallery
Source Code
0 REM Cr w/LF. .... Poke 64460,10 Cr w/o LF.. Poke 64460,0 Width..... Poke 64459, Width-1Print Mode....Poke 64456,1 Control Mode Poke 64456,0 Turn On. . Poke 26703,205 & Poke 26704,251 Turn Off. ..Poke 26703,Ø & Poke 26704,5
1 CLEAR 64455: LOAD ""CODE : REM This line loads the printer driver code. You must have already saved a customize d the e version, as directed by Aerco software that cam with your interface.
2 BORDER 0: PAPER 0: INK 9: CLS : REM Set screen attributes
10 INPUT AT 0,0; "Please select : "'"<P›rinter or <T>S 2040: "; LINE a$: REM Select a printer
20 IF a$="T" OR a$="t" THEN POKE 26703,Ø: POKE 26704,5: GOT0 110: REM Correct channel info to use the TS2040 printer
30 IF a$="p" OR a#="p" THEN POKE 26703,205: POKE 26704,251: GO TO 5Ø: REM Correct channel info to use the 80 column printer
40 GO TO 10: REM Trap Entry Errors
5Ø INPUT AT Ø,Ø; "Length of line to be printed?"' LINE af: REM Get width of printer or line
6Ø IF VAL a$<1 OR VAL a$>150 THEN GO TO 50: REM Trap entry errors
70 POKE 64459,VAL a$-1: REM Set line length to print
80 INPUT "Do you need a line feed after the carriage returns? (Y/N) "; LINE a$: REM This depends on how your printer micro-switches are set. Answer Y if not sure.
90 IF a$="N" OR a$="n" THEN POKE 64460,Ø: GO TO 300: REM This sets up for no LF after CR
100 POKE 64460,10: REM This sets up for a LF after CR
110 PRINT "Ok, we should be set-up correct for the printer we selected. "''"You may re-select printer optionby re-running the program. "''"You should now study the programlisting from line 300 on to"'"determine how to use the printerdriver to print any text from"'"Basic.": LIST 30
300 REM The following program lines demonstrate the method youneed to use to print to a larg printer, from Basic, with the Aerco printer driver, which is supplied with their interfa ce.
310 LET Mode=64456: LET Print=1: LET Cntr1=0: REM We will use these variable namesto make the listing clearer
320 PRINT "This is a test line. It is printed exactly as typed."
330 POKE mode, cntrl: LPRINT CHR$ 14;: REM This will send the control code for large letters to the printer
340 POKE mode,print: LPRINT "We are printing LARGE letters.": REM We are back in text mode, but weare printing large letters
350 POKE mode, cntrl: LPRINT CHR$ 15;: REM This will send the control code for small letters to the printer
360 POKE mode,print: LPRINT "We should now be printing in condensed mode.": REM We are back in text mode, but weare printing small letters
370 POKE mode, cntrl: LPRINT CHR$ 18: : REM We have to turn off the shift-inmode. This was not needed for shift-out as shift-out is only active for one line of text.
380 POKE mode, print: LPRINT "This is a test line. It is printed exactly as typed. ": REM We are back in normal mode
390 POKE mode, cntrl: LPRINT CHR$ 27; CHR$ 52: REM This will turn on Italic mod e
400 POKE mode, print: LPRINT "This is Italic mode, your printer can do it": REM Print in Italics mode
410 POKE mode, cntrl: LPRINT CHR$ 27; CHR$ 53: REM This will turn off italic mode
420 PRINT "and that is the end of our examples."
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.