The Z80's secret feature discovered after 40 years!

Sdílet
Vložit
  • čas přidán 30. 04. 2024
  • For years, it's generally accepted that 8 bit microcomputer CPUs does not have hardware support for protected mode. However, my recent discovery shows otherwise. In this video, I will show you how to implement memory and I/O protection on a z80 with minimal external circuit.
    Links:
    General Introduction to the Z80: • Looking at the Zilog Z...
    The history of Zilog and Z80: • Intel’s worst Nightmare
    Z80 assemnly tutorial: • Z80 Assembly Language ...
    CPU timeline: www.vgamuseum.info/index.php/cpu
    Support this project on Patreon: / andy18650
    Join our discord server: / discord
    GitHub repo for the project: github.com/Andy18650/HEC-Mode...
    Chapters:
    0:00 The Z80 has a protected mode
    0:32 Literally the worst intro video ever
    0:52 What is Z80
    1:52 Why is protected mode important?
    3:10 Undocumented? Really?
    4:10 How to implement protected mode
    10:34 Final Conclusion
    12:10 Clickbait?
    12:54 Applications of the protected mode
    14:27 An interesting story
    Edit: this video is the third release! I managed to iron out all problems in the second one, which includes:
    1, CRT noise everywhere
    2, intro video footages are not muted (you can hear computer noise over the music)
    3, 0:55 the (absolutely terrible) B-roll is not muted (You can hear me watching a video about the Mindset computer in the background... I thought it was fine since I could just mute that, obviously I did not...)
    4, 1:56 my voice is strangely 'doubled' making me sound like the Borg Queen (this does not happen at all when I'm editing the video! In my editing software the two voices just overlap entirely and become louder)
    5, 2:13 that B-roll (and the horrible CRT noise) is not muted
    6, 2:45 a weird 'ding' caused by speeding up the video to hide a long blank
    7, music is still too loud, but my editing machine probably have a voice enhance feature enabled somewhere too. This problem is much less pronounced on it (and maybe some other computers but probably not all).
  • Věda a technologie

Komentáře • 1,3K

  • @mrpawpaw7023
    @mrpawpaw7023 Před rokem +979

    As a retired IBM engineer who started working in 1980 I am impressed with your ability here, and also in your interest in this topic. I used to wire-wrap 8085 systems together and programmed them using asm, reprogramming them after a short 20 minute erase process using an UV light! Spent most of my career in the bare metal space. You have a bright career ahead of you, my friend.

    • @Xray-Rep
      @Xray-Rep Před rokem +53

      @MR PawPaw -- OMG, that's the same kind of work I did back in the mid 1980's!
      I spent countless hours (including evenings and weekends) writing asm code for the 8085. If memory serves me (no pun intended) the 8085A supposedly had four undocumented op codes which allowed some much-desired operations such as a 16 bit subtract, and I believe a couple of indirect memory access operations (my memory is very volatile!). Unfortunately we programmers were not allowed to use those undocumented op codes because Intel did not guarantee they would work in every new lot of chips they produced. We had to be very clever with our coding because of the limited 65K memory that we had to work with.

    • @judd_s5643
      @judd_s5643 Před rokem +30

      I still have factory new z80 cpu, CTC (COUNTER TIMER) AND PIO (Parallel input/output. PLUS my wire wrap guns. I did a lot of work with this chip set.
      I started out in 1971, had one of the very first HP RPN calculators, actually held in my hands, one of the original Intel 8008 cpu that was fabricated by Texas Instruments. Too bad I wasn’t as financially smart as I watched, from within the industry, the entire microprocessor revolution. I’d be rich!

    • @pedzsan
      @pedzsan Před rokem +21

      Yep... I still own my first computer -- Z80 with 256 bytes of ram. Cassette recorder to save programs via Z80's SIO chip. The terminals at school had a bug in them. I reverse engineered the terminal (8085 based) as well as its code, found the bug, re-blew the EPROM and fixed the issue. All without any test equipment at all.
      The 6809 (if I recall correctly) was the most beautiful 8 bit chip I ever saw.

    • @garymartin9777
      @garymartin9777 Před rokem +11

      If National had been a year closer to working samples you would have been wrapping 16032 (later rebranded 32032) as the folks in Boca Raton loved it and hated the Intel architecture. But that's coulda woulda shoulda!!

    • @MichaelKingsfordGray
      @MichaelKingsfordGray Před rokem

      Liar.
      You lie about your real name.

  • @andrewdunbar828
    @andrewdunbar828 Před rokem +769

    You can absolutely do preemptive multitasking without protected memory, it's just a lot less stable since all software has bugs. The Amiga may be the most well-known example of a computer with preemptive multitasking without protected memory.

    • @StefanReich
      @StefanReich Před rokem +24

      True

    • @spakkajack
      @spakkajack Před rokem +15

      and early macs

    • @andrewdunbar828
      @andrewdunbar828 Před rokem +94

      @@spakkajack I was going to say that, but early Macs didn't have preemptive multitasking but cooperative multitasking. Correct me if I'm wrong. I have a Mac knowledge gap between System 7.1 and the M1 (-:

    • @litjellyfish
      @litjellyfish Před rokem +33

      @@andrewdunbar828 that is correct

    • @gblargg
      @gblargg Před rokem +3

      @@andrewdunbar828 The only thing that sort of qualified with Macs was installing an interrupt task. Some programs did this, e.g. MacIntercomm's downloading via interrupt callbacks in the background. It was a niche thing.

  • @k33per03
    @k33per03 Před měsícem +5

    I disagree that this is clickbait, because in the end; you achieve protected mode and without a huge amount of external hardware. Very cool.

  • @rogerhudson2814
    @rogerhudson2814 Před rokem +732

    In the early 1980s a whole UK army signals system used a single Z80 in a shielded casing. Impressive.

    • @deang5622
      @deang5622 Před rokem +27

      I built a phone system using a microcontroller using less RAM and ROM than the Z80 could handle. I had 1.5 KB of RAM and around 30KB of ROM.

    • @nsp265
      @nsp265 Před rokem +3

      Clansman?

    • @deang5622
      @deang5622 Před rokem +6

      @@nsp265 LoL, I do know of Clansman. No, this was a custom built system for a non UK army.

    • @effexon
      @effexon Před rokem +10

      @Tarik B. lol sound chip and vga chip has near nothing to do with either Z80 or PC XT... so im not sure what you are trying to say

    • @cloerenjackson3699
      @cloerenjackson3699 Před rokem +1

      @@effexon What do you mean you're not sure? He's just saying dumb shit to diss the PC, obviously.

  • @tekslice
    @tekslice Před rokem +62

    A protected mode isn't necessary to develop preemptive multitasking. All you need is a clock interrupt that handles task swapping through a scheduler. Once the scheduler has determined what the next eligible task is, it saves the context (stack, IP) of the current task on the task's own stack, restores the context of the next eligible task from the new task's stack, and finally resets the processor Instruction Counter with the new task's saved instruction address. In modern OS, this is done in protected mode, but it doesn't have to be for this mechanism to work.

    • @henriqueseganfredo1166
      @henriqueseganfredo1166 Před 7 měsíci +4

      Some old DOS task schedulers worked this way. Protected mode is more about easying it and creating virtual separated CPU and memory areas with ease for the developer but it must follow a set of strict rules and limitations

    • @jumpstar9000
      @jumpstar9000 Před 2 měsíci +1

      Came here to say the same thing. I've built pre-emptive multi-task schedulers for 6502 and z80 hack in the day. Good times :-) Still, he gets full marks for trying.

    • @jgunther3398
      @jgunther3398 Před 2 měsíci

      of course it isn't. it's software -- we can do anything!

    • @donny121able
      @donny121able Před 2 měsíci

      Pretty cool how programmers push things to their limits. Technology has made us lazy.

    • @paulstelian97
      @paulstelian97 Před měsícem

      pmode and virtual memory are merely required to _enforce_ the task switching and isolation. If you trust the code you’re running then you can run everything in kernel mode and bypass those isolation mechanisms (e.g. JavaOS, which JITs everything and runs everything in the same address space, with isolation coming merely from the Java memory model and no escape hatch being available)

  • @eagledee7753
    @eagledee7753 Před rokem +28

    To be honest I don't consider this kinda format clickbait, as pointed out you delivered well and clarify everything through the process. Nice content, well presented, thank you for sharing.

    • @pseydtonne
      @pseydtonne Před rokem

      I second that. Hear hear, good stuff!

  • @antonnym214
    @antonnym214 Před rokem +95

    Excellent work! You're a very good engineer! I used to code professionally in 8080 Assembly. Also, my father and I wrote the famous Games Pack 1 for the TRS-80 back in '79. We used BASIC with Z-80 assembly subroutines and it was great stuff. Good times. All good wishes.

    • @kensmith5694
      @kensmith5694 Před rokem +8

      The first thing I coded that shipped to users was on an 8080 machine. It had a multitasking OS as part of it. In those days one person could know it all.

    • @capnzilog
      @capnzilog Před rokem

      What games were in the Games Pack? I might have had this!

    • @Zandanga
      @Zandanga Před rokem

      Awesome 👍

    • @YodaWhat
      @YodaWhat Před rokem +3

      Hey there, @Anton Nym. Looks like we both get around! My first experience on microprocessors was 8008 in a homebrew system, then the 8080. Hand-assembled code for both. Man, were they slow! These tricks of adding Protected Mode, more address space and RAM etc., are cool. I can see it making a very flexible computer. *But it will take slowness to a whole new level.* :/

    • @antonnym214
      @antonnym214 Před 2 měsíci +1

      @@capnzilogCard games like Draw and Stud Poker, Blackjack, Battleship (I think we called it Sea Battle) and a few other games that were not card games. Separately, we wrote the first ever Monopoly game for the Model I. It drew the board, handled the deeds and mortgages, the banking, managed auctions, threw and displayed the dice, handled the chance and community chest cards, and even played against you as a computer opponent. All in 48K of RAM.

  • @jgunther3398
    @jgunther3398 Před rokem +35

    z80 was a pleasure to use with its architecture and large instruction set for the time. one thing that sticks in my mind was the companies would put color microphotographs of the chips in their publications and one time i called a distributor to try and get a large one of a z80 to use as a poster. the person answering the phone thought i wanted to use the picture to solve some problem i was having with it, she was like there are better ways, when i wanted it for decoration

    • @neodonkey
      @neodonkey Před rokem +12

      Ah those were the days. I remember writing to a number of graphics chip companies in the early days of accelerated Super VGAs trying to get info - nobody was interested except Cirrus Logic, who sent me free (via international post from the USA) a hand written letter and a set of physical datasheets. Years later I contacted Cirrus trying to track down some data sheets after they were out of the graphics business and they were still really kind and helpful. Great company.

  • @adamboggs4745
    @adamboggs4745 Před rokem +146

    I can totally see you being up there with those top-tier you tubers if you started a whole series based on this concept! Start with a breadboard prototype and simple kernel, and work up to a full pcb and multitasking virtualization kernel. I see at least a dozen or more episodes that I think people will really enjoy.

    • @freeculture
      @freeculture Před rokem +6

      I actually stopped watching a youtuber that switched to click bait titles, i though he changed the content and wanted nothing of it, Like 4 years later i accidentally saw one video and it turns out it was the same good old content, but he just switched to click bait tiles. So yeah, you can be backfiring and alienating your user base seriously doing that. The best youtubers are not in for the money and don't care if they monetize less and honestly do the stuff they are passionate about regardless, and some actually are able to monetize and keep themselves, tho some simply add patreon and other more reliable sources of income, to not fall the death spiral of click baits or obnoxious advertising; some even went to subscription based streaming services which i don't use, so when they start showing half content here and then promise "better" content there, those i also stop watching. It is what it is.

    • @IdleByte
      @IdleByte Před rokem +7

      @@freeculture I stopped watching Linus tech techs for similar reason. Went from being geeky/technical nerd seemingly genuinely fascinated by what he's seeing to feeling like someone on QVC or my local news station pushing local products.

    • @RogerBarraud
      @RogerBarraud Před rokem

      Never Go Full Eater!
      ;-)

    • @Kholaslittlespot1
      @Kholaslittlespot1 Před rokem +1

      @@IdleByte He still has some good content from time to time but yes, I agree.

    • @TheSulross
      @TheSulross Před rokem +2

      would be interesting if this was still possible in latter chips like the eZ80; am saying that because their are SBC designs aimed at retro computing hobbist that use this chip (like the Min-eZ or the Agon Light).
      A protected mode on the eZ80 would actually be useful as that CPU has 24-bit registers and can address 16MB. That's enough memory to make a pretty reasonable Unix-like muli-tasking OS.
      The eZ80 can be clocked up to 50MHz and exectutes several times faster than a Z80 at the same clock speed because of internal pipelining. It's intended to be used only with static memory as that is cheap enough in last few decades. And it does not use internal caching to achieve its performance improvements.

  • @esra_erimez
    @esra_erimez Před rokem +102

    I'm just a software engineer and had to get my dad to watch this video with me. He says that this is ingenious. I subbed. Great video!

    • @mikkelbreiler8916
      @mikkelbreiler8916 Před rokem +7

      Even before the camera zoomed in and out of his CRT monitors I hit the Subscribe button.

  • @a1nelson
    @a1nelson Před rokem +265

    Not clickbait. What you showed demonstrated a very solid understanding of 1970s though early 1990s digital logic. Your solution was nontrivial and it is most certainly educational for those that have not worked through similar problems back in the day. Discrete, and even (hand-rolled) lookup digital logic is, imho, becoming a lost art. Thanks for putting it together!
    P.S. the first CPU-based machine I designed centered around a Z80. It was a non-trivial, embedded system and decades later, it remains one of my favorite projects (at least, for its time).

    • @Curt_Sampson
      @Curt_Sampson Před rokem +23

      It is clickbait. It's a great little MMU implementation, but a non-clickbait title would be something like, "I built an MMU for the Z80."
      The current title, "The Z80's secret feature discovered after 40 years!" contains at least one outright falsehood (being able to build an MMU for an 8-bit processor is far from a "secret feature") and probably a second one (it's very likely several people have done something similar in the past, even in the long past; e.g. similar but more sophisticated techniques for were used for Jeff Laughton's 6502-based KimKlone which was built in the 1980s).

    • @pmcgee003
      @pmcgee003 Před rokem +1

      ​@@Curt_Sampson oh no. so sue him. 🤨

    • @a1nelson
      @a1nelson Před rokem +8

      @@Curt_Sampson yeah, the “secret feature” part 100% is clickbait- I completely agree. But the video still delivers genuinely interesting and useful information about the Z80 (and other, similar CPUs) for the intended audience, so I support that aspect of it. Yep, it’s an MMU, but if the viewer doesn’t know how one works, on a logic level, or why one might be useful, it’s obviously novel (“secret”) to them. Basically, I see both angles, but I also see no harm.

    • @Curt_Sampson
      @Curt_Sampson Před rokem +4

      @@pmcgee003 I'm not going to sue him; it's up to Andy whether he wants to put up clickbait or not. But nor am I going to subscribe, or trust the titles of any videos of his that happen to come up in my feed. I simply don't like channels that don't tell me what I'm getting. I guess Andy will see if turning of folks like me is compensated for by whomever else he gains as viewers from the clickbait.
      (Aside from the clickbait , the video had some good stuff in it; I was conflicted about whether to down- or up-vote it.)
      @a1nelson Yes, the flip-flop to disable/enable "user mode" is clever. Using just I/O address space to trigger the MMU is reasonable, but certainly nothing special; you could just as well decode an area of memory address space for this. What the video doesn't (but should) mention is that the Z80 I/O address space is basically just a bit of convenient built-in decoding; it doesn't offer anything you can't do on other CPUs that use memory-mapped I/O. Admittedly if you're really trying to minimise chip count it can be handy, but that's when you're talking about 5-6 chip systems and don't want to use a GAL.
      And of course there's a lot more to do to get real protection; you need to have a separate bank-switched memory area for each application, you need to switch on interrupts as well, you need a timer interrupt on NMI, and so on. (Much of this is pointed out in the video.) At that point, now that I think about it, having a separate I/O address space makes things no easier at all; in fact this might be easier to implement on a CPU with a single address space, such as 6502 or 6809.

    • @pmcgee003
      @pmcgee003 Před rokem +2

      @@Curt_Sampson1. "I'm not going to sue him". Pretty sure it's only in america that someone would feel this isn't obvious. 😉
      2. As for "didn't know whether to down vote" .... are you dreaming?
      Down voting is an extreme unction resulting from receiving a personal injury from watching the video. "There was some good stuff" is completely incompatible with any consideration of down voting.
      3. The thing is, you've told us of your reaction as if we somehow need to know about it.

  • @TimGilberts
    @TimGilberts Před rokem +131

    This was what you needed to get people watching such a great idea and well produced - look forward to seeing the prototype working!

  • @johnsavard7583
    @johnsavard7583 Před rokem +46

    I remember looking through the documentation of the 6800, and I found that the software interrupt instruction created a unique set of signals on the pins, and, as a result, I thought at the time that a simple external circuit could permit adding a supervisor mode to that processor.

    • @ericwazhung
      @ericwazhung Před rokem +3

      Can I ask why you didn't pursue the idea?

  • @AG-jj3lx
    @AG-jj3lx Před rokem +33

    Modern Historian. Great explanations as I enjoyed your run through of the chip and its features. We stand on the shoulders if giants that came before us. This helps me appreciate hoe far we've progressed on the last 50 years.

  • @ericpaul4575
    @ericpaul4575 Před rokem +12

    Might be a click-bait video, but it got noticed by the Algorithm. Good Job.

    • @sdjhgfkshfswdfhskljh3360
      @sdjhgfkshfswdfhskljh3360 Před rokem

      Algorithm is not fair by itself, so not surprising.

    • @brettselph7591
      @brettselph7591 Před 2 měsíci

      When it passes the "not garbage" and "I'm glad I watched it" tests... It's not clickbait, it's inspired.

  • @Xperimenter
    @Xperimenter Před rokem +7

    The clever thing with this video is that most viewers will need to watch it 5 times before they understand it all :) Great work.

    • @drummerdoingstuff5020
      @drummerdoingstuff5020 Před rokem +1

      I’m on my 6th go and nothing

    • @jose6183
      @jose6183 Před rokem

      Very clever indeed. It will take time to digest it while he blows up his channel's views.

  • @kasuha
    @kasuha Před rokem +157

    Brings back memories, all the cool things we were doing on Z80 and 8080 processors. We did not implement protected mode since there was little need for that, viruses and malicious access were not a thing in conditions we had back then. But things like paging memory into the address space and running CP/M system with multitasking capabilities were there. We also had to write pretty much all the software we used, not like today.

    • @henriksundt7148
      @henriksundt7148 Před rokem +12

      Not to mention that multitasking was an esoteric thing (unless you were on Unix and mainframes), thus in the home computer world protection against other processes wasn't especially relevant.

    • @michaelmoorrees3585
      @michaelmoorrees3585 Před rokem +17

      @@henriksundt7148 - Not that esoteric. In the 80s, the company I worked for, did embedded design, and most of it around a Z80. The company designed its own RTOS. Multitasking came in real handy. We also adapted Forth (the programming language) to the chip, and wrote most of our code in it. We did some complex stuff, around this little 8-bitter.

    • @etchedpixels
      @etchedpixels Před rokem +4

      ​@@henriksundt7148 Some of it was economics too - Z80 systems were often CPU bound so it made more sense to have several Z80 boxes (possibly sharing an expensive hard disk via CP/NET) than multi-task one of them

    • @CanularRadio
      @CanularRadio Před rokem +2

      Your avatar is insane where is it from

    • @kevinrickey3925
      @kevinrickey3925 Před rokem +1

      I miss the old days. I loved the way things used to be, simpler.

  • @serpentza
    @serpentza Před rokem +44

    Awesome video mate!

    • @edug1168
      @edug1168 Před 3 měsíci +3

      Didn't think I would see you here.

    • @JohnnieAshton
      @JohnnieAshton Před 2 měsíci +2

      @@edug1168 My thoughts entirely.

  • @johanneslinde4437
    @johanneslinde4437 Před rokem +17

    Great video and easy to follow, even though it's been years since I last touched the Z80. Would be very interesting to see your diagram turned into an actual PCB. Do not let the 100k> subscriber count of other channels discourage you. Im looking forward to your next videos.

  • @dogshome7110
    @dogshome7110 Před rokem +39

    Be very careful with NMI on Z80. The CPU is not fast and these interrupts can easily swamp the routine code (as you indicated). Anything in NMI must be very brief. How do I know? Multi Z80 control systems design in the 80s. It extended to multi CPU with a shared paged RAM for batching systems (mixers and the like) for animal feed, concrete etc. I also did a coveyor sending system which used an encoder to get the destination. A spring sorter for keyboard spring manufacture and several others in hogh speed use. THAT was a Loooong time ago!
    It's interesting to refresh my memory (ha!) as it isn't static like the Z80, by watching your video 🙂

    • @metatechnologist
      @metatechnologist Před rokem +1

      If your worried about the NMI speed then you've entered the realm of real-time programming. A whole of other ball of wax itself and subject of books and maybe another video lol

    • @uploadJ
      @uploadJ Před rokem +2

      @@metatechnologist re: " A whole of other ball of wax itself and subject of books"
      Yeah ... that's not really going to 'teach' anybody though. Book learning is good to a degree, but NOTHING beats actually doing it, even in prototype stage and then 'learning' the ropes like the rules one learns when doing critical real-time interrupt service routines ...

    • @bennylofgren3208
      @bennylofgren3208 Před 9 dny

      @@metatechnologist The observation is very relevant and has nothing to do with real-time programming. Setting the hardware up so that every single I/O request generates an NMI is idiotic at best. The processor services an NMI by essentially doing an RST instruction to the fixed address 66H, which takes 11 T-states (clock cycles). The shortest possible NMI routine is an immediate RETN instruction (RETurn from Non-maskable interrupt), which takes an additional 14 T-states. An OUT instruction already takes 11-16 T-states to perform, which means that each OUT is now *at least* 35-40 T-states, and that is without any "protection" code even executed! All I/O will be slowed down by *at least* 3 times.

    • @metatechnologist
      @metatechnologist Před 9 dny +1

      @@bennylofgren3208 Here's something that will make you cry just.a tiny.bit. Zilog just announced they're ending production of the Z80 this coming summer. It was a good run though. Thanks for responding! Edit: Apparently it's just the 40 pin dip that's going away not the newer embedded versions. But it's still pretty notable!

    • @bennylofgren3208
      @bennylofgren3208 Před 8 dny

      @@metatechnologist Yeah, I read that too, with some sadness in my heart. I started programming the Z80 in 1979 and as you saw some of it still is still stuck in my head. :) Those were some good days.

  • @electronron1
    @electronron1 Před rokem +22

    My first computer was a TRS-80 and with help from a College professor friend I learned Z80 assembly language on this machine. Thanks for the look back. Sometimes I miss the days of hardware and software hacking to make the computer do things it wasn't intended to do. These days I get my hardware and software fix with Arduino's and Raspberry PI's.

    • @nosuchthing8
      @nosuchthing8 Před rokem +2

      But it's almost impossible to get a pi now

    • @G-ra-ha-m
      @G-ra-ha-m Před rokem +2

      @@nosuchthing8 Really? In the uk they are available.

    • @nosuchthing8
      @nosuchthing8 Před rokem

      @@G-ra-ha-m well of course.

    • @electronron1
      @electronron1 Před rokem +1

      @@nosuchthing8 It's disappointing that they have become scarce, I have a few pi 3B+'s and one pi 4 with the pi 3b+'s dedicated to running 3d printers.

    • @G-ra-ha-m
      @G-ra-ha-m Před rokem +3

      @@electronron1 Yes, the Pi400, overclocked to 2.2GHz, is doing a good impression of a pretty usable PC, silent too, they are becoming very capable.
      I use an (cheap, small) HDMI to DVI-D adapter which makes older monitors useful too!

  • @-Digital-Reality-
    @-Digital-Reality- Před rokem +18

    Very interesting - thank you! I have programmed the Z80 for almost 40 years, and I still do occasional programming on retro hardware. A great 8-bit CPU.

    • @joefish6091
      @joefish6091 Před rokem +3

      Keep an eye out for a Cidco Mailstation, quite a fun Z80 email device from 1999.
      (CZcams just destroyed deleted my long reply to you on this device)

    • @-Digital-Reality-
      @-Digital-Reality- Před rokem +2

      @@joefish6091 I saw it before it vanished, Joe - thank you. 👍 Will check it out - looks like an interesting device. I'm very familiar with CP/M, so that part interests me.

    • @kensmith5694
      @kensmith5694 Před rokem

      Aren't the Rabbit microcontrollers really just dressed up Z80s

  • @rodcleaves9904
    @rodcleaves9904 Před rokem +5

    I designed the Z80 into several systems, but I had no idea about this - Good job Andy!!!

  • @southernflatland
    @southernflatland Před rokem +9

    You are forgiven for using a clickbait title. I'm not even a Z80 guy, but this is absolutely amazing!
    Edit: I subscribed

    • @SeaJay_Oceans
      @SeaJay_Oceans Před rokem

      I subscribed = inventiveness must be supported, and maybe someday a Moder nized Z80 5nm CPU running at top speed will be commerically available ?
      It would have the great benefit of worldwide available, decades of software, hardware, and firmware support - and thousands of people who already know how to program it's now updated and advanced hardware.

    • @andrewdunbar828
      @andrewdunbar828 Před rokem

      @@SeaJay_Oceans Check out the eZ80.

  • @vjspectron
    @vjspectron Před rokem +3

    This is entirely over my head, but I'm still impressed that you've solved a 40-year-old hardware mystery!

  • @etchedpixels
    @etchedpixels Před rokem +16

    The Morrow MP-Z80 and the InterSystems XPU-80 for S100 bus had full protected mode and an MMU. It's worth reading the manuals for these devices as actual protected mode on a Z80 is *much* more complicated than this little trick. You have to manage a bogus stack pointer on NMI and all sorts of other stuff (like infinite prefixes).
    It's actually much easier to do these tricks on a later 65C02 as you've got vector pull and stuff and I've actually done board designs that provide a very basic protected mode setup. There were also historic 6809 setups for this kind of thing - which are even trickier.

  • @edwindelacruz9914
    @edwindelacruz9914 Před rokem +1

    Awesome documentary! I am glad that you are knowledgeable with systems older than the internet. And a nice touch of nostalgia playing Macross in the background. This made me subscribe.

  • @Aquatarkus96
    @Aquatarkus96 Před rokem

    I saw you have less than 1000 subs and was shocked! Great production quality and interesting subject, looking forward to more videos form you!

  • @eaglechawks3933
    @eaglechawks3933 Před rokem +15

    I had a DEC Rainbow - the beast had a Z80 AND an 8086 and you could boot it into either DOS or CP/M. It was SWEET!

    • @JCWren
      @JCWren Před rokem

      Then there was the DECmate -- A PDP/8 (Intersil 6100) and a Z80 :)

    • @badddkattt
      @badddkattt Před měsícem

      I have not thought about that machine since the maybe’85 when it was provided to me and other financial analysts at my company. I had used the Apple][ and IBM PC and had bought a MacIntosh; and the Rainbow was nice; replacing green lined paper spread sheets and long overdue. We only used DOS; and it was annoying that the 5 1/4” floppy discs though higher capacity at 400 kb were not compatible with the IBM PC 360 kb disks.

  • @Karloffspring
    @Karloffspring Před rokem +8

    Loved this video! I remember how excited I was when I found those undocumented instructions back in the late '80s. I made the core of a Z80 disassembler for my A-level Computer Science project that could disassemble all the undocumented instructions and ran under CP/M. No user interface, though. That was plenty for a teen doing an A-Level! I never really tinkered with the hardware, other than zapping the reset pin on the back of my ZX81 to restart it.

    • @paulleach3612
      @paulleach3612 Před rokem +2

      Crikey, the most difficult thing I did on my A-Level Comp Sci project was code a bubble sort routine in visual C++. (I grew up with the Z80 though, having been a Spectrum nerd in the '80's)

    • @IAmMarwood
      @IAmMarwood Před rokem +3

      @@paulleach3612 I wrote a version of Othello in BBC Basic for my GCSE back in 1992 I think it must have been. I'm certain it was the most awful inefficient code imaginable, but it worked! I was an 80s Speccy kid too but needs must and had to slum it using the Beebs at school!

  • @jefftheworld
    @jefftheworld Před rokem +2

    Great video! It's great to get a bit of technical stuff for us 8-bit CPU nerds without it hurting the pacing of the overall video!
    Instant subscribe from me.

  • @joaothomazini
    @joaothomazini Před rokem

    Amazing video, I tought it would be boring at the beginning and you managed to awake me up. Congratulations.

  • @TheRealInscrutable
    @TheRealInscrutable Před rokem +6

    I worked at a company in 1993 that used the Hitachi 64180 cpu to create a smart thermostat before anyone had heard of IoT. Awesome chip for the task.

  • @KittyKatKya
    @KittyKatKya Před rokem +18

    Heya! Do make sure to take care of those drooping AKB Feedback lines on the PVM. If left unattended to, you'll end up with an inoperable monitor.
    It's just a few capacitors that have drifted from spec.

  • @zosowon
    @zosowon Před rokem +1

    if it wasn't for the Z80 i wouldn't be alive right now, thank you Andy.

  • @liveuk
    @liveuk Před rokem +2

    We always saved before a run, loved this chip and learned assembly on it.
    The noise it makes is lovely

  • @donjindra
    @donjindra Před rokem +7

    I worked at a POS manufacturing company around 2000 and we used an external Xilinx chip to protect Z80 memory ranges and do bank switching. It worked well.

  • @ssupertutorial
    @ssupertutorial Před rokem +8

    Hey , you have made a super video!!! Super interesting , well done (the boss key idea made me laugh 😂)

  • @MpetersenTamTD
    @MpetersenTamTD Před rokem +1

    Andy, you're the man! Loved the video. It's refreshing to see a vid like this that actually admits what it is and why. Liked, and subed!

  • @bryanparks6958
    @bryanparks6958 Před rokem

    Fascinating explanation of the theoretical in application usage.
    Thank you for sharing this with us!

  • @MrMegaManFan
    @MrMegaManFan Před rokem +22

    I don't know how long you've been on CZcams, but as a first time viewer, I enjoyed this deep dive into the Zed 80's secrets. Thanks! PS: No need to apologize for "clickbait" because it's only unfair if we didn't enjoy it -- I enjoyed it.

  • @fr_schmidlin
    @fr_schmidlin Před rokem +5

    Clickbait forgiven. Just don't get addicted to it. :)
    BTW, this method around the NMI was used back in the 80s to implement step-by-step debugging. There are some old books describing it.

  • @GodmanchesterGoblin
    @GodmanchesterGoblin Před rokem +1

    This was very cool - and well presented with great graphics and explanation. It reminded me a little of the way that the Sinclair ZX80 generated display info, which involved tying A6 on the Z80 to the interrupt so that it would interrupt itself at a specific value of the refresh address register - quirky hardware and software working together. It also took me back to when I wrote a single stepper for a 16 bit processor in the 1980s that interrupted the code under test after every single instruction. It was slow, but got the job done.

  • @d5kenn
    @d5kenn Před rokem

    This blew my mind. Great job describing such an esoteric topic!

  • @ferrumignis
    @ferrumignis Před rokem +12

    FWIW the ability to implement pre-emptive multitasking does not depend on the presence of a protected mode, millions of embedded systems run a preemptive RTOS on small microcontrollers.

    • @kensmith5694
      @kensmith5694 Před rokem +1

      Yes, Intel sold one for the 8080 processor called RMX8080. It would run on their 8020 PCB that you could buy.

    • @capnzilog
      @capnzilog Před rokem

      And Amigas... :)

    • @cigmorfil4101
      @cigmorfil4101 Před rokem

      @@capnzilog
      And QLs

  • @BritishBeachcomber
    @BritishBeachcomber Před rokem +5

    Designing embedded systems 40 years ago, I switched from x86 to Z80 as soon as it launched. The built in RAM refresh, on alternate clock cycles made graphics so easy.

    • @RKelleyCook
      @RKelleyCook Před rokem +6

      Did you mean the 8080 ? The 16bit 8086 showed up a few years later.

    • @bennylofgren3208
      @bennylofgren3208 Před 9 dny

      No you didn't. The 8088/8086 (x86) wasn't introduced until 1979, when the Z80 had already been out in numbers for almost three years.

  • @AlanBram
    @AlanBram Před rokem +1

    Wow! That's awesome!!
    I don't consider it click-bait, because although the title might not be literally exactly accurate, the tech talk you delivered didn't disappoint. Actually probably even more interesting than one could reasonably expect!

  • @Gwalchgwyn
    @Gwalchgwyn Před měsícem

    Your obvious love for your subject compliments your expertise. More power to you. :)

  • @truegret7778
    @truegret7778 Před rokem +4

    This is cool and brings back memories for sure. When I started my career, I was exposed to the 8088 and 68000, 68030/40. I enjoyed the 8088 more. It was more fun to work with limited memory ( 64KB), the 8255A and 8259, and EEPROM ( as a commentor before me mentions the 20 minute UV erasure), coding in C (remember K&R?), and ASM. I recall using an editor named Brief, by UnderWare. I had a blast .... but am glad I am retired now.
    I enjoyed your video and your enthusiasm.

  • @BitwiseMobile
    @BitwiseMobile Před rokem +3

    Memory Mappers - the concept that made the 6502 based NES such a powerful and extendible platform. That decision, as well as the decision to bring out all the I/O lines to the cards were ingenious. That basically allowed you to extend the NES beyond it's physical limitations. You could have as much RAM as you want on your card, and by flipping pages via the mapper you could use that extended RAM very effectively. Many later games did this, including Star Fox. It allowed you to have coprocessors - a few titles did this - and it allows you to store a HUGE program that would never fit in ROM normally and through that page flipping technique bring in executable code from that extended ROM. It's one of the most genius solutions I've seen in 30+ years of computing.

  • @nairanvac79
    @nairanvac79 Před rokem +2

    This video was so entertaining and informative. I'm glad I found your channel. I subscribed immediately.

  • @ralphweaver1176
    @ralphweaver1176 Před rokem +1

    We had a debug board for our Z80 system back in the day. It was much like you just described. It had a ribbon cable to a 40pin plug which replaced the Z80 in the system. It had LED displays for data and address bus, a button for single step and a knob for slow speed running.

  • @richardbanks2669
    @richardbanks2669 Před rokem +11

    I enjoyed this video, it was presented well, good use of humour, and solid technically. Thank you 😊

  • @damouze
    @damouze Před rokem +7

    I like your video. The Z80 is a powerful little CPU, even today.
    A couple of things to keep in mind though. On the platform you're demonstrating most prominently, the MSX (thanks for that btw - it is way underrated), the Z80 memory addressing space is divided up into 4 pages of 16kB, each of which can be in 1 of 4 so-called slots. Which page is in which slot is governed by port A of the PPI (8255). In theory, this allows for a total of 256kB of address space without any additional circuitry. The main BIOS and BASIC ROMs are usually in port 0, with RAM and additional ROMs in one or more of the other slots. At least one slot is also taken up by a cartridge interace. For instance, the Philips VG-8020 has its ROMs in slot 0, two cartridge slots in slots 1 and 2, and depending on the specific model 64kB of RAM in slot 3 or in a so-called expanded slot 3-2 (expanded slots are a standard way of increasing the capabilities of the MSX platform even further, and later standards such as the MSX2 standard typically feature at least one expanded slot).
    The MSX standard also provides for a so-called memory mapper interface. This interface allows for 1 of up to 256 16kB segments (4MB!) to be selected for a given page in a given (sub-)slot. Any device adhering to at least the MSX2 standard has a memory mapper unit built-in. This is how most non-Japanese MSXes squeeze in more than 64kB of RAM. The Philips NMS-82xx series, for instance, all provide 128kB of RAM in this way, but even MSX2 systems with only 64kB of RAM provide this through a memory mapper. The MSX BIOS in these systems will scan for each and every mapper in the system at boot-up and often, but not always, display the amount of RAM in the largest mapper. Both the MSX BIOS and MSX-DOS 2.x provide memory mapper routines that an application can use to manage this memory. There are a couple of good mapper circuit designs to be found on the world-wide web.
    The final thing to take into account is a peculiarity of the Z80 that is not officially documented, but is important to know, especially with the circuit you describe in your video, namely that, in spite of the Z80 being documented as having an 8-bit I/O addressing space, every I/O instruction does in fact assert the entire address bus. For simple I/O instructions such as in A, (imm8) and out (imm8), A it is the contents of the A register, and for more complex I/O instructions such as in reg, (C) and out (C), reg it is in fact the entire BC register.

    • @Atheist7
      @Atheist7 Před rokem +1

      [The MSX standard also provides for a so-called memory mapper interface. This interface allows for 1 of up to 256 16kB segments (4MB!) to be selected for a given page in a given (sub-)slot.]
      That means that, if you put in 64K, you would have 16 MB of RAM?!!!!!

    • @Atheist7
      @Atheist7 Před rokem +1

      BUILD IT!!!!

    • @damouze
      @damouze Před rokem +3

      @@Atheist7 It means that each page can be set to a specific (sub)slot and to a specific segment in that slot. Think of it as a simple paging mechanism. So, theoretically if you fill each slot with RAM, you could theoretically have up to 16MB of RAM, but then you would not have any room for ROMs, which you will need in order to have a working system. On a typical MSX2 computer with two cartridge slots, you could install a 4MB memory mapper in each of them and have a total of 8MB of RAM, plus the amount of built-in ram. On a NMS 82xx (excluding the 8220), this would amount to a total of 8192 + 128 = 8320kB of RAM. However, then you would not have room for any additional expansion hardware left. So it's a balance between what's practical and what's possible. In my setup, I have one slot in use for a Carnivore 2 (which is a multipurpose device which provides a 1024kB of mapper and a CF card slot among other things) and another for a slot expander, which expands the slot into 4 subslots, each with its own cartridge connector.

    • @Atheist7
      @Atheist7 Před rokem +1

      @@damouze [So, theoretically if you fill each slot with RAM, you could theoretically have up to 16MB of RAM, but then you would not have any room for ROMs, which you will need in order to have a working system.]
      Computers are SOOOOOO baffling.
      Can't you give up ONE of the 256 ---> 64K "slots" to put the ROM into?

    • @damouze
      @damouze Před rokem +2

      @@Atheist7 Theoretically? Probably, but that would not be compliant with the MSX standard. With the MSX2 standard and above the picture becomes even more complicated.
      For instance, in the NMS 82xx, the MSX BIOS and main BASIC ROMs are put in slot 0. Slot 1 and 2 are typically available as cartridge slots and slot 3 is expanded into 4 subslots, labelled 3-0 through 3-3. Subslot 3-0 contains the so-called SUBROM, subslot 3-1 is "empty" (but not fanned out anywhere), subslot 3-2 contains the 64/128kB memory mapper and subslot 3-3 contains the DISK-ROM with the floppy disk firmware and BASIC.
      However, it is possible to fashion a cartridge that internally expands to 4 subslots and then put a memory mapper in each subslot. However, such a device would only work in a primary slot and not in one of the expanded slots of a slot expander (of which each cartridge port would consist of a single subslot). Also, addressing the the so-called mapper register in each subslot would be a big hassle and switching between RAM segments in a page would be painstakingsly slow and involve mapping the slot into the proper page in Z80 address space by programming the PPI, then mapping in the specific subslot in that page and finally mapping the specified segment into that subslot. And there is no guarantee that it would work at all, since some MSX2 computers play fast and loose with the standard, especially where mappers in expanded slots are concerned.

  • @mikebrown485
    @mikebrown485 Před rokem

    Wow man, where have you been all my life? Incredible skills and video. Please keep it up!

  • @dethfan06
    @dethfan06 Před rokem

    Not really a computer guy but I do enjoy the content from the others you flashed up. You linked to places I can get further context before your video which is rare so good job there. Well presented with good slides and didn't really notice the errors listed. Music could be turned down just a tiny bit but I found it fine. Keep up the good work.

  • @briancase6180
    @briancase6180 Před rokem +5

    This would have been big news back in the 70s when I was playing with my 8080 and Z80. I think a lot of older engineers will love this! Thanks!

  • @flyguille
    @flyguille Před rokem +5

    No, you can't virtualize the v99x8, DI & EI do not works for NMI, most game don't include DI EI in fast graphics routines as they works hooked from rst38 anyway, v99x8 has atleast internal 16bits shiftable buffer, by example outputing to 0x99 and then another 0x99 will complete a 14bits address plus mode bit, if you place a third 0x99 and don't complete that output with a fourth 0x99 imagine the state of that buffer address, it will be a mess.

  • @Texas1FlyBoy
    @Texas1FlyBoy Před 2 měsíci

    Wow. I have some great memories of coding in Z80 assembly back in 1977 and later. Great video. Keep up the great work!

  • @milestoitaly
    @milestoitaly Před rokem

    A wonderful idea Andy. And your sense of humor is appreciated. Please consider a follow-up with a prototype and a logic analyzer. All the levels and timing involved with bench-marking your idea would be helpful to enthusiasts.

  • @ridiculous_gaming
    @ridiculous_gaming Před rokem +20

    Good work. I favoured 6502 back in the day, but the Z80 was also highly adopted.

  • @zombieman81
    @zombieman81 Před rokem +6

    Nice idea but I believe the NMI signal can't trigger until the currently running instruction finishes, e.g. in that scenario after the IO request that you think you're intercepting... Only then can the processor perform all the logic to "CALL" the NMI routine at 0x0066... And if you consume the IORQ line to feed the NMI how would a peripheral know to accept an IO request? The part that does have some merit is having an MMU and banking out "protected" code and data... One interesting hardware product for the Sinclair ZX Spectrum was a speech synthsizer addon. In hardware it checked for access memory access to the IM1 maskable interrupt memory address, and as soon as there was an MREQ for that address it would assert a control line that mapped it's own ROM or go back to the computer own ROM by using a flip-flop. Every maskable interrupt (50 times a second) the add-on ROM would execute it's own code then jump back to the start of the code and the original ROM would then continue... an MMU circuit can "redirect" memory signals any way you want.... ZX Spectrum 128 did that on a basic level in the mid 80s though not for the reason you give. As for undocumented features, most of them are bugs or just gaps in the decode logic the designers didn't design.

    • @lawrencemanning
      @lawrencemanning Před rokem +3

      Yup, there is quite a bit of romanticising going on in this video….
      Also, the 6809 was generally more favoured to this kind of hardware hackery, which is why it was the preferred choice for 8 bit Unix-like systems. You could almost do a full protected mode, but like the Z80, the synchronous nature of the bus was the principle flaw.

    • @kensmith5694
      @kensmith5694 Před rokem

      He added a line to block the I/O from really happening by disabling the I/O decoder.

    • @zombieman81
      @zombieman81 Před rokem +2

      @@kensmith5694 But now there's no IORQ going out to tell IO devices to decode the address bus to actually do any I/O.... And the performance hit is IMMENSE... You waste the 11/12 cycles of the "original" in/out, then it takes the CPU 11 cycles to reach the NMI routine, then you SOMEHOW have to work out what the instruction was while preserving the registers because ANY of the main register set could be involved... Then you have to consider block I/O... Takes 14 clock cycles to come out of the NMI too... Just not practical... Notice too a complete lack of a demonstration of this theory...

    • @kensmith5694
      @kensmith5694 Před rokem

      @@zombieman81 He is basing the design (in part) on the idea that I/O instructions are rare in real code. In most cases, this is reasonable.
      Working stuff out is not a mystery. Once in the NMI code, he can store the registers into the OS's workspace RAM and then grab the return address to go look to see which I/O instruction it was. On the Z80 there are not a lot of them and no, not any register can be involved. Take a look at the instruction set. You get to do I/O with the A register using either an inline constant for the address or the BC register pair.
      What he is suggesting is practical for his intended purposes and need not be demonstrated to be studied to see that the idea works.

    • @randyjackson7584
      @randyjackson7584 Před rokem +1

      @@kensmith5694 back in the z80 days this was not reasonable since everything you did was on a port, serial terminal, floppy controller. Doing IO instructions all day long, I'm not convinced this design works as intended but maybe you guys know more than me. That NMI will be after the IO instruction has completed, it may not have been allowed to do anything if the Chip was disabled but it still exectues, then the NMI triggers and you jump to that routine, when its over it returns to the next instruction. What am i missing?

  • @Jennn
    @Jennn Před rokem

    I have goosebumps this is so exciting. So happy to be here on your channel so early! Hope you Share More and More with us, Friend~!

  • @TheScreamingFrog916
    @TheScreamingFrog916 Před rokem

    I built a PolyMorphic System 88 computer kit, with a Z80 chip in it.
    My first electronics project, when I was still in high school.
    Led to a career in electronics.
    This brings back good memories.
    Thanks for sharing, and best wishes for your continued success.

  • @ehsnils
    @ehsnils Před rokem +5

    On the ZX80/ZX81 (my first computer was a ZX80) I have the suspicion that some of the undocumented instructions were used as there were Z80 clones that didn't work in those computers while the original Zilog CPU did work.
    One interesting thing with the Z80 is that there's an indirect I/O mode where you can address the I/O through the HL register (if I remember correctly) and the high 8 bits of the HL register is then put out on the upper 8 bits on the address bus. Something that can be used to create an extended I/O addressing range or do a mask read of an 8x8 keypad.
    You should also look for the Swedish Luxor ABC80 / ABC800 computers. The former one uses the PIO chip while the latter one uses the Zilog Z80 CTC and SIO. The Monroe OC-8800 computer was also Z80 based with a multitasking OS called OS8MT. That computer had a Z80 DMA and also boasted 128K or RAM.
    So now you have something to dive into for the world of Zilog based computers.

    • @drdischord
      @drdischord Před rokem

      Zilog had two kinds of licenses. Some second sources got the physical design. NEC did a licensed redesign from the data sheet, but unlike Zilog they fully decoded the instruction set, as documented. And they filled in the undocumented codes with NOP. So depending on whether your compiler used undocumented instructions, you couldn't always use the NEC chip.

    • @ehsnils
      @ehsnils Před rokem +1

      @@drdischord That seems to match my observations wirh the real Z80 and the D780C on the ZX80.

    • @drdischord
      @drdischord Před rokem +1

      @@ehsnils I learned about second sourcing and licensing in general, when I was working with the Am2901 and Z-80 at an electronic warfare company, in 1979. But I got the specifics on the Z-80 and MC68000 situation when I was working at Motorola a few years later, and I got it in face to face meetings with Zilog and Motorola field support engineers. Zilog's exact physical second sources were Mostek and ST. Second sources for MC68K were Mostek, Signetics, Hitachi, and TI. Each one contributed a peripheral device, but they were all buggy as hell and weren't widely used.

  • @markpstapley
    @markpstapley Před rokem +8

    Where can I find that chart at 0:14 showing CPU evolution?

    • @carlosedwardos
      @carlosedwardos Před 2 měsíci

      here is where to get the MICROPROCESSOR CHART - www.vgamuseum.info/images/doc/cputree.png

  • @qbasic16
    @qbasic16 Před rokem

    Grear video, Andy! Love to see more from you

  • @stuaxo
    @stuaxo Před rokem +2

    Great work, I hope that someone eventually has a go at implementing a system like this, the idea of a system virtualising various different z80 systems would have seemed impossible to my younger self. I guess the peripherals on some of these systems all had their own weirdness, e.g. how screen memory was organised, whether there are sprites etc - but that's another challenge.

  • @jfbeam
    @jfbeam Před rokem +5

    For the record, Protected Mode isn't required to support multitasking. OS-9 (Microware, not Apple's BS) ran on 6800's without any Magic(tm). Yes, a misbehaving program could do bad things. (hint: also allowed the debugger to know it was watching itself...) It didn't work on the 6502 because the lack of registers.

  • @bailahie4235
    @bailahie4235 Před rokem +3

    Yes! I know what a Z80 is. It still has a place in my heart. It was the first chip I wrote blazingly fast assembly language programs for - when I was 14 year old. I taught myself from a (paper!) book from the library. A magical time for me...

  • @BillHustonPodcast
    @BillHustonPodcast Před měsícem

    Absolutely brilliant analysis, Andy!

  • @stephenstange4194
    @stephenstange4194 Před rokem +1

    This brought back memories! I. Wrote a lot of Z80 code (embedded communications systems) in the early 80s. Thanks for sparking those memories!

  • @CJ7Hawk
    @CJ7Hawk Před rokem +15

    Maybe a dumb question, but just as the 8088 didn't have a protected mode, and the 386 did, why not just use the 16 bit protected-mode supporting version of the z80... like the Zilog z280? It's binary compatible with the z80 even in protected mode ( well, a few instructions missing in protected mode ) and it's z80 circuit compatible too... And has the built in MMU and Cache Memory like a 486, but came out mid 80's.

    • @michaelrenper796
      @michaelrenper796 Před rokem +2

      This is a retro design video. It explain how it COULD have been done with commodity hardware back in the day. Why would one built a new Z80 sytem nowadays from scratch?
      Even military equipment goes commodity ARM and/or FPGA today.

    • @CJ7Hawk
      @CJ7Hawk Před rokem +3

      @@michaelrenper796 I do understand that, and credit where due, it's a very clever idea to build the missing CPU elements into the hardware, as often happened back in the day. But the z280 also existed back in the day, and had all of this functionality. There really was a z80 that did all of this without needing to externalise it... It would have performed a bit like a 386DX with cache memory, and could have done so in the mid 80s. I guess I'm wondering why, even back in the day, anyone would have created a protected mode z80 when you could just buy a protected-mode-capable z80 off-the-shelf anyway?

    • @Ironclad17
      @Ironclad17 Před rokem

      @@CJ7Hawk There could be some cost savings using external hw for the few systems that need a protected mode while the majority of systems could be identical except for that circuitry.
      With how expensive and limited memory was at the time, multitasking, virtualization, and emulation were probably not in high demand.

    • @michaelrenper796
      @michaelrenper796 Před rokem +1

      @@CJ7Hawk You are right, the time window for this to make sense is very small.
      For me and other its the retro aspect here that is fascinating.
      Helps understanding microprocessore design basics as I have only theoretical knowledge of modern CPU design and no time and intention to go out tinkering.

    • @andrewdunbar828
      @andrewdunbar828 Před rokem +2

      @@michaelrenper796 More than several people have built and are planning to build homebrew retrocomputers. The author of this video is one of them as you'll see if you watch some of his other videos.

  • @Marco.Teixeira
    @Marco.Teixeira Před rokem +3

    Andy, every CZcamsr starts small. You seem to have what it takes to get there. I liked your video. Can you just let me know where I can find that cpu history timeline you used at 0:14? Thankx
    Ho, and I would really like to see a video from you presenting your collection! You seem to have some very nice computers there!

    • @markwiley6812
      @markwiley6812 Před rokem

      Came here to ask the same question about the CPU history timeline. First time seeing one of your videos. Very interesting topic.

  • @RuiBarbosaJunior
    @RuiBarbosaJunior Před rokem +1

    This is amazing. Thanks for sharing.

  • @soapyfrog
    @soapyfrog Před rokem

    Very enjoyable and interesting Andy. No shame in clickbait with content this good. Well done.

  • @Eyetrauma
    @Eyetrauma Před rokem +55

    I don’t have the EE chops to understand this all fully, but it’s interesting that you feel the MMU can be pretty trivially implemented with a technique similar to a game mapper. I know a lot of computers got kinda hamstrung by the fact that they didn’t implement any kind of MMU, it’s funny if it really was that simple.

    • @Theineluctable_SOME_CANT
      @Theineluctable_SOME_CANT Před rokem +8

      Well, MMUs ARE a bit more involved.
      Like the MC 68881(?) for the 6809E.
      But I like that at least he is THINKING.

    • @metroid031993
      @metroid031993 Před rokem +4

      MMU means memory *mapping* unit. They both run on the same concepts, but of course modern MMUs have more features.

    • @WirrWicht
      @WirrWicht Před rokem +3

      Have no EE or even electronics tinkering skills, but I'm a software developer and could understand everything just fine. Okay, I already wrote a rudimentary Z80 emulator.

    • @lawrencemanning
      @lawrencemanning Před rokem +4

      @@metroid031993 In my mind the key distinction between a simple 8 bit styled memory mapper and a proper MMU like the mc68851 is that the page tables are held in main memory and not in the mapper itself. This of course massively ups the complexity of the mappings possible. This is tricky on most 8 bit MPUs which have ridged timing requirements. The other complex thing required is faulting so pages (and tables) do not have to be in main memory at all times.

    • @lasskinn474
      @lasskinn474 Před rokem

      Well simple and simple. The cartridge mappers were thought of as anything but simple in early 80s(also a simplest mapper is just a bankswitcher anyway)

  • @johnrickard8512
    @johnrickard8512 Před rokem +5

    By the way, this is well produced content on a topic which interests me, and clickbait isn't clickbait if you actually deliver. Subscribed

  • @Micetticat
    @Micetticat Před 2 měsíci +1

    I don't know how after one year you published this amazing video I got it suggested to me by the Algorythm. This is the type of video that I lime to watch! Good work!

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

      I'm surprised at the sudden uptick in view counts too!

  • @mwitschi69
    @mwitschi69 Před rokem

    Congratulations to your presentation! Well done!

  • @Charles.Martin
    @Charles.Martin Před rokem +3

    I fell in love with the Z80 as a teenager. Loved my ZX81 as well. I did a tech project for school where I made a Z80A trainer. Years later I examined an video gaming device where it would switch between running the game and the input devices and had this seperate video board it would switch back and forth with to run to provide the screen output. It seemed over the top to me but that is what it had. For it to generate random numbers it would access the refresh register as a seed. Always thought that was nifty.

    • @MikeSmith-tx2lp
      @MikeSmith-tx2lp Před rokem

      Do check out the ZX81 ROM disassembly books, some seriously devious code in there to squeeze every last gram of potential from such a simple circuit.

  • @yoppindia
    @yoppindia Před rokem +3

    for newbie, certainly a good video, but the elephant in the room is, did you build it to validate that it works?

  • @tux9656
    @tux9656 Před rokem +1

    I saw this was clickbait early in the video, but I stayed anyway. I’m glad I did.

  • @jjones503
    @jjones503 Před rokem

    What a great video. Great work! Some nostalgia for sure.

  • @TheDiveO
    @TheDiveO Před rokem +3

    what exactly is the secret feature discovered? as someone who literally grew up with Z80s and wrote and published my own virt386 machine monitor with EMS emulation (that later ended up in freeDOS IIRC) I don’t get this video. Bank switching was well-known and x286/386 protected mode has dedicated descriptors, a multi-level ring architecture, and the infamous descriptor/segment caches. Can people here help me with that the new thing actually is in this video and what the reference to protected mode means?

    • @lawrencemanning
      @lawrencemanning Před rokem +5

      Not a lot. Basically wrap the IORQ pin back through to generate an interrupts on IO ops so they can be monitored/changed etc. I don’t honestly see how this is can be called protected mode. But it does seem to have some utility by making it so “user” code can’t generate IO ops directly, though I suspect the performance hit would give it limited practical use.

    • @zombieman81
      @zombieman81 Před rokem +1

      @@lawrencemanning and there's the question how do you signal real IO if IORQ is fed to NMI... ;)

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

      This IS a clickbait video. Basically "Z80 has a PM" then goes to build shit entirely outside of Z80, using none of Z80 builtin "undocumented" features. Exactly the same thing could be done with 8080, 8086, or 6502 - just setup external memory banking/address capture and hit NMI for some software emulation.

  • @angelamcmahon
    @angelamcmahon Před rokem +4

    Where did you get that chart shown at 0:15 ?

    • @carlosedwardos
      @carlosedwardos Před 2 měsíci

      here is where to get the MICROPROCESSOR CHART - www.vgamuseum.info/images/doc/cputree.png

  • @machmar
    @machmar Před rokem

    I never saw your videos before but I really like it. Music is on point! Subbed

  • @CaidicusProductions
    @CaidicusProductions Před rokem

    Ni hao, Andy. Your attic looks cool a hell. Thanks for the great video!

  • @DavidCookeZ80
    @DavidCookeZ80 Před rokem +10

    The original NASCOM-1 used flip-flops, gates, the NMI and one of the RST instructions to implement breakpoints and single stepping. It would drop a RST in place of the orginal opcode at the breakpoint, which would call into the OS, there it would replace the original instruction and arm the flip flops and RETI, raising an NMI after the second M1 cycle (ie. after the stepped to instruction had executed) handing control back to the OS again.

  • @JanusCycle
    @JanusCycle Před rokem +4

    We need a new version of CP/M now.

  • @baconthevainglorious7371
    @baconthevainglorious7371 Před 2 měsíci

    amazing job you deserve the growth friend. I love the complete nerd out here. It's about time this blew up

  • @hhart6266
    @hhart6266 Před rokem

    This was an awesome video - I really enjoyed it!

  • @SeaJay_Oceans
    @SeaJay_Oceans Před rokem +14

    It would be amazing if someone would make a Military Grade Z80A clone chip on 7nm wafer process, with a 64K L1 Buffer so all code and data can run at full speed !
    Consider the SGS Z80 6 MHz vs Zilog Z80 4 MHz - the SGS military grade Z80 can work at below freezing and above boiling temperatures: -55°C - 125°C .
    Even the Zilog Z0840008PEC runs at 8 MHz and operates at temperature of -40°C - 100°C.

    • @greenaum
      @greenaum Před rokem +3

      The Z80 isn't memory bound like modern CPUs, it doesn't have to wait for memory to catch up, it's actually "slower" than the RAM in 8-bit micros. That's what allows the video circuits to also access RAM. So code already runs at full speed.
      Of course, modern fab technology could speed it up. You can integrate a Z80 into an FPGA at hundreds of MHz. Zilog sell Z80s at around 20MHz. If you really wanted faster, you could go up to GHz with modern tech. Nobody has, though, because Z80s nowadays are used as microcontrollers, integrated into a larger chip, to control hardware, so it just doesn't need to be so fast. If you wanted the power of GHz you'd also benefit from a modern 64-bit chip.
      But it would still be cool though!

    • @michaelrenper796
      @michaelrenper796 Před rokem +1

      While there is indeed still systems and code in mil-space targetting the Z80, re-making the old hardware is no longer the preferred approach for maintaining and upgrading those old weapons.
      Nowadays people go for FPGAs. More flexible, interchangeable and available. Got this confirmed by somebody working in the space at a conference recently.
      So if you have a (sub)-system that has Z80 code and needs an upgrade one would plugin in a FPGA synthesize the Z80 on it and whatever other upgrades are required.

    • @SeaJay_Oceans
      @SeaJay_Oceans Před rokem

      @@greenaum :-) I'm saving my money up for when the first 128 - Bit CPUs get released... Still . . . Waiting . . . :-D

  • @i93sme
    @i93sme Před rokem +16

    This is not a secret feature but just a clever use of the processor’s NMI capabilities to implement support for a protected mode

  • @bendyloco
    @bendyloco Před rokem

    Great video, I’m subbed can’t wait to see more!

  • @Rob9Nicholson
    @Rob9Nicholson Před rokem

    This is an awesome video. Brought back memories of a mis-spent childhood playing with ZX81s and spectrums.

  • @johnrickard8512
    @johnrickard8512 Před rokem +10

    I knew the Z80 was a CPU with lots of tricks buried in the silicon, but I hadn't expected some mad engineer to come along and squeeze even more features out of it by now...

  • @elkeospert9188
    @elkeospert9188 Před rokem +4

    Handling a interrupt for each I/O operation will decrease the performance a lot.
    It might be better to have an additional bit in the MMU address translation memory indicating if the memory page which is accessed as I/O should cause an interrupt or not

  • @deantiquisetnovis
    @deantiquisetnovis Před 2 měsíci +1

    Having learned programming on Z80 computers (TRS 80 and Sharp MZ80k) this totally blows my mind! Andy, You definitely have a bright future ahead 👍

  • @Shkunk1
    @Shkunk1 Před rokem

    I worked with the Z80 as a student. I was pretty familiar with every register, flag, interrupt, and command of that processor. I never knew about this. I'm impressed. Good job.