Teaching a Z80 to share (memory)

Поділитися
Вставка
  • Опубліковано 23 сер 2024

КОМЕНТАРІ • 26

  • @microhobbyist
    @microhobbyist 11 місяців тому +2

    I would also go with putting buffers. I'm actually implementing this on my homebrew Z80.

  • @stamasd8500
    @stamasd8500 Рік тому +7

    I would do it the "right" way, i.e. using the BUSRQ/BUSACK mechanism - that's what it's there for. And if you run out of pins on the Arduino you can always either use something with more I/O pins (like an ESP32) or a I/O expander like the MCP23017 to give the Arduino more GPIO pins.

    • @alexloktionoff6833
      @alexloktionoff6833 Рік тому +1

      With ESP/STM/RISCV you have to convert logic levels 3.3v5v, those chips are no cheap.

    • @davethedaemon9024
      @davethedaemon9024 Рік тому +1

      The ATmega4809 Curiosity Nano has more pins and runs at 5v and as a bonus can run at 20Mhz when configured correctly (note: it is 16Mhz by default). The drawback is it doesn't handle nested interrupts the same way as other Arduinos. At the moment, Mouser has it in stock for $25 US.

    • @TrevorMakes
      @TrevorMakes  Рік тому

      You'd probably hate the ZX81 video circuit! It uses series resistors on the actual data and address lines so the logic chip can inject fake NOPs while the Z80 reads from the display memory, and then injects pattern addresses to the ROM while the Z80 does refresh. I thought overriding the read/write enable was pretty tame in comparison! 😁

    • @tgopaul
      @tgopaul Рік тому

      @@TrevorMakes .. choosing resistors will require consideration of what type of Z80 you have. A CMOS version at the logic and opcode level is the same as an NMOS Z80 … but at the transistor level, bending the rules will need to account for differences. ..an old timer told me .. all circuits are analog. .. but kids wiring logic gates for the first time are confused by the power and ground pins.
      On my original build I had a CMOS Z80 and was using an Adafruit Metro Mini instead of your Nano. The Metro Mini has the smallest surface mount packaging of the Atmel328. This might explain why the Z80 reset behaved differently for me.

    • @tgopaul
      @tgopaul Рік тому

      @@TrevorMakes op-amps will make the slide-rule obsolete

  • @spodule6000
    @spodule6000 Рік тому

    No comments? Well I better just say that was nicely explained, your measured delivery is very clear. I haven't looked at Z80 stuff for many years so this is kind of fresh for me again. I've been idly designing CPUs lately so I guess that's why UA-cam put this in my feed. I'll check out your other bids.

    • @spodule6000
      @spodule6000 Рік тому

      *vids

    • @TrevorMakes
      @TrevorMakes  Рік тому

      Thanks! I like CPU and logic design stuff too and hope to make more videos about that.

  • @stephencole9289
    @stephencole9289 Рік тому

    Just for info. 40 years ago (!) I added a Z80 to my 6502 based single board computer, sharing the memory (and memory mapped io). Only one cpu was active at any time. Had to add tristate buffers to the 6502 lines but could use the fact that the 'inactive' Z80 had built in tri-state. Cant remember exactly how I 'paused' the cpus (probably via reset) but could use the 6502 to set up the initial memory contents then switch to Z80 (which started from a reset state into a monitor program and could eventually boot CP/M from disk. Could also use the Z80/cpm to load a 6502 memory image and then switch over to the 6502 (as didnt have a disk operation system for the 6502) . Seem to recall I inverted the address lines to the Z80 to 'move' the 6502 important zero page out of the way

    • @TrevorMakes
      @TrevorMakes  Рік тому

      How cool! Like the Commodore 128. That's an interesting point about the 6502's zero page, since that's where the Z80 entry points are. I'm spoiled using a microcontroller since it has its own ROM/RAM built-in separate from the Z80 bus.

  • @tgopaul
    @tgopaul Рік тому

    Good video and explanation! The scope traces show what is happening.
    ...
    I've placed 3 buffer ICs (74HCT245) on the address and data lines to drive some LEDs. When in TriState high impedance mode the input to the buffers floats. ... so I put in 10K pull down resistors.
    I might switch these to pull up.
    I'm thinking that Tristate is useful in transition from one controlling CPU to another but a bus shouldn't be left dangling in Tristate mode.
    Looking through data sheet for an IDT dual port RAM it warns not to leave the input pins floating. I also see that a Hitachi 63C09 processor pulls all the address lines high in between instructions. TriState is reserved for only when the CPU receives a BusRequest.
    This is probably why Reset does not put the bus into tristate. Tristate is special and needs to hand off quickly to another controlling master.
    Good fun to figure out at the hardware level. ... and to appreciate more what goes on inside a device running at 3GHz with 2GB RAM.
    Using an Arduino and the Analog inputs there are some circuits out there to make a tristate logic probe.
    Knowing when a bus is in tristate might help for projects that have devices sharing bus lines.

    • @TrevorMakes
      @TrevorMakes  Рік тому

      That's an interesting point about not leaving the bus lines floating... Is that referring to the data/address or just the control lines?
      A tristate logic probe sounds useful, I'll have to look into that.

  • @PebblesChan
    @PebblesChan Рік тому

    When using a Z80 with DRAM that refreshed by the CPU appropriate measures are required by the external bus master to continue refreshing the DRAM to preserve DRAM contents. This may involve a method to exchange the Z80’s R register contents to the external bus masters.

    • @TrevorMakes
      @TrevorMakes  Рік тому

      That's a good point. Both BUSRQ and RESET (but not HALT) stop the Z80's built-in DRAM refresh cycles, so as you say the external bus master (in this case Arduino) would have to take over refresh duty. The Arduino could do this with interrupts, though the overhead of interrupt handling at the row refresh frequency would be significant, ~10% of CPU cycles (AVR has lots of registers to save/restore in ISR).
      I've got a bunch of different DRAM laying around for my DRAM tester, so I was thinking about building a more standard Z80 system with DRAM and Z80 peripherals after I wrap up this Arduino-based one.

  • @Rich-can-do
    @Rich-can-do 4 місяці тому

    Sounds good to me. I really like that you don't program a EEPROM every time you want to do something. Using that NANO which is providing a serial link . Having to program a EEPROM every time you want to do something is a bit of a pest. I am still building the Ben Eater 6502 breadboard computer, but I have a Z80 and tones of 8k EEPROMS and lots of static parallel ram. BUT vscode that's Microsoft. Even though they say its *free* its a special kind of free they like to enforce. I use Arduino IDE and I use minicom so maybe I can do this. I really like what you are doing here. Keep going. It looks like you are maybe using a MAC?. I have been told its a bit like Linux. One thing, be careful to who you listen to. Before long they will tell you to put antivirus on your Z80 breadboard. Keep it simple. Don't over engineer it.

    • @TrevorMakes
      @TrevorMakes  4 місяці тому

      Agreed about Microsoft. There is vscodium as well... I might switch back to Arduino IDE for my videos since it seems to be more foolproof for beginners and hobbyists who don't already know things like git, vscode, installing extensions, etc. I'd really like to remove the software dependence from the PC side completely and add something like a web interface for programming the breadboard from anything with a web browser.
      Macs have a Unix command line but some tools like sed are the BSD variant which lack features tacked-on to the GNU variants more common on Linux. This can be frustrating when trying to adapt shell scripts or one-liners written for Linux, but at least you don't have to learn Windows powershell.

    • @Rich-can-do
      @Rich-can-do 4 місяці тому

      @@TrevorMakesI took a quick look at vscodium. For whatever reason I couldn't get get the addons to work. I am very comfortable in the shell. Been using it for along time. People make it very complex, but it doesn't need to be. When i first started with C was back in the day when High SoftC was new and I got it free. Its now pretty darn expensive. I was using my Amstrad CPC 464 and green screen monitor. Your Arduino code is amazing for sure. I wonder if I can use it on my Arduino IDE. You can use Arduino IDE as a neat simple build system for your code . I am waiting for my Oscilloscope and probe leads to arrive from amazon. Suppose to be this week. For streaming stick to UA-cam. Twitch is really for gaming.

    • @Rich-can-do
      @Rich-can-do 4 місяці тому

      @@TrevorMakesStick to Arduino IDE. Its amazing what you can do with it. You can do very simple stuff with it your more complex projects. I have been checking out Python. It looks interesting. I want to work on serial communication between my PC and a breadboard computer. We are talking about serial TTL to USB no nasty rs323. :)

  • @christophero1969
    @christophero1969 4 місяці тому

    Additional Buffers\Inverters\Resistors are much more expensive than using the proper lines.

  • @ownpj
    @ownpj Рік тому

    If you prefer to use /RESET, what if you tie the /RESET and /BUSREQ lines together? Do you get the best of both by doing this?

    • @TrevorMakes
      @TrevorMakes  Рік тому

      That seems reasonable, but unfortunately the RESET state takes precedence over the BUSREQ state, so the control lines are still held high as if it was just RESET alone.

  • @geowar20
    @geowar20 4 місяці тому

    74HC04? Or just use a diode.