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.
|