30.12.2013 Views

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

112 COMPUU. MAVIJUNE . <strong>1980</strong>. ISSUE 4.<br />

112 COMPUTE. MAY/JUNE. 198O ISSUE &.<br />

50 to start outputting MARKS, pokes the lower case<br />

mode for PET screen output, and then calls 52<br />

50 to start outputting MARKS, pokes the lower case<br />

mode for PET screen output, and then calls 52<br />

for the prompt to to check that your cassette is is running<br />

and 54 to initialize variables and the details of<br />

and 54 to initialize variables and the details of<br />

paper size and format that you wish to to use.<br />

71 simply outputs the current S$, then carriage<br />

returns and, if if required, linefeeds to the next page.<br />

80 cleans up: linefeed to to a blank page so that<br />

garbage created by turning off the audio doesn't<br />

spoil the beautiful page that Cheep Print has just<br />

produced, then ding the bell on the printer to announce<br />

that it's done, followed ed by a wait loop for a little<br />

trailer on the tape. Then the shift register at 59467<br />

is reset so that the PET tape read and write will<br />

operate properly and the graphics mode for screen<br />

operate properly and the graphics mode for screen<br />

output is is restored.<br />

98 converts the hex string Q(uery)$ into the<br />

equivalent number A(nswcr). A(nswer).<br />

99 loads (hex machine) C(ode)$ into memory<br />

locations beginning at MA.<br />

Lines 5 and 6 serve only as an index to the<br />

program lines that structure Cheep Print for the<br />

printer you use. I have included the most common<br />

options in the listing.<br />

Line 23: : with the REM, we list the program<br />

with extra space for comments. Delete the REM, and<br />

the program is listed single spaced, with the print<br />

output strung across the whole page. This is useful<br />

during development; not only does it execute more<br />

quickly, but it is an advantage to have as much as<br />

possible of the program in view at once, provided<br />

that the details of what is supposed to happen are<br />

fresh in your mind.<br />

Lines 50 and 63-66 are involved in setting the<br />

baud rate and whether originate or answer mode. In<br />

line 50, only the mode needs to be determined, and the<br />

two possible choices are snuck in following the REM.<br />

Lines 63-66 contain that portion of the machine code<br />

which depends upon the baud rate and the mode.<br />

The four options given are receive and originate<br />

mode at 110 and 300 baud (10 and 30 characters<br />

per second), and which one you use is determined<br />

by which of the initial REM's isn't there. Table 2<br />

gives the details of getting output at different<br />

frequencies and baud rates. The timing parameters<br />

MF and SF determine the mark frequency and the<br />

space frequency appropriately for you to be in<br />

originate or answer mode; the decimal equivalent of<br />

MF also needs to be reflected in the initialization at<br />

line 50. Usually you will want to be in answer<br />

mode when talking to a terminal and in originate<br />

mode when talking to a mainframe. The baud rate is<br />

determined by the timing loop parameters XR and<br />

YR, and the duration of the stop bits by SB. I did<br />

some experimenting with these parameters and found<br />

that the baud rate could be off by 7 or 8 percent<br />

and the mark and space frequencies off by 4 percent<br />

and still get solid copy; SB only needs to to be<br />

sufficiently long. The output can be structured in in<br />

any way you wish, of course; for instance, you<br />

could generate tapes to Kansas City standards if if you<br />

wish. The most important thing is is that your cassette<br />

recorder should run at the same speed at home as<br />

it it does at your printer, but it it doesn't matter what<br />

the speed is. If you are forced to use battery<br />

operation at your printer, then you should use<br />

battery operation at home or else experiment with<br />

the timing parameters to compensate for the speed<br />

difference that many recorders exhibit between battery<br />

and a nd AC line operation.<br />

.<br />

Lines 85-86 contain the formatting data for the<br />

two styles of listing, and lines 87-88 contain two<br />

types of carriage return- line feed sequences. These<br />

are implemented by LISTing 85-88 on the screen,<br />

deleting the line number and REM from the data<br />

you wish to use, usc, and then hitting RETURN;<br />

the PET screen editor picks up the line number<br />

55 or 56 that remains and inserts these statements<br />

into the program. Lines 85-88 remain unchanged for<br />

future use. The carriage return-line feed sequence<br />

that you need will depend on the printer you use. I've<br />

used a DECwriter and a thermal printer in which<br />

carriage return (Control-M) does not also give a<br />

line feed (Control-J), and a Selectric which includes<br />

the line feed with the carriage return whether you<br />

like it or not. Further, the DECwriter requires no<br />

nulls to waste time while the print head returns to<br />

the left side of the paper, the thermal printer sometimes<br />

requires as many as four nulls, and the Selectric<br />

wants a goodly number of nulls. The Anderson­<br />

Anderson-<br />

Jackson Selectric has an 800 character buffer to<br />

deal with transmission faster than the print mechanism<br />

can keep up with, and the nulls plus the program<br />

execution time seem to be enough to keep the buffer<br />

from overflowing. If you have a Selectric, one solution<br />

is to make every other character a null, , which is<br />

included in the REM of line 8; if you use these<br />

nulls, declarations of P will have to go inside the<br />

FOR-NEXT loops of lines 44, 47, 53, , 22, and 17. . I<br />

doubt that the line 8 nulls are a good solution for<br />

a Selectric, because there is a mechanical clutch<br />

that continually engages and disengages, and probably<br />

wears more than it needs to. . This clutch is also the<br />

reason that the listing output is generated line by<br />

line, rather than simply printing individual characters<br />

when ready; ;<br />

As an example of using Cheep Print to serve a<br />

host program, I wrote a quick 6502 disassembler in<br />

Basic so that Cheep Print could list its own machine<br />

code for commenting. The disassembler isn't included<br />

here because there's nothing particularly exciting or<br />

instructive about it. The disassembly shows that the<br />

machine code is only a simple software timing loop,<br />

performed with interrupts inhibited (this is important!)<br />

so that the timing doesn't get messed up. The<br />

machine code outputs the start bit, and then the<br />

contents of memory location 1023/03FF low order bit<br />

first. All the printers I know ignore the highest

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!