Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ clear): kill credited, P2 dies, message shown, wins=1, next round from corners.

Result: joystick type on the title (W/S cycle NONE / MZ 800 / MZ 1X03).
MZ-800/MZ-1500 digital sticks are read on ports F0h/F1h with 8255 port A bit
5/6 lowered for the read (`mz_joy800`). The MZ-700's MZ-1X03 analogue sticks
4/5 lowered for the read (`mz_joy800`). The MZ-700's MZ-1X03 analogue sticks
(E008h bits 1..4) are measured once per frame right after the VBLK falling
edge: 64 samples ~105 T apart, low count < 22 = left/up, > 46 = right/down,
switches sampled during display; with that type the frame limiter targets 880
Expand Down
9 changes: 5 additions & 4 deletions c/platform/mz/plat_mz.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ void mz_set_attr(uint8_t x, uint8_t y, uint8_t attr) {
/* ---- joysticks ----
* MZ-800 / MZ-1500: ports F0h (joy 1) and F1h (joy 2), active low:
* bit0 up, bit1 down, bit2 left, bit3 right, bit4 fire. The lines are only
* driven while 8255 port A bit 5 (joy 1) / bit 6 (joy 2) is low; keyboard
* strobes leave them high, so lower the bit around the read. */
* driven while 8255 port A bit 4 (joy 1) / bit 5 (joy 2) is low (MZ-800
* Service Manual, 8255 table and 4-7 Joystick; the ROM's @JOYIN writes CFh);
* keyboard strobes leave them high, so lower the bit around the read. */
uint8_t mz_joy800(uint8_t n) __naked {
__asm
push iy
Expand All @@ -280,14 +281,14 @@ uint8_t mz_joy800(uint8_t n) __naked {
ld a,(iy+0)
or a
jr nz,j8_two
ld a,0xdf ; PA bit5 low: joy 1
ld a,0xef ; PA bit4 low: joy 1
ld (0xe000),a
nop
nop
in a,(0xf0)
jr j8_got
j8_two:
ld a,0xbf ; PA bit6 low: joy 2
ld a,0xdf ; PA bit5 low: joy 2
ld (0xe000),a
nop
nop
Expand Down
Loading