News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_cpcitor

Program that tests Z80 SCF/CCF undefined behavior on flags

Started by cpcitor, 16:03, 16 November 24

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

cpcitor

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
You cannot view this attachment.

On CPCEC it reports Zilog flavor
You cannot view this attachment.

On RetroVirtualMachine it reports Zilog flavor
You cannot view this attachment.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

andycadley

I believe all CPCs should have official Zilog Z80s (or at least any of them that don't have post manufacture modifications).

robcfg

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.

cpcitor

On Floooh's tiny8bit / chips it reports NEC NMOS flavor.

You cannot view this attachment.
Had a CPC since 1985, currently software dev professional, including embedded systems.

I made in 2013 the first CPC cross-dev environment that auto-installs C compiler and tools: cpc-dev-tool-chain: a portable toolchain for C/ASM development targetting CPC, later forked into CPCTelera.

ZjoyKiLer

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

zhulien

that's a pretty cool way to detect which CPU you have 

Powered by SMFPacks Menu Editor Mod