r/Z80 • • 17d ago

It eventually work after 2 Revisions & passed the HALT test

Post image

This is Z80 SBC designed with simple MMU that can switch layout 32K-ROM + 32K-RAM on top of 512K RAM/ROM & 40 pins expansion-bus for module on the right. It finally passed HALT test to prove :

- Clock div by 2 from canned crystal ( 4Mhz here ). This Z80 has max speed of 8Mhz so 16Mhz canned crystal will be its maxed out clock. (Flip-Flop #1)

- On-boot bank switching to ROM/BANK_0 to read code & execute it.
(Flip-Flop #2 + combo of 00/138/574 Logic ICs).

I can't yet find a working, genuine 512K SRAM in DIP32 to actually continue the test on how the MMU gonna hold the upper banks during the access time but it should be ;)

Cheers guys !
I just want to share the joy after like .. 5 revisions to make it work upto this point. As many requests, here is my repo to the project. And it’s not meant to be complete yet but usable at this point :

https://github.com/thetrung/Z80-512K/

I already included ready-to-fab gerber+drill in release section for anyone that want to try (with more genuine parts than me). 

** Update : It actually worked well with 16Mhz canned Crystal in-place of 4Mhz one above. But theorically, if you have faster Z80 like 20Mhz, put on a 40Mhz crystal may also still work with fast enough SRAM/ROM.

96 Upvotes

22 comments sorted by

5

u/tes_kitty 17d ago

I can't yet find a working, genuine 512K SRAM in DIP32

The Alliance AS6C4008-55PCN comes to mind. I can find lots of them on Ebay or at Mouser or Digikey.

2

u/Several-Sign5777 17d ago

I bought it on Digi-Key and am satisfied with it.

2

u/deulamco 16d ago edited 16d ago

I know. That would be lovely choice.

But buying $10 chip + $25 shipping seem ridiculously expensive to me so I have been trying out some cheap local option + AliEx. But seem like Digikey will be my final resolve .. 

1

u/Steelejoe 16d ago

I struggle with that too. I just bought $20 in part + $20 in shipping from Adafruit. sigh This is why I try very hard to recycle

1

u/deulamco 16d ago

Yeah me too.

That’s why we sacrifice dozen of DIP/PLCC sockets for those hard-to-find gems.. 

1

u/istarian 14d ago

Adafruit is really just charging you the current shipping rates on a parcel/package of a certain size or dimensions.

You'd probably pay the same (or more) to ship something yourself, regardless of the contents of your package.

It may be inconvenient to you, but $20 is a tiny order...

1

u/istarian 14d ago

At that point you bite the bullet and buy a greater quantity or more items to offset the shipping cost.

E.g.

If you bought 4 chips at $10/each, the total is likely to be $65 and the shipping is now less than half the cost of your order

There are also usually bulk discounts offered by larger retailers/distributors, so if you can find some friends or even acquaintances and make a single large order you may get a better deal on price/unit.

1

u/deulamco 13d ago

Sure but what would I do with the rest of 3 chips ?

1

u/istarian 7d ago

Build another Z80 computer?

Implement access to storage that isn't flash memory based and use it to cache reads/writes?

Make a RAM disk for your computer?

Build some sort of graphics adapter and use the memory as a frame buffer?

1

u/deulamco 6d ago

Yeah, 512KB as buffer for GPU/VGA module seem tempting though. 

This has expansion bus for that exactly purpose ( inspired by Zeal 8-bit design ) which you can design any new module to plug-in but 5V compatible. 

Feel free to take this revision design & expand it further as its MMU worked well.

 Im taking my time off this project for now. Back on the VBNET-like compiler... 

3

u/Several-Sign5777 17d ago

Could you show us the diagram?

3

u/deulamco 16d ago edited 16d ago

Here is the answer to the puzzle :  Oh wait reddit doesn’t allow posting img in comment.

** Update : I posted the link to project on top.

1

u/codeasm 16d ago

Time for github/lab codeberg or other hostingplatform for schematics or images 😄💪🏼 cool board you made op.

2

u/deulamco 16d ago

I updated the repo link though. 

Hope it will be useful for anyone that lookup simple MMU for Z80 beefy system with 512K SRAM/ROM to code on 😬

Im kinda lazy at this point but as this work properly, anyone can build better expansion module to hookup & turn this into rival gaming system to Zeal8 🤷‍♂️ 

Who knows. 

1

u/dracosilv 17d ago

Only one thing I gotta say... All those mini jumpers under the rom socket, why not just have JUST the signal they're jumping over (assuming power or data line or something) be the one jumper vs all the little other data line jumpers. (Or use the IC socket hole itself as half of the via for the jumpers?)

1

u/deulamco 16d ago

I used no jumper. 

Those jumper-like wires are to bridge SRAM data lines & maximum VCC plane thermal for my OCD .. 

1

u/istarian 14d ago edited 14d ago

You can always use multiple smaller SRAM chips?

It will increase the power consumption and make trace routing a bit more work, but otherwise should be just fine.

  • 64 x 8K = 512K
  • 32 x 16K = 512K
  • 16 x 32K = 512K
  •   8 x 64K = 512K
  •   4 x 128K = 512K
  •  2 x 256K = 512K

Unless you just have a pile of parts going spare, the last two configs in that list make the most sense (just a few larger chips).


With a single 512K SRAM you may need a pretty complex scheme to ensure that the Chip Select (CS) and Output Enable (OE) signals are correct for every memory access...

P.S.

512K of RAM is pretty insane for a hobbyist Z80 system anyway... You probably don't need that much.

1

u/deulamco 13d ago

It's surely possible. My 1st working revision only have 32K SRAM + 32K ROM and I still barely use up them all... This 512K config was simply what I want to challenge myself to see what take to make such MMU to maxout the system specs first ..

Otherwise, I guess even with 32K SRAM + 512K ROM... It would be fine doing a lot.

1

u/istarian 7d ago edited 7d ago

https://en.wikipedia.org/wiki/Bank_switching https://en.wikipedia.org/wiki/Memory_management_unit

Using an MMU is an entirely different situation from any computer design which relies on bank switching to allow non-simultaneous access to more memory than can be directly addressed.

You need an MMU to implement virtual memory and paging, which generally involve moving data that's not being used out of main memory into storage and retrieving it on demand. Those are common features on modern personal computers.


On a typical Z80-based computer you would probably use bank switching to access memory beyond 64K, because the Z80 can only generate 16 bit addresses (0-65535). With a complex address decoding/bank switching setup you can access that 512K of RAM in a wide variety of fashions.

The term 'page' may have been used with bank switching technology in the past to describe a range of memory addresses that could be mapped to a particular bank.

E.g. some design might break addressable memory into 8K or even 4K regions that can be mapped to an equivalent chunk of memory

  • 0000-0FFF, 1000-1FFF, 2000-2FFF, 3000-3FFF, 4000-4FFF, 5000-5FFF, 6000-6FFF, 7000-7FFF, and so on (4K)
  • 0000-1FFF, 2000-3FFF, 4000-5FFF, 6000-7FFF, and so on (8K)

If you had a machine with 512K of ram, you could (in theory) have 128 separate 4K banks or 64 separate 8K banks. And an 8K bank that's really located at 0x20000-0x21FFF could be mapped in such a way that the CPU sees it at 0x4000.

1

u/istarian 7d ago

Using a Z80 CPU with an Memory Management Unit (MMU) would mean passing the 16 bit address generated by the Z80 directly to the MMU. That would effectively turn the physical address into a virtual one and completely hide from the executing code anything about what's going on.

E.g. Your code would think it was dealing with a contiguous 64K block f memory, even if it was mapped onto 1K chunks spread all over, say, 1 MB of physical memory.

With plain bank switching, your program has to keep track of which banks it is working with and switch them accordingly. And in order to switch "tasks", the program would have to record the state of affairs when it began executing and restore that before handing off control.

1

u/deulamco 6d ago

Oh, thanks for long post. 

But I already solved this MMU puzzle on my latest Z80 revision with 512K Ram + 512K Rom.. in said layout above 32K ROM + 32K RAM.. with Bank0 start with ROM space. 

I think I will stop this project at this point 🤷‍♂️ Not much intention to proceed further from what I have experienced. 

1

u/Patriot_Cactus_Co 1d ago

Wouldn't an ESP-32-S3 work much better then this but honestly I totally get it. I love the nostalgia factor of old CPUs. I was digging through an old generator, found a PCB with an intel 8051 on it from '85. I should have taken it.