Checking board type (KS1/KS2) from my code?

The Speccy's spritely young offspring. Discuss everything from FPGA to ZX
Post Reply
jamesh
Dizzy
Posts: 89
Joined: Thu Jul 06, 2023 6:36 pm

Checking board type (KS1/KS2) from my code?

Post by jamesh »

I was wondering, is there a way to programmatically identify the Next board type? At least distinguish the KS1/KS2 variants? "Machine ID" register only tells if this is a real Next or clone, is this correct?
why
I am thinking about releasing some experimental stuff and knowing the board revision will help a lot.
User avatar
Seven.FFF
Manic Miner
Posts: 753
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Checking board type (KS1/KS2) from my code?

Post by Seven.FFF »

Nextreg 15:

Code: Select all

0x0F (15) => Board ID
(R)
  bits 7:4 = Reserved, 0
  bits 3:0 = Board ID
    0000 = ZXN Issue 2, XC6SLX16-2FTG256, 128Mbit W25Q128JV, 24bit spi, 64K*8 core size
    0001 = ZXN Issue 3, XC6SLX16-2FTG256, 128Mbit W25Q128JV, 24bit spi, 64K*8 core size
    0010 = ZXN Issue 4, XC7A15T-1CSG324, 256Mbit MX25L25645G, 32bit spi, 64K*34 core size
The primary nextreg and port documentation pretty comprehensively defines the hardware, is guaranteed to be kept up to date in a way the wiki or manual isn't, and because it's git commit-based can be used to track back which features were introduced in which core versions.

You can safely call nextreg 15 on even the oldest cores, because the issue 2 value was chosen to be the same as the default 0 that not-yet-defined nextregs return. Which is also why it's impotant to mask out reserved bits when reading (as in this case), and mask out or set reserved bits to their
documented values when writing, so your code remains compatible with things not yet invented.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel NXTP ESP Update ESP Reset CSpect Plugins
jamesh
Dizzy
Posts: 89
Joined: Thu Jul 06, 2023 6:36 pm

Re: Checking board type (KS1/KS2) from my code?

Post by jamesh »

That's great. Thank you very much! I guess I have to update my bookmarks and make sure they point to the Gitlab docs.
Post Reply