Broken joystick routines in type-in programs

Basic and Machine Language

Moderator: Moderators

xavier
Vic 20 Nerd
Posts: 953
Joined: Wed Jan 07, 2015 2:20 pm
Location: France

Broken joystick routines in type-in programs

Postby xavier » Sat Apr 11, 2015 2:18 am

Hi,

I typed-ins a program using a Vic20 with a 16kb expansion.
And i find a bug regard the Vice joystick and listings...

Code: Select all

65 PRINT"{red}{down}fire------>"
66 IFPEEK(37151)=94ORPEEK(37151)=30THEN70
67 PRINTPEEK(37151):GOTO66


May work on a true Vic20, but in vice, "PRINTPEEK(37151)" with 'Fire' give a 95 !!!
I use to change PEEK(37151)OR1 , but in ASM, the bug is less easy to change...

Is where any POKEs or, perhaps, a joystick option to set?
In my actual listing, there's many PEEKs from the Joy PIA IO!
And I can't change all Peeked values...

Thinks for replies!

User avatar
Mike
Herr VC
Posts: 3118
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Broken joystick routines in type-in programs

Postby Mike » Sat Apr 11, 2015 4:21 am

This is just (once again) the case of a fucked up joystick routine that compares whole register values instead of only the bits relevant to the directions or fire, by masking them out first. One other bit in that register gets changed by floppy access and thus this method leads to problems even on real hardware.

For those BASIC type-ins, try inserting SYS65017 as first instruction in the first line, which will reset the VIA registers.

xavier wrote:but in ASM, the bug is less easy to change...

... but that's what those concerned actually do on a per-program basis for those games which actually interest them. :) As an example, in my collection of type-ins for the VIC-20, roughly one half of the games suffered from the very same problem, and I patched the joystick routines to work correctly (in some cases there, the joystick routines were contained within a ML routine ...)

In any case, that issue doesn't have anything to do with VICE.

xavier
Vic 20 Nerd
Posts: 953
Joined: Wed Jan 07, 2015 2:20 pm
Location: France

Re: Broken joystick routines in type-in programs

Postby xavier » Sat Apr 11, 2015 8:07 am

Hi Mike,
I ever seen this command : "SYS65017" , but It was an enigma!
Thanks for help.
I will try to reset the IO joystick before its use.
...

User avatar
Mike
Herr VC
Posts: 3118
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Broken joystick routines in type-in programs

Postby Mike » Sat Apr 11, 2015 10:33 am

xavier wrote:I ever seen this command : "SYS65017" , but It was an enigma!

Mind you, that SYS only cures the symptoms. Those joystick routines affected remain in error nonetheless.

A correct way to read the joystick is shown in the Denial Wiki, in case you want to fix up such cases by yourself.

...

Please change the title of this thread to reflect the correct topic, like: 'Broken joystick routines in type-in programs'. You can do that by editing the start posting. Thanks.
[MOD] I did that for you :wink:

xavier
Vic 20 Nerd
Posts: 953
Joined: Wed Jan 07, 2015 2:20 pm
Location: France

Re: Broken joystick routines in type-in programs

Postby xavier » Sat Apr 11, 2015 2:29 pm

hi,
I have a "SYS65017:POKE36879,252" in the begin of the game...
But, I had to repeat it before the first 'fire' routine!
... seem working!
Thanks a lot.

xavier
Vic 20 Nerd
Posts: 953
Joined: Wed Jan 07, 2015 2:20 pm
Location: France

Re: Broken joystick routines in type-in programs

Postby xavier » Mon Apr 13, 2015 8:29 am

Please change the title of this thread to reflect the correct topic, like: 'Broken joystick routines in type-in programs'. You can do that by editing the start posting. Thanks.
[MOD] I did that for you

Ok!
The Vice emulator isn't "Brocken" or bugged in this case of home made routines.
It's due to a bit modification on the joystick port, when using the floppy port!
All routines are designed to work on Vic20 tape storage... and using a floppy instead of tape, get a bugs on the joystick port... like a true Vic20!

Thank to erase VICE in the topic name!
Have Fun.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest