Skip to content

feat(emu): joystick, paddle & pushbutton emulation ($C061/$C062/$C070/PREAD) #72

@relmer

Description

@relmer

Summary

Casso emulates no joystick, paddles, or pushbuttons. Every relevant soft
switch falls through to default and returns 0, so games that need analog
input or the Open/Closed Apple buttons cannot be controlled — even if they
otherwise boot and run.

Surfaced while validating Choplifter (#69): the title boots, the game starts,
but nothing responds. Root cause is not the disk path — it's that the
"press button to start" / fire action is gated on button 0 ($C061),
which is hardwired to always-unpressed.

Missing hardware

Register Function Current behavior
$C061 R Open Apple / Button 0 (bit 7) returns 0 (always unpressed)
$C062 R Closed Apple / Button 1 (bit 7) returns 0 (always unpressed)
$C063 R Shift-key mod (bit 7) unimplemented
$C064$C067 R Paddle 0–3 position (PREAD countdown) return 0 (center)
$C070 R/W Paddle timer strobe no-op
$C058$C05D Annunciators AN0–AN3 (AN0/AN1 = joystick control lines) not tracked

Known code facts (from docs/iie-audit.md)

  • [CRITICAL] C3$C061/$C062 are unreachable via the bus.
    AppleIIeKeyboard::GetEnd() returns $C01F, so the button-read logic at
    AppleIIeKeyboard.cpp:36-45 is dead code. The bus dispatches
    $C061/$C062 to AppleIIeSoftSwitchBank (its $C050$C07F range),
    which returns 0. (AppleIIeKeyboard.h:18, AppleIIeKeyboard.cpp:36)
  • AppleIIeSoftSwitchBank::GetEnd() returns $C07F but $C060$C07D all
    return 0 — paddles, tape, buttons absent. (iie-audit.md:182)
  • [MINOR] N3 — Annunciators AN0–AN3 ($C058$C05D) not tracked;
    AN0/AN1 drive the joystick port control lines. (AppleSoftSwitchBank.cpp:65)
  • $C063 Shift-key read unimplemented. (iie-audit.md:340,359)

Proposed staging

  1. Buttons-only (fixes audit C3, smallest, highest leverage).
    Make $C061/$C062 reachable and map button 0/1 to host keys
    (e.g. Left/Right Alt = Open/Closed Apple). Likely unblocks Choplifter's
    start + fire alongside its keyboard movement (A/D/W/S/Space/1-2-3).
    Either override AppleIIeKeyboard::GetEnd() to cover $C061-$C063
    and wire the existing dead code, or implement the reads in
    AppleIIeSoftSwitchBank. Add $C063 Shift read while there.
  2. Analog paddle/joystick. Implement the PREAD timing model:
    $C070 strobe starts the RC countdown; $C064-$C067 read bit 7 = 1
    until each axis's timer (proportional to position, ~0-3.3 ms) expires.
    Map axes to a host gamepad and/or keyboard. Track AN0/AN1.

Acceptance criteria

  • A game polling $C061 (e.g. Choplifter) sees the button as pressed when the
    mapped host input is active.
  • PREAD ($C070 strobe + $C064-$C067 poll) returns a position
    proportional to the mapped axis, matching the //e RC timing within tolerance.
  • DOS 3.3 / ProDOS boot and existing soft-switch tests stay green.

Notes

Separate feature from the Disk II copy-protection work (#67). Deferred — capturing
as backlog per discussion; not yet scheduled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions