Fixing joystick reading in games

Discussion, Reviews & High-scores

Moderator: Moderators

Post Reply
mimmosic
Vic 20 Drifter
Posts: 23
Joined: Mon Jul 01, 2019 8:28 am
Website: https://vic20reloaded.com
Location: Bologna
Occupation: programmer

Fixing joystick reading in games

Post by mimmosic »

Hello,
I have ported a compilation of games for unexpanded VIC-20 from cassette to diskette (.d64, attached).
vic20-base1-b.zip
(49.25 KiB) Downloaded 45 times
A few of these 20 games are multi-load games which I adapted in order to be loaded on diskette instead of tape.

Apart that you might enjoy the compilation, I need some help for the following 3 titles:

FROG
PERLE
LABYRINTH

all of them have the same problem: the reading of joystick is faulty. Only the right direction is correctly sensed.
If loaded from tape, original version of the games did work.
I remember the original tape versions did stop working when the STOP button on the tape player was pressed (and the PLAY button was released) so I thought there could be some link between the VIC VIAs for sensing the joystick buttons and the tape power flowing or not.

Can somebody help me out in restoring the normal joystick operation in these 3 titles?
A working version of these 3 games runnable from diskette will solve the problem anyway (Perle and Labyrinth are probably clones of known titles).

Thanks to anybody willing to help!
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: Fixing joystick reading in games

Post by tokra »

From memory: Usually a SYS65017 added right at the start of the final part should reset the VIA-registers so the (poorly programmed) joystick-routines in the programms keep working.
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Fixing joystick reading in games

Post by groepaz »

without looking, my bet is on the DDR being wrong. so one POKE should fix it :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Fixing joystick reading in games

Post by Mike »

It's not quite that simple: common observation is, games with said issue happen to run fine from tape.

When a file has been loaded from disk though, two bits in the VIA port register used for fire and most joystick directions (except right) are changed from the default. Now the - please excuse the profane language - completely wrecked joystick routines in those games compare whole register values instead of doing the Right Thing™ and masking out the bits corresponding to the given directions or fire.

SYS65017 reinitialises the VIA registers and cures the symptoms, but the joystick routines of course remain defective.

See also here: http://sleepingelephant.com/ipw-web/bul ... s=SYS65017
groepaz
Vic 20 Scientist
Posts: 1188
Joined: Wed Aug 25, 2010 5:30 pm

Re: Fixing joystick reading in games

Post by groepaz »

eeeks, ok. sounds reasonable :)
I'm just a Software Guy who has no Idea how the Hardware works. Don't listen to me.
mimmosic
Vic 20 Drifter
Posts: 23
Joined: Mon Jul 01, 2019 8:28 am
Website: https://vic20reloaded.com
Location: Bologna
Occupation: programmer

Re: Fixing joystick reading in games

Post by mimmosic »

I'll experiment a little bit, thanks all for help!
Post Reply