Hi,
Is there a decent 'failsafe' method of finding out which MZ computer your program is running on? Only one I know of is perhaps checking the Monitor text (e.g. "SA-1510" etc). But that's not 100% accurate and if somebody has a modified MROM which doesn't even display this text then the program would have to fall back to a default.
Determining which MZ
Re: Determining which MZ
There were a couple of answers (or rather ideas) here: viewtopic.php?f=6&t=431
Re: Determining which MZ
I guess there are roughly three categories :
- MZ-80 K series (MZ-80 K/K2E/C)
- MZ-80 A series (MZ-1200)
- MZ-700 series (MZ-700/800/1500)
One possibility:
700 series: disallow VRAM access through "OUT A,($E5)" (with A = 0). Try to write the XORed byte at $D3FF and read it back. If not equal, it's MZ-700. Restore if needed then get back to normal mapping with "OUT A,($E6)".
A series: if not MZ-700, $D3FF shall NOT be mirrored in $D7FF.
K series: if not MZ-700, $D3FF shall be mirrored in $D7FF.
It should work as long VRAM is working.
- MZ-80 K series (MZ-80 K/K2E/C)
- MZ-80 A series (MZ-1200)
- MZ-700 series (MZ-700/800/1500)
One possibility:
700 series: disallow VRAM access through "OUT A,($E5)" (with A = 0). Try to write the XORed byte at $D3FF and read it back. If not equal, it's MZ-700. Restore if needed then get back to normal mapping with "OUT A,($E6)".
A series: if not MZ-700, $D3FF shall NOT be mirrored in $D7FF.
K series: if not MZ-700, $D3FF shall be mirrored in $D7FF.
It should work as long VRAM is working.
Re: Determining which MZ
Thanks! I forgot about that other thread! Looks like you have a decent method worked out. I might write a small program soon to try this out and try it on my various machines.
hlide wrote: ↑Sat Oct 30, 2021 4:24 pm I guess there are roughly three categories :
- MZ-80 K series (MZ-80 K/K2E/C)
- MZ-80 A series (MZ-1200)
- MZ-700 series (MZ-700/800/1500)
One possibility:
700 series: disallow VRAM access through "OUT A,($E5)" (with A = 0). Try to write the XORed byte at $D3FF and read it back. If not equal, it's MZ-700. Restore if needed then get back to normal mapping with "OUT A,($E6)".
A series: if not MZ-700, $D3FF shall NOT be mirrored in $D7FF.
K series: if not MZ-700, $D3FF shall be mirrored in $D7FF.
It should work as long VRAM is working.
Re: Determining which MZ
I couldn't succeed with this method.
I haven't tried on the real machine, but on many emulators.
Is my code wrong ?
Here's my last attempt:
...this is my current, non optimal way to determine if we're on MZ700 or MZ800
; Probe the MONITOR to detect Sharp MZ model.
; $26 would probably identify the MZ80K.
ld a,($10)
cp $24 ; Are we on a MZ700 ?
jr z,no_patch
cp $58 ; Are we on a MZ800 ?
jr z,no_patch
I haven't tried on the real machine, but on many emulators.
Is my code wrong ?
Here's my last attempt:
Code: Select all
mz_type:
_mz_type:
ld hl,$D3FF ; A position in VRAM to probe
ld a,(hl) ; pick a byte, we will try to alter the data in VRAM
; 700 series have a function to disable the VRAM access, let's see if it works..
out ($e5),a ; lock VRAM
xor $55 ; put some dirt
ld e,a ; keep a copy of the value used to probe the VRAM
ld (hl),a
out ($e6),a ; unlock VRAM
cp (hl) ; Z set if we have an older model (no VRAM protection)
jr z,no_mz700
;out ($e6),a ; unlock VRAM
; If not equal, it's MZ-700, MZ-800, MZ-1500
ld hl,2
ret
no_mz700:
; No need to unlock VRAM if we get here, it was never locked !
; Viceversa, we must restore the original value in VRAM
push af
xor $55 ; wipe out the added dirt
ld (hl),a
pop af
ld a,($D7FF) ; This is for the MZ80K
cp e ; compare to see if data was mirrored
; MZ80K: data was mirrored
ld hl,0
ret z
; MZ80A, data was not mirrored
inc hl
ret
; Probe the MONITOR to detect Sharp MZ model.
; $26 would probably identify the MZ80K.
ld a,($10)
cp $24 ; Are we on a MZ700 ?
jr z,no_patch
cp $58 ; Are we on a MZ800 ?
jr z,no_patch