Google-apper
Hovedmeny

Post a Comment On: Ken Shirriff's blog

"The Z-80's 16-bit increment/decrement circuit reverse engineered"

13 Comments -

1 – 13 of 13
Anonymous Anonymous said...

There is a small error regarding the refresh feature of the Z80.

64KBit-DRAMs (4164) use a 7Bit refresh (128 cycles) despite using 8Bit addresses. This carries through to the 256 KBit DRAMs (41256) which need an 8Bit refresh (256 cycles) despite having 9Bit addresses.

So a Z80 can properly refresh a 64KBit DRAM if the address lines are wired correctly.

Since a 64Kx4 DRAM (41464) is internally 256KBit, it needs an 8Bit refresh.

November 13, 2013 at 12:38 AM

Blogger Mr Z said...

Apparently it's not quite as simple as Anonymous said above. There's apparently 128-cycle refresh and 256-cycle refresh 4164s. (The first one I found a datasheet for required a full 256 refresh cycles.)

Here's one thread elsewhere that briefly mentions the difference:

http://www.vintage-computer.com/vcforum/showthread.php?36974-4164-DRAM-with-128-refresh

November 13, 2013 at 6:18 AM

Blogger Mr Z said...

This list from the previous thread shows 128-cycle vs. 256-cycle DRAMs from multiple vendors. http://www.minuszerodegrees.net/memory/4164.htm

November 13, 2013 at 6:20 AM

Anonymous Anonymous said...

Ok, I stand corrected.

All the datasheets of 4164 in my collection state 128 cycle refresh and I never had seen any others.

So in other words, you can refresh 4164 with a Z80 if you wire it right _and_ use the right RAMs.

I'm curious how TMS4532 (partially defective TMS4164) work in a ZX Spectrum though since the upper RAM is refreshed by the Z80 and the TMS4164 are listed as 256 cycle.

November 13, 2013 at 12:39 PM

Blogger Mr Z said...

Just speculation, but it seems likely that the ZX Spectrum was only refreshing the 128 good rows...

November 14, 2013 at 12:14 PM

Anonymous Anonymous said...

all the z80 reverse engineering stuff on this blog is really cool, I enjoyed reading it. I download the z80 layout and started looking at the register file area.

Any tips on where to start! I guess tracing through the clock, vcc and gnd signals is a good place.

Any idea which pads on the edge of the die are which? How did you start?

November 15, 2013 at 1:30 AM

Blogger Ken Shirriff said...

Anonymous: if you want to trace the chip, you should get in touch with the Visual 6502 team. But to get you started, ground is the big trace on the left, and +5 is the big trace on the right. The upper-left pin is BUSRQ, upper-right is D1, lower left is A5, and lower-right pin is CLK. You can fill in the rest of the pins by looking at the chip pinout.

November 18, 2013 at 11:00 PM

Anonymous Anonymous said...

Fantastic investigation, Ken! Have you found the adder that should be connected to IX and IY registers to quickly compute (IX+d) addresses? Is that adder somehow part of the incrementer, but not shown? Greetings!

February 3, 2014 at 9:49 PM

Blogger Mr Z said...

@Anonymous: My own guess is that it uses the 4-bit ALU for that. Compare the cycle time for "LD r, (HL)" to "LD r, (IX+d)". 2M/7T vs. 5M/19T.

If this incrementer was able to do the add, I would expect IX+d to be much faster.

Ken, any thoughts?

February 4, 2014 at 6:54 AM

Blogger Goran Devic said...

Some Z80 block schematics out there actually show the adder but again some don’t. The confusing part is that ALU flags are not affected by it. There must be some signal to inhibit ALU from updating all relevant flags if this was the case.

When you account for 2 extra M cycles (fetching the prefix and “d”), you are left with 1 extra M cycle and 6 T clocks. Those clocks may as well implement this: #1: Xl->ACT, #2: Add, #3: ALU->Z, #4: Xh->ACT, #5:Adc, #6:ALU->W and then next M phase instead of HL->bus, do WZ->bus, so WZ holds the (IX+d). That would add up.

What do you think?

February 4, 2014 at 9:04 AM

Anonymous Goran Devic said...

How do I contact someone from the 6502 team to get the Z80 chip traces? I did some investigation of the Z80 instruction register latches here: http://www.devic.us/hacks/z80-instruction-register-deciphered
but having traces would really help me getting further. Ken, how did you get the image of incrementer you compared in this blog? Thanks!

March 7, 2014 at 3:47 PM

Blogger Mario. said...

Regarding the faulty DRAM chips and ZX Spectrum refresh, yes, it was in the documentation, that Clive Sinclair, yet again used defective components to build a massively successful product.

He used to do a similar thing with transistors, even pulling them out of the tarmac and recycling. Also, individually (by hand) testing their beta and selling them via ads in the magazines.

Those were the days...

April 15, 2016 at 7:11 AM

Blogger Mike Dimmick said...

On the 48KB ZX Spectrum, the upper 32KB of memory was wired with physical links to select which half of the TMS4532 chips to use. A7 is wired to a logic 0 for the lower half being good and a logic 1 for the upper half. On early issues, each bank of 16KB had to all be the same type (-20NL3 for low and -20NL4 for high). Later issues of the PCB had links to set each chip separately. If the chips need to be replaced you either have to find an exact match, or swap the links around. Or just use working 4164s! Presumably it was cheaper for Sinclair to obtain and fit 2x 4532 than 1x 4164.

Because A7 is hard-wired, the refresh from the CPU does indeed only touch the working half of the chips. There is no way to access the other half.

November 25, 2020 at 10:55 AM

You can use some HTML tags, such as <b>, <i>, <a>

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.
Please prove you're not a robot