P. 1
Commodore 64 Subroutine Cookbook

Commodore 64 Subroutine Cookbook

|Views: 423|Likes:
Published by CubemanPDX
Commodore Computer Book
Commodore Computer Book

More info:

Published by: CubemanPDX on May 13, 2011
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less






This simple tape cassette procedure works for longer subroutines but must be followed
carefully and exactly. First, prepare an ASCII version of the subroutine to be appended
as follows. LOAD the subroutine and make sure that the line numbers are larger than
the line numbers in the programs you intend to append the subroutine to. Place a blank
tape in the cassette recorder, and rewind. Next type OPEN 1,1,2," ASCII-prog.
name":CMDl :LlST, and press RETURN. What this step does is open a data channel,
number one, with the cassette recorder specified as the output device, using the filename
"ASClI-prog.name." You can substitute your own program name for the second part
of the file name, but the total filename must be 16 characters or fewer. Then, CMDl
tells the Commodore 64 to route to the tape recorder anything that would have been
sent to the CRT screen. The following command, LIST, has the Commodore 64 list the
program (or subroutine) in the usual manner-except that the ASCII listing of the module
will be written to the tape instead of the screen.

*Adapted from a paper presented by Dr. Melvin E. Zandler, Chemistry Department, Wichita State
University, Witchita, Kansas (with permission).

4 / Commodore 64 Subroutine Cookbook

Once you have keyed in this coJllmand line, and pressed RETURN, the Commodore
64 wi II ask you to press PLAY and RECORD. Do so, and wait unti I the tape drive stops.
With the PLAY and RECORD buttons still depressed, type PRINT#l :CLOSE1 on the
keyboard and press RETURN. The cassette recorder will run for several more seconds
as the remaining data in the Commodore 64's buffer is written to tape and the file is
closed. You will now have an ASCII version of the subroutine on tape. Rewind the tape
and label it.

Next, load your main program into the Commodore 64. Mount the ASCII subroutine
tape in the cassette recorder, and TYPE OPEN1,l on the keyboard. Press RETURN. You
wi II be asked to press the PLAY button on the cassette recorder. When you have done
that, the recorder will run until the tape header with the filename is read ("ASCII-
prog.name") and the recorder stops.
At this point, leave the PLAY key depressed. Next press CLR to clear the screen, and
type POKE 153,1 at the top of the screen, and press RETURN. The cassette drive will
run for a few seconds until the buffer is filled with characters. Now, alternately press
HOME and RETURN. Each time you do this, one of the subroutine lines from the buf-
fer wi II be added to the main program in memory. When the buffer is empty, the recorder
will start again, and additional data read into the buffer. Repeat pressing HOME and
RETURN until the end of the fi Ie mark is sensed. At this point, a SYNTAX error will be
displayed on the screen.
Congratulations! You now have appended the subroutine to the main program with
all the program pointers properly adjusted. LIST the program to check. Rewind your
ASCII subroutine tape to make it ready to append to another main program. You can
repeat these steps as many times as necessary to add several subroutines to your main

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->