Build an 8-bit Z80 breadboard computer

Sdílet
Vložit
  • čas přidán 1. 08. 2024
  • Build and program an 8-bit computer in Z80 assembly language! The computer bus circuit continues from my last video on EEPROM programming using an Arduino Nano. Program an ROT13 cipher and decode a secret message!
    Find the code at github.com/trevor-makes/avr-z...
    Parts used in this project:
    Arduino Nano
    2x 74HC573 latches
    AS6C62256 SRAM
    Z84C0010PEG CPU
    5x 1 kΩ resistors
    100 nF capacitor
    Visual Studio Code: code.visualstudio.com/
    PlatformIO IDE: platformio.org/platformio-ide
    Music from Fantasy Arcade by StreamBeats
    Chapters
    00:00 - Introduction
    00:54 - Continue breadboarding
    04:48 - Review code from last video
    06:59 - Writing the Arduino code
    13:11 - Adding numbers with assembly
    15:24 - ROT13 cipher in Z80 assembly
    21:47 - Special message from Njrfbzr
  • Věda a technologie

Komentáře • 40

  • @chrismcbrien2412
    @chrismcbrien2412 Před rokem +5

    Your wiring style is impressive. Like a work of art. Mine resembles a London road map.

  • @Rich-can-do
    @Rich-can-do Před 5 měsíci +1

    I love this I have a z80 chip right here and plenty of solderless breadboard

  • @jennifervangorkom4712

    While I use 6502 cpus when doing this sort of thing, I love what you have done here. Very clear and easy to follow. Thank You.

    • @TrevorMakes
      @TrevorMakes  Před rokem

      I love 6502 too! I'll probably swap one into this board after I do a few more videos on Z80. Glad you enjoyed it

  • @Rich-can-do
    @Rich-can-do Před 4 měsíci

    I love asm but I also love what you're doing. I can learn a thing or two here, and I have a z80 and its PIO and its serial controller as well, as well us plenty of 8k atcs64b eeprms and static ram . I will be keeping an eye on this channel. Ty so much.

  • @haroldmoore2563
    @haroldmoore2563 Před rokem +2

    That is 'most excellent' at around 5:14 in the video, I would have to say this is getting better than the Ben Eater videos because even tho the Eater videos have the 'educational' element, yours take it to the 'sub-atomic' level. Kids need to know what the 8080, 8085, Z80 times were all about, GREAT JOB!

    • @TrevorMakes
      @TrevorMakes  Před rokem +2

      Thanks Harold, totally agree about classic 8-bit CPUs, and even modern 8-bits like ATmega and PIC. There are so many layers of magic in doing anything on modern computers that it can be hard to reason out why software works the way it does or how to make it better. I'm trying to figure out how to make the assembly and registers level more accessible, but it's still pretty dense material even on 8-bits!

    • @haroldmoore2563
      @haroldmoore2563 Před rokem

      @@TrevorMakes of all the school curriculum's I think 8085 is still the main one. I'm going to wire up the programmer, didn't have thru hole 573's so making a kludge for my smt versions.

    • @TrevorMakes
      @TrevorMakes  Před rokem +1

      @@haroldmoore2563 Glad to hear, keep me updated! What CPUs do you have laying around?
      I'm surprised 6502 hasn't been picked up more in schools given all the trainer boards that WDC still produces. At my uni the CS dept used MIPS for theory and the EE dept used a bespoke design in Verilog--all simulated, nothing physical

    • @haroldmoore2563
      @haroldmoore2563 Před rokem +2

      @@TrevorMakes mostly microchip 18F types, intel 8052, an small xilinx cpld's. here is a short progress report ----> czcams.com/users/shortsloUglcRiixQ

    • @haroldmoore2563
      @haroldmoore2563 Před rokem +1

      @@TrevorMakes czcams.com/video/utd7YBTtVZk/video.html

  • @andyhu9542
    @andyhu9542 Před 3 měsíci

    The Arduino code is significantly more complex than the norm. I wonder what benefit this have over a simpler approach.

  • @morrielarsen
    @morrielarsen Před rokem

    My dude's wicked smaht.

  • @WagonLoads
    @WagonLoads Před měsícem +1

    I think your videos are very well done, even if some of it slightly over my head.
    Could you include a KiCad circuit diagram in the related GitHub repo for each video?
    Also, I have no understanding of how to use PlatformIO..
    I like the encryption program you made.. I made one in php that takes over 3600
    iterations to get back to the original sequence.
    pVHMNllMhNBwMe2yywiMNyiMgNllMehVHtMVgMthwMalVHFMVgMrVi3

  • @-stchs3757
    @-stchs3757 Před 4 měsíci

    good😀

  • @waterjoe2024
    @waterjoe2024 Před rokem

    🎉

  • @Rich-can-do
    @Rich-can-do Před 4 měsíci

    I love these 8biit cpus I wonder if the ca65 assembler be used for the z80? Looks great.

    • @TrevorMakes
      @TrevorMakes  Před 4 měsíci

      I tried out Z88DK and SDCC, and settled on the latter. Have a whole project on uploading C code to the breadboard computer that's mostly ready, but haven't scripted and filmed yet.

  • @JarppaGuru
    @JarppaGuru Před 8 měsíci

    21:52 yes im awesome! its just shift 13 xD

  • @tgopaul
    @tgopaul Před rokem +1

    Hi Trevor, I wired the EEPROM circuit on a breadboard using your jumper-bus technique. It took an extra day stripping wires but it is nice to work on now.
    I converted the working EEPROΜ breadboard for this Z80 project to take advantage of your Nano CLI code. With the Z80 removed from the board, the Nano and RAM are working. When I insert the Z80, read and write to RAM with the CLI memory commands corrupts the RAM content. I am suspecting the Z80 held in Reset is still messing with the shared bus. I am experimenting with using BUSREQ and BUSAK to resolve the conflict. It could be some versions of the Z80 do 3-state the Bus under reset and some versions do not. I did find some other Z80 projects that discuss the Reset vs Busreq signals. I’m learning a lot about C++ from your core library. I found the spot to lower the Z80 clock speed and may attempt to make a CLI command to select a slow debug speed.

    • @TrevorMakes
      @TrevorMakes  Před rokem

      Awesome, I'm glad you're finding the core library useful! That's strange about the Z80 though... It has worked for me with both a 2020 Z84C as well as a 1983 Z84. I don't suppose you're using a non-Zilog model? The datasheet states "During reset time, the address and data bus enter a high-impedance state, and all control output signals enter an inactive state." Does it work if you unhook the Z80's RE and WE from the bus, or is it also fighting the data and address lines?

    • @TrevorMakes
      @TrevorMakes  Před rokem +1

      @tgopaul can you share where to find the other Z80 projects you were talking about that discuss reset vs busreq? I don't think CZcams will let you post links, but maybe you can add spaces and take out the www. and .com etc

    • @tgopaul
      @tgopaul Před rokem +1

      @@TrevorMakes Hi Trevor, I found that when the Z80 reset is held low the RD and WR pins on the Z80 are High, preventing the Nano from accessing the RAM. I pulled the RD and WR breadboard wires from the Z80 to confirm they are blocking the NANO. There is the Z80 BUSREQ input that will 3state the Z80 RD and WR, Address, Data and other control lines at the completion of the current instruction and acknowledge the 3 state mode with BUSAK pin. The catch is, if the Z80 reset is held low there is no processing so the BUSREQ can not acknowledge with a BUSAK. An instruction must be running in order for BUSREQ to work. Another thing… the halt output is cleared when the Z80 reset is pulled low.
      I think you are close.
      If you put 00 on the DATA BUS and start the Z80 out of Reset it will run NOPs. Watch for M1 signal.
      Then Pull BUSREQ low and wait for BUSAK to Acknowledge. Don’t Reset the Z80. Let it sit with BUSREQ low.
      This will also suppress the Refresh signal and the address bus counting used for dynamic ram refresh.
      Then the NANO can take over and control the RAM and load and save contents.
      When the Nano is done…
      Have the Nano 3state its latches, the Nano RD and WR and any other of the Nano control output
      Then the Nano can issue a Reset to the Z80 with a low signal at least 4 clock cycle times.
      Release the Z80reset and it will start to run code.
      .. you could hold it back with BUSREQ or maybe WAIT line
      I wired the M1 signal to the Wait line to allow 1 instruction to run the first time M1 goes low. If you then use some logic monitoring the halt, wait, and M1 signal you can control the Z80 from the NANO.
      The NANO can write code into the address Zero so the Z80 will always start with this code on reset.
      The official Z80 documentation lists the actions of each pin. With old chips they often do not behave the way you think they should.
      Even Reset will be ignored if there is a long stretched clock cycle.
      check this link
      retrocomputing.stackexchange.com/questions/25962/z80-bus-control-by-external-device-busrq-or-reset

    • @tgopaul
      @tgopaul Před rokem

      @@TrevorMakes key point… RESET held low holds RD and WR HIGH blocking NANO

    • @tgopaul
      @tgopaul Před rokem

      @@TrevorMakes … thanks for the library code.
      you forced me to learn what C++ bit fields are for.
      ..there are big gaps in my knowledge. ..thats where your youtube videos are helpful.

  • @ngtester6215
    @ngtester6215 Před 3 měsíci

    is it ok to wire Arduino-Nano directly to Z80 bus?1 .. or level shifter are needed ?!

  • @PavanKumar-nx2bm
    @PavanKumar-nx2bm Před rokem

    Hello!! Could you please tell how to learn about arduino and other programming stuff.?? I am interested in it but don't know how to start..

    • @TrevorMakes
      @TrevorMakes  Před rokem

      Arduino is an excellent place to start with programming. I've seen a lot of people recommend www.youtube.com/@paulmcwhorter and I'll be starting a series of Arduino beginner videos soon too

  • @TheStickCollector
    @TheStickCollector Před 8 měsíci

    I want to make a z80 computer and use a real Game Boy processor to make Gameboy games with and other projects
    Really push the gbz80 language fully if given good amounts of ram and other specs.

  • @ottooctavius4116
    @ottooctavius4116 Před rokem

    Can you give the procedure to build this computer?

    • @TrevorMakes
      @TrevorMakes  Před rokem

      What part would you like to see more about? This video and the previous video (EEPROM programmer) go through the steps, and there are wiring diagrams on GitHub: github.com/trevor-makes/avr-z80-part1