Commodore Care Manual PDF
Commodore Care Manual PDF
Your Commodore 64
or 128 Sytstem
Diagnosing and Maintaining
Your Commodore 64
or 128 System
CHRIS MORRISON AND
TERESA S. STOVER
Commodore 64, Commodore 128, VIC 1541, VIC 1571 VIC Datasette. and VIC·
MODEM are trademarks of Commodore Business Machines. Inc
CompuServe IS a registered trademark of CompuServe Consumer Information
Service
CP/M IS a registered trademark of Digital Research Inc.
Dow Jones News/Retrieval is a registered trademark of Dow Jones & Company.
Inc
Smartmodem IS a trademark of Hayes Microcomputer Products. Inc
The Source is a trademark of Source Telecomputmg Corporation
VT100 IS a trademark of Digital Equ,pment Corporation
FIRST EDITION
FIRST PRINTING
Morrison, Chris.
Commodore care manual. diagnosing and maintaining your 64 or 128
system / by ChriS Morrison and Teresa S Stover.
p. cm.
Includes Index.
ISBN 0-8306·3141-0 (pbk.)
1. Microcomputers-Maintenance and repair. 2. Commodore 64
(Computer) 3. Commodore 128 (Computer) I. Stover, Teresa S.
II. Title.
TK887.M65 1988 88·4925
621.391 '6~dc19 CIP
Craig A. Stover edited the manuscript, shot the photographs, provided mor-
al support, and acted as our public relations representative through his incessant
bragging about us.
Diana H. Price edited the manuscript, and offered us her unique blend of
humor, sympathy, and food while having to work with the authors.
IIva Klar created the manual line drawings and loaned us her Commodore
64 system for research and development of this book and the software.
We would especially like to thank Qubix Graphic Systems, Inc. for allowing
Chris to create the electronic line drawings of the Qubix Designer Workstation.
Conlellis
Introduction xiii
Preventive Maintenance
Repair Guidelines
Diagnostics
Exerciser
Creating Your Own Diagnostics
I Getting Started
System Overview
1
The Monitor
I Description and Function of the Monitor 46
46
Types of Monitors
How the Monitor Functions
Troubleshooting and Repair Guidelines 51
PROBLEMS:
Nothing Displays on the Monitor
Static on the Television Screen
Etching
Blank Character Location
Misaligned Display
A Particular Character Does Not Display
Colors Do Not Display Correctly
Sprites Do Not Display Correctly
Running the Monitor Diagnostic Module 58
Display Test
Alignment Test
Character Set Test
Color Test
Scroll Test
Sprite Test
How the Monitor Module Works 62
GL The Printer 76
--- Description and Function of the Printer 76
Types of Printers
Printer Interfaces
Troubleshooting and Repair Guidelines 79
PROblEMS:
The Printer Does Not Work
Poor Print Quality
A Horizontal Tab Is Not Working
Paper Does Not Feed Properly
Certain Characters Do Not Print
Certain Characters 00 Not Print Completely
Installing a New Printer
Running the Printer Diagnostic Module 84
Sliding Alpha Test
Display Character Print Test
Echo Character Print Test
HOrizontal Tab Test
Line Feed Test
How the Printer Module Works 88
161
9 Writing Diagnostics for Other Peripherals
Types of Microcomputer Peripherals 162
Developing a New Diagnostic Module 162
Learn the Functions of the Device
Read the Device Manual
Decide What to Test For
Create a Program Flowchart
Write the Diagnostic Module
Integrate the New Module
Test the New Diagnostic Module
Developing the Joystick Diagnostic Module 165
Functions of the Joystick
Information about the Joystick
Troubleshooting and Repair Guidelines 167
PROBLE.~1S
Joystick Does Not Work At All
Joystick Does Not Work In a Particular
Direction
Fire Button Does Not Work
Joystick Tests
The Joystick Module Flowchart
Writing the Joystick Diagnostic Module
Integrating the Joystick Module
Testing the Joystick Module
xiii
xiv
These methods and procedures will help you better understand the internal
workings of your system, enabling you to maintain a well-running system less
likely to experience long periods of "downtime." You will save time from not
having to deal with a broken computer, and save money from fewer trips to the
computer service center. You might also gain a new understanding of BASIC pro-
gramming. You will certainly gain more control from knowledge about your
computer.
PREVENTIVE MAINTENANCE
To avoid breakdowns and their associated troubles, certain preventive
measures are necessary. Following these procedures will help you maintain your
computer in its best possible condition.
Chapter 1 outlines general practices that help keep your Commodore healthy.
It also explains periodic preventive maintenance procedures that can stave off
system problems. Troubleshooting techniques are explained to help you isolate
problems.
Each succeeding chapter specializes in a particular Commodore subsystem:
the system unit, the keyboard, the monitor, the printer, the cassette tape drive,
the disk drive, and the serial communication interface. Each of these subsystem
chapters provides a brief theory of operation, a I ist of possible problems with
troubleshooting and repair techniques, and an explanation of the associated
diagnostic program module.
REPAIR GUIDELINES
If you suspect a problem with some part of your computer system, refer to
the appropriate subsystem chapter. Within that chapter, refer to the
"Troubleshooting and Repair Guidelines" section. Then look up the problem that
fits what your system is experiencing. Follow the troubleshooting and repair
instructions in the order given. This becomes the computer's "treatment plan."
By following these instructions, you can often fix the problem yourself. If it's
a more complex problem, you can take the system to a computer service center
with a more educated in-depth explanation, a diagnosis of the problem, and a
specific directive of what must be done. This saves the technician repair time,
thereby saving you money.
DIAGNOSTICS
In addition to the "Troubleshooting and Repair Guidelines," the "System
Diagnostic Program" can assist with the troubleshooting task. This BASIC program
includes seven modules, each designed to perform a series of tests on a different
component. You can buy the program on a diskette (refer to the last page of this
book), or you can key it in yourself, because complete program listings for both
the Commodore 64 and the Commodore 128 are provided in the appendices.
The System Diagnostic Program lets you gather information in order to
determine whether the subsystem being tested has a problem, and to pinpoint
where that problem lies. The "Troubleshooting and Repair Guidelines" indicate
xv
when a particular test should be performed. Instructions for running the module
are provided in their own section, along with illustrations of expected test results.
After executing these tests, you'll be able to make a diagnosis and take the
appropriate action.
The program listings and detailed line-by-line explanations of this program
"code" are also included in the corresponding chapters. This is particularly useful
if you know how to program in BASIC, and would like to understand the workings
and logic of the programs. This can also help you modify the program for your
own purposes or for creating new modules for additional subsystems and
peri pherals.
In these line-by-line explanations, the code for the Commodore 64 is used
as a model. The code for the C64 and C128 are similar, but not identical. When-
ever there is a difference between the two, this is noted within the text. In addition,
Appendix C summarizes the major programming differences between the two
systems.
The program listings provided throughout this book use a particular
convention. When a special symbol representing a special key or program output
is part of an instruction, { } braces enclose the word describing the symbol. For
example, consider the following instruction:
PRINT" {CLR/HOME}":RETURN
The words CLR/HOME are not actually in the instruction; rather, the CLR/HOME
key is pressed as part of the instruction. The words are simply spelled out in these
listings for your clarification.
Another example of this is found in the Color Test of the Monitor Diagnostic
Module:
Here, the words in braces, CTRL 1, are the keys that are pressed in order to change
the color to black.
If you are not familiar with BASIC, you can easily skip the program explanations
and still use the diagnostic modules successfully. The entire program is ready to
use. Just create a backup of the program, then load it into your system.
EXERCISER
After you have your computer repaired, you will want to make sure that the
problem has really been solved. The computer is a system of many components,
and as such, when something goes wrong in one part of the computer, it could
actually be caused by something in another part. The Exerciser Module of the
System Diagnostic Program lets you make sure that the system as a whole is work-
ing properly. This is described in Chapter 8.
When you run the Exerciser Module after having a problem repaired, all
system functions are exercised and run for a period of time. This is much like
test-driving your car after repair. The program "burns-in" and tests the system
to confirm that it works correctly and to ensure that there are no recurring
problems.
xvi
SYSTEM OVERVIEW
The typical Commodore computer system consists of the following
components:
o system unit
o keyboard
o monitor
o printer
o cassette drive and/or disk drive(s)
o serial communication interface
You might have more peripherals on your particular system, but this is a basic
configuration, resembling the system shown in Fig. 1-1.
2 Getting Started
serial communication interface, serial printer interface, cassette interface, and mon-
itor interface. Just like the Commodore 64, the 128 system unit is housed in the
same unit as the keyboard. Further information about the system unit is found
in Chapter 2.
The Keyboard
The keyboard is the Commodore's primary input device from the outside
world. Typed characters form commands, move the cursor, and enter data. The
keyboard receives the code of the characters entered, sends them to the system
unit for processing and interpretation, and displays the appropriate results on the
monitor screen. Further information about the keyboard is provided in Chapter 2.
The Monitor
The monitor is the visual output for work done on the Commodore. It is also
known as a cathode ray tube (CRT) or video display. The monitor is the output
device that shows your input data from the keyboard, modem, joystick, or other
input device. It also displays the result of system processing performed within
the system unit. The Commodore usually uses a color monitor, and this can be
either a standard television set or a computer monitor. Further information about
the monitor is found in Chapter 3.
The Printer
Like the monitor, the printer is an output device. However, while the moni-
tor provides output on the screen, the printer provides output on paper, or
hardcopy. A serial interface connection between the system unit and the printer
causes data and processing results to be transferred from the system to the print-
er. You might have a dot-matrix or letter-quality printer. Learn more about the
printer in Chapter 4.
D The Display Test fills the entire screen with a specified character. This lets
you check that each location on the monitor is capable of displaying data.
D The Alignment Test displays a series of vertical and horizontal lines to let you
check that the monitor is properly aligned.
D The Character Set Test displays your monitor's full set of available display and
graphic characters.
D The Scroll Test provides a sl idi ng character set to let you check that the moni-
tor is scrolling correctly.
D The Color Test checks the 16 available colors with a color pallet test.
D The Sprite Test checks the special circuitry used to display and move sprites,
which are used in many Commodore game applications.
D The Sliding Alpha Test lets you check each letter of the printer's available
character set.
D The Display Character Print Test displays the primary character set that the
pri nter recogn izes.
Commodore Care Manual 5
Constant. and
V.rlables
Unes 6-36
1
Main Menu Module
Unes 60-180
!
Keyboard Diagnostic
Module
Lln.s 200-740
!
Monitor Diagnostic
Modul.
Unea 800-11130
!
Printer DI.~nostlc
Modu.
Une.3600-4160
1
C....n. Diagnostic
Fig. 1-2. System Diagnostic Program block diagram. Module
Un.s 4200-4800
T
Disk Drlv. D I.g nostlc
Module
Unes 6000-6200
!
Serial Comm
DI.gnostlc Modul.
Unes 6000-6110
1
Joystick Diagnostic
Module
Unes 7000-7130
1
Exercl ..r Diagnostic
Modul.
Un•• 7200-7470
1
Addltlon.1 Modules
Une. 7600-64000
6 Getting Started
o The Echo Character Print Test lets you check whether or not a particular
character can be pri nted.
o The Horizontal Tab Test checks all horizontal tab positions.
II The Line Feed Test checks various line space gradations, including the feeding
of a new continuous form page.
The Cassette Drive Diagnostic Module tests and exercises the two main
functions of a cassette drive: reading and writing to the cassette. This module is
found at lines 4200-4600.
Likewise, the Disk Drive Diagnostic Module tests and exercises the two main
functions of a disk drive: reading and writing to the diskette. This test supports
both the 1541 and 1571 floppy disk drive models. Lines 5000-5200 contain this
disk drive test.
Lines 6000-6110 contain the Serial Communication Diagnostic Module,
which lets you test the serial communication interface. For this test, you press
a key on the keyboard, and the character is echoed on the screen. This "Ioopback"
test determines whether or not the modem interface is functioning.
The Joystick Diagnostic Module, located at lines 7000 through 7130, is the
example used in Chapter 9 to demonstrate how you could go about developing
and integrating your own diagnostic module for any additional peripherals you
might have.
The final program module is the System Exerciser Module at lines 7200 to
7470. If you have just purchased a new Commodore, or if you've just brought
your computer back from servicing, it's a good idea to burn-in the system. Burn-
in is a continuous testing mode that exercises all system functions. This is
particularly useful when the computer is first set up, or when it is moved, because
that is when most problems take place. The Exerciser Module allows you to burn-in
and check system functions automatically and unattended.
Five system utility subroutines are included at lines 2990 through 3300. These
subroutines include the Clear Screen subroutine, the Get-a-Key subroutine, the
Beep subroutine, the Key-to-End-Test subroutine, and the Key-to-Continue
subroutine. These subroutines are explained later in this chapter.
NOTE: It is imperative that you key the program in before you have a system
problem. If you wait until after you suspect a malfunction, you might not
be able to enter the program for some reason attributed to this malfunction.
Even if you are able to enter and run the program, your test results might
be inaccurate and misleading.
From a Disk Drive. To run the diagnostic on your disk drive, follow these steps:
From a Cassette Drive. To run the diagnostic from a cassette tape drive, follow
these steps:
Once the program is loaded, the screen displays the System Diagnostic Main
Menu. This menu allows you to choose from several diagnostic options, as shown
in Fig. 1-3.
A selection is made by pressing the one-character command which is the first
letter of the name of the desired test. For example, if you wish to run the keyboard
test, enter K or k. The program is not character case-sensitive.
When you press a valid selection, the screen is cleared and you are either
presented with a new menu, or the desired test begins immediately. If you enter
an inval id command, such as Z or R, the system beeps and returns to the selection
mode to let you try again.
When you press Q, the program "quits," or ceases operation, and returns
you to the BASIC environment.
System Diagnostic
Enter Selection
Remember, you can skip this section if you are not familiar with BASIC pro-
gramming, or if you are not interested in how the program works. Skipping this
section and the uihers like it throughout the book \\':1! r:ot in .1::1' v\'ay d!!T!!ni~h
your ability to use the System Diagnostic Program to troubleshoot and repai r your
Commodore.
Line 1 indicates the version of the code-Commodore 64 or Commodore 128:
Line 5 indicates the title and copyright of the System Diagnostic Program:
Line 10 uses the POKE statement to set the graphic character mode to be used
in the test. Then an array is established for a keyboard map by using a DIMENSION
statement to initialize variable K$ to 63:
C128 USERS: In the C128 code, the POKE and DIM K$ statements are
modified to accommodate the larger keyboard.
serves to establish the keyboard map within the program. This map corresponds
to the column/row layout of the keyboard so that the appropriate keycap value
is displayed when a CTRL or COMMODORE (C~) key combination is pressed. This
is necessary because a character might display that is not indicated on the actual
keycap.
For example, at position 0 of this keyboard map is the INSERT/DELETE key, position
1 is the RETURN key, and position 2 is the CURSOR RIGHT key.
The FOR-NEXT loop at line 25 causes the 62 values assigned in the keyboard
map to be read into variable array R:
The (I) is the FOR-NEXT loop index, and this value determines that the characters
fall into keyboard map K$, a variable that is used later in the Keyboard Diagnostic
Module.
e128 USERS: The C128 code includes the 88 values assigned in the key-
board map to be read into variable array R.
e128 USERS: The C128 code has two additional lines at this point. The
first one loads an array with the CHR$ values of the eight function keys.
Line 37 is a FOR-TO loop which reads these values into the array. Refer
to Chapter 2, "How the Keyboard Module Works," for more information
on how this array is used. Refer to Appendix B for the actual C128 code
listing.
Lines 50 through 90 display the System Diagnostic Main Menu on the screen.
Line 50 calls up the Clear Screen subroutine at Line 2990, which clears the screen
and places the cursor at the top left corner. Then a series of PRINT commands
display the title and the various menu options:
Commodore Care Manual 11
Line 100 sends the program to line 3000 for the Get-a-Key subroutine:
When the user presses the key indicating the desired system module diagnostic
test, the CHR$ code value of the key is placed into variable A$.
Lines 110 through 170 check to see which key was pressed for a particular
menu choice. Each menu choice represents the diagnostic test for a different system
module, and is chosen by pressing the indicated character. Pressing K or k initiates
the Keyboard Diagnostic, just as pressing 0 or d initiates the Disk Drive Diagnostic,
and so forth.
When you press the designated key to choose a particular module test, the
program branches to the Get-a-Key subroutine, and the CHR$ code value of the
key pressed is placed into variable A$. If A$ is equal to K or k, then line 110
causes the program to branch to line 200, which is the beginning of the Keyboard
Diagnostic Module:
Line 170 is similar, but slightly different. This line checks to see if you have pressed
o or q, indicating that you are finished with the program and wish to "quit" out
of it:
In this case, rather than branching to another module, the program simply ends,
and the system exits to the BASIC environment.
If the user does not press any of the valid keystrokes as presented in the menu,
the program falls through to line 180. Line 180 goes to the Beep subroutine at
line 3100:
After the beep, the GOTO statement branches the program back to Line 80 to
await another user keystroke.
This is used to clear any messages or displays left on the screen before putting
up a new display. It also places the cursor in an appropriate location so that the
new display fits neatly within the limits of the screen. This subroutine is first
encountered at line 50, when the screen must be cleared and the cursor placed
at the HOME position before printing the System Diagnostic Main Menu on the
screen.
The GET command in line 3000 retrieves the user's keystroke directly from the
keyboard and places it into A$. The IF statement checks whether or not a key
has actually been entered. If no key is entered, then variable A$ is equal to a
null, meaning that there is nothing in the variable. The null is specified by the
two double-quotes:
3005 K=PEEK(197)S=PEEK(653)
When the Get-a-Key subroutine gets a key for the keyboard test, the value of the
key is placed into memory location 197. Here, the program reads this value from
memory to use it as an index into the columnlrow matrix of the keyboard map,
which was built with the DATA statements starting at line 35. This index is used
later in line 595, where the program gets the key value from the keyboard map.
The second PEEK statement on line 3005 sets variable S to memory location
653. This memory location contains the SHIFT/C-/CTRL condition of the key that
has been pressed. If there is a zero in memory location 653, the SHIFT key has
not been pressed. If location 653 contains a one, the SHIFT key has been pressed.
If it contains a two, the c- key has been pressed. And if it contains a four, the
14 Getting Started
CTRL key has been pressed. (For further information about how these commands
function in the program, refer to "How the Keyboard Diagnostic Module Works"
in Chapter 2.)
The RETURN instruction sends the program back to where it was in the code
before it branched to this subroutine to get a key:
3010 RETURN
The Commodore's built-in sound routines are used in this subroutine to produce
a beep to indicate an input error. This first appears in the Main Menu Module
at line 180, when the Beep subroutine is called up if the user presses a key that
is not a valid command key.
The Beep subroutine begins at line 3099 with a REMARK statement:
This line clears the Sound interface Device (SID) registers to prepare for subsequent
sound generation. A register is a special memory location that is an integral part
of the chip's circuitry. To clear the registers, a value of zero is "POKEd" into the
registers located at memory addresses 54272 through 54296.
(128 USERS: Line 3100 takes care of the entire Beep subroutine in the C 128
code, reflecting the use of the C128 beep character, CHR$(7). The POKE
and PEEK statements described below apply only to the C64 version of the
subroutine.
Commodore Care Manual 15
POKE 54296.15 sets the volume (at location 54296) at its highest setting
(represented by the value 15). If you wanted to make the volume of the beep
lower, you could enter a number smaller than 15.
POKE 54277.90 defines how fast the sound rises and falls from its peak level.
POKE 54278.1 defines the level to prolong a note. A value of one does not
hold the sound very long, because a quick beeping effect is desired in this instance.
POKE 54273.21 and POKE 54272.31 specify which note on the musical scale
the beep should be. If you were to refer to the Appendix of the Commodore User's
Guide, you would find a table of musical notes, with the high and low oscillator
frequencies. In this particular case, the note is an E.
Line 3120 is another POKE statement which sets a waveform. The value of
33 defines the resonance of the sound-how shrill or muted the tone is:
Line 3130 is a FOR-N EXT loop which is nothing more than a short delay loop.
This stops the execution of the Beep subroutine, because other than this loop,
there is actually no processing taking place in this line:
This sets the duration that the note is to be played as the beep. For example, if
the TO value were set to 250 instead of 50, you would hear a quarter-note, which
is one standard musical beat. The value of 50 provides a very short, crisp beep
that seems to be the most appropriate for an alarm.
Li ne 3140 halts the beep:
It then returns the program back to where it was in the code before it branched
to this subroutine to sound a beep.
When the program branches here on a GOSU B instruction, the message - press
16 Getting Started
any key to end test" is displayed on the screen. Line 3210 sends this subroutine
to the Get-a-Key subroutine at line 3000. When a key is received in line 3000,
the program returns to the place in the program from which it came.
This subroutine is used several times throughout the System Diagnostic Program
to allow the user to continue with the test at hand.
Documentation
Save all manuals, user guides, specifications, installation instructions, and any
other technical documentation that comes with your system, peripherals, and
upgrades. This documentation will provide the necessary specifics about your
particular Commodore configuration. This information is vital when installing and
setting up a new device, or if your computer malfunctions.
Commodore Care Manual 17
Tools
Tools let you open, bend, cut, insert, and connect things in your computer.
The following tables list required tools, optional tools, and cleaning supplies. The
tools make the job of computer troubleshooting and repair possible. The clean-
ing supplies are vital, because cleaning is a major aspect of maintenance.
When you buy your tools, try to obtain good-quality tools. This does not
necessarily mean you should buy the most expensive ones on the market, but
you do want tools that will not bend or break at a critical moment. In other words,
buy dependable tools that will last a long time.
Table 1-1 lists required tools, and Fig. 1-6 illustrates these tools. Table 1-2
lists optional tools, and Fig. 1-7 provides their illustration. Table 1-3 lists clean-
ing supplies, and Fig. 1-8 illustrates them. The tables all list the functions, uses
and approximate costs for the tools and cleaning supplies.
Spares
Professional technicians usually have an inventory of spare parts for the
equipment they work on. The spares help them in troubleshooting, when they
swap out parts to find out whether or not it was that component that was causing
the problem. If the replacement solves the problem, then they know that the old
part was defective.
In your case, however, maintaining an inventory of spare parts for your
Commodore would be costly and impractical. An alternative to this is to find some-
one (a friend, a colleague at work, an acquaintance in a user's group) who also
owns a Commodore system. Work out a deal with this person enabling you to
temporarily swap parts with each other when one of your systems malfunctions.
You can use the other person's system for troubleshooting by temporarily swapping
suspect parts to find exactly where the problem is.
Find out where you can get the best prices for computer parts. There might
be a good discount computer or electronics supply store in your area that stocks
computer components at lower rates than a computer retailer. The want ads in
18 Getting Started
wire strippers/cutters
'Is" flat-blade
needle -nose screwdriver
pliers %" flat-blade
screwdriver
Average
Cost
to tighten and untighten
1/4" slotted screws for $3_50
1/4" flat-blade screwdriver
opening the system unit and
keyboard covers
to tighten and untighten
1/8" flat-blade screwdriver 1/8" slotted screws on $2_00
interface cables
to tighten and untighten
small Phillips screwdriver small cross-slotted screws $3_00
used for holding bolts down
to grip and/or bend
needle nose pliers small objects as an
$5-12.00
extension or a "helping
hand"
to grip and/or bend
pliers small objects, to hold larger $5.00
nuts
to cut wire, to strip away
wire strippers/cutters $5-12.00
plastic insulation
to tighten and unti!ilhten
screws in an electrically
non -conductive screwdriver charged environment such $2.00
as the monitor and power
supply
Commodore Care Manual 19
socket
t
III r,\
~Id! small
wrench metal desoldering digital
set flat tool voltmeter &
file probes
brush
the back pages of most computer magazines are good sources for used parts, as
are computer flea markets and swap meets.
User Resources
Computer resources become more and more important, the more involved
you become with your computer. It becomes less important to know everything
if you have good resources that provide you with accurate information.
If, after doing a bit of troubleshooting, you still can't find the problem, call
your local Commodore dealer. Most stores will assist you with valuable information
if you can ask specific questions.
Keep in mind that a friend of yours with a Commodore system might know
things you don't. Exchange information with any other Commodore users of your
acquaintance. Everyone's computer experience and knowledge is different.
Commodore user's groups are excellent repositories of information and
experience. You can find a local user's group through your computer dealer, in
your newspaper's computer page or social events page, or from listings in computer
magazines. The people you'll meet at a user's group can help you answer
questions, solve problems, and find other resources.
Read the Commodore computer magazines. They often provide good advice,
information, and further resources.
LIMITS TO TINKERING
Never try to fix something for which you do not have the proper knowledge,
documentation, tools, or parts. A little knowledge can be dangerous, especially
when you know just enough to get yourself in trouble. You could make the prob-
lem worse.
22 Getting Started
Never attempt any procedure you feel you cannot handle. Do the easy repairs
first, and work your way up to the more difficult repairs as your skill and confidence
grow. When in doubt, let the professionals do it. Don't put your computer in
needless jeopardy.
Also, remember that a good technician does not tinker needlessly:
MAINTENANCE TECHNIOUES
A good computer technician performs general care and preventive main-
tenance on computers to minimize "downtime." Preventive maintenance and
good working habits are the two keys to system and component longevity. Many
system problems can be avoided if a few good habits are established.
Dust Covers. Buy dust covers to protect the monitor, system unit/keyboard,
disk drive, and printer. Dirt and moisture are your system's worst enemies. Dust
settles and collects on the contacts-the exposed wi res, or the legs, of the integrated
circuit (IC) chips on the system's printed circuit boards. These contacts have electric
current flowing through them, so that they become ionized, and attract particles
of dust. The dust attracts moisture out of the air. As this process continues, the
dust and moisture eventually cause electrical shorts and corrosion of the electronic
parts, which can then cause system malfunctions.
Spending $10 or $20 for a dust cover is preferable to buying a brand-new
printed circuit board to replace one that has been ruined by corrosion. Get into
the habit of coveri ng your system when not in use.
This grounds you and keeps you from transferring static electricity to your
computer.
If you ever handle a printed circuit board, do not touch the metal edge
connectors. This will discharge the electricity in your body through the printed
circuit board to the nearest IC chip.
Power Surge Protection. The electricity at the wall sockets is rated at 110/120
volts at 60 Hertz (cycles per second). There are moments when surges of electricity
exceed 110/120 volts, and other moments when sags in voltage are lower than
normal. You've probably experienced drops in electricity when your lights dim.
This "brown-out" effect might cause your keyboard to temporarily lock up, and
you might lose some data due to logic-related problems within the computer.
The most damaging problem is the voltage surge. A power surge can pass
through your power supply's filter circuits by giving it more peak voltage than
it can effectively suppress. Your computer's power supply takes the 110/120 volts
ac and rectifies it to 5, 12, or 15 volts de. These are the voltages with which the
integrated circuits in the computer are designed to operate. When the computer's
power supply receives a large power surge, it is not capable of suppressing it.
This instantaneous spike is sent through to the chips, damaging or even destroying
them.
Because boards and many chips are expensive to repair and replace, protect
the computer from these indiscriminate surges by using a surge protector.
A surge protector isolates the voltage spikes in order to provide the system
with a constant 11 0/120-volt supply. Obtain a surge protector at a computer or
electronics supply store. Using a surge protector with your computer extends the
life of its integrated circuits.
Food and Drink. Don't eat or drink near your computer. If you spill or drip
something into your keyboard, you'll have an emergency cleaning job on your
hands, or even the instant need for a new keyboard. Because the keyboard and
system unit are included in the same housing, any liquid that spills in the keyboard
could seep into the system unit, causing far more serious problems, such as shorting
components out and causing permanent damage.
Cookie crumbs, sandwich particles, and dinner bits can all end up inside your
keyboard and system unit, if you eat while working. This can destroy the keyboard
contacts and render your keyboard useless. It can also damage components of
the system unit.
Preventive Maintenance
You should perform the following preventive maintenance procedures for
your computer at least every three months. These procedures keep your system
clean and in adjustment, thereby warding off possible problems.
If you have a choice between the two, it's preferable to vacuum dust up rath-
er than blow it around. Blowing dust can possibly send it deeper into the system,
where it might cause even more trouble _
Cleaning. Certain parts of your system can become dirty through continuous
use. The floppy disk drive head, the daisy print wheel, or the dot-matrix print
head can accumulate a layer of oxidation or dried ink.
Disk drive head cleaning kits are available at most computer stores for
approximately six dollars. Insert a special diskette permeated with a cleaning
solution, enter a command that causes the diskette to rotate, and the read/write
heads are cleaned in a flash.
If you use a cassette drive with your system, you can get cassette cleaner from
a record or stereo store. You can also use cotton swabs lightly moistened with
isopropyl alcohol to clean the read/write heads of the cassette drive.
A gauze cloth soaked in isopropyl alcohol (not rubbing alcohol) can be used
to clean daisy wheels and dot-matrix print heads. Isopropyl alcohol can also be
used to clean the exterior or interior of your system where dirt and dust have
accumulated. Use cotton swabs lightly moistened with isopropyl alcohol to clean
hard-to-reach areas .
Loose Cables. Several cables may be connected to the system unit at the rear
and side. These cables connect interface circuits to the peripheral devices. The
cable connectors are plugged into the system unit's receptacles . If the cable
includes screws, they should be tightened down. These cables loosen when, for
example, you move the printer or bump the modem. Suddenly a peripheral stops
working because it's not getting the proper connection .
The solution to this is to use a small screwdriver and secure the cable into
Commodore Care Manual 25
its receptacle. If the cable does not have screw mounts, then simply make sure
it is correctly pressed into the receptacle.
Troubleshooting Techniques
"Troubleshooting" is another word for problem-solving. You have a computer
malfunction, and you want to systematically go about discovering what caused
it so you can effect a repair.
Start with the easy things first:
Each subsystem chapter that follows lists several more specific solutions to try
when troubleshooting a problem.
When you've tried everything and the problem still is not fixed, the system
unit itself is often involved. Refer to Chapter 2, "System Unit/Keyboard" for system
unit troubleshooting procedures.
If those system unit measures do not effect a repair, it's time to take the
computer in for servicing.
WHAT TO DO FIRST
To get started on the general care, preventive maintenance, troubleshooting,
and repair of your Commodore, do the following:
D Read through this book to familiarize yourself with the concepts and
organization of the material. This way you can get started immediately with
preventive maintenance, and when a problem arises, you'll know right where
to look.
D Make a backup of the System Diagnostic Program. If you did not purchase
the program diskette, key in all the diagnostic programs now, before any prob-
lems arise. Then if something does go wrong, you'll already be prepared to
troubleshoot.
D Gather at least the basic tools and cleaning supplies into a computer
maintenance kit.
n Collect all the technical documentation you have and find a central place for
it, such as an area at your desk or bookcase, or in a binder.
U Contact someone who also owns a Commodore system, and agree to loan
and borrow components when needed for troubleshooting. Start establishing
your computer user resources.
n Tryout the diagnostics now, before you have a problem. Know how the results
are supposed to appear under normal circumstances.
D Code any necessary modifications into the System Diagnostic Program. These
modifications might have to do with accommodating another peripheral, or
26 Getting Started
Although there is no specific system unit module within the System Diagnostic
Program, the modules testing each of the subsystems perform a sufficient job of
exercising the system as a whole. This is because all subsystems are connected
into and controlled by the system unit.
27
28 The System Unit/Keyboard
The physical action of pressing the key causes the CPU, which interfaces with
the keyboard, to gather the column and row information, indicating where the
key is located on the keyboard. The CPU also discerns whether the SHIFT, CTRL,
or c- (Commodore logo) key is pressed.
This information is sent into a program residing within the kernel portion of
the system's read-only memory (ROM), and it is here that the calculations are
made about what the keystroke actually is and what it is expected to do.
The kernel handles input (keyboard) and output (monitor), or I/O functions
for the Commodore. In this case, it takes the character and transfers it to the
keyboard buffer_ Further processing in turn transfers the character to the monitor's
screen memory, thus displaying the character on the screen_
B Solutions
[] The first thing to check is whether or not the system unit's red LED power
light is illuminated. If it is not lit, the system unit is not getting power. Check
your electrical outlet, the power strip if applicable, the wall switch if applicable,
and the fuse box or circuit breaker.
If these are all in order, the next thing to do is check the system's power sup-
ply. This is a fairly simple procedure, because the power supply is external
to the system (Fig. 2-3). Remove the power supply and swap it on another
Commodore system. If that system does not power up either, then buying and
installing a new power supply will solve your problem. A Commodore power
supply costs approximately $40.
o If the red LED light is illuminated, but the keyboard does not work, check
the monitor for your standard screen prompts. These prompts indicate that
you are in the BASIC environment by displaying the word READY and then
a block cursor. If you do not see any of these, there is likely to be a problem
with the system unit. Turn the computer off, Make sure the power supply cable
is securely connected to the system, and turn the computer on again. If the
screen display still does not look right, take the system unit in for servicing.
o If the red LED is illuminated and the system prompts are displayed correctly
on the screen, but the keyboard still does not work, this indicates a keyboard
problem rather than a system unit problem. Follow these steps:
1. Turn the system off.
2. Disconnect the power supply.
3. Disconnect all attached peripheral devices (cassette drive, disk drive,
printer, monitor, etc.).
4. Remove the screws from the bottom of the system unit (Fig . 2-4).
5. Open the system unit. You'll see a ribbon cable running from the keyboard
onto the printed circuit board containing the CPU chip and many other
o If the keyboard circuitry is not the problem, replace the keyboard. Replacement
keyboards are available through a Commodore dealer, service center, or
magazine mail order. However, the keyboard should not need to be replaced
unless it has been handled roughly or dropped.
where it's supposed to be, but nothing happens; the "a" simply is not working,
while all the other keys are working fine.
First run the Keyboard Diagnostic Module and confirm that the key does not
work.
l2i Solution
o If the key does not work, use a flatblade screwdriver, or better yet, a key
removal tool, to lift the key from the keyboard (Fig. 2-7). Spray contact cleaner
on the key post (Fig. 2-8). Contact cleaner is available at electronics stores.
Replace the keycap on the post and try it again. If the key still does not work,
the keyboard might have a more serious problem; take it in for servicing.
c;::: Solutions
[l Lift the key off and spray contact cleaner on the key post as described in the
previous solution. This clears off any dust or dirt that might be obstructing
the free movement of the key.
II Remove the keyboard cover from the bottom. Take a flat file and slightly file
the cutout in the case where the key is binding. This makes the receptacle
larger, so the key doesn't fit so tightly.
o If the key is not binding on the case, pop the key off and lightly file the edges
of the key itself (Fig. 2-9). This should loosen the fit between the key and the
key case so that the key can move more freely and no longer stick.
'2J Solutions
D Call around to computer retailers to find keyboard springs for your keyboard.
Lift off the keycap and then remove the spring from its post (Fig. 2-10). Re-
place the old spring with the new, and pop the keycap back on.
D If you can't find a replacement spring, use one from the keyboard that is rarely
used. It could be one of the function keys, or perhaps one of the numbers
on the 128 ten-key pad.
When running the Keyboard Diagnostic Module, press a key to test whether
it's working properly. This diagnostic should read and display, or echo, this key.
The echo test lets you check whether or not a particular key, or even the entire
keyboard, is working.
The Keyboard Diagnostic Module also displays the CHR$ value of the key.
This lets you check whether the keys are sending the proper code to the computer
to display the proper character or function. The Commodore User's Guide that
is provided with your system includes a table that shows which key and/or function
each CHR$ code value is meant to provide.
To run the Keyboard Diagnostic Module, follow the instructions provided
in "Running the Diagnostic Program" in Chapter 1. Then press K or k to initiate
the Keyboard Diagnostic Module.
Following the instructions given, press any key you wish to test. You can test
any key on the keyboard: alphanumeric keys, cursor keys, function keys, special
CTRL or c~ keys. The key you press is displayed along with its CHR$ code value
and any applicable key combination (Fig. 2-13).
If a character other than the one you pressed is displayed, or if no CHR$ code
value is displayed, then you have accomplished the first troubleshooting step:
there is something wrong with your keyboard. Refer to "Troubleshooting and Re-
pair Guidelines" earlier in this chapter to get the keyboard working properly again.
When you finish testing, press the CLR/HOME key, and the program should
return to the System Diagnostic Main Menu. If this does not happen, the CLR/HOME
key is failing. In that case, press the RUN/STOP key to end the program, then
troubleshoot the CLR/HOME key.
C128 USERS: The C128 code has an additional line, 205, which changes
the values of the function keys so that they will actually display their
keynames (Fl, F2, F3, etc.) during this test, rather than displaying the code
for their programmed functions. This replaces the function keys' current pro-
gramming; however, their default designations are stored in system ROM.
Turn the system off and on again to restore the function keys to their original
programming after you have run this test.
Actual processing begins at line 210. The first command is a POKE statement,
which places a value directly into a particular memory location. In this case, the
program places a value of 23 into memory location 53272. This sets the character
mode to set 2, the upper/lowercase mode.
C128 USERS: The 128 code uses a different POKE location and value in
line 210.
Line 220 indicates that until the user enters a key to be placed in variable A$,
variable KY$ remains null. Variable KY$ holds the display indications of any CTRL
and c ~ key combinations, such as GRL A, for later use in the test display.
The COSUB instruction returns the program to the Get-a-Key subroutine at line
3000. As soon as the user presses a key to be tested, the Get-a-Key subroutine
breaks its continuous loop, and the program continues on to line 230.
Line 230 sets variable N equal to the CHR$ value of A$, which is the variable
holding the keystroke:
230 N = ASC(A$)
Commodore Care Manual 39
This is done because some keystrokes cause some type of cursor movement.
Ordinarily, the program prints the value held in A$ to display the graphic character.
However, if it's a special character that causes a cursor movement, the program
changes A$ to a blank so that the test display is not disrupted. Still, the CHR$
value of the key must be indicated, even though there is no graphic indication
of the keystroke itself. So the program sets N to the CH R$ value of A$ before
processi ng.
After this, line 260 checks to see if the CHR$ value of A$ is equal to 19.
If it is, this indicates that the user has pressed the CLRiHOME key, which causes
the program to go to line 740 to begin an exit subroutine:
The program performs some "housekeeping" routines before exiting back out
to the System Diagnostic Main Menu, and these routines are found at line 740.
If the value of A$ is not equal to 19, the prograrn falls through to line 270.
Lines 270 through 530 check for exception keys, such as cursor movement keys,
the RETURN key, color modes, and keys for which there is no actual graphic display
character:
This exception check is done for these particular keys so that these functions are
not actually displayed. To prevent any disruption to the screen displays effected
by these keys, variable A$ is set equal to null for each of these special cases.
The color commands are not "trapped" in this manner other than to display
their key combinations. If the user activates the color green while in this test,
for example, the display changes to green. This lets you test the key combinations
used to obtain the different colors. As part of the "housekeeping" routine start-
ing at line 740, the program resets the screen color back to the default of light
blue before returning to the Main Menu.
Taking line 270 as an example for these exception cases, you see the following:
The value 5 returned from a character variable (CHR$) means that the user pressed
CTRI 2, which sets one of the colors. The variable KY$ stores the key combination.
The program branches to line 600 for the actual test processing, because now
that the program has received a user keystroke, the keystroke can be processed.
As you can see, there are quite a number of these exception checks. This
ensures that all keys and all combinations can be tested. Some key combinations
produce a color, as in the example at line 270. Other key combinations produce
graphic characters. An example of this is pressing SHIFT 1 to have the! symbol
displayed and tested. Other examples include the graphic characters returned when
the C ~ key is pressed alone or in combi nation with the SHIFT key to get one of
the graphic characters displayed on the right or left of the keycap legend. This
test lets the user know which key combination was pressed to display the graphic
character.
e128 USERS: Three additional lines are added in the C128 code for this
section: lines 272, 273, and 315. These I ines provide exception checks for
the TAB, LINE FEED, and ESC keys, respectively, which are not available on
the C64.
If the user does not press any of these exception case keys, the program falls
through to line 560.
Line 560 is an IF statement which sends the program to line 600 if variable
42 The System Unit/Keyboard
If variable 5 is not equal to four, the program falls through to line 710, which
is an error routine signaling that an improper SHIFT condition, and possibly a
keyboard problem, exists.
C12B USERS: Line 580 is modified in the C128 code to handle the ALT key
available from the C128 keyboard, which offsets the possibility of such an
improper SHIFT condition.
Line 590 sets variable KY$ to CTRL for the display of the key combination. The
program then falls through to line 595.
Line 595 goes to the keyboard map and retrieves the other character that was
pressed in combination with the c- or CTRL key. This key is held in variable K$(K),
the character value index that was retrieved from memory in line 550. The (K)
holds the position of the major keycap from K$:
At this point, the program finally has all the information necessary to actually
display the test results of the key(s) pressed, and can proceed to line 600.
Line 600 is a CaSUB to line 630. Line 630 starts the routine which prints
the Keyboard Diagnostic Module headings, such as "Character," "Value," and
so forth:
After the headings are displayed, the program returns to line 610. This is the line
that actually prints the test results of the pressed key(s):
It tabs the display over five columns, then prints the contents of variable A$, which
is the actual graphic character. Of course, if the pressed key(s) were an exception
of some type, nothing would display in this field, because the exceptions were
set to blanks to prevent the display from being adversely affected by the function.
Then the display tabs to position 13, and the contents of variable N is printed.
At the start of this module, the CHR$ value of A$ was set to N. This was done
for the exception keys which were converted to blank letters. If the actual
CHR$(A$) were printed here, you would probably see just a blank, or a value
of 32, which would not be useful information. So N holds the actual CHR$ code
value of the key(s) that is being tested.
Next, the line tabs to position 23, and the key combination is printed, for
example, CTRL 4. Finally, the line tabs to position 35, and either Sl or S2 is
pri nted, to tell you which graphic character mode the system is currently
employing, set 1 or set 2.
Line 620 sends the program back to line 220, the location where the program
looks for another keystroke to test:
640 V = PEEK(53272)
Location 53272 holds the data indicating which graph ic character set is currently
active-the uppercase-only mode (set 1), or the upper/lowercase mode (set 2).
(128 USERS: Line 640 in the C128 code is modified for a different PEEK
location of the current graphic character set.
Li ne 650 then has a related IF statement: if variable V contai ns 21, then the
44 The System Unit/Keyboard
variable S1, which holds the graphic character set information, is set 1, the
uppercase mode.
(128 USERS: The (128 code is modified at line 650 to handle the different
value of V for the character set mode.
If the statement in line 650 is not true, the program falls through to line 660,
which assumes that if variable V is not a 21, then it must be a 23. The value 23
indicates that graphic character set 2 is active for the upper/lowercase mode.
Line 660 first sets variable S1 to two for the upper/lowercase mode. Then it prints
the title of the Keyboard Diagnostic Module followed by a blank line.
Line 670 goes on to print the test headings:
This lets you change between the two character sets, and the headings reflect
which set is active.
Line 700 then prints a row of dashes beneath the test headings. This row of
dashes is valid for either graphic character set:
Line 700 then returns the program to the point in the code from which it came
before it branched to this subroutine.
Recall that line 580 checks the key combination's SHIFT mode. If a value of
zero, one, two, or four is not found there, the program branches down to line 710:
Line 710 is a GOSUB to line 630, which displays the diagnostic headings.
Lines 720 and 730 then print a message and return the program to line 220
to wait for another key to test:
This resets the system to graphic set 2, for the upper/lowercase character mode.
This ensures that when the program does return to the Main Menu, all the menu
choices will be displayed in the proper type style.
That's the first part of the exit "housekeeping" routine. The second part prints
CHR$(154) to return the screen color to the default of light blue, in case the user
has been testing the different color commands as part of the keyboard test.
Finally, the GOTO statement returns the program to line 50, which is the
beginning of the System Diagnostic Main Menu.
C128 USERS: Line 740 is modified in the C128 code for a different POKE
location and value.
Chapter 3
Tile Manitor
When working with a computer, constant visual feedback, or output is necessary.
You need to see your input as you enter it, and you want to see processing results
as the computer produces them. Just as the keyboard is the primary input device,
the computer uses the monitor to provide the primary output.
Types of Monitors
There are several types of monitors that can work with your Commodore
system. These include the following:
46
Commodore Care Manual 47
o monochrome monitors
o high-resolution monochrome graphics monitors
o high-resolution color graphics monitors
The monitor you obtain to work with your Commodore must be able to conform
to the Commodore's RGB (red-green-blue) cable plug. Most computer monitors
available can accommodate this type of cable.
The Television Set Monitor. The, Commodore 64 and 128, like many other
home computers, are designed to use a television set as the monitor. An external
radio frequency (RF) converter is attached to the television via the television's
VHF antenna leads (Fig. 3-2). If your television is cable-ready, you can use a coaxial
cable connector instead of the antenna leads.
The Commodore cable attaches from the back of the Commodore to the RF
converter. The RF converter includes a switch to let you choose between using
the television as a computer monitor ("COMPUTER") and using the television
to view broadcasts (" TV"). There is also a switch on the Commodore that allows
selection of either Channel 3 or Channel 4 as the channel used for the computer
mode.
The television-set monitor can display graphics and color, but only in the
40 x 25 text format (instead of the 80 x 25 text format on a standard computer
monitor) .
48 The Monitor
The Color Monitor. The color monitor is a high-resolution monitor that can
display the pixels in different colors. A color monitor can be a vital asset when
using your computer to do business graphics or design work.
If you Jre using a color television as the computer monitor, colors are already
available to you. Another option is to buy a high-resolution color computer mon-
itor that can be used with the special Commodore five-pin composite video port.
Electron Beam ~
----I- Image Produced by
the Electron Beam
...... ....................................
"
~
t
Electron Gun _ _
chrome monitor, about seven of these light spots make up one character. On a
high-resolution monitor, these light spots are the pixels which vary in density to
form the characters, graphic elements, and drawings.
When a character on the keyboard is pressed to be displayed on the moni-
tor, or when a particular application displays processing results, the program
instructs the monitor to paint a certain pattern which forms the character
representation. The specific pattern displayed is dependent upon the type of display
matrix your monitor has.
When in the text mode, the monitor's display works on a character matrix.
The display is divided into 25 horizontal rows. These rows are intersected by 40
to 80 vertical columns. The position at which a column and row intersect is one
character location (Fig. 3-4).
The high-resolution, or color, display is a matrix as well, but a much more
2 3 4 5 6 7 8 9 10 11 12 13 14 . 80
T H I S I S L I N E I
2
3
4 V~
5 /
6 1/
7 l/
8 V
24
Fig. 3-4. Column/row matrix.
50 The Monitor
precise one, working at a pixel level rather than a character level. Because an
individual pixel is much smaller than a character, and because there is a greater
density of pixels, there is more flexibility and precision represented on the display.
This creates a sharper picture with higher resolution.
The Monitor Interface. The Commodore systems have two types of monitor
interfaces available. The one you use depends on whether you're using a television
or a computer monitor.
When using a television as your monitor, a round single-pin cable is used
together with an RF converter to create the monitor interface. One end of this
cable connects into the Commodore system unit, and the other end connects to
the RF converter, which in turn connects to the VHF antenna terminals on the
back of the television (see Fig. 3-2). The RF converter takes the computer's digital
signals and converts them into the analog signals required by the television. In
effect, the computer is functioning as a transmitting station to the television. When
using a computer monitor instead of a television, the round five-pin RGB cable
supplied with the monitor is the monitor interface.
[.-j Solutions
D Check the brightness and contrast knobs, and make sure they are turned at
least two-thirds of the way up. Someone else might have turned the controls
down to prevent the screen from etching (see the next section on "Etching").
D Check that the monitor itself is properly connected. If the monitor is a television
set plugged into a different socket than the computer itself, check to see whether
the plug is controlled by a light switch. If it is, turn the light switch on.
D Make sure that the plug is active and working. Test this by plugging another
electrical device into the socket to see if it works. If it does not, an electrical
supply problem is indicated. Check the fuse box or circuit breaker.
D Check the cabling to ensure that the monitor is properly attached to the display
interface of the system unit.
D When the monitor is properly warmed up (it takes a minute or so), turn the
brightness control knob up as far as it wi II go. A series of lines shou Id be
displayed across the screen (Fig. 3-5). If you don't see this, and the screen
remains blank, then the monitor's power supply might be defective. Take the
monitor in for servicing.
D If the monitor is making a crackling noise and the screen remains blank, this
might indicate a problem with the display interface. If you run your hand next
to the screen, the hairs on the back of your hand might become attracted to it.
First, try swapping a different monitor or television onto your system. If this
monitor works, then your other monitor needs servicing. If the swapped monitor
does not work either, a problem with the system unit itself is indicated. Refer
to Chapter 2 for system unit troubleshooting procedures.
[2] SolutIons
D First check the television. To do this, switch the RF converter to the television
mode, or disconnect it altogether. Then change the television channel to a
known working station. For example, if you know that you receive Channel
2 very well, turn it to Channel 2. If you still do not receive Channel 2 nor
any other channel, there is a problem with the television's tuning or receiving
mechanism, and it should be taken in for servicing.
[J If there is a television picture, then you know that the television is working
fine, and you should test the RF converter. The RF converter has two switch
positions: COMPUTER and TV. Make sure that the converter is switched to
the COMPUTER position. Check that the converter is properly connected to
the correct antenna leads: VHF rather than UHF.
Next, make sure the channel selector is set properly for the computer.
The Commodore is set up so that it can operate from either Channel 3 or
Channel 4. Select which channel the computer will use with the slide switch
on the rear of the Commodore system unit/keyboard. The channel selected
on the computer should be the channel the television is on.
If the screen still shows just static, replace the RF converter. You can obtain
one for approximately $5 at a stereo or electronics store.
[J !f you try a!! the previous solutions with thp tplevision 5Pt ;mrl thp RF ronvprtpr,
but there is still static on the television screen, the computer system unit is
probably having a problem. Refer to Chapter 2, "The System Unit/Keyboard"
to troubleshoot system unit problems.
Problem: EtchIng
Etching, or ghosting, takes place on the screen when one particular format,
such as the text editor menus or database screen, is displayed on the screen for
long periods of time without changing. If the computer is left running with the
same image displayed for many hours a day, or many days a week, the constant
bombardment of the electrons on the same area of the picture tube phosphor can
permanently burn, or etch, that image into the screen. When that happens, even
when something else is displayed, you will still see a ghost image of the etched
Commodore Care Manual 53
display. At the same time, the display you want to see will be fainter, more
"washed out."
There isn't anything you can do to make an image that is etched into your
display go away. In other words, you can't "fix" etching, unless you buy a new
monitor. The key in this case is prevention. To prevent etching, either turn off
the display or turn down the brightness when the computer is not in use.
2] Solution
o To troubleshoot this problem, run the Display Test of the Monitor Diagnostic
Module. Press a character on the keyboard, and the entire screen should be
filled with this character at every available character location. If you see that
a particular character is missing, there is a problem in the display interface
board. Each character represents a video memory location. If a character does
not display, it means that its memory location is probably bad, and chips need
to be replaced. Take the CPU board in for servicing.
II I
Fig 3-6. Misaligned displays.
54 The Monitor
~ Solutions
D Run the Alignment Test. If the grid does not appear square and symmetrical
on the screen, the monitor needs adjustment. There are adjustment
potentiometers on the back of most monitors. Use the tuning wand (do not
use a metal screwdriver!) to gently turn these potentiometers ("pots") either
clockwise or counterclockwise to bring the screen back into alignment. Note
the direction you're turning the pot, and make only one-quarter of a turn at
a time, so you can easily return the pot to its original position if necessary.
D If adjusting the pots does not bring the monitor back into the proper alignment,
take the monitor in for servicing and have it adjusted.
D If your monitor is a television set, simply adjust the horizontal and vertical
hold controls until the alignment grid looks straight.
~ Solution
D If you run the Display Test and do not see all the expected characters, or if
the display is incorrect or garbled, a problem with the system unit itself is
indicated. Refer to Chapter 2, "The System Board/Keyboard" to troubleshoot
the system unit.
~ Solutions
D First make sure that the monitor is actually a color television or a color moni-
tor instead of a black-and-white television or monochrome monitor.
D If the monitor is displaying colors, but they're not the correct colors, there
are two different adjustments you can make to rectify this problem.
If you're using a television monitor, first check a normal television picture,
Commodore Care Manual 55
and see if that color is adjusted properly. If the picture doesn't look right, for
instance, if faces look too red , or green, then you simply need to adjust the
color and tint controls on the television set.
Once the television broadcast picture has displayed the correct colors,
switch the television back to the computer mode and check the color. It's
possible that the color of a television broadcast might look fine, but when
working in the computer mode, the colors are wrong and/or fuzzy. \Vhen work-
ing with a computer monitor, you can simply adjust the color and tint controls
of the monitor, just as you would with a televi sion.
o After making the proper adjustments, if the colors are still not correct, you'll
need to adjust a variable resistor inside the computer's system unit on the
motherboard. To do this, first remove the cover to the system unit, following
these steps:
1. Turn the system off and disconnect all peripheral cables.
2. Turn the system unit upside-down, resting the keyboard on foam or pa-
per to protect it.
3. Remove the three phillips-head screws (Fig. 3-7).
4. While holding the case together, place the system unit keyboard-side up
again .
5. Grasp the case on the bottom edge (by the SPACE BAR) and I ift. The case
is hinged and will fold back. Do this slowly and carefully to avoid
jerking the keyboard cable from its connector.
6. Carefully bend back the silver ca rdboard cover which shields the
motherboard (Fig. 3-8).
Now adjust the color trim. To do this, follow these steps:
Rear
D
Motherboard
o
o
c:J
c:JC
Color trim
resistor
Front
Adjusting the color from inside the system unit does not affect the color and
tint settings of the television or the monitor whatsoever.
B Solution
o To check the scrolling, run the Scroll Test. Enter enough repetitions, about
30, so that the printed lines will more than fill up the screen. if the display
does not scroll properly, then there is a problem with the display section of
the system unit. Refer to Chapter 2 and troubleshoot the system unit.
display sectioll of memory. A problem with the sprite memory register could cause
a problem with the sprite display.
You might susiJect a sprite problem when running a game, for example, if
olle of the objects do not rnove or look quite right. Confirrn the problem by run-
ning the Sprite Test of the Monitor Diagnostic Module.
!;.;; Solution
If the sprite doe" not move, or if it rs the wrong color (it should be white)
or the wrong shape (it should be a square), there is a problem with the sprite
circuitry in the system unit. If this is the case, refer to Chapter 2 and troubleshoot
the system unit.
Display Test
To run the Display Test, press 1. The screen clears and then gives the test
instruction (Fig. 3-11). Press d character on the keyboard. (Function keys and the
/'
Monitor Diagnostic
Display Test
cursor arrow keys do not work for this test, because they do not have a particular
graphic display.) The character fills the entire screen at every available character
location, including the status line.
At this point, any character locations that do not display the character, or any
pixels that are "out," are suddenly very obvious.
After displaying the character at every location, the program waits for you
to press another character. You may enter another character at this point, or press
CLR/HOME to return to the Monitor Diagnostic Menu.
Both character sets, set 1 and set 2, can be used for this test. It's a good idea
to run the Display Test twice, once for character set 1, and again for set 2.
The Display Test can also be used to validate a keyboard problem. Because
the Keyboard Diagnostic relies on user input to display a character, a faulty key
might not produce a particular character. If the Keyboard Diagnostic indicates
a problem, check it again with the Display Test. The Display Test generates the
characters by using a program, so if there is a character in this test that you did
not see in the Keyboard Test, this confirms a keyboard problem. Refer to Chapter
2 to troubleshoot the keyboard.
Alignment Test
Pressing 2 from the Monitor Menu presents the Alignment Test, which displays
the alignment box with horizontal and vertical lines resembling Fig. 3-12.
The alignment grid helps you look for any alignment or skew problems. The
display should look symmetrical, with straight lines and no distortion. To end
this test and return to the Monitor Diagnostic Menu, press any key on the keyboard.
60 The Monitor
ALIGNMENT TEST
Color Test
To test color on a color monitor, press 4 from the Monitor Diagnostic Menu.
The screen displays the name of the color, then a bar of that color (see Fig. 3-14).
All the colors available for your monitor are displayed in this manner.
This test is particularly useful not only to test the colors of the monitor, but
also to adjust the colors if there is a problem with them. Leave this test displayed
on the screen, and make the necessary adjustments, until all the colors look right.
Refer to "Troubleshooting and Repair Guidelines" earlier in this chapter for the
adjustment procedure.
When you press any key, the Color Test is cleared, and the Monitor Diagnostic
Menu is displayed again.
Scroll Test
To test scrolling and scroll rates, press 5 from the Monitor Diagnostic Menu.
The Scroll Test prompts for the number of repetitions for the test. Enter a number
Commodore Care Manual 61
Color Test
Black XXXXXXXXXXXXXXXXXXXX
White XXXXXXXXXXXXXXXXXXXX
Red XXXXXXXXXXXXXXXXXXXX
Cyan XXXXXXXXXXXXXXXXXXXX
Purple XXXXXXXXXXXXXXXXXXXX
Green XXXXXXXXXXXXXXXXXXXX
Blue XXXXXXXXXXXXXXXXXXXX
Yellow XXXXXXXXXXXXXXXXXXXX
Orange XXXXXXXXXXXXXXXXXXXX
Brown XXXXXXXXXXXXXXXXXXXX
Light Red XXXXXXXXXXXXXXXXXXXX
Gray 1 XXXXXXXXXXXXXXXXXXXX
Gray 2 XXXXXXXXXXXXXXXXXXXX
Light Green XXXXXXXXXXXXXXXXXXXX
Light Blue XXXXXXXXXXXXXXXXXXXX
Gray 3 XXXXXXXXXXXXXXXXXXXX
press any key to end test
Fig. 3-14. Color Test results.
62 The Monitor
greater than 25 so that you will indeed see scrolling take place. The test displays
the same line over and over again in a "sliding" character set display on the screen.
It will display the number of lines that you have specified.
Once the screen is filled, the top line scrolls off the top of the screen and
disappears, while a new line appears at the bottom of the screen. If new lines
are added to the bottom, the lines of the character set appear to "walk" or slide
sideways, one character at a time. If it scrolls properly, the screen will resemble
Fig. 3-15.
Sprite Test
The Sprite Test is accessed by pressing 6 from the Monitor Diagnostic Menu.
The first sprite appears at the left edge of the screen and moves to the right edge.
Each of the eight sprites appear in succession, one at a time.
The sprites are represented by a white square (Fig. 3-16). If you do not see
a sprite appear, if its movement is erratic, or if it is the wrong color or shape,
there is a problem in the sprite-handling logic of your cpu. Refer to Chapter 2
and troubleshoot the system unit.
When monitor testing is complete, press CLR/HOME to return to the System
Diagnostic Main Menu.
Scrull Test
Sprite Test
-
,- -,
-
Line 800 goes first to the Clear Screen subroutine at line 2990. The REMARK
statement indicates that this is the Monitor Diagnostic Module:
Six tests are included in the Monitor Diagnostic Module. Lines 810 through
880 print the test selection menu on the screen:
Line 890 instructs the user to press the CLRiHOME key when they want to quit
the Monitor Diagnostic and return to the System Diagnostic Main Menu:
Line 900 sends the program to the Get-a-Key subroutine at line 3000:
64 The Monitor
Fig. 3-17. The Monitor Diagnostic Module listing. (Continued from page 64.)
66 The Monitor
Fig. 3-17. The Monitor Diagnostic Module listing. (Continued from page 65.)
When the user presses a key, its value is placed into variable A$. Line 100 checks
whether the value of A$ is equal to 19, which is the CLRiHOME key. If it is, the
program returns to line 50, the beginning of the System Diagnostic Main Menu:
If the value of A$ is not equal to 19, lines 1010 through 1070 check to see whether
the key pressed is a valid entry for this test, valid entries being numbers 1 through
6. If the user pressed a 1 for the Display Test, the program would branch to line
1090. If the user pressed 2 for the Alignment Test, the program would branch
to line 1180, and so on:
Commodore Care Manual 67
If the user does not press a valid key, the program falls through to line 1080. Line
1080 sends the program to the Beep subroutine at line 3100 to signal the error.
The program returns, then goes back to line 900 to let the user try again with
another key:
Line 1090 is the beginning of the Display Test. It goes to the Clear Screen
subroutine at line 2990. The REMARK statement indicates that this is the Display
Test:
Lines 1100 through 1120 display the Display Test title and prompts on the screen:
The program falls through to line 1130, which goes to the Get-a-Key subroutine
at line 3000. When the user presses a key, the program returns to line 1132:
Line 1132 prints the CLRlHOME key, which clears the screen to prepare for the
actual test:
Line 1135 checks whether the ASCII value of A$ is 19, the CLRlHOME key. If it
is, the program branches back to line 800 to display the Monitor Diagnostic Menu:
If the key is not the CLRlHOME key, the program falls through to line 1140. This
I ine begins a FOR-TO loop which runs from 1 through 999 for the number of
characters needed to fill up the screen display:
The program falls through to line 1150, which prints the value contained in A$,
obtai ned from the Get-a-Key subroutine when the user pressed a key. It also
includes the N EXT statement which loops the program back to line 1140 for 999
iterations:
Line 1155 checks whether the Exerciser Module is in effect. If EX is set to one,
the program branches to the next test. If EX is equal to zero, the program falls
through to the next line.
Line 1160 branches back to line 1130 to wait for another keystroke. The program
continues to display any key pressed until the user presses the CLRlHOME key.
When the user presses 2 trom the Monitor Diagnostic Menu, the program branches
to the Alignment Test starting at line 1180.
Line 1180 uses the Clear Screen subroutine to prepare the screen for this test.
The REMARK statement indicates the test name:
Line 1185 sets the mode to the uppercase-only character mode. This accesses
the characters necessary to draw the alignment grid for this test.
C128 USERS: Line 1185 in the C128 code reflects a different POKE location
and value.
Lines 1200 through 1300 paint the alignment grid on the screen. This is done
with FOR-TO loops of the graphic characters which form bins, vertical bars, and
horizontal bars.
Once the alignment grid is painted, the program goes to the subroutine at 3200,
which displays a prompt to enter any key to continue. When the user enters a
key, the program returns to line 1310.
Line 1310 resets the character mode to the upper/lowercase mode with the
POKE instruction. It then branches back to line 800, the beginning of the Mon-
itor Diagnostic Module:
C128 USERS: Line 1310 in the C128 code is modified to reflect a different
POKE location and value.
When the user presses 3 from the Monitor Diagnostic Menu, the program
branches to line 1320 to begi n the Character Set Test. Thi s test provides a display
of the full graphic character set available through the computer's character
generator, either Commodore character set 1 or character set 2.
At line 1320, the Clear Screen subroutine clears the screen. The REMARK
statement indicates the name of the test:
Line 1340 prompts the user to indicate which character set is being used for the test:
Line 1350 then branches to the Get-a-Key subroutine at line 3000 to get the
character pressed by the user in response to this prompt. The character is placed
in variable A$, which is used in line 1360:
Line 1360 checks to see if the value of A$ is equal to one. If it is, a POKE reads
into memory location 53272, set to 21, ensuring that the user is set up for the
chosen character set:
70 The Monitor
C128 USERS: The C128 code at line 1360 is modified to reflect a different
POKE location and value.
Line 1370 does a FOR-TO loop, indicating the range of characters that are
to be displayed for this test:
Lines 1380 through 1395 check for special cursor positioning characters which
would alter the display. When the FOR-TO loop increments to one of these
characters, lines 1380 through 1395 catch it and cause the program to ignore
it by going to the end of the N EXT loop at line 1410. The program then increments
to the next character string value:
Line 1410 is the NEXT statement which increments the character string value:
1410 NEXT
When all 255 characters have been printed, the program falls through to line
1415, which checks whether the EX exerciser flag is on. If it is set to one, the
program sets the system to the upper/lowercase character mode, and then branches
to line 1440:
C128 USERS: The C128 code at line 1415 is modified to reflect a different
POKE location and value.
Line 1420 then branches to the subroutine at line 3200, which prints the
prompt to enter any key to end test. Once the user enters any key, the program
falls through to line 1430:
Line 1430 POKEs memory location 53272 to 23 to make sure that it's in the
upper/lowercase character mode. The program then returns to line 800, which
is the start of the Monitor Diagnostic Menu:
C128 USERS: The C128 code at line 1430 is modified to reflect a different
POKE location and value.
When the user enters a 4 from the Monitor Diagnostic Menu, the program branches
to line 1440 for the start of the Color Test.
NOTE: If you do not have a color monitor, you may delete this routine from
the System Diagnostic Program, or simply ignore it.
Line 1440 clears the screen and incl udes the identifying REMARK statement:
Line 1460 assigns a series of 20 Xs to variable C$. This is used for the color bar
pattern:
1460 "C$="XXXXXXXXXXXXXXXXXXXX"
Lines 1470 through 1620 are PRINT statements that print the name of the
color in that color, and then fills in the blanks in C$ with that color. This is done
for all 16 colors:
Line 1625 checks for the exerciser flag EX once again. If it is set to one, the
color is reset to the default of light blue. Then the program branches to line 1680:
At line 1630, a blank line is printed. The subroutine at line 3200 prompts
the user to enter any key to end the test. This provides the user with ample time
to make any necessary monitor color adjustments:
Line 1640 resets the screen to its default of light blue, then the program
branches back to line 800 to display the Monitor Diagnostic Menu:
When the user presses 5 from the Monitor Diagnostic Menu, the program branches
to line 1650.
Line 1650 clears the screen and identifies the name of the test:
Line 1670 prompts the user to enter the number of repetitions for the scroll test.
When entered, this value is placed into variable A:
Line 1680 sets N to 31. N is the character string to be printed. The value 31 wi II
be the character string value with which the line is to begin:
1680 N =31
Line 1690 is the beginning of a FOR-TO loop which indicates the number of lines
to be printed as specified by the user in line 1670.
1690 FOR 1= 1 TO A
Line 1700 begins a series of instructions that serve to build and display a sliding
character string, 40 characters in length. N starts with character string 31, as
Commodore Care Manual 73
indicated in line 1680. Line 1700 increments N until it gets to character string
71 (40 characters later). When N is incremented to greater than 71, N is brought
back to a value of 32:
Line 1710 is a FOR-TO loop which ensures that 40 characters are printed on each
line:
Line 1720 prints character string N, which will have a value between 32 and 71,
depending on where it is in the loop. N is incremented once each time it passes
through the loop:
Line 1730 checks to see if N is greater than 71. If it is, N is set back to 32:
Lines 1740 and 1750 are the corresponding NEXT statements. The first one,
NEXT X, is for the 40 characters filling a single line. The second one, NEXT I,
is for the specified number of lines being printed to see the screen scrolling:
1740 NEXT X
1750 NEXT I
Line 1755 prints a blank line to prepare for the GOSUB instruction at line 1760:
1755 PRINT
Line 1757 checks the EX flag. If it is set to one, the program branches to line 1770:
Line 1760 goes to the subroutine at line 3200, which prompts the user to press
any key to end the test:
Line 1765 branches the program back to line 800 to display the Monitor Diagnostic
Menu:
When the user presses 6 for the Sprite Test, the program branches to line
74 The Monitor
1770, which clears the screen and includes the identifying REMARK statement:
Li ne 1 780 prepares the screen display for the Sprite Test by pri nti ng the test name:
Line 1790 is a FOR-TO loop which sets all the sprites' pointers to 13 in or-
der to activate them. Locations 2040 through 2047 are sprite firmware locations.
Line 1800 sets V equal to 53248, which is another firmware location for the
sprite registers. Memory location V + 21 is POKEd to a value of 255. Th is informs
the system that all eight sprites will be used:
Line 1810 is another FOR-TO loop, which colors the sprites white. This is
done with the instruction S = 39 TO 46. The values 39 through 46 dre the eight
locations of the eight sprites. V, which was set in line 1800, is POKEd into the
value of S, which is 29 through 46. The value 1 indicates that the sprites are to
be colored white:
The program then falls through to line 1820, which moves the eight sprites, one
at a time, across the screen with a FOR-TO loop:
1820 FOR I = 0 TO 7
Li ne 1830 uses d POKE and PEEK logic statement in order to activate the
individual sprites for individual testing. Because this is in a FOR-TO loop, it begins
with zero, and increments up through seven, to test all eight sprites:
Line 1840 is another FOR-TO loop which sets up the XY coordinates to place
the location of the sprite. The sprite will move from left to right, which is
represented by the values 24 (at the left edge of the screen) through 255 (almost
to the right of the screen):
Lines 1850 through 1890 consist of more POKE statements and FOR-TO
statements which cause the sprite to continue on to the right edge of the screen.
Line 1870 uses the array R, which was initialized in line 35:
C128 USERS: Lines 1790 through 1880 of the e128 code are completely
modified to reflect the system's method of programming sprites. This
particularly involves the special sprite-related commands, SPRITE and
MOVSPR. Refer to Appendix B for the actual code.
Line 1897 resets the sprite X pointer back to the left edge of the screen:
Line 1900 turns off the sprite currently being tested so that the next sprite can
be tested in the same manner:
Line 1910 is a NEXT statement which lets the program move on to the next sprite
to be tested. This loop continues until all eight sprites are tested from left to right:
1910 NEXT I
Line 1915 checks for the EX flag. If it is set to one, the program returns to the
Exerciser module:
Line 1920 prints a blank line, and then branches to the subroutine which prompts
the user to press any key to end the Sprite Test:
Line 1930 returns the program back to the Monitor Diagnostic Menu:
Types of PrInters
There are a myriad of printers available on the market today which work with
the Commodore. A printer is a standard peripheral, but you need to make sure
that the printer has a serial bus interface connector. Aside from that, Commodore
printer choices consist of the dot-matrix printer and the letter-quality printer.
The Dot-Matrix Printer. If a character on the monitor screen were magnified,
you would see that instead of being made up of solid lines, the character is in
fact composed of a series of light dots. Each character is typically composed of
seven or more dots. The series of dots used to build characters is called a dot matrix.
76
Commodore Care Manual 77
The dot-matrix printer uses the same method as the monitor does for building
characters to print letters on paper. In the printer there is a single print head with
an array of small wires. When a character is sent to the printer, this print head
punches out the shape of the character through the ink ribbon to create its
impression on the paper (Fig. 4-1).
The dot-matrix printer provides output very quickly, and is the least expensive
printer available. Speed is measured in characters per second, or "cps." This speed
refers to how fast the printer can lay down characters on paper. A dot-matrix printer
can range in speed from 30 to 200 cps, possibly more.
The wide range of possible speeds is attributed to several factors. The most
obvious is how fast the computer can feed data to the printer.
Some printers print only left to right. These are called unidirectional printers.
Others can print both left to right and right to left. These are called bidirectional
printers, and they lay characters down on a page much faster, since no time is
wasted in sending the print head back to the "beginning" of a new line.
Some dot matrix printers offer several qualities of print. These different qualities
might include a draft, near-letter-quality, and letter-quality modes. The draft mode
might print a minimum number of dots for a character, thus taking the least amount
of time. The other modes use multiple print passes and more dots to make a darker,
more solid-looking character with better resolution. The tradeoff for higher quality
printing is speed.
In addition to the advantages of speed, the dot-matrix printer is attractive
because of its ability to produce an unlimited number of character font styles and
point sizes. Certain dot-matrix printers, called graphic printers, Can render graphic
characters. A graphic printer can address just as many ink points (which correspond
to the monitor's pixels) as your monitor resolution can display. This type of print-
er can reproduce graphic characters, as well as drawings and business graphics.
Any shape can be created with a series of dots. This makes the dot-matrix printer
highly flexible in terms of the output that can be created.
There are also dot-matrix printers that can print in different colors. The major
difference is that the printer uses a multicolored ribbon ..
The Letter-Quality Printer. Another very popular printer is the letter-quality
printer, sometimes referred to as a daisy-wheel printer. On such a printer, the
output looks as though it were typed on a typewriter.
The letter-qual ity printer is often preferred by people who use computers to
PRINT HEAD
78 The Printer
Printer Interfaces
The printer is physically connected, or interfaced to the computer through
a receptacle on the back of the system unit which accepts the printer's cable.
There are two major ways a printer can interface with a computer: parallel
and serial. The difference between these two interfaces is the manner in which
the data is transferred. A parallel interface pushes seven or eight bits of data in
one transfer. The serial interface sends data one bit at a time, in a series (Fig. 4-4).
Commodore systems only support serial printers. Parallel printers are not
compatible with these systems.
[2] Solutions
o First check that power is applied to the printer. The printer has a power indicator
light on the top or front of the chassis. If the printer's ON/OFF switch is in
the ON position, but the indicator is not lit, make sure the printer is properly
plugged in. If it's plugged in but still not working, try using a different electrical
plug. Check whether this plug is controlled by a light switch.
o Make sure the printer is in the proper mode. Most printers have an ONLINE
mode which indicates that it is ready to receive data from the computer. They
might also have a LOCAL mode which allows you to physically manipulate
the printer: roll the paper, prepare the printer for a different form, or adjust
- r---
0
cr: cr: cr: cr:
w 0 w w w
I- 0 I- I- I-
:::> z :::> Z
0 c..
tL
~ 0
a:
c.. ~ cr:
c..
0 o
U u
'--- '---
the platen. To get the printer operating again, switch it back to the ONLINE
mode.
iJ Check the cabling. Make sure you have the right kind of cable for the printer.
Make sure the cable is inserted into the proper plugs, and that it is sufficiently
secured and tightened down between the printer and the system interface port.
o Check that the application program is addressing the printer correctly. The
printer might not be working because the correct printer driver has not been
installed for this application.
The driver is activated by a printer installation program provided with your
application software. This special utility program lets you tell the program what
make of printer is being used so that the output to the printer is produced
correctly. It also ensures that any special printing functions such as boldface
and italic can be used.
The printer installation program provides numerous models from which
to choose. Even off-brand printers always have an equivalent to one of these
choices. If you do not run the application's printer installation program, the
driver might not be installed properly, and the printer would not work.
o Certain option switch settings within the printer might be making it impossible
to print. Such switch settings might control parameters such as "baud rate"
and "word length." Refer to the printer documentation for more information
about these switch settings. For more information about what the terms "baud
rate" and "word length" mean, refer to Chapter 7, "The Serial Communication
Interface. "
One problem you might notice is that the print image quality is poor. While
the characters are recognizable, they look blurred, light, washed out. A related
problem can occur when printing on a multiple copy form. While the top copy
prints well, subsequent copies print poorly or not at all.
'vi SolutIons
LJ Run the Sliding Alpha or Display Print Character Test of the Printer Diagnostic
to obtain sample output. Poor print qual ity is usually a mechanical rather than
a software problem.
D Check the printer ribbon. It might be jammed or spent. When this happens,
the print heads strike the same place on the ribbon, and the ribbon is unable
to advance to fresh ink. Unjam the ribbon, or install a new ribbon cartridge.
[1 Some printers have a iorms adjustment. This adjustment causes the print head
to be brought further back from the platen to accommodate paper of heavier
thicknesses, or multipart forms. Use the forms adjustment to move the head
closer to the platen. Run a print sample again, and adjust the head until the
print image is clear and sharp again.
Commodore Care Manual 81
o Clean the letter-quality daisy wheel or the dot-matrix print head with a lint-
free cloth or cotton swab moistened with isopropyl alcohol.
D If the print quality is still unacceptable after changing the ribbon, adjusting
the print head, and cleaning the element, refer to the printer documentation.
Call the manufacturer for more information.
B Solutions
D If the tabs do not print in this diagonal, check whether something is obstructing
the platen (the cylinder around which the paper rolls) or the print head. Of-
ten, simply blowing through the print head or pulling out a bit of paper hung
on it will solve the problem.
D If this does not solve the problem, refer to the printer documentation, or contact
the manufacturer.
B Solutions
D Run the Line Feed Test of the Printer Diagnostic Module to check the carriage
control. This test prints lines with variable line spacing and then feeds the pa-
per up to the next page.
D If the Line Feed Test does not take place as expected, check that the paper
has been fed into the printer correctly.
D If you are working with continuous-feed paper on a forms tractor, check that
the paper is not pulled too tight or left too loose in the tractor clamps.
LI Check the platen adjustment. There is a lever that unlocks the platen when
82 The Printer
rolling the paper in. In order for the paper to automatically feed with the forms
tractor, the platen must be set at the locked position.
D Check for a scrap of paper or other foreign object that might be lodged in
the platen or in the paper feed area.
D If you suspect that the printer is inserting extra spaces between lines, run the
Sliding Alpha Test of the Printer Diagnostic. The output should appear single-
spaced. If there are blank line spaces between the printed lines, faulty option
switch setting might be causing the extra line feeds. Check your printer
documentation for more information about the switch settings.
D If none of the above suggestions repair the line spacing problem, refer to your
printer documentation for the manufacturer recommendations.
B SolutIons
D If you're working with a dot-matrix printer, run the Display Character Print
or Echo Character Test of the Printer Diagnostic. If you see that black box or
blank space where a character is supposed to be, then the printer is probably
not set up to accommodate graphics.
As discussed earlier, there are several types of dot-matrix printers. One
type accommodates graphic characters as well as the standard alphanumeric
characters. Another type operates only in the character mode. If yours is a
character printer, you cannot print graphic characters.
It might be confusing to see the graphic characters on your monitor display,
and yet not be able to print them. This is because different makes of printers
support different character sets. Some character sets are more limited than
others. Therefore, be sure to send only valid characters to the printer.
The Commodore provides two graphic character sets. You might be
attempting to print a character that is not in the currently active character set.
The character set printed is the one that is active when the printer is powered
on.
D In the case of a letter-quality printer, the daisy wheels are limited in size and
can usually only accommodate about 100 characters, upper- and lowercase.
Because of this, it is likely that the daisy wheel you're using does not include
any special graphic characters. (However, you can get special graphic daisy
wheels consisting of such special characters as part of their character sets.)
B SolutIons
o First check the ribbon. It might be folded down or spent. Replace the ribbon
and run the Sliding Alpha or Display Character Print Test to print sample output.
o If the ribbon is in good condition, then there is a problem in the print head.
One of the solenoids that drives the dot matrix pins in the head has probably
malfunctioned or worn out, and that would explain the partially formed
characters. Take the printer in for servicing to have this solenoid motor repaired
or replaced.
• •••
• •••
Fig. 4-6. Incompletely printed
• •• • • •• •
characters.
••••••••• •••• ••
• • •••••• •• • ••• •
84 The Printer
l"d SolutIons
o Particular rules, or protocols, must be followed in order for the various system
components to communicate and send data back and forth. The protocol that
the old printer understood might be quite different from the protocol that your
new printer understands.
To help alleviate this problem, many application programs include a
program called a device driver that is established for a particular printer. A
device driver is a program that recognizes a special peripheral device such
as a letter-quality printer. Many applications, especially word processors, need
to know the exact printer model so that special functions such as underlining
and boldface can be handled correctly.
The device driver lets you specify which printer is being used, and thus
can let the program communicate correctly with the printer. Refer to the user
manual of the application software for more information on configuring the
device driver.
o When connecting a printer to the Commodore, ensure that any software
programs that use the printer are set up to the proper interface. This information
should be provided with your various user documentation; documentation
for the computer system, the printer, and the software are all vital for
configuration.
o You might encounter other problems when setting up a new printer. Again,
read the printer documentation thoroughly before installing. Other
documentation that might help includes Chapter 6, "Input/Output Guide,"
of the Commodore 64 Programmers Reference Guide. The user guide for any
software programs with which you're going to use the printer can also be a
good resource. Consult the printer manufacturer for further information.
Printer Diagnostic
is displayed as shown in Fig. 4-7. To activate one of the printer tests, press the
corresponding number, 1 through 5.
o
o ~"'S\&'(l"+,- '012J456789:;(:::)".ABCDEFGHIJF'LHNOPQRSTUVWXYZ( ]-_ abcdef9hijklmno
0
0
o ! "IS'\&' ( ) *+ -
"ltS\&'()· .. ,-.
10123456789:; (::: >., .... BCDEFGHIJKLMNOPQRSTUVWXYZ [\ J . _ 'abcdetqhi jklmno
012J456789:·(">?"BCDEFGHIJKLHNOPQRSTUVWXYZ[\] "_'abcdef ohijklmno! 0
o 0
o 0
o 0
o 0
o 0
o 0
QV
Fig. 4-8. Sliding Alpha Test results.
printer's character set, including graphic characters, and is used to check wheth-
er all characters are printing satisfactorily_
This test checks both character sets_ You must have a dot-matrix printer in
order to print the graphic characters_
To run the Display Character PrintTest, simply press 2_ All characters in the
character set are printed (Fig_ 4-9)_ After printing the character set, the Printer
Diagnostic Menu is displayed once again_
o o
o ./0-:2345673.:> ., :2 ..
J: ...,:
~ .::
"'
d.
L..
"
:1
f
r~
:J
0 o
o
" E
O PQP37'J'/:..J.--: I- I :::::';:;;;Al.=l..r.s1::lJ!I;':~"AI..!J~" 31:: • _ - _ I ~
o I _ ~ I r
8P:~S-'J,/~,,:v:+J
J 11--_,.
I _ -
·~'··.-i-13c..;:J
_
a 1_:;;: I r •
~
-,
~
-
rl
/" ~
~ K L [1 N
..,. , I I I
o
o o
o o
o o
o o
o o
QV
Fig. 4-9. Display Character Print Test results.
Commodore Care Manual 87
o o
o EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE 0
o 0
o 0
o 0
o 0
o 0
o 0
o 0
2V
Fig. 4-10. Echo Character Print Test results.
88 The Printer
0 •• 0
0 • 0
••
0 • 0
••
0 •• 0
0 •• 0
0 •• 0
0 •• 0
0 •• 0
••
0 • 0
0
0
""'- /
Fig. 4-11. HOrizontal Tab Test results.
Line 3510 begins with a GOSUB instruction to line 2900 to clear the screen and
position the cursor:
Fig. 412. The Printer Diagnostic Module listing. (Continued from page 89.)
The balance of line 3510, together with lines 3515 through 3530, displays the
Printer Diagnostic Menu.
Line 3535 opens the printer in the upper/lowercase character set mode:
Line 3540 accesses the keyboard input subroutine, and waits for the user to press
a key indicating the printer test choice:
If the user presses the CLRlHOME key (character string value 19), the program goes
to line 3550, which closes the printer and returns to the System Diagnostic Main
Menu:
3550 CLOSE 1:GOTO 50
When the user presses a key other than CLRlHOME, the program branches to
lines 3560 through 3600:
The program returns to line 3540, at which point the user can try again with a
valid key.
When the user presses 1, the program branches to line 3630 for the SI iding
Alpha Test:
Line 3640 clears the screen and displays the Sliding Alpha Test title. The INPUT
statement at line 3645 prompts for the number of repetitions to be printed. This
number is placed into variable X:
Variable N holds the value of the characters to be included in the line which
successively builds the sliding alpha pattern. In line 3650, N is set to 31. This
is one less than 32, the character string value for a blank space:
3650 N =31
92 The Printer
3660 FOR I = 1 TO X
N starts out as 31, and then becomes 32, the character code for the blank space
character. If N is greater than 111, N is reset back to 32. The characters with values
between 32 and 111 are printed. Once 112 is reached, the IF statement causes
N to return to 32. This prevents invalid characters, such as ESC sequences, from
being printed. It also causes the string to slide by one character for each line that
is printed.
3680 FOR A= 1 TO 80
3690 L$= L$+CHR$(N):N = N + 1
3700 IFN>111THENi'-J=32
3710 NEXT A
Again, if N is greater than 111, N is reset to CHR$ value 32, the blank space
character. The statement NEXT A causes the characters to fill an entire line.
Once all the characters have built an 80-character line, which is the printer
carriage width, the program proceeds to line 3720:
This causes the output of L$ to go to the printer instead of to the monitor. The
semicolon prevents a line feed. The NEXT I means that one of the repetitions
has been carried out. This routine prints the lines for the specified number of
repetitions.
When the number of repetitions entered into the INPUT statement for X is
satisfied, the program goes to line 3730, which checks whether variable EX is
equal to one. If it is, then the Exerciser Module is in control, and the program
branches to line 3760. If EX is equal to zero, then the program proceeds to lines
3735 and 3740. The printer is closed, and the program branches back to display
the Printer Diagnostic Menu:
Commodore Care Manual 93
When 2 is pressed, the program goes to the Display Character Print Test start-
ing at line 3750:
Line 3760 clears the screen and then displays the test title. As before, L$ is used
to build the print line, and is set to null. N is set to one.
Line 3770 closes the printer so it can be opened to print in the uppercase
graphics character mode:
3770 CLOSE 1
Lines 3790 through 3820 form a FOR-NEXT loop which prints the complete
uppercase graphic character set:
Lines 3830 and 3840 close and reopen the printer in the upper/lowercase mode:
3830 CLOSE 1
3840 OPEN 1,4,7:REM "Open as Upper/Lowercase"
Line 3850 prints the upper/lowercase graphic character set, cycling through values
32 to 255. These are the values for the standard CHR$ display codes (blank space,
A through Z, 1 through 0, etc.).
Line 3860 checks to see if variable N is equal to the carriage width of 80 characters:
If N =80, a full line has been built, and L$ is output to the printer, device #1.
94 The Printer
In this case, the line feed is not suppressed as in the previous test, so the test
is double-spaced. N is reset to one and the program skips to line 3880, the NEXT
I statement.
If N is not equal to 80 at line 3860, the program falls through to 3870, which
concatenates the next character onto the L$ and adds one to N:
This loop continues until a" character positions have been printed:
3880 NEXT I
Because a full line is not builtforthe part of the character set, L$ must be dumped
after the FOR-NEXT loop. Line 3890 accomplishes this:
Line 3900 checks whether the EX flag is set to one. If it is, the Exerciser Module
is operating, and the program branches to line 3950:
3905 CLOSE 1
Line 3910 returns the program to display the Printer Diagnostic Menu:
When the user enters 3 from the Printer Diagnostic Menu, the program
branches to line 3915 for the Echo Character Print Test:
Line 3925 prompts the user to enter the character to be echoed on the printer:
Line 3935 prompts the user to press the ESC key to end the test:
3935 PRINT " Press the CLR/HOME Key to End the Test"
Commodore Care Manual 95
Line 3940 goes to the Get-a-Key subroutine at line 3000. As before, if the
value of A$ is equal to character string value 19 (the CLRlHOME key), the program
closes the printer and then branches back to the Printer Diagnostic Menu:
3950 L$=""
Once the user enters a valid key to be echoed, the program falls to 3970,
which is a FOR-NEXT loop:
As before, 80, the carriage length, is used as the parameter for how far the character
is to be printed.
Line 3980 takes the entered character and joins it with L$ for the length of
the carriage:
3980 L$=L$+A$:NEXT I
Once all positions in the carriage width are filled, the program proceeds to line
3990.
Line 3990 outputs the contents of L$ to the printer:
3990 PRINT#1,L$
Line 4000 returns the program to line 3940, at which point the user can either
enter another character to be echoed, or press CLRlHOME to end this test and re-
turn to the Printer Diagnostic Menu:
Pressing 4 from the Printer Diagnostic Menu branches the program to the
Horizontal Tab Test starting at line 4010:
Line 4040 prints a series of asterisks using the TAB statement. This causes
horizontal tabbing:
The TAB statement uses variable I of the FOR-NEXT loop as the tab value. It prints
an asterisk, then loops back to repeat for the next value of variable I. This causes
the asterisks to be printed in a stairstepped row.
After printing this diagonal row of asterisks, the program proceeds to line 4050,
which checks whether variable EX is equal to one. If EX is equal to one, the
Exerciser Module continues at line 4080. If EX is not equal to one, the program
falls through to line 4060, which closes the printer and returns the program to
display the Printer Diagnostic Menu:
The final test is activated by pressing 5. The program branches to line 4070
for the Line Feed Test:
4110 FOR A = 1 TO I
This causes the printing to space the desired number of lines. On the first iteration,
2 is printed, followed by two line feeds.
Line 4115 prints the contents of the line to the printer, then goes on to the
next cycle of the FOR-NEXT loop:
4115 PRINT#l,"":NEXT A
The program falls through to line 4120, which sets N$ equal to the string value
of I. The (1-1) part of the statement makes sure that the first I ine feed actually takes
place on the first line:
4120 N$=STR$(I-1)
Commodore Care Manual 97
This creates orderly output for line 4130, which is the message indicating the
number of lines that have been tabbed:
It then goes to the NEXT statement. This sequence repeats four more times.
After this is completed, line 4140 checks to see if EX is equal to one. If it
is not, the program proceeds to Line 4150:
This causes the program to close the printer and then branch back to line 3500,
returning the program to display the Printer Diagnostic Menu.
Chapter 5
Tile Casselle
Drive
The previous chapters have primarily covered computer input and output, the
keyboard being the major input device, and the monitor and printer being output
devices. However, when you wish to do anything even slightly sophisticated with
your computer, in addition to the facilities of input and output, you need one
more function: mass storage.
The system unit of the Commodore 64 can store 64 kilobytes (abbreviated
64K) of information at one time. The Commodore 128 system unit memory can
store 128 kilobytes of information at one time. This is fine until you want to turn
the computer off. The Commodore systems have what is called a volatile memo-
ry. This means that in order for the memory chips to retain their information, power
must be continuously applied to their circuitry. Once the computer is powered
off, everything that was stored in that 64 or 128K is erased.
To prevent the loss of valuable programs and data, mass storage devices such
as the cassette tape drive and the floppy diskette drive are used. When you
command the computer to save a file, the program currently in system memory
is written onto the magnetic media, whether it is a cassette tape or a diskette.
The file is written in digital form, as a series of ON and OFF bits.
Likewise, when you command the computer to restore a saved file, the system
retrieves the information stored on the media (tape or diskette). It places it into
system memory just as it was last saved. This facility also allows you to buy
prerecorded programs and load them into your system.
While Chapter 6 covers the disk drive, this chapter deals solely with the
cassette drive.
98
Commodore Care Manual 99
Cassette
IlL..---system_unitJ~I
1101100 1100011 1111001
TRACK A
TRACK B
tapes to store the less important data, and high-quality tapes to store important
data and programs. And remember to make backups of everything.
NOTE: Whenever you write a program or data to tape, always make one
or two backups, just in case something goes wrong.
B Solutions
D First check the cassette tape itself. If you pressed PLAY or FAST FORWARD and
nothing happened, it could mean that the tape is wound all the way through.
Press REWIND. If it begins rewinding, then this certainly was the case. If it does
not rewind, and if the red LED does not light, a power problem is indicated.
D Check the power source. The VIC Datasette power is derived from the
Commodore system unit itself. Whenever the Commodore system unit is
powered on, the tape drive should power on along with it. The LED on the
front of the Commodore indicates that the system unit has power. If the LED
does not light up, check the power receptacle to which the Commodore is
connected. Check to see whether that receptacle is working, and whether it
is controlled by a switch.
A standard cassette tape drive is plugged directly into its own power
receptacle. In this case, check the power receptacle to which the cassette drive
is connected.
C If the cable looks secure on both ends, note that the cassette drive must be
connected to the system unit prior to powering on the system. If you tried
to connect the drive while the system unit is powered on, the system might
not have recognized that the drive was there. To check this, turn the system
off, turn it on, and try to load the tape again.
C If the tape still does not load, try swapping a different tape drive on your system.
If the swapped tape drive works on your system, there is a problem with your
cassette drive, and it should be replaced (it probably would cost as much to
repair a defective tape drive as it would to buy a new one).
o If the swapped tape drive does not work on your system, try using your tape
drive on a different system. If your tape drive works on a different system,
there is a problem with your system unit. Refer to the "Troubleshooting and
Repair Guidelines" in Chapter 2, and follow the instructions for troubleshooting
the system unit.
B Solutions
Ll First run the Cassette Tape Diagnostic, particularly the Read/\Nrite Test de-
scribed in the next section, "Running the Cassette Drive Diagnostic." Use
a new, blank cassette tape.
If the cassette drive passes the test, this indicates that the tape you tried
to read to or write from is defective. Use its backup. If the test fails, there might
be a problem in the read/write circuitry of the system unit. There are other
tests you should try, however, before delving into the computer itself.
o Load a cassette that you know is good-one that contains a program loaded
many times in the past without fail. If it does not load at first, try it again several
more times. Sometimes the tape will eventually read, but this is often an
indication of a problem with the cassette tape media. Immediately make a
backup, if you don't have one already.
104 The Cassette Drive
o If the test still fails, try loading yet another tape that has recently been
successfully loaded. If this tape loads, this means the other tape was defective.
Discard it and use its backup.
o If the second tape does not load either, try loading the tape on another system.
If the tape sti II does not load, the tape is defective. If it does load on the other
system, create a backup copy of the tape and try it again on your system.
If the backup works on your system, the tape was defective. However,
if the backup still does not work on your system, there might be a more ser-
ious problem with the cassette drive or the system unit.
o If you are using a standard cassette drive rather than the Commodore VIC
Datasette, check the levels of the volume and tone controls. If either of these
is set too low, the data signal will not be interpreted properly, causing an
unsuccessful read or write.
A good rule of thumb is to maintain both volume and tone controls at
least three-quarters of the way up. The ReadIWrite Test of the
Cassette Diagnostic Module can also help you determine the best levels.
o If you're not having trouble reading from a cassette tape, but are having trouble
writing, check the cassette tape itself-it might be write-protected . Cassette
tapes usually have a write-protect tab at the top, and if it has been broken
off, nothing can be saved on this tape.
You can easily make the tape write-enabled again by placing a small
piece of cellophane tape over the write-protect gap (Fig. 5-6) .
Write-protect tab
Write-p(otect tab for side B
for side A
D If the system is attempting to read and write information, but the results are
not accurate, the problem might be that the read/write head in the cassette
drive needs cleaning.
The cassette's mylar tape is coated with iron oxide that comes into direct
contact with the cassette drive's read/write head. This head magnetizes the
tape when writing (recording), or reads the magnetic pattern in the tape when
reading (playing).
Because of this direct contact, the iron oxide coating can rub off on the
head. Over a period of time, this residue on the head can begin to inhibit
its functions of reading and writing data.
To clean the iron oxide residue from the cassette drive head, moisten a
cotton swab or lint-free cloth with isopropyl alcohol. Rub the swab or cloth
over the head (Fig. 5-7). Now attempt to load the tape again.
D If there is still trouble reading or writing, try cleaning the cassette drive interface
edge connector. This edge connector can oxidize, and the oxidation can
prevent the necessary electrical connection.
To clean off the oxidation, use the pink eraser from the end of a pencil,
and rub it over the edge connector (refer to Fig. 2-6 for a photograph of this
procedure). Black or gray residue will be removed by the eraser.
Reconnect the cable and attempt to read or write the problem cassette
tape again.
D If problems persist, swap a different cassette drive on your system and load
a tape. If you are able to read/write a tape on the swapped tape drive, there
is a problem with your original cassette drive, and it should be replaced.
D If the swapped tape drive does not work on your system, swap your cassette
drive on a different system and load a tape. If you are able to read/write a
tape on the different system, a problem with your system unit is indicated.
Refer to the "Troubleshooting and Repair Guidelines" in Chapter 2, "The
System Unit/Keyboard," and follow further instructions for troubleshooting
the system unit.
Cassette Diagnostic
Enter Command
an alternating pattern of 10101010. The second one has the opposite pattern of
01010101. The program writes 100 records of these patterns to the tape.
Once this is done, you are prompted to press the cassette drive STOP button,
rewind the tape to the beginning, press the PLAY button, and press any key to
continue. The program reads both files containing the 100 records of alternating
bit patterns. As it reads, it compares each record to the value that was written.
If there is a discrepancy, an error message is displayed, indicating the number
of errors encountered during the test.
To select the Read-Only Test, enter 2 from the Cassette Drive Diagnostic
Menu. You are prompted to load the cassette tape to be read into the cassette
drive. Be sure to have the tape rewound to the beginning. Press PI AY, and then
press any key to continue.
Lines 4210 through 4250 clear the screen and display the Cassette I Jrive
Diagnostic Menu:
Line 4260 sends the program to the Get-a-Key subroutine at line 3000. A valid
character here is either 1 or 2, corresponding to the two tests within this diagnostic:
Lines 4270 and 4280 check for these values and branch to the appropriate places
in the code:
4270 IFA$~"1"THEN4310
4280 IF A$= "2" THEN 4420
If a key other than 1 or 2 was pressed, the program falls through to line 4290,
which sends for the Beep subroutine at line 3100. The program then proceeds
on to line 4300, which returns the program back to line 4260, letting the user
enter another key:
108 The Cassette Drive
Fig. 5·9. The Cassette Drive Diagnostic Module listing. (Continued from page 108.)
When the user presses 1, the program branches to line 4310 for the Write/Read
Test. Here, the screen is cleared with the Clear Screen subroutine, and the title
is displayed at the top of the screen:
The program then falls through to line 4350, which opens the tape device
and assigns the name of "Test-Tape 1" to the first file that is written with this
test. "Opening" the tape device means that it is logically connected to the system:
Line 4370 actually prints the record which will be written 100 times. The
PRINT #1 statement instructs the program to direct the output to file #1, which
is the cassette drive opened in line 4350. Its output is the character string 170,
which is a pattern with every other bit on: 10 101010.
4370 PRINT#1,CHR$(170):NEXT
At line 4380, the cassette drive is closed with the CLOSE 1 statement. It is
opened again immediately, and given a new file name of "Test-Tape 2."
Line 4390 begins another FOR-TO loop that goes from one to 100. This time,
it's output is character string 85, which is a pattern with every other bit off:
01010101.
Once the FOR-TO loop is complete, line 4405 closes the cassette drive:
4405 CLOSE 1
Line 4410 prompts the user to rewind the tape, press PLAY, and press any
key to continue:
Line 4415 sends the program to line 4460, the beginning of the Read Test:
When the user selects 2 from the Cassette Drive Diagnostic Menu, the Read-
Only Test is activated, beginning at line 4420. This test is also the second part
of the Write/Read Test. Line 4420 itself clears the screen with the Clear Screen
subroutine:
Line 4430 displays the title of the test, and the followi ng I ines print the necessary
user prompts:
Line 4460 opens the cassette drive device in a read mode, rather than a write
mode as in the first test. This is indicated by the 0 instead of a 2 in the second
operand. It is looking to read a file called "Test-Tape 1," which was created by
the Write/Read Test. This is also the point where the Write/Read Test branches
after it has completed writing the test files:
Line 4470 is a FOR-TO loop for 100 records. Instead of writing information
to tape as before, it reads information from the tape, placing it into variable A$:
Commodore Care Manual 111
4470 FORI=1T0100
4480 INPUT#1,A$
Line 4490 checks variable A$ for accuracy. If it is not equal to 170, which
was the value written to Test-Tape 1, error counter E is set equal to one. From
there, it is incremented with each error encountered through each pass of the
FOR-TO loop.
After A$ is compared, the program falls through to the NEXT statement at
line 4495, which sends the program back through another loop. This continues
until 100 passes have been completed:
4500 CLOSE 1
Line 4510 immediately opens the device again. This time the program looks
for the Test-Tape 2 file created in the Write/Read Test:
Line 4520 begins a FOR-TO loop, and again it reads from one to 100, inputting
its data into variable A$. This time it compares the data with character string val-
ue 85. If A$ is not equal to 85, the error counter is incremented as before:
Line 4550 sends the program back through the FOR-TO loop:
4550 NEXT I
Once the 100 passes through the loop are completed, line 4560 closes the
cassette drive:
Line 4570 displays the number of high value errors encountered during the
test, if any; while line 4580 displays the number of low value errors encountered:
Line 4590 goes to line 3200, which prompts the user to press any key to end
the test:
Finally, the program falls through to line 4600, which sends it back to line
50 to display the System Diagnostic Main Menu:
4600 GOTO 50
Chapter 6
Tile Disk Drive
Computer data is broken down into a series of ON and OFF bits: ones and zeros.
Eight of these ON and OFF bits constitute a byte. Most computer dimensions are
in terms of bytes, particularly the amount of data that can be stored in system
memory, or the amount of data that can be stored on a diskette.
Every computer system unit is rated for a certain capacity of data it can store
at one time within system memory. The capacity of the Commodore 64 is 64
kilobytes of data (approximately 64,000 bytes), while that of the Commodore 128
is 128 kilobytes of data.
This capacity is not large enough to hold software programs and all your data.
Two or three application programs could easily use up this capacity, leaving no
room for additional software or data with which to use the programs. The disk
drive provides the additional storage necessary to supplement system memory.
113
114 The Disk Drive
"drive" are used. Disk is the generic term for the floppy disk media on which
the data is written . Diskette also refers to the floppy diskette media. Disk drive
and drive are both generic terms for the floppy disk drive.
- - . ~-
·--t'-t:
..
Fig. 6-2. The Commodore disk drive is external to the system unit.
between the second and third, and so on. Having multiple disk drives provides
greater ease of use and versatility than just having one_
The disk drive includes a motor which spins the diskette at 300 to 400
revolutions per minute (rpm). The disk drive also consists of a head-arm assembly
which locates, reads, and writes data to and from the disk according to the
computer's internal program instructions (Fig_ 6-7).
daisy chain
!
computer
The diskette is a magnetic recording medium made with iron oxide, similar
to the material used on cassette tapes for a stereo cassette player. The magnetic
material covers the surface of the diskette like an emulsion, or film_ It is into this
material that data are written, stored, and read magnetically (Fig_ 6-8)_
The floppy diskette has a means for protecting the programs and data stored
there from being overwritten or erased_ The 5V4-inch diskette includes a small
cutout on the side called the write-protect notch. As long as the write-protect notch
is exposed, the disk drive is able to write information onto the diskette as well
as read from it (Fig. 6-9). New boxes of diskettes always include a package of
adhesive foil tapes. When one of these tapes is placed over a diskette's write-
protect notch, the disk drive's ability to write information onto the diskette is
"turned off." The tape blocks the write logic sensor in the disk drive, and no data
can be written onto this diskette.
When you insert your diskette into the disk drive and close the drive latch,
a switch inside the drive tells the system that a diskette has been inserted. The
drive motor then spins the diskette.
There is a small hole located near the center of the diskette. This hole is used
floppy diskette
for timing and synchronization. The diskette must be spinning at about 300 rpm
to be in a ready state for reading or writing data. This timing and synchronization
hole is used as a means for sensing when the platter is spinning at the correct
speed. it is also used as a reference point, marking the start point for information
to be written on the diskette. When the disk drive comes up to speed, which
takes about a second, it is ready to read or write data.
Within the disk drive unit is a mechani,m referred to as the head. The head
is a magnetic device on the end of a mechanical access arm. The head can
magnetize the diskette emul sion, thereby writing new data onto the diskette. it
can also sense a magnetic pattern already in the emulsion, thereby reading existing
data. The head itself never physically touches the surface of the diskette as it reads
or writes . instead, it rides ct few microns ( a micron is one millionth of a meter)
above the diskette on a cushion of air. Software and hardware logic position the
head at the proper location for reading or writing.
The diskette, like a phonograph record or a compact laser disk, stores specific
information in specific areas. Just as the laser disk might have different songs on
twelve different tracks, for example, a diskette has information stored on various
tracks and sectors.
The diskette is divided into a series of concentric circles. Each circle is a track.
There are 35 tracks on a 175-kilobyte 1541 disk drive, and 70 tracks on a
350-kilobyte 1571 disk drive. When the diskette is formatted, each track is divided
into sectors (Fig. 6-10).
Exactly one sector's worth of information is transferred in any given read or
write operation. Your program might need to manipulate only 20 characters of
that sector, but the computer always transfers all the information in the entire
sector. One sector on either of the Commodore disk drives contains 256 characters.
When a read command is issued by the operating system or the application
program, the disk drive positions the head at the proper track and sector. The
head copies the data from the sector and transfers it to a disk buffer. The program
logic extracts the record needed, and it is used as directed by the program.
A write command points to a disk buffer that contains the data to be written.
The head is positioned over the proper track and sector, and then the data are
transferred onto the diskette.
Track _____...J
S e c t o r - - - - - - - - -J
Fig. 6-10. Diskette tracks and sectors.
120 The Disk Drive
NOTE: While running the System Diagnostic Program, if the disk drive
encounters an error in writing or reading data, the error message is not
automatically displayed. A drive error is indicated by the drive's red LED
flashing on and off. If you see this condition, press RUN/STOP, then enter
GOTO 5180. This returns the system to the location in the Disk Drive
Diagnostic Module that displays the error code, the message, and the track
and sector wh ich contai ns the error.
L.--J Solutions
D Check how the diskette is inserted. If it's inserted upside-down, the drive cannot
read from or write to it. The diskette label should be face up.
D Make sure the diskette is formatted correctly for your system. For example,
a diskette formatted for a 1571 cannot be used on a 1541 disk drive. (Howev-
er, you can use a diskette formatted for a 1541 on a 1571 disk drive, although
it would not be the most efficient use of the drive, because the diskette is on Iy
formatted for half of its potential storage capacity.)
D Most disk drives have an indicator light next to the drive door. This light ei-
ther shows that the drive has power or that the drive is currently executing
a read or write operation. If the system boots up, the cursor is displayed on
the screen, and the fan is running, but you do not see the disk drive indicator
light come on, then there's a good chance that no power is being supplied
to the disk drive.
D The disk drive has its own power supply. First make sure that power is being
supplied to the drive. Check that the drive is properly plugged in. If it is, try
using a different electrical outlet. See whether the outlet being used for the
drive is controlled by a light switch.
D If the power checks out but the drive's indicator still does not light, there is
most likely a problem with the drive's power supply. Check the power supply's
fuse located on the rear of the disk drive (Fig. 6-11). Pull the fuse out by inserting
the end of a flatblade screwdriver into the fuse slot and turning it
counterclockwise until the fuse holder is disengaged. Examine the fuse. If it
is blown, replace it with another of the same rating. If the fuse is still good,
take the drive in for servicing.
Commodore Care Manual 121
D If the operating system does not boot up, check that the disk drive interface
cable is properly attached between the drive and the CPU board in the system
unit.
D If your Commodore configuration includes more than one disk drive, there
might be a problem with the daisy-chain arrangement that could be preventing
the disk drive from getting power_ Each disk drive must have its own unique
address which is set internally in the drive itself. To set the drive's address,
follow these steps:
1. Turn off the disk drive.
2. Disconnect the cables from the drive.
3. Turn the drive upside-down.
4. Remove the four phillips screws from the bottom of the drive (Fig. 6-12).
5. Hold the case together and turn it rights ide-up again.
6. Remove the top of the disk drive housing.
7. Remove the two screws from the side of the metal housing shield (Fig.
6-13).
8. Remove the metal housing shield.
9. Locate the address jumper block on the printed circuit board (Fig. 6-14).
10. Refer to Table 6-1 to determine which jumper should be cut to give the
disk drive its proper address for its place along the daisy chain.
11. Use a small pair of diagonal wire cutters to cut the jumper(s) as needed.
12. Replace the metal housing.
13. Replace the upper case of the disk drive and reinstall the phillips screws.
14. Reconnect the disk drive cable.
15. Test the disk drive again to see if this solved the problem. If not, take
the drive in for servicing.
122 The Disk Drive
(]DCD
P~ P2
cut trace with a
sharp knife
Device Address P1 P2
8 Intact Intact
9 Cut Intact
10 Intact Cut
11 Cut Cut
[2' SolutIons
D If the system is not writing, and you are using a brand new diskette, first make
sure that it is the correct type of diskette for your drive. There are hard-sectored
and soft-sectored, single-density and double-density, single-sided and double-
sided diskettes.
D If the diskette is the correct type for the drive, the problem might be that the
diskette is not formatted. There are many diskette manufacturers, and the same
make of diskettes can be used with a number of different computer types. A
diskette is made to work on your particular computer by inserting the diskette
into the disk drive and running the operating system's format program. This
must be done to all new diskettes in order for them to work with your computer.
The format program places operating system information and a disk
directory program onto the new diskette. The format program also tests the
diskette for bad sectors. If any bad sectors are found, the format program blocks
them out. The diskette can still be used, and valuable data is prevented from
being written onto bad areas.
U If the system is able to read from a diskette, but cannot write to it, or if you've
run the Disk Drive Diagnostic Module and the 26 Write Protect On error
message was returned, look at the diskette and see whether it is write-protected.
[l If you've been using a particular diskette, and now find that the computer can
no longer read the data or write to it, it might have just worn out. Diskettes
are fragile, and after a great deal of use they can actually wear out, much the
same way that a phonograph record or cassette tape can wear out after
continuous use. This is one reason why keeping a current backup copy of each
diskette is so important. If a diskette wears out, and the message 25 Write Error
is displayed, simply use its backup diskette.
n If you still cannot read from or write to the diskette, try a different diskette,
one that you have recently used and know is not defective. If the system has
Commodore Care Manual 125
no problem with this diskette, the original diskette you were trying to use was
defective. Use its backup.
D If you cannot read from or write to the second diskette, there might be a prob-
lem with the drive. To check this, try the diskette on another system. If it does
not read or write on that system, this indicates a bad diskette. However, if
it does read and write on the other system, your disk drive is probably faulty.
D To begin troubleshooting the disk drive, run the Disk Drive Diagnostic Module
on the suspected disk drive. The diagnostic writes a known pattern to the disk,
reads it back, and compares the two to make certain they match. This checks
the read/write logic.
When running the test, if two or three error messages are returned, a bad
sector on the disk is probably the cause. When a new diskette is formatted,
all bad sectors are blocked out. Sometimes a sector can go bad after formatting.
In this case, the disk can be salvaged with reformatting. Reformatting lets you
start over with a "fresh" disk, and will block out the bad sectors. Remember,
however, that when a diskette is reformatted, all data on it is erased. You cannot
reformat without losing the data on the diskette.
If the diagnostic test returns a lengthy series of read errors, either the disk
drive or the drive controller read circuit on the motherboard is probably faulty.
To check this, boot up the system and load the program from that disk drive.
If it boots up and loads satisfactori Iy, then the read logic on the motherboard
is fine. The problem lies in the disk drive, which should be taken in for
servicing.
121 Solutions
D If the system includes a second disk drive, place the program diskette in that
drive, and try reading the program from there. If the system still cannot read
from the other drive, this indicates a bad program diskette. Load the backup
diskette.
If the disk drive does load, load the Disk Drive Diagnostic Module. Run
the diagnostic on the drive that would not load the program. If the test runs
successfully, and the successful test completion message is returned from the
diagnostic, then nothing was wrong with the disk drive. It was probably just
a problem with the diskette. Try a different diskette, and it should work.
If the diagnostic test fails, this indicates that the disk drive is defective,
and it should be taken in for servicing.
D If the system cannot boot up, read data from or write data to any of the disk
drives, then the problem almost certainly resides on the disk drive interface
circuit within the system unit, and not on the disk drive itself. Refer to Chapter
2 to troubleshoot the motherboard.
126 The Disk Drive
B Solution
D When the head crashes, the drive must be taken in for servicing. Discard any
diskettes that have come into contact with the drive head after the crash.
fingerprint ridge
dust particle
read/write head j
rl --tie 0
diskette surface
Fig. 6-15. Diskette contamination.
Commodore Care Manual 127
~ Solutions
o Try to read a known, good diskette, perhaps the test diskette, in the same drive.
If the drive can read this diskette, it means the first diskette is defective. If
the drive still cannot read the diskette, it means the disk drive is probably
defective.
o Try to read the diskette in a different drive, if available. If the diskette can be
read in the different drive, it means the first drive is defective. If the diskette
cannot be read in the different drive, it means the diskette media is defective.
B Solutions
o Insert another diskette that you know is formatted, perhaps the test diskette.
Run the Disk Drive Diagnostic again. If the diagnostic runs without errors,
the original diskette probably was not formatted. If the diagnostic returns the
same error message, the disk drive might be out of alignment. Take it in for
servicing to have it realigned.
B Solution
:;:1 Solution
o This indicates a problem with electrical grounding. Make sure that the diskette
drive is properly grounded with a grounded plug.
V' Solution
o If this error occurs frequently on the same diskette, there is probably a disk
media problem. Using a backup of the diskette or a new diskette will solve
the problem.
?1 Solution
o Remove the diskette from the drive, then remove the adhesive write-protect
tape from the edge of the diskette. Insert the diskette back into the drive, and
the system will now be able to write information onto the diskette. Remember,
however, that you probably originally placed the write-protect tape on the
diskette in order to protect data already written on it. Make sure the system
does not overwrite valuable data, now that you have write-enabled the diskette.
B Solution
[l Check the electrical grounding of the disk drive. Make sure that the diskette
drive is properly grounded with a grounded plug.
B Solutions
n Try writing to another diskette that you know is formatted properly. Run the
Disk Drive Diagnostic.
D If the same error message reoccurs, the disk drive might be defective, and it
should be taken in for servicing.
B Solutions
D Run the Disk Drive Diagnostic on the diskette. If this message is returned again,
there is a problem with the diskette media itself.
D Run the diagnostic with a different diskette, preferably a new one. If the
diagnostic does not detect the error, this means the original diskette was
defective. If the error message is returned again, this means the disk drive is
probably defective, and it should be taken in for servicing.
[?I Solutions
D Run the Disk Drive Diagnostic Test again and make sure that you specify the
proper drive and diskette type (1541 or 1571).
lJ If the error message is still returned, there might be a problem with the disk
drive. Swap the drive on another system unit. If the drive fails on another
system, it is defective and should be taken in for servicing.
130 The Disk Drive
D if the drive works on the other system, there is probably a problem with the
system unit. Swap a different disk drive onto the system. if the new drive does
not work either, refer to Chapter 2 to troubleshoot the system unit.
:2l Solutions
D if the error message persists, check whether the diskette is formatted or not.
The easiest way to do this is to try another diskette that you know is formatted.
PREVENTIVE MAINTENANCE
Floppy disk drives require a degree of preventive maintenance. Make sure
that the disk drive doors are closed when not in use. This prevents dirt and dust
from collecting on the disk drive head mechanism.
Dust can be a big enemy to the disk drive motors. Dirt can collect on the
head mechanism and cause the head to crash. Covering the system with a dust
cover protects disk drives from dust and dirt.
When moving the floppy disk drives, insert the cardboard "diskettes" into
the drives and close the doors. These protect the head mechanism from being
jostled, thereby preventing it from going out of alignment during transport.
Obtain a disk drive head cleaning kit from a computer store. insert the special
diskette, which is permeated with a cleaning solution, into the drive. Enter a read
command to cause the diskette to rotate. The read/write heads are then cleaned
as they pass over the cleaning diskette.
Because the information already residing on the disk is not tested, it cannot
be damaged or wiped out. However, as always, make sure you have complete
current backups of all programs and files, especially those residing on any diskette
bei ng tested.
In response to the prompt, indicate the number of the drive to be tested: 8
to 15. The diagnostic creates a file called TEST, and makes four distinct passes
through the disk.
The first pass writes a series of 254-byte records that contain a 254-character
string of CHR$ value 170. CHR$ value 170 is a character that has every other
bit on (10101010). The diagnostic writes these records throughout the entire disk.
Once the disk is full, the file is closed.
The diagnostic immediately begins the second pass through the disk, which
consists of reopening the file and rereading the data that were written during the
first pass. The read data are compared to CHR$ value 170. If there is a discrepancy
between what was written and what is now being read, an error message is
displayed on the screen.
When the second pass of the test is completed, the file is deleted. The third
pass consists of recreating the file, this time with a series of 254-character records
of CHR$ value 85, which has every other bit turned off (01 01 01 01). It completely
fills the disk up again with this alternate character record, just as it did before
with CHR$ value 170. When the diskette is full, the file is again closed.
CHR$ 170 has every odd bit turned off, and every even bit turned on. CHR$
85 has the opposite characteristics, with every odd bit turned off and every even
bit turned on. This creates an alternating bit pattern. Testing for alternating bit
patterns ensures that all possible bits on the disk are written.
lust as in the second pass, the fourth pass through the disk opens the file and
rereads the data written during the third pass. The read data are compared to CHR$
85. An error message is displayed if there is a discrepancy between what was
132 The Disk Drive
written and what is now being read. Then the file is erased, just as it was after
the second pass of the test.
Lines 5010 and 5020 initialize two variables, HV$ for high values, and LV$
for low values. HV$ builds a string of the high CHR$ value 170. The loop continues
eight times, essentially building an eight-character record:
Line 5020 does the same thing, building a string of the low CHR$ value 85 eight
times.
Line 5030 clears the screen and displays the diagnostic title. Line 5035 then
displays a prompt for the user to enter the disk drive to be tested. The user would
enter a value such as 8 to designate the first drive, 9 to designate the second drive,
or any drive designation up through 15. This drive designation number is placed
in variable D:
Line 5036 checks that a valid drive number selection has been made. If an
invalid drive number has been entered, the program displays an error message
and loops back to line 5035 for the user to try again:
Line 5037 prompts the user to specify the drive type. A value of one indicates
the 1541 drive, and a two indicates the 1571 drive. If a value other than one
or two is entered, line 5038 causes the program to default to the 1541 drive:
Line 5040 sets variable BF$ equal to HV$. The name variable NM$ is
initialized to the character literal "High Values":
When the diagnostic is running, the words High Values are displayed on the
screen, indicating that it is currently writing $CHR$ character 170 to disk.
Line 5050 is the beginning of a FOR-TO loop. The test runs through two
passes: one for the high values of $CHR$ value 170, and one for the low values
of $CHR$ 'value 85.
134 The Disk Drive
The FOR-TO loop allows the same code to be used in both cases, simply inserting
the different variables as appropriate.
The program proceeds to line 5060. The disk file is opened using the disk
number that was stored in variable D in line 5035. The file is named "TEST,"
and is opened in the output mode as a sequential file:
Line 5070 prints a blank line and then displays an informational message
indicating that the contents of NM$, which was initialized in line 5040 to "High
Values," is being written to disk:
Line 5072 determines the number of records to write, based on the value
of T. If T equals two, then variable Z is set to 33600, which fills up all available
free sectors on a 1571 diskette. Otherwise, Z is set to 16800, the number of eight-
byte records needed to fill up the sectors available on a 1541 diskette:
Line 5075 causes 33600 or 16800 records to be written to the dsk. This
completely fi lis up the diskette:
5075 FOR A= 1 TO Z
5077 B1$=""
Line 5080 is where the actual output to disk takes place. The PRINT #1
statement from variable BF$ writes the high values out to the disk:
5080 PRINT#1,BF$
Line 5090 is the NEXT statement which serves to loop the program back to the
Write Test code:
5090 NEXT A
Line 5095 closes the file after all records have been written:
5095 CLOSE 1
Line 5100 reopens TEST, which is the name designated for the file created in
the Write Test:
Commodore Care Manual 135
Line 5110 displays the message indicating that the high values of NM$ are being
read from the disk:
Line 5115 begins a FOR-TO loop which causes the program to read the 33600
or 16800 records, depending on the drive type:
5115 FOR A = 1 TO Z
Line 5120 inputs the data being read from the disk into variable B$:
5120 INPUT#1,B$
When all the data have been read, the program branches to line 5160 to end
the test.
If the end-of-file has not yet been reached, the program falls through to line
5140, which compares variable B1 $ to variable B$. B1 $ contains the high values
read from the disk in line 5120, while B$ contains the high values written into
the disk in line 5080:
In other words, this statement compares the data that was written in the Write
Test to the data that was read in the Read Only Test. They should be exactly the
same. If there is a discrepancy between the two, a message is displayed, indicating
a high-value error reading.
The latter part of the statement, E = E + 1, increments an error counter. This
counter keeps track of the number of read errors encountered during the test.
The program proceeds to line 51 50, a N EXT statement to increment the FOR-
TO loop begun in line 5115:
5150 NEXT
There was an end-of-file trap at line 5130. When the end of the file is reached,
the program branches here to line 5160 to close the test file:
5160 CLOSE 1
Line 5170 sets BF$ to CHR$(85) and reads the disk for the low values:
Once the FOR-NEXT loop is completed, the program proceeds to line 5180.
Line 5180 displays a summary of the number of read errors encountered during
the test, such as "There were 2 errors encountered," or better yet, "There were
o errors encountered:"
5180 PRINT:PRINT "There were ";E;" errors encountered"
If read errors are returned, there could be a problem with either the diskette or
the disk drive itself. Refer to "Troubleshooting and Repair Guidelines" earlier
in this chapter for further action.
Line 5182 displays the error code, error message, faulty track and sector for
any error encountered in the course of this test:
If a read or write error takes place during this test, the error message does not
display automatically. Such an error is indicated by the disk drive light flashing
on and off. If this happens, press the RUN/STOP key on the keyboard, then enter
GOTO 5182. The System Diagnostic Program resumes at this point, and line 5182
displays the error message and information.
Line 5185 checks for the EX flag. If it equal to one, this indicates that the
Exerciser Module is in effect, in which case the program returns to the Exerciser
Module portion of the code. If it is equal to zero, the program falls through to
line 5190:
Once the test is complete, it prompts the user to enter any character to
continue and then branches back to line 50, the beginning of the System Diagnostic
Main Menu:
Interfacing with a Modem. The modem is a device widely used for serial
communication. It allows transmission and reception of computer data using
137
138 The Serial Communication Interface
telephone lines. The word modem is derived from the term modulator-
demodulator. The computer produces data and control signals in the form of
electrical impulses, also known as digital signals. These digital data exist in the
form of ONs and OFFs, or ones and zeros.
The modem converts this digital signal into sound waves, or analog signals
for transmission over telephone lines. This part of the conversion is referred to
as modulation.
The modem at the receiving end then converts the analog signal back into
a digital signal, and this part of the conversion is referred to as demodulation.
The information once again takes the form of ones and zeros, so the computer
connected to the receiving modem can successfully interpret it (Fig. 7-1).
Modems can only operate in pairs. For two computers to communicate with
one another, each computer must be connected to a modem that has matching
configurations. This would include communication speed, data size, start bits,
and other parameters that are discussed later in this chapter.
Online services such as CompuServe, DElPHI, Dow Jones News, The Source,
and Computext make it easy for people with computers and modems to link up
to the networks' centers of information. By coupling the modem to a telephone,
then dialing a specific telephone number (which is often a local or toll-free
number), the Commodore can be linked into a network's mainframe computer.
You can then use the network service to research a wide range of information,
as well as to communicate with other users. Online services can also provide
banking, shopping, and airline reservation services through the use of the
Commodore's serial communication interface and the modem (Fig. 7-2).
The Commodore systems have two different types of modems available. One
is the RS-232 modem, and the other is the VIC-MODEM. The VIC-MODEM
connects into one of the game ports on the right side of the system unit. An RS-232
modem uses the RS-232 cable, and connects to the serial port at the rear of the
system unit.
Interfacing with a Printer. The serial bus interface is most commonly used
for the printer on a Commodore system. A serial bus is a daisy-chained, high-
~~
Dow Jones News Service
'\ , ------------- f
~~
Users Groups
.=-~ Database Access
~
OJ / Mainframe
Computer OJ
~
Airline Reservations
~
Online Banking
Fig. 7-2. Online services.
speed serial interface. It is located on the back of the Commodore system unit,
and allows daisy-chaining of up to eight devices. It is used to interface disk drives
and Commodore-supplied printers.
However, if you have a serial pri nter using the serial communication interface,
it would be cabled to the serial communication port instead of the serial bus port.
The printer is typically attached to the computer with an interface cable, or hard
wire.
Just like with the modem, either type of printer must be configured with the
same data speed and size parameters that are set within the Commodore. This
is because the printer must know what to expect from the computer, and how
to handle it.
In some cases, the printer can even be used in conjunction with the modem
to provide long-range printing. A central computer from a remote site can send
information via a communication line, and have it print out on this local printer.
in order for them to understand and process the information being sent and re-
ceived.
Hard wiring works over short distances of less than 50 feet. Communication
over longer distances requires modems or signal amplifiers, because the electrical
pulses diminish and are lost due to the resistance of the wire through which the
signals are traveling.
Baud Rate. The first parameter pertains to how fast the device sends
information. The device receiving the data must know the speed at which the
data are being sent in order for the two devices to be in sync with one another.
In serial communication, speed is expressed in a measurement called baud.
Baud is usually the number of bits that can be transmitted in a second. The
Commodore Care Manual 141
differences in baud rates are analogous to the different ways a car horn might
be sounded. Three short beeps can be heard much faster than three long beeps.
In the same way, eight bits of data traveling at 2400 baud are transmitted
and received much faster than the same eight bits traveling at 300 baud. When
the baud rate is set to a predetermined speed of which both devices are aware,
the system knows how long each ON bit lasts, and how long each OFF bit lasts.
Most communication interfaces for personal computers have a baud rate of 300
or 1200 bits per second.
Higher-speed communication, in the range of 4800 and 9600 bits per sec-
ond, is available, but is used primarily for communicating with devices that are
hard-wired to a system through an interface cable. A hard-wire setup does not
require an intermediary such as a modem in order to establish communication.
A printer, or even a computer that is hard-wired to another computer, is able to
operate at the faster speeds. There are modems available that can run at such
high speeds, but they are prohibitively expensive, especially for the small busi-
ness or home user.
Data Size. Another parameter, data size, refers to the size of the data being
sent: how many bits make up a standard character or word. A standard character
of data consists of seven or eight bits, depending on the software. The software
needs to know the character length or word length of the data being sent, so that
it knows what to expect (Fig. 7-3).
Start Bits and Stop Bits. In serial communication, the software adds additional
bits to each character to help coordinate the communication transfer. These added
bits are referred to as start bits and stop bits. When the software adds the start
bit and stop bit, then nine or ten bits are actually sent for each data character.
The start bit signals the beginning of a character, and captures the receiving
device's attention. It tells the device to expect seven or eight more bits of data
for processing. Likewise, the stop bit signifies the end of a character.
Both ends of the communication line need to know whether start bits and
stop bits are being employed, and if so, how many there are, one or two or each
(Fig. 7-4).
Parity. Another variable that many systems use is parity, which is an error-
checking scheme used to ensure accurate data transmission. With parity, the last
bit in a data word is set so that the sum of the number of bits is either an odd
number (for odd parity), or an even number (for even parity).
Word or Character
I;
r,11 0 001
Word Length is 8 Bits
Fig. 7-3. Bits, characters, and words.
142 The Serial Communication Interface
Stop Bit
Parity Bit (Odd Parity)
Start Bit - - - t
Fig. 7-4. The stop bit, start bit, and parity bit.
For example, if the system is set up with odd parity from the modem to the
computer, and a character or word is received with an even number of bits, parity
is not correct. This might mean that one of the character bits has dropped off during
transmission. A failure of parity indicates an error in transmission, and the
communication software either prompts you to try the data transmission again,
or it restarts it automatically for you.
fer. In the process of receiving a file that may be 16,000 bytes long, the commu-
nication buffer is quickly filled up. When this happens, the Commodore sends
a "suspend" command to the other system, temporarily stopping communica-
tion transfer. This suspension is the XOFF command. When the buffer is emptied
through computer processing, such as displaying characters on the screen, the
Commodore sends a "resume" command, which is XON. The transfer then con-
tinues where it left off. This process continues throughout the file in 2000-byte
chunks until all 16,000 bytes are successfully transferred.
There is another protocol used by modems to establish communication. This
is called the handshaking protocol. The handshaking protocol is analogous to
human greeting and communication protocols. When two people meet, they
ordinarily greet one another in the following manner:
Then they might go on their way, or they might continue talking. The important
thing is that they have satisfied the human protocol of "the greeting." People
use such protocols in order to enhance their personal communication, and ensure
understand i ng.
If one person talks much faster than the other is able to comprehend what
is being said, there will be a breakdown in communication: words will be missed,
and the original thought will be misunderstood.
The manner in which protocols are used is important as well. If two people
meet, and follow the protocols, but in the wrong order, they might still have a
communication failure, as in this example:
When a person says "good-bye," our protocol implies that this is the end of the
conversation. If more is said after this end-of-conversation message, then there
will be confusion and lack of understanding.
The modem handshaking protocol operates under the same principle. Many
signals are used to establish modem communication. The following is a listing
of the handshaking protocol used to establish and maintain communication.
5. The modem tells your system that it is prepared to accept data for
transmission.
The CTS (Clear to Send) signal is sent to your system.
6. The data is sent.
The SD (Send Data) light is illuminated on the modem.
o Solutions
o Check that the cable is properly connected and seated to the system unit serial
communication interfclce port.
o Make sure that the proper interface cable is connected to the serial
communication interface. The serial communication interface is usually a male
connector, meaning it is a pins-type connector.
Commodore Care Manual 145
D Check the device with which you're trying to communicate. If it's another
Commodore, run the diagnostic program on it to see whether its
communication interface is working properly.
D Check the interface or system technical manual to see if the interface cable
has any special requirements. RS-232 is a relatively loose standard. Some cable
manufacturers use a different scheme for their RS-232 cable pins. These cables
might expect data from different pins, look for other signals, or have signals
tied together. If this is the case, cable that has the correct pin configuration.
to talk to each other. If these indicator lights are not on, there might be a prob-
lem with the interface cable connection or with the modem.
When data are being sent, the indicator lights over RO ("receive data")
or TO ("transmit data") are illuminated. When a key is pressed, these lights
indicate that the data for the key code are indeed being sent.
o The modem might also have a test mode (check the modem documentation
to see if this is the case). This test mode loops a data pattern back through
the modem. It takes a pattern of characters from the computer, sends the pattern
through the modem back to itself, and then returns the pattern to the computer.
This internalloopback test checks the modem to make sure that it is sending
and receiving as it should. Use this test mode if communication still cannot
be established. It helps troubleshoot one suspected modem problem at a time.
r:] A carrier is a tone that the modem expects before it can send data. It's like
saying "Hello" when the phone rings and you pick up the receiver. After saying
"Hello," communication can be established, and information from the caller
can be transmitted.
This carrier can be heard when using a smart modem that dials the phone
automatically. You would first hear the telephone ring through the modem
speaker, and then a high-pitched tone would sound. This audible signal is the
carrier, and it tells the system that the modem is ready to accept data, either
from your system or from the other system. The CO ("carrier detect") light
is illuminated. This indicates that the other system has answered and been
given the carrier.
If the carrier signal is not received, it could mean a wrong number, a busy
signal, or some other problem at the other end.
~ SolutIon
M SolutIons
n Printers ordinarily default to the parallel interface, and a switch must be set
Commodore Care Manual 147
D The printer also needs to know the usual communication parameters, such
as the baud rate being run, the character length, the parity, and so forth. This
is set up with a DIP-switch in the printer interface board. The printer
documentation details how to make the necessary settings.
. .................
. . . . . .. . . .
Pin 2
Receive Data
Pin 3 - - - - '
Transmit Data
Fig. 7-7. Loopback diagram.
There are plugs available that already have pins 2 and 3 wired together. Such
a plug is called a "2S-pin serialloopback connector," and can be purchased at
a computer or electronic supply store. The plug fits directly onto the serial port,
and accomplishes the same loopback test (Fig. 7-8).
The instructions to the Serial Communication Diagnostic Module appear on
the screen (Fig. 7-9). The Serial Communication Diagnostic consists of a single
test: the Display Character Loopback Test. You enter a character on the keyboard,
and it is sent through the communication loop created by the loopback wire. The
loopback causes the character to be immediately sent back and received as output
displayed on the monitor screen. This checks the functions of the serial
communication interface by both transmitting and receiving data .
• • • • • • • • • • • • •
• • • • • • • • • • • •
•
Fig. 7·8. Loopback connector.
Commodore Care Manual 149
Line 6020 prints the user instruction to press the CLR/HOME key to end the test:
Line 6025 then instructs the user to enter any key to continue, once the previous
messages have been read:
When the user presses a key, the program goes to line 6030, which clears
the screen again:
Line 6040 opens the serial communication interface, which is designated as de-
vice #2. There are two character strings: 6 and O. These character strings establish
parameters for the serial communication line being opened. The first character
string, 6, indicates that the test is to be run at 300 baud, which is a sufficient
speed for this test. The second character string, 0, specifies that no parity checking
is to take place.
The GET instruction in line 6050 opens the receive side of the serial
communication interface, and places the character residing in the receive buffer
into variable A$. This prepares the program for testing.
Line 6060 checks whether there is a value in A$. If there is none, and A$ is a
null, the program goes to line 6070 to get a value:
The GET statement in line 6070 causes the program to go to the keyboard
and look for the user's keystroke. This keystroke is placed into variable A$. If
this keystroke is the CLRlHOME key, the program branches to 6100, where the serial
communications interface is closed and the test ended:
If A$ does not contain the CLRlHOME key, the program continues with testing
the keystroke, falling through to line 6075. If A$ contains nothing, the program
branches from line 6075 to line 6050:
Once A$ is output, the program returns to line 6050 to accept additional values
for testing.
Line 6100 closes the serial communication interface which was designated
as device #2. Then the program returns to line 50, the beginning of the System
Diagnostic Main Menu:
152
Commodore Care Manual 153
For example, if the system unit had a problem, you probably would have
just taken the system unit in for servicing, leaving the printer, disk drive, and
modem at home. But the computer is a system, consisting of a number of devices
and peripherals which all work together. Because of this, sometimes when there
is a problem in one device, it can manifest itself in another device. So even when
the technician demonstrates that the system unit is working fine, the complete
status is unknown until the unit is assembled at home with the entire system in
its usual configuration.
The diagnostic module covered in this chapter is a program that thoroughly
exercises the Commodore when it's new, when its configuration changes, or when
it returns from servicing. This Exerciser Module checks various components of
the Commodore system and leaves it running in a continuous mode so that it
can "burn in" for several hours, even overnight.
Burn-in thoroughly tests and exercises the system, and should be done for
12 to 24 hours. If there is a problem with the computer, it's better to discover
it during burn-in than while entering and processing valuable data. This is a good
practice widely used in industrial manufacturing and product testing.
message is displayed which indicates the number of cycles the Exerciser has run
through.
Because the Exerciser tests the three major components of the Commodore
system, the monitor, the disk drive(s), and the printer, it can indicate whether
there is a problem. If it's an obvious problem, it will probably surface immediately.
If there is a marginal or intermittent problem elsewhere in the system, it will show
up within a 24-hour burn-in run of the Exerciser.
The System Exerciser Module runs under BASIC, just like the rest of the System
Diagnostic Program. Because of this, the Exerciser is also testing an extensive
section of the system unit's machine instruction set.
Exerciser Diagnostic
then the printer, and so forth. The Exerciser runs in this continuous loop, running
the tests in a repeated cycle. To halt the Exerciser, press the RUN/STOP key. This
ends the System Exerciser Module, and also halts the entire System Diagnostic
Program.
To return to the Exerciser, enter GOTO 7430. The system returns to the system
Diagnostic Program at line 7430 in the code. This causes the message indicating
the number of passes the program has completed to be printed. You are then
prompted to enter any character to end the diagnostic. Once this is done, the
System Diagnostic Program returns to display the System Diagnostic Main Menu.
If the Exerciser is interrupted while it's running the disk drive test, you might
see a file called "TEST" show up in the diskette's directory. Delete this file from
the diskette. Normally, the diagnostic removes this file after it completes its run.
If one of the tests fail, the Exerciser halts. So if the printer runs out of paper,
or if something happens to the disk drive, the program stops at the point at which
the problem took place. An error message describing the problem is displayed,
so that you can take the appropriate action.
modules to function in its usual standalone mode with user input. However, when
EX is set to 1, the program skips the various parts of the program which require
user intervention, such as entering a particular value.
The COSUB statement sends the program to the Clear Screen subroutine at line
2990. Finally, the REMARK statement indicates that this is the beginning of the
Exerciser module.
Line 7210 prints the title of the module on the screen:
Line 7220 prompts the user to indicate whether or not the monitor is to be tested.
The answer is placed into variable MN$:
Line 7230 prompts the user to indicate whether or not the printer is to be tested.
The answer is placed into variable PT$:
Line 7240 prompts the user to indicate whether or not the disk drivels) are to
be tested. The answer is placed into variable DD$:
Because the user's system can have more than one drive, and different types of
drives, further prompts are required regarding the disk drive test.
Line 7250 checks to see if the user has answered "no" to the Test Disk Drive(s)
prompt. If so, the program branches to line 7310, skipping the code asking for
further information about the disk drivels) to be tested:
If the user answered "yes" to the Test Disk Drive(s) prompt, the program falls
through to line 7260, which prompts the user for the number of drives to be tested.
The answer is placed into numeric variable DD:
Line 7265 sets dimension ON equal to null, in order to clear it. Disk number
variable DN is dimensioned by the disk quantity variable DD. Also, disk type
variable DT is dimensioned by the disk quantity variable DD. The variable DT
will indicate whether the disk type in question is a 1541 or 1571 disk drive:
Line 7270 is a FOR-TO loop, looping through the number of drives being
tested:
7270 FOR I = 1 TO 00
Line 7280 prompts the user for the drive number, and places the answer into
array DN(I). If the first drive is drive #8, for example, the first element of the array
becomes an 8:
Line 7290 is a similar instruction. The user is prompted to enter the drive type:
1 signifies a 1541 drive, and 2 signifies a 1571 drive. The answer is placed into
array DT(I):
Line 7300 is the NEXT statement that corresponds with the FOR-TO loop that
began in line 7270. This causes the code to loop as many times as there are drives
to test:
7300 NEXT
Line 7310 begins the actual system exercising. Here the program examines
which options the user has selected, then goes about executing them. This line
begins with an IF statement for the Monitor Diagnostic. If the user has chosen
not to exercise the monitor, the program branches to line 7330:
If the user did choose to exercise the monitor, the program falls through to line
7320, which sets variable A$ equal to X, which is used as the display character
in the monitor scroll test, and sets variable A equal to 50 for the number of
repetitions to scroll. Finally, GOSUB 1140 sends the program back to the
Monitor Diagnostic Module in order to perform the Scroll Test with these preset
parameters:
In the Monitor Diagnostic Module code, there are various checks to see wheth-
er or not EX is equal to one. If it is, the Exerciser is active, and the program jumps
past any lines that require user input. The Exerciser runs through the various tests
of the Monitor Diagnostic through to the Sprite Test. At that point, at line 1915,
there is a statement indicating that if the Exerciser is active, it should RETURN.
So when the program runs to that line, it returns back to line 7340.
Line 7340 then does the same check for variable PT$, the printer flag. If the
user has chosen not to test the printer, the program branches to line 7380:
If the user did choose to test the printer, the program falls through to line 7350,
which opens the printer as upper/lowercase device #1:
be echoed in the Echo Character Print Test in the Printer Diagnostic. It also sets
X equal to ten for the number of lines to print in the Sliding Alpha test. Finally,
there is a GOSUB to line 3650, treating the entire Printer Diagnostic Module like
a large subroutine:
7370 CLOSE 1
Line 7380 checks if the user opted to exercise the disk drivers). If not, the
program branches to line 7310:
If the user did choose to exercise the disk drivers), the program falls through to
line 7390, which is a FOR-TO loop. Variable DD holds the user input of the
number of drives to be tested, so this loops for the number of drives:
7390 FOR I = 1 TO DO
Line 7395 goes to the Clear Screen subroutine at line 2990, which clears the screen
of leftover messages and prompts from the previous test:
Line 7400 sets variable D, the disk number, equal to DN(I). DN is the array
in which the disk number is stored. I is an index. In the first pass through the
first disk, the program goes through DN(I). The second part of the statement sets
variable T, the disk type, equal to DT(I). Then the program goes back to line 5040
into the Disk Drive Diagnostic Module to run the write and read tests.
When the Exerciser completes its run through the Disk Drive Diagnostic, it
returns to line 7410, the NEXT statement corresponding to the FOR-TO loop at
line 7390:
7410 NEXT
When all the specified disk drives have been tested, the program falls to line
7420. Line 7420 sets variable PS equal to PS + 1. When the user halts the program,
this variable indicates the number of passes the Exerciser has run, which is
especially useful if the Exerciser has been run for several hours or even overnight.
160 Post-Repair Test and Burn-In
The program then branches to line 7310, which returns the program to the process
loop at the beginning of the Exerciser module, with the prompts for which devices
to test:
The Exerciser is an endless loop which the user can halt by pressing the
RUN/STOP key on the keyboard. When this is done, to continue with the rest of
the program, the user must enter the statement GOTO 7430.
Line 7430 is the last segment of the Exerciser Module. It branches to the Clear
Screen subroutine at line 2990, then closes device #1, in case the printer or disk
drive was left open at the time the program was halted:
Line 7440 prints the Exerciser Diagnostic title on the screen again:
Line 7450 prints the total number of test passes on the screen, using variable PS
from line 7420, which has been counting the passes:
Line 7460 goes to the subroutine at line 3200, which prints the user prompt to
enter any character to end the test:
Line 7470 returns EX equal to zero again, to set the System Diagnostic Program
back to its usual mode of user-directed operation. The program then returns to
line 50, which is the beginning of the System Diagnostic Main Menu:
7470 EX=O:GOTO 50
Chapter 9
Writing
Di_gn.stics
far OIlier
Peripherals
When there is a problem somewhere in the system, you want to be able to isolate
and identify its source. The System Diagnostic Program presented in this book
provides the means for doing this with the system unit, keyboard, monitor, print-
er, disk drives, and serial communication interface. You are able to perform the
necessary repairs on the indicated subsystem, based on this information.
However, if your system utilizes other peripherals not covered by this program,
it might be desirable to be able to write new diagnostic modules for them. In
this way, the System Diagnostic Program can grow with the computer system,
and new components will not be left out of the diagnostic loop that benefits the
rest of the system.
Using the joystick as an example, this chapter explains how to identify the
basic functions of a new device, and describes the types of problems you might
have with it. This chapter also tells how to find the information necessary for
developing the diagnostic that tests the device functions. Advice on flowcharting
and coding is provided, along with integration and testing procedures. This chapter
assumes that you are conversant in the BASIC programming language in which
the System Diagnostic Program is written .
If you are not currently familiar with BASIC but would like to be, obtain one
of the many excellent books on learning BASIC. There are also BASIC classes
available through computer stores, community colleges, and adult education
programs.
161
162 Writing Diagnostics for Other Peripherals
10 PRINT {CLR/HOME}
20 INPUT "Enter your name-";A$
30 PRINT "Hello ";A$
40 END
164 Writing Diagnostics for Other Peripherals
The joystick is a mechanical device with five internal switches. Four of these
switches control the four directional positions at which the joystick can point:
top, bottom, right, and left. The fifth switch controls the fire button at the top
of the joystick lever.
Two of the directional switches can be activated at one time. For example,
if the joystick is pointed diagonally toward the top right, both the top and right
joystick switches are activated. This means that there are eight different directional
positional positions that can be used, in addition to the fire button control.
Pressing the FIRE Button. In addition to the pointing lever, the joystick
includes the FIRE button. The graphic object can be positioned at a certain location,
and then when the fire button is pressed, the computer is informed to take a certain
action as programmed. By clicking the button, the computer knows that something
is to be done with the item on the screen where the cursor is pointing. Typically,
this would be shooting something in a game.
The Commodore BASIC manual has a great deal of valuable information for
programming in Commodore BASIC. The joystick user's manual provides more
specific information. The amount of information included in the joystick manual
depends on the manufacturer. The manual will often include information on
installation and maintenance, uses and applications for the joystick, and perhaps
sample programs and a troubleshooting guide.
One of the best sources of information on programming the joystick, is the
Commodore Programmer's Reference Guide. In the 110 chapter, there is
information about programming the joystick. In addition, one of the appendices
includes documentation on the pinout configuration of the game port to which
the joystick is connected.
Find out all the possible positions in which a joystick can be placed. Find
out how the joystick button is activated. Find out new uses for the joystick of
which you might not have been aware. Any sample programs in the documentation
will provide a good idea of the proper approach and special commands for
developing a program for your own purposes.
Another very beneficial means for researching the joystick is an old defective
joystick. If there is a defective joystick available, or if yours goes bad and needs
to be replaced, experiment with the old one. It's already defective, so nothing
can be hurt by taking it apart and exploring the works. This will help you under-
stand the component better, which will later aid troubleshooting endeavors.
121 Solutions
D Make sure the joystick is firmly seated in its game paddle port (Fig 9-3). Unplug
it, and carefully plug it back in and see if it works.
D If it still does not work, unplug the joystick cable from its game paddle port,
and plug it into the second port. If the joystick works in the other game padd Ie
port, this indicates a problem in the original port in the system unit. Refer
to Chapter 2 for further instructions on troubleshooting the system unit.
LJ If the joystick does not work in either of the two game paddle ports, try
operating the joystick, along with the diagnostic program, on another system.
If the joystick works on the other system, this indicates a problem with your
system unit. Refer to Chapter 2 for system unit troubleshooting procedures.
168 Writing Diagnostics for Other Peripherals
game
port #1
o If the joystick does not work on the other system, this indicates a faulty joystick.
The easiest thing to do in this case is to simply replace it.
[2J Solutions
o Check the cable connection and make sure the joystick connection is proper-
ly plugged in to the game paddle port.
o Swap another joystick onto your system, if available. If the other joystick works
on your system, then your joystick is defective, and should be replaced. If
the other joystick does not work on your system, this indicates a problem with
the system unit. Refer to Chapter 2 for further solutions.
121 Solutions
o Check the cable connection and make sure that the joystick connection is pro~
erly plugged in to the game paddle port.
D Swap another joystick onto your system, if available. If the other joystick works
on your system, then your joystick is defective, and should be replaced. If
the other joystick does not work on your system, this indicates a problem with
your system unit. Refer to Chapter 2 for further solutions.
Joystick Tests
Once you have a fair understanding of the joystick, determine the kinds of
tests that would be most helpful in such a diagnostic module.
The Game Port Option. Because the Commodore includes two game paddle
ports, the diagnostic user instructions should include a prompt for which port
is to be tested. This will allow separate testing of both ports.
The Direction Test. The joystick is a series of switches which determine the
direction of movement or firing action of the object it is controlling. Because of
this, one particularly useful test would be an on-screen display tracking the
direction in which the joystick is pointing. This would let you diagnose whether
a particular switch or combination of switches is malfunctioning.
In such a direction test, when the joystick is in its neutral position, the screen
is clear. If the joystick is moved away from you, the word NORTH would appear
on the screen. Likewise, if the joystick is moved to your left, the word WEST
would appear on the screen. And if you were to move the joystick diagonally
to the lower right, the word SOUTHEAST would be displayed.
In order to develop such a directional test, determine how information is sent
from the joystick to the system unit, and how this information is accessed. This
is a relatively simple process. The joystick is connected to one of two game ports
located on the right side of the system unit (Fig. 9-3). One of the chips on the
system unit's motherboard is an input port, accepting and processing input from
these game ports.
When one of the joystick switches is activated, a particular memory location
is set in this input port chip. On the Commodore 64, this is memory location
56320 for the first port, and memory location 56321 for the second port. This
is a one-byte location which contains a numeric value. The following table
indicates the numeric value which corresponds to each joystick position:
neutral 0
up
down 2
left 4
up left diagonal 5
down left diagonal 6
right 8
up right diagonal 9
down right diagonal 10
The Joystick Diagnostic Module must include a tight loop that continuously
examines the appropriate game port memory location. As long as the value is
170 Writing Diagnostics for Other Peripherals
zero and the joystick is in the neutral position, the loop goes around continuously.
As soon as the user moves the joystick, the value changes, and the program can
go to a table that holds some comparison statements. If the value were one, the
program would display the word "NORTH" on the screen. If the value changed
to two, the program would display the word "SOUTH." This would let the user
make sure that the joystick's "sense of direction" is working properly.
The Fire Test. A second test necessary for joystick diagnostics involves the
fire button. When the fire button is pressed, a value of 15 is set into the game
port memory location. This can serve two purposes: to test the fire button, and
to quit from the joystick Diagnostic and return to the System Diagnostic Main
Menu.
The Joystick Diagnostic Module Listing. Based on the flowchart, the program
code might look similar (although it could have very many variations) to the listing
as shown in Fig. 9-5.
How the Joystick Diagnostic Module Works. just as was done with the oth-
er modules within the System Diagnostic Program, the first things to be done in
this module are to clear the screen, position the cursor, provide an identifying
Commodore Care Manual 171
Examine
Joystick
Port
Find
Direction
In Array
Set to
Port 1
Set to
Port 2
REMARK statement, and print the module's title on the screen. This begins at line
7000, which clears the screen, positions the cursor, and identifies the module:
Line 7004 reads variable D$, which is indexed by I. I is set from one to ten,
meaning there are ten pieces of data loaded into the array. The data for the array
follow in lines 7006, 7007, and 7008:
These data specify the position indicators that are to be printed on the screen
depending on the direction in which the joystick is moved. These data are placed
in the array according to the possible values that can be returned when the program
PEEKs into the memory location variable where the joystick input information
resides.
e128 USERS: Lines 7002 through 7009 are modified in the e128 code to
reflect the different switch positions of the directions in the array.
Line 7010 prints the name of the Joystick Diagnostic at the top of the screen:
Commodore Care Manual 173
Line 7020 prompts the user to select the game port to be tested, port 1 or port
2. The value entered is placed into variable P:
Line 7030 fixes the program so that if the value entered is anything but a two,
P is automatically set to one. This ensures that only the values one or two are
ever placed into variable P:
Line 7040 prints a message that instructs the user to end the test by pressing
the FIRE button on the joystick:
Line 7050 checks to see if P is equal to one. If it is, then variable J is set equal
to 56320, which is the memory location that holds the input information for game
port #1. If P is equal to two, then J is set to 56321, which is the memory location
that holds the input information for game port #2:
Line 7060 sets variable VL equal to the contents of location L which is set
up either for game port #1 or game port #2:
7060 VL = PEEK(J)
e128 USERS: Lines 7050 through 7060 are modified to reflect the use of
the e128 joystick JOY command.
Line 7070 sets variable FB equal to variable VL, which is derived from the
PEEK statement, after going through the logical AND of 16 in the array. This
instruction filters out some unnecessary data that it picked up from the PEEK
operation. All that is necessary for the purposes of this program is that the input
value equal a number between zero and 16:
Line 7080 sets variable JD equal to 15 minus VL after it went through the
logical AND statement. This again filters out extra data, and will also help check
when the FIRE button is depressed on the joystick:
174 Writing Diagnostics for Other Peripherals
If it is, the program branches to line 7110. If it is not equal to 16, the program
falls through to line 7100, which loops back to line 50, the beginning of the System
Diagnostic Main Menu:
7100 GOTO 50
If FB is not equal to 16, the FIRE button was not pressed, and the program
branches to line 7110. Line 7110 checks whether variable JD (joystick direction)
is equal to zero. If it is, the joystick is in the neutral position, so the program returns
to line 7060:
If JD is not equal to zero, the program falls through to line 7120, wh ich pri nts
the contents of variable D$. D$ is the array set up at the beginning of the module,
indexed by variable )D. Therefore, if JD contains a value of one, for example,
then the word NORTH is printed on the screen, indicating that the user is pointing
the joystick forward.
The program then falls through to line 7130, which immediately sends the
program back to line 7060 for the loop looking for another value again. In this
manner, the user can continue to check the various joystick directions.
When the user wants to end the diagnostic, the FIRE button can be tested at
the same time. If the FIRE button does not cause the program to exit to the System
Diagnostic Main Menu, there is probably a problem with the button. Press the
RUN/STOP key to end execution of the entire program, then refer to the
"Troubleshooting and Repair Guidelines" earlier in this chapter to continue with
diagnostic and repair efforts.
If the FIRE button is working correctly, the program branches all the way back
to line 50 for the beginning of the System Diagnostic Main Menu, at which point
the user can choose another diagnostic module or quit the program.
First, modify the System Diagnostic Main Menu routine, which displays and
accesses all the diagnostic module options. Look at lines 50 through 90 of the
program where the Main Menu Module resides. Add the joystick Diagnostic
identifier to the PRINT statement that lists the menu options on the screen. Also,
insert the appropriate IF statement for the joystick Diagnostic identifier in lines
110-170, so that the program branches to the beginning of the joystick Diagnostic
Module when the appropriate key, perhaps a j, is pressed.
Once this is done, add the code to the program. A good place to append
the new code is starting at line 7000, as was done in this chapter's example. This
begins the new module where the last diagnostic module stopped.
Co• •adora 64
Iysta.
Dlagnaslic
iProgra_ Llsll••
REM "COfTJ1lOdore 64"
5 REM "System Diagnostic Program Copyright 1988
TAB BOOKS Inc."
10 POKE 53272,23:DIM K$(63):REM Set Character Set
20 DATA "INST/DEL","RETURN","CRSR RTOI,OIF7",OIF1","F3","F6",
"CRSR UP", 0I 3","II","A"
21 DATA "4","Z","S",I'E"," 1I,1I5",lIr","O","6","CII,IIF",
"TII, "X", 117 11 , IIY","G", 118", 118"
22 DATA IIH","U",IIV","9 11 ,III",IIJ","O","MII,IIK",IIOII,"N",
"+", lip", ilL 11,11_11,11.11,11: II,"@II
23 DATA II,","£II,"*",";II,"CLR/HOMEII,II 1I,1I=",lItll,II/II,"1I1,
"-"," ","2","SPACE"
24 DATA" ","Q"
25 FOR 1=0 TO 62: READ K$(I):NEXT
30 DIM R(8):DATA 1,2,4,8,16,32,64,128
35 FOR 1=0 TO 7:READ R(I):NEXT
50 GOSUB 2990: PRINT TAB(12) "System Diagnostic":PRINT:
60 PRINT TAB(3) "<K>eyboard Text <S>erial Comm Test"
70 PRINT TAB(3) "<M>onitor Test <D>isk Drive Test":
80 PRINT TAB(3) "<C>assette Test <J>oystick Test":
85 PRINT TAB(3) "<P>rinter Test <E>xerciser":
90 PRINT TAB(16) "<Q>uit":PRINT:PRINT TAB(12)
"Enter Selection"
176
Commodore 64 System Diagnostic Program Listing 177
595 KYS=KYS+KS(K)
600 GOSUB 630
610 PRINT TAB(5) ASiTAB(13) NiTAB(23) KYSiTAB(35) S1
620 GOTO 220
630 GOSUB 2990
640 V=PEEK(53272)
650 IF V=21 THEN S1=1:GOTO 680
660 S1=2:PRINT TABU) "Keyboard Diagnostic Module":PRINT
670 PRINT TAB(2) "Character Value Key Combination Set":GOTO 700
680 PRINT TAB(7) "keyboard diagnostic roodule":PRINT
690 PRINT TAB(2) "character value key combination set"
700 PRINT TAB(2)"--------- ----- --------------- ---":RETURN
710 GOSUB 630
720 PRINT "An illegal shift code was encountered!"
730 PRINT "your keyboard needs service": GOTO 220
740 POKE 53272,23:PRINT "{BLUE}":GOTO 50
3005 K=PEEK(197):S=PEEK(653)
3010 RETURN
3099 REM "Beep Routine"
3100 FOR L=54272 TO 54296:POKE L,O:NEXT
3110 POKE 54296,15:POKE 54277,90:POKE 54278,1:
POKE 54273,21:POKE 54272,31
3120 POKE 54276,33
3130 FOR T=1 TO 50:NEXT
3140 POKE 54276, 16:RETURN
3200 PRINT TAB(7)"press any key to end test";
3210 GOSUB 3000
3220 RETURN
3300 PRINT TAB(7)"press any key to continue":RETURN
Test":L$="":N=1
3770 CLOSE 1
3780 OPEN 1,4:REM "Open as Upper Case Only
3790 FOR 1=32 TO 255
3800 IF N=80 THEN PRINT#1,L$;:N=1:L$="":GOTO 3820
3810 L$=L$+CHRS{l )+" ":N=N+1
3820 NEXT I
3830 CLOSE 1
3840 OPEN 1,4, 7:REM "Open as Upper/Lower Case"
3850 FOR 1=32 TO 255
3860 IF N=80 THEN PRINT#1,LS;:N=1:L$="":GOTO 3880
3870 LS=LS+CHRS(I)+" ":N=N+1
3880 NEXT I
3890 IF LS<>"" THEN PRINT#1,L$
3900 IF EX=1 THEN GOTO 3950
3905 CLOSE 1
3910 GOTO 3500
3915 REM "Echo Character Print Test"
3920 GOSUB 2990:PRINT TAB(7)"Echo Character Print Test":
PRINT
3925 PRINT TAB(5)"Enter the Character to Ecno":PRINT
3935 PRINT "Press the CLR/HC»4E Key to End the Test"
3940 GOSU~ 3000:IF ASC(AS)=19 THEN CLOSE 1:GOTO 3500
3950 LS=""
3970 FOR 1=1 TO 80
3980 L$=L$+A$:NEXT
3990 PRINT#1,L$
4000 GOTO 3940
4010 REM Horizontal Tab Test
4020 GOSUB 2990:PRINT TAB(10)"Horizontal Tab Test"
4030 FOR 1=1 TO 80
4040 PRINT #1,TAB(I)"*":NEXT
4050 IF EX=1 THEN GOTO 4080
4060 CLOSE 1:GOTO 3500
4070 REM "Line Feed Test"
4080 GOSUB 2990:PRINT TAB(13)"Line Feed Test"
4100 FOR 1=2 TO 10
4110 FOR A=1 TO I
4115 PRINT#1,"":NEXT A
4120 N$=STR$(1-1)
4130 PRINT#1,"There have been ";NS;" line feeds"; :NEXT I
4140 IF EX=1 THEN RETURN
4150 CLOSE 1:GOTO 3500
187
188 Commodore 128 BASIC Programming Differences
198
Glossary 199
GETKEY-Waits for a key to be pressed, and places the value into a variable. The
Commodore 64 uses a GET loop, as in GET A$:IF A$-"" THEN 10.
GO 64-Puts the system into Commodore 64 mode.
GRAPHIC-Sets the screen display mode. The Commodore 64 requires direct
POKE instructions into memory in order to set the modes.
GSHAPE-Displays a graphic shape in high-resolution mode.
200 Glossary
202
Index 203
If you are intrigued with the possibilities of the programs included in Commodore Care Manual:
Diagnosing and Maintaining Your 64 or 128 System (TAB Book No. 3141), you should definitely
consider having the ready-to-run disk containing the software applications. This software is
guaranteed free of manufacturer's defects. (If you have any problems, return the disk within 30
days, and we'll send you a new one.) Not only will you save the time and effort of typing the
programs, the disk eliminates the possibility of errors that can prevent the programs from
functioning. Interested?
Available on disk for the Commodore 64 or the Commodore 128 at $24.95 for each disk plus $1.50
shipping and handling.
p-----------------------------------.
I
I I'm interested. Send me:
I
I
I I
_____ disk for the Commodore 64 (6432S) I
_____ disk for the Commodore 128 (6433S) I
_____ TAB BOOKS catalog I
Check/Money Order enclosed for $24.95 plus $1.50 shipping and handling for each disk I
ordered. I
_____ VISA _ _ _ _ _ MasterCard I
Account No. Expires I
Name I
I
Address I
City _ _ _ _ _ _ _ _ _ _ State __________ Zip _ _ _ _ _ __ I
Signature I
I
Mail To: TAB BOOKS Inc. I
Blue Ridge Summit, PA 17294-0850 I
I
OR CALL TOLL-FREE TODAY: 1-800-233-1128 I
IN PENNSYLVANIA AND ALASKA CALL: 717-794-2191. I
I
(Pa. add 6% sales tax. Orders outside U.S. must be prepaid with international money orders in U.S. dollars.)
'Prices subject to change without notice.
I
TAB 3141 I
I
~-----------------------------------~