L: a 1020 Handler Device

by David and Mary Lynch

 

 

Issue 13

Jan/Feb 85

Next Article >>

<< Prev Article

 

 

We bought an ATARI 1020 printer earlier this year. Since then the price has fallen considerably! We have used the printer a great deal, mainly for programming but we have written one or two graphics programs ourselves.

A printer makes writing large programs feasible on a home computer, no more scribbling down odd lines of code on scraps of paper. You can debug your programs as they ought to be debugged. Get a listing, retire to an armchair, read and think.

In general, we are satisfied with the printer. In general that is. It gives clear, readable text, easier on the eyes than that produced on many mainframes, flexible graphics and is fast enough for the applications we wanted. A business user would probably find speed a drawback though. There is however one problem with the printer - the documentation is terrible. It is so bad that even a casual perusal reveals its inadequacies. We have therefore spent some time trying to find out how far you can stretch the printer, with some success, and this article records some of our findings.

Since, as far as we know, there are no programs on sale which use the 1020 printer, one of the first ways in which you can use your printer is to list your own programs.

Early on it struck us how inappropriate is the size of text for program listings, it is too large. Our bookshelves began to look like Roman libraries with scrolls of code many feet long. To get to the subroutine you wanted in a long program meant unravelling many feet of paper. How much nicer if the text could be printed in the smallest character size available, 80 characters per line. Ideal for assembler listings and a great improvement for BASIC ones.

We set about trying to do this. Our first attempt, successful but cumbersome, was to write the listing file to disc and then use a program to read in the file and write it to the printer, preceded by ESC-CNTL-S, the magic formula for getting small letters on the printer. This involved reading and writing large files - slow. We tried various other tacks, including ESC-CNTL-S as a comment in the program and using a vertical blank interrupt to write ESC-CNTL-S, until we finally came up with a workable solution.

The problem is that when confronted with a command LIST "P:" to print a listing the Operating System first closes then re-opens the printer, thus setting default values and defeating any chicanery you may have been up to. The solution was to define a new input handler "L:" whose only function is to print in small letters. We steal most of the code provided by the Operating System for the printer, "P:", but substitute our own code for the OPEN routine. When we set up "L:", we open the printer then print ESC-CNTL-S. (Note that because "P"' and "L:" share code and buffers, it is dangerous to have them OPEN at the same time - not that I can see any reason for doing so.)

There are a couple of additional frills. How about being able to forget about setting up "L:" each time we turn on the computer? We can do this by making the program into a "D:AUTORUN.SYS" file which is executed automatically by DOS on power up. (This of course works only if you have a disc drive). In addition, we do not want our facility ruined by pressing SYSTEM RESET and we can stop this by placing the address of the set up routine in RUNAD ($2E0,$2E1), which is executed when SYSTEM RESET is pressed.

For those with assembler editors, a listing of the code is included. Save the object code as "D:AUTORUN.SYS". The print out is of the assembler listing rather than the source so that the BASIC program may be more understandable.

The program occupies the end of page 6 - $6A0 to $6FF. If you don't mind SYSTEM RESET destroying "L:", $6DC to $6FF is all that needs preserving.
The BASIC program does the same thing. The first two numbers in line 1070 are a header for the file. The following four numbers are the addresses of the start and end of the routine in decimal. There follows the machine code down to line 1200. Line 1210 inserts the address of the routine in place so that SYSTEM RESET will restore "L:".

Type in the program as listed. SAVE it as "L.BAS" and then RUN the program with a disk in the drive containing DOS. Turn off the computer and turn it on again. If all has gone well you should now have set up "L:". Try LOAD "L.BAS" then LIST "L:" and you should get a listing of the program in letters 80 characters to a line.

LPRINT does not appear to work very well with the 1020. While you can print normal size (40 characters per line), the special facilities, such as changing print size, do not work. I suspect that this is because when BASIC meets an LPRINT statement, it closes and opens the printer, so destroying control commands that you have sent it previously. The solution is to amend programs containing LPRINT as follows:

a. Precede the first LPRINT statement executed in the program by CLOSE #7: OPEN  #7, 8, 0, "P:"

b. Replace all LPRINTs by PRINT #7;

I have amended the TINYTEXT program to enable it to use the 1020 printer. In my version, lines 700, 725, 727, 830, 870, 885 and 3130 require changing in the way that I have explained. I hope that this updated version of TINYTEXT can be made available to readers of PAGE 6.

(I hope to publish a revised and updated version of TINYTEXT early next year. If any other readers have modified or improved the program I would appreciate a copy. Ed.)

AtariLister - requires Java

top