Login
Back to forumReply to this topicGo to last reply

Posted By

Charlemagne
on 2023-02-27
04:44:29
 ?Peek(198) -> Joy0, Joy1 in emulator and a real machine

Dear Plus/4 Fanatics,

I had fun with joystick emulation in Yape and a real joystick in a real Commodore Plus/4 computer.

10 PRINT PEEK(198) : GOTO 10

I got some strange experinces...

1.: in Yape

Joy0 - UP = $10 (16)
Joy0 - DOWN = $11 (17)
Joy0 - RIGHT = $13 (19)
Joy0 - LEFT = $12 (18)
Joy0 - FIRE = $16 (22)
Joy1 - UP = $08 (8)
Joy1 - DOWN = $09 (9)
Joy1 - RIGHT = $0B (11)
Joy1 - LEFT = $0A (10)
Joy1 - FIRE = $14 (20)


2.: in a real Commodore Plus/4 with a real joystick

Joy0 - UP = 48 or 16 or "1"
Joy0 - DOWN = 57 or HOME
Joy0 - RIGHT = 59 or "2"
Joy0 - LEFT = 50 or right cursor
Joy0 - FIRE = 62 or 22 or "T" or "Q"
Joy1 - UP = same as joy0
Joy1 - DOWN = same as joy0
Joy1 - RIGHT = same as joy0
Joy1 - LEFT = same as joy0
Joy1 - FIRE = RUN STOP (?)

Moreover:
SE: 18
SW: 17
NE: 19
NW: 16

Why? What is it? So I don't understand...

Have a good time.

Posted By

siz
on 2023-02-28
08:55:18
 Re: ?Peek(198) -> Joy0, Joy1 in emulator and a real machine

Hello Charlemagne,

What you are trying to do is using the fact that the joystick is connected to the same wires as the keyboard. In ideal cases it would work with some restrictions: the KERNAL stops scanning at the first pressed key in the keyboard matrix (except for shift/control/commodore keys). This restricts from detecting simultaneous presses like diagonal directions and movement with fire pressed.

Most probably your plus/4 has a bad TED latch which causes joystick to response to every column scan. This TED fault is not (yet?) emulated by YaPE.

It's worth noting that BSz did a comprehensive analysis on the topic and posted methods to detect and workaround this bad latch problem (but they work in assembly only).

If You want to use BASIC You can use KEY() (or KEY$()? I haven't used BASIC in 30 years) and JOY() functions.

Posted By

Charlemagne
on 2023-03-01
15:41:26
 Re: ?Peek(198) -> Joy0, Joy1 in emulator and a real machine

Hello siz,

Thank you for your reply.

Yes you are right again, because this Commodore Plus/4 was that I got from a guy who found it his loft without rooftop... happy ...stuck keys... ...and very dirty inside... So I do not wonder.

Well, I tried another two Commodore Plus/4 computer pulled out from a deeper location of my storage and both of them gave me the following values:

Joy0 - Up = 16 or "5"
Joy0 - Down = 17 or "R"
Joy0 - Right = 19 or "6"
Joy0 - Left = 18 or "D"
Joy0 - Fire = 22 or "T"

Joy1 - Up = 8 or "3"
Joy1 - Down = 9 or "W"
Joy1 - Right = 11 or "4"
Joy1 - Left = 10 or "A"
Joy1 - Fire = ??? (???empty???)

I like BASIC, too, but it was only a quick test to check what values are coming from $C6 when using joysticks.

Posted By

Csabo
on 2023-03-01
17:13:31
 Re: ?Peek(198) -> Joy0, Joy1 in emulator and a real machine

Joy1 - Fire should be the Shift key (which is why you don't see anything "typed").

Posted By

Charlemagne
on 2023-03-02
02:21:07
 Re: ?Peek(198) -> Joy0, Joy1 in emulator and a real machine

WoW, thank you guys...

What a fool was I, but I have already come out of the dark and see the light.



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024