30.12.2013 Views

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

May June 1980 - Commodore Computers

SHOW MORE
SHOW LESS

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

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

MAY/JUNE.<strong>1980</strong> MAV/JUNE. 198O ISSUE.a 4<br />

COMPUTE. 89<br />

FOT For)'OIiT your cOl/lienie1lU: convenience i,l in making flU usr f!.f of the following fol/owillg (lTlide. article, I I'm '/'r lrprilltrd reprinted (I a<br />

/JlJrtioll portion oj of C~/lck Chuck.I0/I/ Johnson HOIl 's rxu:lIrnl excellent article ankle ill in Jjesl lies! of the PET<br />

Ga:etlr, Gazette, p. pA2. -I2, RCL<br />

PET ting WITH<br />

PET ting WITH<br />

AJOYSTICK<br />

HONey B. Herm on<br />

Harvey B. Herman<br />

Chemistry Deportment<br />

Department<br />

University of North Carolina<br />

at Greensboro<br />

Greensboro, N.C, 27412<br />

Greensboro, N.C 27412<br />

My y older style PET keyboard gets banged around<br />

quite a bit when my kids play games which use the<br />

number pad. , A recent PET-Pourri column in Kilobaud<br />

((1) I) prompted me to install a joystick on my<br />

PET in order to save my keylOps keytops from further wear.<br />

This article is intended to share my experiences<br />

with this project and lO to encourage other fumblethumbs<br />

like myself to try it. .<br />

fumble-<br />

I purchased the Atari-joysticks from Sears as<br />

suggested in the above column (catalog #6C99835)<br />

for r $9.95 each. Since I could not find a mating<br />

connector, eClOr, I cut off ff' each end and attached ached them to a<br />

User Pon Port connector as per the e instructions (see also<br />

refs 2 and 3). The latter connector can be purchased<br />

from any number of companies (e.g.,, AB All <strong>Computers</strong>).<br />

Four signal d iodes ( I N662), whose speci fi ca­<br />

puters). Four signal diodes (1N662), whose specifica<br />

tions I believe are not t critical, ical, are also used in this<br />

s<br />

super simple interface circuit it which can be constructed<br />

in about 112 1/2 hour. Check to make sure thatt the<br />

diode cathodes are connected as shown in the e circuit<br />

diagram (1) I) and the color coded wires of the joystick<br />

are connected to the proper pins s ofo f the e User Port<br />

conneclOr. connector. OtherwiseO no special precautions are arc<br />

necessary. I did it right the first time e (yes brag!) brag')<br />

This neat hardware would, , of course, be useless<br />

withoutw software to work it. CursorC magazine e (4)<br />

has supplied several programs which have a joystick<br />

option. I tried these first (Demon, Canyon, Pickup<br />

and Nab) with happy success. . These programs area rc<br />

written to work withw various model joysticks wired \"ired and<br />

oriented in differentd llt ways. SinceS my configuration<br />

io n<br />

was fixed I modified the joystick subroutine uti in each<br />

Cursor program to lO skip the test step. That procedure<br />

can be tedious if a program is run repeatedly. TheT following g changes in the CursorC joystick subroutine<br />

should work for alla Atari-type type joysticks wired according<br />

to the circuit diagram in reference 1: I:<br />

610306 PRINT: FOR R I = ~ 0 to 5: READ T, T , P:<br />

GOSUB 61120: 6 T(I) T = ~ T: T : J(T) J ) = ~ P: NEXT I<br />

611206 T = ~ INT (T/16) I16) ANDA NDT: RETURNR U R N<br />

612506 DATA 255, 5, 223,4,239,6 239, 6 127,8, 191,2,<br />

1,2,<br />

63, 0.7, 0 1, I , 9, 3<br />

I ran the original program once to find the<br />

values in the T array and used data statements tement s in the<br />

modified program in order to skip the test step. This<br />

considerably speeds up thee beginning of a game. I<br />

have deliberately ignored thee rationall behind the bitt<br />

manipulations ns in statement 61120. 20, It is not necessary<br />

to understand that in order to use joysticks. I emphasize<br />

this point because I hope it will encourage<br />

PET users who may strain aatl bitss to attempt projects<br />

such as described here. I Inn a future an article e I<br />

may try my hand at a tutorialo forr those who wish<br />

to delve imo into thiss mystery further. er,<br />

If a program was nott writlen written with a joystick<br />

in mind another modification n procedure must be used<br />

to convert it a\",ay away from number pad usc. use. As an<br />

example I modified the programm Obsracl Obstacle e (5) which<br />

utilizes utlitzes the full keyboard as two pseudo-joysticks.<br />

Each player manipulates hiss piece (screen character)<br />

with the now standard keyboard patterns, ""W, , X X, , A<br />

and D" and "8, 2, 4, 6". The object is to keep from<br />

running into the screen traill left by the other<br />

player - the first to do so loses. As withh many games it<br />

is easier to use than to describe. The following<br />

statements in the original program are used lO to sense a<br />

keypress by a player and change direction if necessary:<br />

260 GET R$<br />

265 IF RS R$ = ~ ""W" W " THEN AD = ~ 1I<br />

•<br />

300 IF RS ~ "8" THEN E 11D llD = 1<br />

•<br />

It If W is pressed the direction of the player on the<br />

leit's left's piece is changed to up. If 8 is pressed<br />

the direction of the player on the right's piece picce is<br />

also changed to up. . Player and direction are detc deterr­<br />

mined by the above keyboard pattern which can be<br />

learned quickly by new pl ayers.<br />

learned quickly by new players.<br />

Converting a program like this s to joystick use is<br />

very easy. The following owing statements s will do this:<br />

260 M = ~ PEEK (59471)<br />

1)<br />

265 IF (M ORO R 240) = ~ 247 THEN AD = ~ 1I<br />

•<br />

300 IF (M OR 15)<br />

127 THEN E BD =<br />

•<br />

The elipsis is can be fleshed out with the help of<br />

the table below. . A peek ata t the User Port Pon gives a<br />

unique value e for each position on of o f the e joystick as long<br />

as only y one is being used. . It is necessary to "mask"" with 15 IS or 240 if the possibility ilit y exists of both<br />

being g used at the e same time. If only one joystick<br />

is used and it doesn't matter which, a further opera-

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

Saved successfully!

Ooh no, something went wrong!