siggi wrote: ↑Tue Oct 12, 2021 10:20 am
The new version of ZXGLX.P crashes on my Zeddy (56K, no ZxPand, no chroma, no ULA, but with Z80
) when the second screen appears. The old version is running as expected ....
Siggi
The only reason I see the game crashing is conflicting with the ZXpand IO addresses. Do other games that read the ZXpand joystick work satisfactorily?
https://sinclairzxworld.com/viewtopic.php?f=4&t=833
This is the code I used to read the ZXpand joystick:
Code: Select all
.
.
.
ld b,$e7
ld c,$fe
in d,(c) ;read keyboard
call RDZXPJOY
.
.
.
; ---
; Read ZXpand joystick:
; Return status in A:
;
; Bit --Direction
; 7 Up
; 6 Down
; 5 Left
; 4 Right
; 3 Fire
; 2 indefined
; 1 indefined
; 0 indefined
;
; The corresponding bit will be 0 when the joystick is pushed in that direction.
; Bits 2 to 0 inclusive are undefined, but you might just work out that bit 0
; represents whether a card is present...
RDZXPJOY:
ld a,$a0
ld bc,$e007
out (c),a
ex (sp),hl
ex (sp),hl
in a,(c)
or $07
cp $ff ; test if joystick was activated
jr z,RDKBJOYEND ; jump if not
LEFTFIRE:
ld c,a
and $28 ; tests for left/shot combination
jr nz,LEFT ; jump if not
ld a,$ee ; if yes, associate to the keys "5" + "0"
jr RDKBJOYEND
LEFT:
ld a,c
and $20 ; tests whether joystick was triggered to
jr nz,RIGHTFIRE ; left; if not, jump
ld a,$ef ; if yes, then associate the "5" key
jr RDKBJOYEND
RIGHTFIRE:
ld a,c
and $18 ; tests for right/shot combination
jr nz,RIGHT ; jump if not
ld a,$fa ; if yes, associate to the keys "8" + "0"
jr RDKBJOYEND
RIGHT:
ld a,c
and $10 ; tests whether joystick was triggered to
jr nz,FIRE ; right; if not, jump
ld a,$fb ; if yes, then associate the "8" key
jr RDKBJOYEND
FIRE:
ld a,c
and $08 ; test whether the fire button was activated
jr nz,RDKBJOYEND ; jump if not
ld a,$fe ; if yes, then associate with "0" key
RDKBJOYEND:
and d ; mix with previous contents in d and return
ld d,a
ret
It might be better to give the option to select the patch for the ZXpand Joystick before starting the game, this would avoid this kind of conflict.