Classic Computer Magazine Archive COMPUTE! ISSUE 60 / MAY 1985 / PAGE 10

Sending Output To A Commodore Printer

How can I get a printout of the results of a program that doesn't have acommand to send the results of the program to the printer?

Tom Holloway

Assuming you're asking about a BASIC program which you can modify, simply add the following short subroutine (renumber the lines if necessary to keep them from conflicting with existing lines in the program). Call the routine with a GOSUB command before executing the PRINT statements you'd like sent to your printer.

1000 OPEN 4, 4, 0
1010 CMD4

This sets up a Commodore printer for uppercase and graphics characters. To print upper- and lowercase characters, change line 1000 to:

1000 OPEN 4, 4, 7

In line 1010, the command CMD4 directs the computer to send all output to the device opened as file number 4, in this case the printer. Remember, your monitor is simply an output device, and the output device can be changed.

After your program reaches the end of the section you would like sent to the printer, another subroutine is necessary to restore output to the screen:

2000 PRINT#4
2010 CLOSE 4

If you'd like to change the output of a machine language program from the screen to a printer, it will be necessary to find the points in the program where display is sent to the screen, usually through the CHROUT routine at $FFD2, and divert that to your ML routine to open output to the printer.

To add a routine to send output to non-Commodore printers, refer to your printer manual for the necessary commands.