1

Copy Your Screen to
Your Printer

titlebar.gif

Harry A. Straw


This is a simple, short screen dump for mode 0. It will work with any BASIC program.

Here's a handy routine for copying text from your Atari screen (GRAPHICS 0 mode) to your printer. It is set up to use two GOSUB commands in your main program:

GOSUB 32010 to initialize
GOSUB 32040 each time you want to line-print a page displayed on your screen.

The program is straightforward, but a few comments may help you to run it smoothly.

The main business of this program is the double FOR/NEXT loop in lines 32050-32110. With the POSITION command, these loops move the cursor over the entire screen, one position at a time. At each cursor position, line 32080 GETs the ASCII number for the character under the cursor, and line 32090 puts the corresponding character on the printer. Since I have an 80-column printer and the Atari screen is only 40 characters wide, I need line 32105 to get printer carriage return at the proper place. You may be able to delete this line if you have a 40 column printer (or one that can be set to 40 columns).

Line 32040 (printer carriage return) makes sure that the printer head starts copying at its left-hand margin. Line 32120 "homes" the cursor at the end of the subroutine. This is not always necessary, but, depending on the next line in your main program, it may prevent an ERROR - 141, "cursor out of range."

You must OPEN a channel to GET from the screen. I use channel number 5, leaving channels 1-4 free for use in main programs. The initializing subroutine in lines 32010-32030 does this. It also expands the Atari display to its full 40-character width and 24-line height to match the cursor movement controlled by lines 32050 and 32060. The OPEN command clears the screen, so you must OPEN before displaying the text you want to copy. Just be sure your main program says GOSUB 32010 aheadof the screen display to be printed.

If you have only a few lines to copy, no problem. Merely adjust line 32050 to cover the rows you want to scan. Otherwise, the printer will run for all 24 rows, printing a lot of blank spaces wherever nothing shows on the screen.

There is no CLOSE #5 statement in the listing. This leaves channel 5 open, so it is not necessary to repeat GOSUB 32010 for each page to be line-printed.

Take advantage of Atari's ability to merge stored programs with RAM-resident programs by recording this routine with the command LIST"C:" and reading it with ENTER"C:" (or ENTER "D:Filename). CSAVE and CLOAD won't work this way. In fact, CLOAD erases programs in RAM! This routine starts with a high line number, 32000, so its line numbers won't conflict with those of a program already in RAM.


Sample Screen Dump

chap1p3.gif



GRAPHICS 0 Screen to Printer

Download P019L1.BAS (Saved BASIC)
Download / View P019L1.LST (Listed BASIC)

Return to Table of Contents | Previous Section | Next Section