Skip to content

MZ-800 joysticks: strobe on 8255 PA4 (joy 1) and PA5 (joy 2) - #23

Merged
martin-mat merged 1 commit into
MZPico:mainfrom
mlukasek:mz800-joystick-strobe
Nov 17, 2026
Merged

martin-mat merged 1 commit into
MZPico:mainfrom
mlukasek:mz800-joystick-strobe

Conversation

@mlukasek

@mlukasek mlukasek commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

On a real MZ-800 the joysticks did not work in BomberNet: both ports read FFh. mz_joy800 lowers the wrong 8255 port A bit before the read.

Change

  • c/platform/mz/plat_mz.c, mz_joy800: joy 1 strobe 0xDF -> 0xEF (PA4 low), joy 2 strobe 0xBF -> 0xDF (PA5 low). The comment above the function cites the source.
  • PLAN.md: "port A bit 5/6" -> "bit 4/5".

The MZ-800 Service Manual assigns PA4 to the joystick-1 strobe and PA5 to the joystick-2 strobe, both active low (section 4-3, 8255 table; section 4-7 Joystick: "Low active strobes are issued through PA4 (JOY1) of the 8255 and PA5 (JOY2)"). The ROM's @JOYIN writes CFh, both low. With the old values the code read F0h while strobing joystick 2 (PA5), and F1h while strobing nothing (PA6 is not connected), so the switches never reached the bus.

Earlier versions of mz800emu returned the stick state regardless of the strobe, which is why the emulator tests passed.

Testing

  • Real MZ-800, JOY1 and JOY2: a local game played with the fixed build; movement and fire work in both ports. The stick was a Bluetooth gamepad adapter that switches the lines to COM (pin 8) like an original Atari stick. BASIC STICK/STRIG worked with the same adapter before the fix, while BomberNet did not.
  • mz800emu with strobe emulation (PA4 = JOY1, PA5 = JOY2, as in the manual): a small z88dk +mz program reads the ports with the mz_joy800 sequence while the emulated stick holds all directions and fire. JOY1: DFh reads nothing, EFh reads everything, CFh everything, FFh nothing. JOY2: BFh nothing, DFh everything.
  • The MZ build compiles with z88dk (nightly); the binary differs from the unfixed build in exactly these two bytes.
  • Not checked: the MZ-1500. The comment names it next to the MZ-800, but I had no MZ-1500 documentation to confirm its strobe bits.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QfaMrBqpK7kyqn5PJoxRUq

Summary by CodeRabbit

  • Bug Fixes
    • Corrected joystick selection on MZ-800 and MZ-1500 platforms to use the documented 8255 port A bits.

mz_joy800 lowered PA5 for joy 1 and PA6 for joy 2. The MZ-800 Service
Manual (8255 table, 4-7 Joystick) assigns PA4 to joystick 1 and PA5 to
joystick 2, active low; the ROM's @joyin writes CFh. With the old values
a real MZ-800 reads FFh on both ports.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QfaMrBqpK7kyqn5PJoxRUq
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Phase 3 plan and MZ joystick documentation now specify port A bits 4 and 5. The mz_joy800 selector writes updated values when it selects each joystick.

Changes: MZ joystick selection

Layer / File(s) Summary
Document and apply joystick selector bits
PLAN.md, c/platform/mz/plat_mz.c
The plan and code comments assign port A bit 4 to joystick 1 and bit 5 to joystick 2. mz_joy800 writes 0xEF for joystick 1 and 0xDF for joystick 2, and reads port 0xF0 for joystick 1.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: martin-mat

Merge Risk: Minimal · up to dfb0f

The change corrects which port A bits select joystick 1 and joystick 2 on the MZ-800, and the author reports it working on real hardware. No concrete merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: the MZ-800 joystick strobe moves to 8255 port A bit 4 for joystick 1 and bit 5 for joystick 2. The raw summary confirms the plat_mz.c selector change (0xEF/0xDF) and t…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the MZ-800 joystick strobe moves to 8255 port A bit 4 for joystick 1 and bit 5 for joystick 2. The raw summary confirms the plat_mz.c selector change (0xEF/0xDF) and the matching PLAN.md update from bits 5/6 to bits 4/5. The title is specific and matches the changeset.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between a6deef5 and dfb0f33.

Files selected for processing: 2

  • PLAN.md
  • c/platform/mz/plat_mz.c

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@martin-mat

Copy link
Copy Markdown
Contributor

Good catch @mlukasek, thanks for the PR!

@martin-mat
martin-mat merged commit 1df918b into MZPico:main Nov 17, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants