In the Z80, bits 3 and 5 of F are officially "not used" (cf. official documentation "Z80 CPU User Manual UM008011-0816", section "Z80 Status Indicator Flags", PDF page 80 labelled 66).
Their values depend on the flavor of Z80 which is running the program and... to put a long story short "other factors". Yes is it a deep and interesting rabbit hole.
Anyway, different machines and emulators have differing behaviors. ZX Spectrum coder Redcode has written a test that checks combinations, compares them with a few references and tells which "flavor" of Z80 is running the code.
I have ported it to the Amstrad CPC.
More explanations and source on https://github.com/cpcitor/Z80_XCF_Flavor_CPC
Disk and tape image attached, along with results in some emulators.
Do all CPCs behave the same regarding this test?
I would love to see a number of labelled results, e.g. photo of the test result on the screen, and in my wildest dreams photo of the CPU inside the same machine.
What do you think? What's the results on the emulators and real CPCs you have?
What about CPC running on FPGA reimplementations and whatnot?
On Caprice32 it reports NEC NMOS flavor
screenshot_z80_xcf_flavor__caprice32__nec_nmos.png
On CPCEC it reports Zilog flavor
screenshot_z80_xcf_flavor__cpcec20240414__zilog.png
On RetroVirtualMachine it reports Zilog flavor
screenshot_z80_xcf_flavor__retrovirtualmachine__zilog.png
I believe all CPCs should have official Zilog Z80s (or at least any of them that don't have post manufacture modifications).
For what I see on our board scans, the classic machines usually have a Zilog or SGS cpu and they turn to ST ones towards the end of the range, that is, the cost down versions. The Plus and GX4000 all seem to have the ST Z80.
There's a branch of boards distributed by Schneider in Germany and maybe France, which have a Mostek Z80.
On Floooh's tiny8bit / chips it reports NEC NMOS flavor.
screenshot_z80_xcf_flavor__floooh_tiny8bit__nec_cmos.png
Quote from: cpcitor on 21:27, 16 November 24On Floooh's tiny8bit / chips it reports NEC NMOS flavor.
Floh was noticed about this some time ago here: https://github.com/floooh/chips/issues/98
BTW, there are some Zilog models that behave as NEC NMOS in ccf/scf, or at least some units from these models. Z0840004PSC and Z0840006PSC (possibly all *PSC models). More info:
https://zx-pk.ru/threads/34173-revers-inzhiniring-z80.html?p=1204453&viewfull=1#post1204453
https://zx-pk.ru/threads/34173-revers-inzhiniring-z80/page39.html?p=1204448#post1204448
that's a pretty cool way to detect which CPU you have