travisgoodspeed / maskromtool

A CAD tool for extracting bits from Mask ROM photographs.
Other
331 stars 21 forks source link

GatoROM Z8 Format #76

Closed travisgoodspeed closed 4 months ago

travisgoodspeed commented 10 months ago

Close this issue when we have support for decoding ROMs from Z8 chips of multiple ROM sizes.

Lord-Nightmare commented 10 months ago
I figured this out using a number of guesses, some hints from the micrograph in the July 1981 issue of BYTE magazine, and a Log table at the end of the rom as a rosetta stone for the rather weird column order.

The Z8611 rom, if arranged so that the rom is at the bottom of the die (which is technically upside-down compared to the image in the july 1981 BYTE article), is arranged as such:

ROM OVERVIEW:

1 vs 0 bits: an open link (blue dot in maskromtool) is a 0 bit, a closed link (red dot in maskromtool) is a 1 bit

| D0   D1   D2   D3 || D4   D5   D6   D7 |
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|
|.... .... .... ....||.... .... .... ....|

Column order:

Detail of the D0-D3 columns:
|                                                D0                                              ||    D1   ...
#  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
c 0f 1f 07 17 0b 1b 03 13 0d 1d 05 15 09 19 01 11 0e 1e 06 16 0a 1a 02 12 0c 1c 04 14 08 18 00 10 

Detail of the D4-D7 columns: (same as D0-D3 but mirrored left to right)
...  D6    ||                                             D7                                                |
           #  0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
           c 10 00 18 08 14 04 1c 0c 12 02 1a 0a 16 06 1e 0e 11 01 19 09 15 05 1d 0d 13 03 1b 0b 17 07 1f 0f|

ROM address is column 'number' plus 32 * row number

Row order from top: (T0 and T1 are the two rows of the 64-byte test rom)
T1
T0
00
01
03
02
04
05
07
06
08
09
0b
0a
...
7b
7d
7c
7e
7f
Lord-Nightmare commented 10 months ago

Effectively this means, to find a specific bit in the array given its rom address, you'd do something like: D0-D3: final_column = BITSWAP8((column^0x1E), 7, 6, 5, 0, 1, 2, 3, 4); D4-D7: final_column = BITSWAP8((column^0x01), 7, 6, 5, 0, 1, 2, 3, 4);

The BITSWAP8 function is:

#define BITSWAP8(val,B7,B6,B5,B4,B3,B2,B1,B0) \
        ((BIT(val, B7) <<  7) | \
         (BIT(val, B6) <<  6) | \
         (BIT(val, B5) <<  5) | \
         (BIT(val, B4) <<  4) | \
         (BIT(val, B3) <<  3) | \
         (BIT(val, B2) <<  2) | \
         (BIT(val, B1) <<  1) | \
         (BIT(val, B0) <<  0))
Lord-Nightmare commented 10 months ago

I think it is likely that the Z8601 ROM on the die is in the same order as the Z8611, with the sole difference that the "bottom-most" row is 3f instead of 7f, no other significant difference.

travisgoodspeed commented 10 months ago

Sean Riddle just published his notes on the Z8.

travisgoodspeed commented 10 months ago

77 tracks a patch that adds support.

travisgoodspeed commented 4 months ago

We still lack support for exporting the test ROM, but this seems to work for everything else.