Classic Computer Magazine Archive COMPUTE! ISSUE 1 / FALL 1979 / PAGE 78

SCREEN PRINT ROUTINE

From David Malmberg—Sphinx

General utility to print the screen using the new PET printers, and convert from a basic print format to the PET printer format—which are far from compatible.

This routine will handle upper and lower case, as well as graphics and reverse fields. It can be appended to a program as a subroutine or used as a stand alone routine.

Some of the options in the routine are as follow:

  1. Enhanced printing is obtained when the entry point is line 63500 i.e., GOSUB63500 or RUN63500.
  2. Normal printing is obtained when the entry point is 63510.
  3. Number of copies is set by the variable NN in line 63510.
  4. Number of blank lines between copies is given by the limit of the for loop in line 63580.
  5. Graphic or lower case modes are automatically handled by PEEKING in LOC(59468) and formatting to the printer accordingly. Note!!! This routine assumes the new ROM. If the old ROM is used, switch the CHR$(17)'s and CHR$(145)'s in lines 63526-29.
  6. The routine will print the entire screen or until it encounters a "READY." The variable JJ, specified in lines 63520 and 63570, controls the print line range, and could be specified by the calling program—especially if the purpose was to use the screen as a work area to convert between BASIC and PET printer formats.

A word of caution—the PET printer interprets a number of characters as special control characters.

63500 CC$ = CHR$ (1)
63510 NN = 1 : OPEN 1, 4 : FOR II = 1 TO NN
63520 JJ = 0
63521 SL$ = " " : JJ = JJ + 1 : FOR KK = 1 TO 40
63522 WW = 0 : XX = PEEK (32767 + KK + 40*(JJ-1))
63523 IF XX = 32 OR XX = 96 THEN SL$ = SL$ + CHR$(32) : GOTO 63558
63524 IF XX > 127 THEN SL$ = SL$ + CHR$(18)
63525 IF PEEK (59468) = 12 THEN 63541
63526 IF XX > 0 AND XX < 27 THEN SL$ = SL$ + CHR$(17) + CHR$(XX + 64) : WW = 1
63527 IF XX > 128 AND XX < 155 THEN SL$ = SL$ + CHR$(17) + CHR$(XX-64) : WW = 1
63528 IF XX > 64 AND XX < 91 THEN SL$ = SL$ + CHR$(145) + CHR$(XX) : WW = 1
63529 IF XX > 192 AND XX < 219 THEN SL$ = SL$ + CHR$(145) + CHR$(XX-128) : WW = 1
63530 IF WW = 1 THEN 63549
63541 IF XX<32 THEN SL$ = SL$ + CHR$(XX + 64) : GOTO63549
63542 IF XX>31 AND XX<64 THEN SL$ = SL$ + CHR$ (XX) : GOTO63549
63543 IF XX>63 AND XX<96 THEN SL$ = SL$ + CHR$ (XX + 128) : GOTO63549
63544 IF XX>95 AND XX<128 THEN SL$ = SL$ + CHR$ (XX + 64) : GOTO63549
63545 IF XX>127 AND XX<160 THEN SL$ = SL$ + CHR$ (XX-64) : GOTO63549
63546 IF XX>159 AND XX<192 THEN SL$ = SL$ + CHR$ (XX-128) : GOTO63549
63547 IF XX>191 AND XX<224 THEN SL$ = SL$ + CHR$ (XX) : GOTO63549
63548 IF XX>223 THEN SL$ = SL$ + CHR$ (XX-64)
63549 IF XX>127 THEN SL$ = SL$ + CHR$ (146)
63558 NEXT KK
63559 IF LEFTS (SL$, 6) = "READY." THEN 63580
63560 PRINT#1, CC$;SL$
63570 IF JJ<25 THEN 63521
63580 FOR PP = 1 TO 10 : PRINT#1 : NEXT PP
63590 NEXT II :CC$ = " " : CLOSE 1