So how does a PS/2 keyboard interface work?

Поділитися
Вставка
  • Опубліковано 5 бер 2021
  • Check out eater.net for more computer engineering stuff!
    List of scancodes from the video: docs.google.com/document/d/1w...
    Support these videos on Patreon: / beneater or eater.net/support for other ways to support.
    ------------------
    Social media:
    Website: www.eater.net
    Twitter: / ben_eater
    Patreon: / beneater
    Reddit: / beneater
    Special thanks to these supporters for making this video possible:
    Aleksey Smolenchuk, Alexander Wendland, Andrew C. Young, Anson VanDoren, Anthanasius, Armin Brauns, Ben Cochran, Ben Dyson, Ben Kamens, Ben Williams, Bill Cooksey, Binh Tran, Bouke Groenescheij, Bradley Pirtle, Bradley Stach, Brent Reusing, Brian T Hoover, Bryan Brickman, Bryan Glezerson, CaffeinatedClockmaker, Carlos Ambrozak, Christopher Blackmon, Dale Andrew Darling, Daniel Jeppsson, Daniel Tang, Dave Burley, Dave Walter, David Brown, David Clark, David Cox, David House, David Sastre Medina, David Turner, David Worsham, Dean Winger, Dissy, dko, Dmitry Guyvoronsky, dstensnes, Dušan Dželebdžić, Dzevad Trumic, Emilio Mendoza, Eric Busalacchi, Eric Dynowski, Erik Broeders, Eugene Bulkin, George Foot, George Miroshnykov, Harry McDow, Ingo Eble, Ivan Sorokin, james schaefer, Jared Dziedzic, Jason DeStefano, Jason Specland, JavaXP, Jay Binks, Jayne Gabriele, Jeffery Springs, Jeremy A., Jim Kelly, Jim Knowler, Jim Van Meggelen, Joe Beda, Joe OConnor, Joe Pregracke, Joel Jakobsson, Joel Miller, John Fenwick, John Meade, Jon Dugan, Joseph Portaro, Joshua King, Kai Wells, Kefen, Kenneth Christensen, Kent Collins, Koreo, Lambda GPU Workstations, Larry, László Bácsi, Lukasz Pacholik, Marcus Classon, Martin Roth, Mats Fredriksson, Matt Krueger, Matthäus Pawelczyk, melvin2001, Michael Garland, Michael Tedder, Michael Timbrook, Michael Weitman, Miguel Ríos, mikebad, Mikel Lindsaar, Miles Macchiaroli, moi n, Nicholas Counts, Nicholas Moresco, Nick, Örn Arnarson, Paul Pluzhnikov, Paul Randal, Pete Dietl, Phil Dennis, Philip Hofstetter, Phillip Glau, PixelSergey, ProgrammerDor, Randal Masutani, Randy True, Raoul van Prooijen, Renaldas Zioma, Ric King, Rob Bruno, Robert Comyn, Robert Diaz, Roland Bobek, sam raza, Sergey Kruk, SonOfSofaman, Stefan Nesinger, Stefanus Du Toit, Stephen, Stephen Riley, Stephen Smithstone, Steve Jones, Tayler Porter, TheWebMachine, Tom, Tyler Latham, Vincent Bernat, Vladimir Solomatin, Walter Montalvo, Warren Miller, xisente, Yee Lam Wan, דויד אללוף

КОМЕНТАРІ • 1,7 тис.

  • @isohyde
    @isohyde 3 роки тому +2852

    The reason the Pause/Break key has such a weird scan code is because old 84-key keyboards didn't have that key and used Ctrl+Num Lock for Pause/Break. If you look at the scancode it's actually a make sequence for control and num lock, followed by a break sequence for both-so it acts like you quickly presesed and released control+num lock even if you hold it down.

    • @luizzeroxis
      @luizzeroxis 3 роки тому +60

      That's really cool!

    • @Mike.Kachar
      @Mike.Kachar 3 роки тому +63

      Does that mean that, for keyboards/laptops that do not have a pause/break key (nowadays), that they can use Ctrl+Num Lock for that same function? For Windows OS's, in my job, I frequently give people the hotkey of Win Key + Pause/Break key to give me the info I need, and sometimes I hear that they don't have a Pause/Break key. In those situations, would Win Key + Ctrl + Num Lock work?

    • @owenvogelgesang7314
      @owenvogelgesang7314 3 роки тому +47

      @@Mike.Kachar I think if a keyboard is cut down enough to not have a pause/break key, it probably doesn't have a number pad either

    • @voodoolilium
      @voodoolilium 3 роки тому +30

      @@owenvogelgesang7314 My laptop actually has most of numpad and no pause/break. I don't think the Num Lock is a normal num lock though, I think it switches the keys in hardware, because the numpad doesn't have any nav keys on it. BUT, I'm sure somewhere out there these is a keyboard with a numpad but no pause/break, especially if you consider the world of custom mechanical keyboards, although that's a whole other can of worms....

    • @theowinters6314
      @theowinters6314 3 роки тому +27

      Same thing for Print Screen, on old keyboards you would press shift-numpad *, and other then the extended code (probably because to indicate it's a multibyte code) it's still that.

  • @osirisgolad
    @osirisgolad 3 роки тому +1722

    "I've got about eight of them here; at least as far as you know..." Should we send someone to check on you?

    • @nickvoncloft4566
      @nickvoncloft4566 3 роки тому +58

      i counted a sliver of one offscreen

    • @eternaldoorman5228
      @eternaldoorman5228 3 роки тому +4

      😂

    • @Tedd755
      @Tedd755 3 роки тому +35

      Choked on my coffee when he said that.

    • @zekodun
      @zekodun 3 роки тому +13

      I for one am not surprised. :)

    • @RedwoodRhiadra
      @RedwoodRhiadra 3 роки тому +17

      The serial output of the bottom-most visible board didn't have any wires headed further down, so 8 was how many he had...

  • @marred2277
    @marred2277 3 роки тому +957

    "I've got about 8 of 'em here, at least as far as you know" LOL

  • @samp-w7439
    @samp-w7439 3 роки тому +288

    Everybody gangsta' until he slides in 8 identical copies of the shift register. (At least as far as we know)

    • @monad_tcp
      @monad_tcp 3 роки тому +13

      And I though cook shows were crazy with their tricks of pulling 2 of the thing already made from under the table.

  • @HenrikDanielsson
    @HenrikDanielsson 3 роки тому +885

    Morgan Freeman narrating the epilogue of this series: "...and as far we know, Ben is still out there, happily building scancode decoders 'til this day...".

    • @khatharrmalkavian3306
      @khatharrmalkavian3306 3 роки тому +53

      When he said, "...for all you know," I imagined a five foot mound of breadboards behind him.

    • @nickvoncloft4566
      @nickvoncloft4566 3 роки тому +4

      samuel l jackson would make it better by throwing in cursewords

    • @tomyyoung2624
      @tomyyoung2624 3 роки тому +3

      Yes changes, UTC +9 hours all of the period

    • @willofirony
      @willofirony 3 роки тому +6

      He had 256 breadboards, wired together to make a word processor. The next episode is going to be a doozy!

    • @FranklinChou
      @FranklinChou 3 роки тому +3

      @@khatharrmalkavian3306 Slices of breadboards?

  • @YoursTruelyMe2
    @YoursTruelyMe2 3 роки тому +1288

    To anyone reading...
    Ben's website under credentials says "I went to school for computer science, but failed out after the first year and have no degree"
    Why I bring this to attention is because with such a deep understanding, I assumed this guy had several PhDs. The fact that one of these videos is more informative than some of the most rigorous 4 year programs is a true testament to self education. This is the golden corner of UA-cam, please never stop.

    • @dandan7884
      @dandan7884 3 роки тому +87

      seems like those who value knowledge dont value degrees nearly as much, dont they

    • @jeromethiel4323
      @jeromethiel4323 3 роки тому +112

      That's because computer science degrees don't teach digital logic. Not like this, anyway. Modern computer science is all about high level languages, because they want you as divorced from the metal as they can get. I actually had 2 semesters of digital logic, and we hand built everything on breadboards, just like Ben does. But i was not in computer science, i was in electronics, which is different. Because digital logic is a very useful tool when you are building electronic devices, you often end up with "digilog" circuitry, where you have some analog and some digital working together to accomplish a function.

    • @BetweenTheBorders
      @BetweenTheBorders 3 роки тому +49

      @@dandan7884 It really, really depends. Undergraduate work is stuff you can usually teach yourself to greater or lesser effect. Graduate work is more about synthesizing ideas and research while doctoral level work tends to be almost pure theory. I am wildly over-simplifying. I would argue that this level of deep dive is easily graduate level presentation. The second he makes his own die, you send someone to check on him and I'll see if we can find him an honorary doctorate. ;)
      That being said, yes, a degree is not an education, but if you try hard enough, you can become educated while earning a degree.

    • @monad_tcp
      @monad_tcp 3 роки тому +18

      @@dandan7884 I got a degree just for social contract with my family. So they would stop bothering me. I was already well into the profession since 14yo.
      Entirely self-learned.
      Also me: I wonder if one day I could design my own CMOS chip, that's why I went to Uni, not to get the basics.

    • @TheEmeraldMenOfficial
      @TheEmeraldMenOfficial 3 роки тому +10

      Well, think:
      Thomas Edison was expelled from the second grade.
      Albert Einstein was considered dumb in high school.
      Micheal Faraday never went to school and was illiterate.
      Winston Churchill failed English and Latin class in high school.
      Self-education is more effective than most education systems out there.

  • @Roxor128
    @Roxor128 3 роки тому +288

    Something to clarify: The two pins Ben said were unused only applies to keyboards. Mice use them and leave the ones used by a keyboard unused. If you've got a PS/2 keyboard with a trackball in it that still only uses one plug, the trackball will be using those pins while the main keyboard uses the other two.

    • @solhsa
      @solhsa 3 роки тому +55

      Ah, that explains how some systems have a single ps/2 port and you can use an adaptor to hook both keyboard and mouse in.

    • @tirocska
      @tirocska 3 роки тому +8

      Thanks! I was reading the comments hoping to learn what the other 2 pins are for. (And also the reason for the strange bit-mapping of the keys.)

    • @NiyaKouya
      @NiyaKouya 3 роки тому +8

      That also explains how "dual personality" PS/2 ports on modern mainboards (probably) work. The board/chipset/cpu knows if a keyboard or mouse is plugged in by which data/clock pin is used.

    • @Bunkers-Boys
      @Bunkers-Boys 3 роки тому +18

      so now ben needs to build a mouse interface

    • @HenryLoenwind
      @HenryLoenwind 3 роки тому +7

      @@solhsa And it explains why they moved from the 5-pin connector to the 6-pin connector.

  • @bertholtappels1081
    @bertholtappels1081 3 роки тому +327

    This guy turns a KEYBOARD PROTOCOL into binge-worthy content. That’s one of those things about 2021 that I didn’t see coming.

    • @MarioManTV
      @MarioManTV 3 роки тому +28

      After watching his VGA interface video, I could watch this man cobble together *any* IO protocol, in discrete logic circuits, all day. And I’d be captivated the whole time.

    • @deedewald1707
      @deedewald1707 3 роки тому +3

      Well put !

    • @LeoStaley
      @LeoStaley 3 роки тому +3

      Wish I understood. I don't even know what ground and shield mean.

    • @topilinkala1594
      @topilinkala1594 10 місяців тому

      @@LeoStaley In a real computer the shield is connected to the mains ground which is the same protective ground that is in the chassis of the computer. The ground is the 0 VDC on the +5 VDC voltage supply.

  • @MIKAEL212345
    @MIKAEL212345 3 роки тому +438

    "8 of them as far you know" LMAO. This and the zooming out on the data the HOME key was sending was so funny to me. It's like watching the old commercials "But wait there's more!"

    • @ouya_expert
      @ouya_expert 3 роки тому +33

      call now and get another 11 bits absolutely free, plus shipping and handling

    • @BertGrink
      @BertGrink 3 роки тому +22

      Or those cooking shows where the host/chef says "Here's one i made earlier"

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

      "If you release the key *now* , you'll get an "F-Zero" byte *along with* your regular scancode!
      And if you use an extended key, you'll get *three* bytes when you let go!"
      "But wait, there's *yet more* ! I haven't started talking about PrintScreen and Pause/Break! Get yout uber-load of bytes RIGHT NOW!"

  • @SnowyPup
    @SnowyPup 3 роки тому +63

    22:20
    Man, this really hits home

    • @zvava
      @zvava 2 роки тому

      this is the greatest dad joke ever

  • @RuiMartins
    @RuiMartins 3 роки тому +115

    Scan codes are based on a matrix of vertical and horizontal lines, at least for the main section of the keyboard.
    That is why key "1" and "2" start with Hex1 (same matrix vertical), and similar for "3","4","5" starting with Hex2 and "6","7","8" starting with Hex3, ... they belong to the same keyboard matrix vertical scan line. The right Hex digit is the horizontal matrix scan line.
    The other special keys, like: "F"unction , Insert, Home, PageUp, Delete, End, PageUp, System/PrintScreen, Scroll Lock, Break/Pause, ... depend on how they were mapped on the Matrix of the first keyboard that added them.
    For example, F1 to F6, where originally listed vertically on the left side of the keyboard, hence all their codes start with Hex0.
    The IBM standard evolved with each successive keyboard, with new keys, that were usually mapped to the closest vertical and horizontal lines of the scan matrix. Basically to make it as simple as possible to route the matrix circuit onto the keyboard PCB, since any pattern can be easily handled by the software layer.

    • @HenryLoenwind
      @HenryLoenwind 3 роки тому +8

      Yes. The first keyboard to use those codes didn't send a byte, it sent two nibbles for the row and column. But when the first PC came around, they already needed a microcontroller to map row/col onto those backwards compatible scancodes. And so they started a tradition that still lives on today...

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

      I remember reading that the original K/B interface had the driver program in the CPU send the column number to the keyboard, and the keyboard would send back a byte containing a 1 bit for each key in that column that was pressed. The driver had to maintain a map of which keys were pressed by rotating through the columns and saving the bits many times per second, and detecting when one or more changed from its previous value. Needless to say, the second time around was much more efficient.

  • @N0Xa880iUL
    @N0Xa880iUL 3 роки тому +177

    Your channel is worth more than gold. This stuff you are making is timeless.

    • @electronicengineer
      @electronicengineer 3 роки тому +16

      I totally agree with your statement. Ben's way of teaching is, in my opinion, the best way for me to learn. I love every single video this man makes because he presents his massive knowledge one step at a time, sequentially explained, so even slow people, like myself, can follow his thinking, as he progresses, and actually Understand his thinking. A master teacher, Ben is. Fred

    • @red_ford23
      @red_ford23 3 роки тому +4

      somehow this stuff is gonna save a space mission someday because finally this info is being passed cross generations properly. This is an amazingly clear presentation. Thank you.

    • @To-mos
      @To-mos 3 роки тому +6

      @@red_ford23 Welcome to interplanetary mechanic school, this is your holographic AI driven teacher Ben Eater recorded from the year 2021.

    • @apkat2066
      @apkat2066 3 роки тому

      @@electronicengineer
      I made 4 bit RAM ckt using only D FLIP FLOPS And Basic gates:ua-cam.com/video/q7bZs2Nhi4Ez/v-deo.html

    • @apkat2066
      @apkat2066 3 роки тому

      @@To-mos
      I made 4 bit RAM ckt using only D FLIP FLOPS And Basic gates:ua-cam.com/video/q7bZs2Nhi4Ez/v-deo.html

  • @N3tech
    @N3tech 3 роки тому +123

    My breadboards look like rotten spaghetti, while yours look like works of art.

    • @BlackEpyon
      @BlackEpyon 3 роки тому +4

      I usually take a twist tie or spare piece of single-core wire, and tie the buses together. If possible, I'll also colour code them, such as green being data, blue being address, etc, but I don't use pre-formed jumpers except for power/ground, otherwise you keep needing to cut and form them, which slows things down.

    • @jozefbania
      @jozefbania 3 роки тому +5

      You should play Factorio and make 10 rockets per launch using belts only that will teach you how to route anything. LOL.

    • @foty8679
      @foty8679 3 роки тому +2

      @@jozefbania To be fair though. If i remember correctly he has pre bent cables

    • @sadhlife
      @sadhlife 3 роки тому +1

      @@foty8679 pre-bent by himself :)

    • @Niosus
      @Niosus 3 роки тому +4

      Well, it could be worse. I just bought a house and decided to take a look at how the central heating boiler is wired to the thermostats. I mean, the boiler only has two wires as input. Short them, and it turns on. How bad could it be?
      Turns out it look like a bowl of spaghetti, with a bunch of unterminated brown wires sticking out. And if there is one thing I remember from that introductory course to home wiring in high school: "brown is the color your pants will be when you touch it".
      I promptly closed the box, and checked the batteries on the smoke alarm. I guess I'll figure this out in summer... Note to self, also buy a new CO alarm. That thing expired 3 years ago.

  • @MovieMationStudios
    @MovieMationStudios 3 роки тому +51

    Ben busted out that ready-made second shift register breadboard like a Food Network chef

    • @BertGrink
      @BertGrink 3 роки тому +2

      Exactly! 😂

    • @Roxor128
      @Roxor128 3 роки тому +6

      I'm a little disappointed he didn't use the phrase "here's one I prepared earlier".

  • @itsthesola10
    @itsthesola10 3 роки тому +23

    "5v is black"
    Okay, now what? Next you're gonna tell me data is red?
    "data is red"
    oh no.

  • @Vaibhavhayaran1
    @Vaibhavhayaran1 3 роки тому +102

    It's 2030 and Ben is building a Quantum computer on breadboard.

    • @diggoran
      @diggoran 3 роки тому +3

      I'd very much like to see that happen! Such advancements in quantum computing over the next decade that it can be done on regular copper, aluminum, and steel components!

  • @dsgeyer
    @dsgeyer 3 роки тому +363

    “Black is 5v, figures” lololol love these videos. I need to quit everything and just do these videos all day

    • @Puner54
      @Puner54 3 роки тому +2

      Quite Informitive!

    • @BlackEpyon
      @BlackEpyon 3 роки тому +5

      In automotive wiring, black is usually 12v, and white is ground.

    • @omniyambot9876
      @omniyambot9876 3 роки тому +20

      @@BlackEpyon and all my life my instinct tells me every black is ground and red is postive V

    • @BlackEpyon
      @BlackEpyon 3 роки тому +6

      @@omniyambot9876 IKR? That's where you get in trouble. And then in the US/Canada, mains AC, black is hot, and white is neutral, and you could potentially have a VERY bad time if you get those mixed up.

    • @omniyambot9876
      @omniyambot9876 3 роки тому +5

      @@BlackEpyon yeah man that's why I try not to touch high power lines until I'm very very sure what is going on

  • @SamBebbington
    @SamBebbington 3 роки тому +218

    He’s alive!

  • @garychap8384
    @garychap8384 3 роки тому +6

    Great video, man, it took me right back to my early hacker days : )
    We used to swap out PS/2 keyboards in target sites, with a modified one that could install malware and act as a bidirectional radio link to the attacker. Nobody ever suspected that the keyboard was an attack (and communication) vector.
    Call centres were one of our favourite targets as they had access to the targets customer systems and the high turnover of call staff made employee positioning ridiculously easy.
    Basically, you'd put your foot on the keyboard cable and make a visible show of trying to pull the keyboard forwards to a comfortable position at the front of the desk. Of course, because you're resting a foot on the cable, the cable would appear too short. Then, you'd look under the desk and sigh ... disconnect the keyboard and pass it under the desk (as though trying to free the cabling) ... once under the desk we'd quickly swap the keyboard with one in our bag... and then bring it back up. Done correctly it's a fast and smooth way to switch keyboards undetected.
    Now, there were a few things that most people don't consider...
    1. Like the video said, a keyboard isn't an input device - it's a bidirectional input/output device
    2. The keyboard can act as external media - installing malware and communicating with it once installed
    3. A modified keyboard can act as a simple RF node, bypassing network security and backdooring standalones
    4. Keyboards are (or, rather, were) never investigated or suspected to be vectors for persistent malware.
    We used a slow, low power PIC chip between the keyboard IC and the PS/2, powered from the PS/2 line itself.
    Malware once installed on the PC could send a sequence to the KB to let it know that the malware was available... but, if the KB didn't get the sequence after a few minutes, it would wait till a suitable moment _(a timeout after last keystroke)_ and then buffer any new keystrokes temporarily - whilst installing the malware!
    The malware installation was easy. Rapidly injected keystrokes opened the console via hotkey, dropped to black foreground and used the 'debug' command, to create and execute a tiny .com program in memory (the chain-loader) as hex. This tiny chain-loader program would then stream the real malware image from the keyboard using a faster more efficient method (binary data) that didn't echo into the console window. The malware would then execute via debug, closing the console and installing into the filesystem. After the KB has sent the last byte of the malware to the chain-loader it would then release any keystrokes in the buffer as normal and return to regular working.
    The user just saw a brief console window flash, if they were paying attention. This would never be seen again, as once the malware was installed, the periodic PS/2 'malware available' sequence kept the keyboard happy.
    We also experimented with a system that would identify logins (by comparing first keystrokes after boot) ... then wait till it had been on more than 12 hours AND more than 4 hours since last keypress. It would then assume that the machine had been left on overnight, and would log-in using the stolen credentials and install : ) Our agent could then swap keyboards with another machine they didn't have credentials for... under the guise of "stealing a nicer keyboard" ... in call centres nobody cares... they find it funny if you steal the managers keyboard. Scavenging nicer headsets, ear foam, voice tubes, mice and keyboards is quite common in call centre environments ; )
    The malware was pretty sweet, and could be updated wirelessly.
    The malware on the PC communicated with the PS/2 keyboard, which stored user passwords, web passwords, and other data - and released it via short range wireless on the hour every hour. Every hour the RF module would listen for 10 seconds for a short binary "hello" sequence before going back to sleep. If it heard a "hello sequence" it would stream out all of its saved data. It would then listen for another 10 seconds before going to sleep again. A similar "thanks" sequence would cause the CPU to clear any stored data (successful transmission)
    You can do the same today in USB keyboards, using an ISM, GSM or WiFi module and any microcontroller with an integrated USB receiver (or emulator) ... a couple of IO pins and some onboard (or i2c) SRAM. These days they can also act as an AP with hidden SSID as the chips are cheap and low power... or, employ mobile data, a SIM and a 3G/4G module. The latter is particularly nice as it allows an attacker to remotely use the PC as a remote node into the LAN (for further penetrations) without having to negotiate the perimeter security.
    In the old days, fetching data off the poisoned device was as simple as walking past it at the appropriate time, with a similarly modified device set to capture information over RF. We used to use a modified walkman or portable radio in our pocket - as, again, these were never suspected as being malevolent.
    Back in the day, we didn't have the ISM band, GSM modules or cheap digital RF modules with good shaping... we used very simple bead-like devices that were carrier only, and we used checksums to validate message reception : ) These days it's a LOT more dangerous to allow a modded KB into an organisation.
    Yep, PS2 keyboards really bring back some great memories of misspent youth : )
    Thanks for taking the time to make this video. Tinkering is it's own reward.

    • @halfacanuck
      @halfacanuck 2 роки тому

      Bad ass.

    • @mayaencuk3828
      @mayaencuk3828 3 місяці тому

      Very enjoyable reads, every line of it. In fact I read it twice man! Purely scifi, espionage stuffs... 😂😂😂

  • @agvulpine
    @agvulpine 3 роки тому +58

    Hint: There are scan codes for POWER, SLEEP, and WAKE. If you send those scan codes through a PS/2 interface on any modern PC (that still has PS/2 interfaces), you can make it instantly interrupt power or go to sleep. When I say instantly, I mean ungracefully turn off without question or delay.

    • @m.kostoglod7949
      @m.kostoglod7949 2 роки тому +5

      Some recent enterprise motherboards with ps/2 interface do not comply with those scancodes, they simply do not react!

    • @j7ndominica051
      @j7ndominica051 Рік тому +11

      I had a keyboard with a Power button in place of the Print Screen key. I had to remove it and cover the slot with tape.

    • @Inf1e
      @Inf1e Рік тому +3

      it acts like 98 power button, which is controlled by BIOS (UEFI in modern scenario)

  • @HorochovPL
    @HorochovPL 3 роки тому +217

    Two shift registers on a single board?
    Don't worry, I have another similar board.
    Wait, there's three actually!
    So, how many boards does Ben have? All of them.

    • @uwezimmermann5427
      @uwezimmermann5427 3 роки тому +5

      it's boards all the way down! (not elephants!)

    • @Yootzkore
      @Yootzkore 3 роки тому +3

      It's almost AVGN 64-32-16-8-4-2-1-½-¼-bit meme material.

    • @lightwaves1859
      @lightwaves1859 3 роки тому +5

      i'm fairly convinced he has a replicator.

  • @ZeroSleap
    @ZeroSleap 2 роки тому +14

    I cannot state enough,the fact that your channel is one of the few channels concerning computer science/engineering that is WHOLLY bingable.
    Every video makes you ask for more,bravo!

  • @VictorSavelle
    @VictorSavelle Рік тому +14

    UA-cam finally decided it is time for me to find your channel, Ben. Amazing work!

  • @DoogieLabs
    @DoogieLabs 3 роки тому +8

    Watching you cut the cable at one end instead of in the middle thereby having the DIN pigtail for later triggered my OCD.

  • @StefanoBorini
    @StefanoBorini 3 роки тому +250

    I did some research on the scancode origin when self-building a keyboard. I was not able to find anything authoritative, so the best guess I have for its strange pattern is the ye olde connection matrix they chose originally for the buttons. In other words, in the old days they connected the buttons with a reasonable (cheap to produce) row/col network, then the internal chip scans the rows and gets which column is connected to identify which key is pressed. So what you might get in the original, basic set, is simply the encoded row/column position of the button _according_ to the wiring matrix (not the visual layout). But I might be wrong.

    • @mikefochtman7164
      @mikefochtman7164 3 роки тому +28

      I think you're on to it. We tore an old Hazeltine 1500 'dumb' terminal apart and found the 'scan' chip that interfaced the row/col switch matrix to ASCII. Sent the ASCII to RS-232 interface and that was about all there was on the 'output' side of the terminal. Of course the 'input' side to the screen was more complicated. :)

    • @okuno54
      @okuno54 3 роки тому +17

      I would be extraordinarily unsurprised by this. Today we can just throw an arduino (or even a full raspberry pi!) into a keyboard and do a bunch of processing in the keeb itself, but back in the day you probly had to build all the functionality out of nand/nor gates, I dunno, maybe as many as four gates per IC 0.o

    • @BertGrink
      @BertGrink 3 роки тому +1

      Yeah I was thinking along the same lines as I watched the video, so that does seem quite likely.

    • @BertGrink
      @BertGrink 3 роки тому +22

      @@okuno54 As far as I know, when IBM introduced the original PC Model 5150, the keyboard had an Intel 8048 microcontroller built in, and all subsequent keyboards have had either that chip, a clone, or some modern derivative, for backwards compatibility.

    • @tomyyoung2624
      @tomyyoung2624 3 роки тому

      Yes break code!

  • @Mallyhubz
    @Mallyhubz 3 роки тому +12

    Some of my favourite comedians have an odd parody bit.

  • @haniyasu8236
    @haniyasu8236 3 роки тому +194

    11:45 omg he just fixed a timing problem by effectively adding a redstone repeater

    • @ornessarhithfaeron3576
      @ornessarhithfaeron3576 3 роки тому +19

      Yup. Not exactly (then again, you said "effectively" so you know it yourself), but you're right. If you know the redstone trick with making a redstone clock without using repeaters (just redstone torches and redstone dust and any block), it's basically two of these things together.
      That type of redstone clock is basically several NOT-gates in series, the delay happening because of minecraft ticks. So what he did is put two NOT-gates in series.
      But yeah, you're pretty much right overall. That's more or less what he did.

    • @thizthizzydizzy
      @thizthizzydizzy 3 роки тому +45

      The original repeaters (before repeaters existed) was just a couple of NOT gates (redstone torches)
      The repeater's recipe reflects this too :P

    • @lucaseastman1877
      @lucaseastman1877 3 роки тому +15

      @@thizthizzydizzy That's like a little easter egg. That's cool.

    • @Scaramouche122
      @Scaramouche122 3 роки тому

      Dog

    • @dioneto6855
      @dioneto6855 3 роки тому +8

      when he said that wanted some delay i thought 'just connect to 2 inverters" not clearly with minecraft in mind but now i realize that minecraft may have influenced me to think that way

  • @tyisafk
    @tyisafk 3 роки тому +23

    Me, a nail biter, seeing someone strip wires by hand:
    Pure sorcery.

  • @delawarepilot
    @delawarepilot 3 роки тому +21

    (Looks at my breadboard) It may have been assembled by bird preparing for spring.

  • @djcsdy2
    @djcsdy2 3 роки тому +6

    The scan codes make a lot more sense if you arrange them on an IBM Model F keyboard, which is probably where they originated. It looks like the scan codes come from each key's position on the Model F keyboard matrix, with the low 3 bits representing the key's row from bottom to top, and the high 5 bits representing the column. This doesn't exactly correspond to each key's physical row and column but each column in the keyboard matrix instead corresponds to a cluster of keys on the keyboard. For example F4, F6, F8, F10, Tab, and Alt are assigned to column 1 of the keyboard matrix and are all physically adjacent to each other on the keyboard. F9 is the bottom-left key so it makes sense that it's assigned code 0x01.
    There are a couple of oddities that stand out. F7 must surely have originally been assigned code 0x02 but has changed to 0x83 for some reason. Backtick appears to be in a cluster with Alt and Tab but was at the other end of the keyboard on the Model F. Perhaps it has been reassigned a spare code to correspond to its modern physical location. Some other weird codes such as F11 are easily explained as keys that didn't exist on the Model F and have simply been assigned spare codes. Similarly the keys with extended codes didn't exist on Model F either.

  • @GuildOfCalamity
    @GuildOfCalamity 3 роки тому +3

    Is there an award for break board wiring neatness? Because if there is, it DEFINITELY goes to Ben.

  • @nagasaipurvaz4251
    @nagasaipurvaz4251 3 роки тому +117

    You know he is professional when he strip wires with finger nails

    • @BlackEpyon
      @BlackEpyon 3 роки тому +12

      I used to use my teeth when I was a kid.

    • @nagasaipurvaz4251
      @nagasaipurvaz4251 3 роки тому +7

      @@BlackEpyon I use teeth now too

    • @stevensgarage6451
      @stevensgarage6451 3 роки тому +3

      Never seen that before

    • @gen157
      @gen157 3 роки тому +7

      @@BlackEpyon Can't use my teeth anymore for that. It feels weird. Metal on teeth is awful.

    • @watchableraven3517
      @watchableraven3517 3 роки тому +4

      @@nagasaipurvaz4251 Your own?

  • @WarrenGarabrandt
    @WarrenGarabrandt 3 роки тому +5

    I've been looking forward to this video. Thanks!

  • @DamianReloaded
    @DamianReloaded 3 роки тому +5

    I love this. I've always wanted to have some insight into these kind of things. Outstanding content. Keep'em coming!

  • @MarcelHuguenin
    @MarcelHuguenin 3 роки тому +1

    Very informative and entertaining. Have never given it a thought how it would work but this makes a whole lot of sense. Thanks Ben!

  • @dentakuweb
    @dentakuweb 3 роки тому +1

    That was the best video I've seen in a while. You put a lot of thought into it and it was very clear and informative.

  • @maciej.opalinski
    @maciej.opalinski 3 роки тому +5

    Ayo! That's what I needed! Thanks 😊
    You explain everything in the way that no one does. Your videos are perfect!

  • @nagualdesign
    @nagualdesign 3 роки тому +11

    Brilliant. The story got even more interesting as it went on. 10/10 for effort!

  • @mandisaplaylist
    @mandisaplaylist 2 роки тому +2

    30:35 Actually, it is not that crazy "to have LEDs everywhere" because at the times these CPUs and other chips came to the market first, there weren't fancy oscilloscopes available which could "one-shot a signal" and then "show it to you indefinitely" so when you wanted to debug some hardware, you needed to create visible "debug outputs" and you use LEDs for that. The red LEDs are actually pretty old and I remember having a LED based calculator when I was 8 (in 1981) so yes, LEDs are common "hardware debugger", even today. It takes just 1 resistor to hook one to a TTL output to be able to see what is in there and once you are no longer interested in what is there, you can just pull the two components out and be done.
    There are many HW enthusiasts who "like the lights". And, also when you watch old sci-fi movies, you will see these "flashing light panels" in their spaceships and other system. That is actually based on real-world use of LEDs in that era - these debugging lights for signals that changed not that often (e.g. machine inputs in some manufacturing process) were left there permanently and rearranged into a matrix so that when something went wrong (a cable fell off, a chip burned out, a rat came in and ate a cable or two), the personnel operating the device could look at the panel and immediately see (from the changes of the patterns on it) that something went wrong and where. These also can serve as some sort of "poor man's status display" where the computer needs to just emit a single bit of data to tell that something is happening or "all is well" versus "something went wrong" (disk activity LEDs anyone?).

  • @clownhands
    @clownhands 3 роки тому +1

    This was the most satisfying thing I’ve watched today. Thank you!

  • @ChristieNel
    @ChristieNel 3 роки тому +74

    Games used to have issues with cursor keys filling up the buffer, because they sent more data. So if you played against a friend on the same keyboard, give them the cursors.

    • @Spedley_2142
      @Spedley_2142 3 роки тому +8

      I'd totally forgotten about that. I often used to try and fill the keyboard buffer before the machine posted. :)

    • @ELYESSS
      @ELYESSS 3 роки тому +10

      @@Spedley_2142 those beeps

    • @thizthizzydizzy
      @thizthizzydizzy 3 роки тому +7

      @@ELYESSS Oh, that's what that was
      I always wondered why mashing the keyboard on startup made the computer beep

    • @nothingTVatYT
      @nothingTVatYT 3 роки тому +12

      These DOS multi-user games were fun, especially the ones that let you customize the controls. I once watched two friends, one used the insert, delete, home etc. and the other used the very left side with Alt and Ctrl. Guess what happened. :-)

    • @ChristieNel
      @ChristieNel 3 роки тому +1

      @@nothingTVatYT Haha! Yes. Buffer overflow.

  • @ArnCiS96
    @ArnCiS96 3 роки тому +30

    You making my childhold dreams come true, next thing I wonder how mouse is working with same interface, waiting so much for future videos like this

    • @ElektrikDunyam
      @ElektrikDunyam 3 роки тому +1

      exactly !!!

    • @iivarimokelainen
      @iivarimokelainen 3 роки тому

      *childhood

    • @ryanchase6194
      @ryanchase6194 3 роки тому

      SP/2 mice use the unused pins, pins 2 and 6 in the diagram he used. This is how you can have both keyboards and mice on the same input.

  • @vbkfivn
    @vbkfivn 3 роки тому +15

    Ben, I just wanted to thank you for all the work you do in these videos. They really helped me find my passion for computer engineering.

  • @AjinkyaMahajan
    @AjinkyaMahajan 3 роки тому +3

    Mindblowing Explanation man
    You Nailed it

  • @XT82
    @XT82 3 роки тому +5

    Great video. So basically, the PS/2 keyboard uses a UART protocol, but with an extra clock signal (USART). Maybe you could use a 8250 or 16550 UART chip to interface the keyboard to the 6502 computer, if you can find a matching baud rate. The 16550 even has a FIFO buffer for storing up to 16 bytes coming from the keyboard. The chip could be connected to the shared address and data busses you already have in the computer. An interrupt could be generated each time a new byte arrives. Also, it would be great to add serial communication capabilities to the 6502 computer.

  • @Ronenlahat
    @Ronenlahat 3 роки тому +3

    This is one of the coolest videos I watched. You just kept pulling out circuit boards

  • @mceajc
    @mceajc 3 роки тому +1

    I adore this content. Not only informative, but compellingly informative. The more I learn, the more I need to know!

  • @Dynamic_Flyer
    @Dynamic_Flyer 2 роки тому

    Explaining complex stuff in a clear, easy to understand way. Brilliant!

  • @whoknows8225
    @whoknows8225 Рік тому +3

    this man puts so much effort in his projects, it's bone chillingly good.

  • @lexus4tw
    @lexus4tw 3 роки тому +49

    5V Black, Orange Ground, Red Data, totally obvious color choices :'D

    • @hermitoldguy6312
      @hermitoldguy6312 3 роки тому +22

      Red, orange and brown - or as we colour-blind folks say, brown, brown and brown.

    • @diydad7704
      @diydad7704 3 роки тому +1

      Same with my 3D printer that's a chinese original. Guess now we know where this cable comes from.
      "China's been treating us very unfair!" (D.J.T.) Like he ever knew the meaning of a cable color... LMAO

    • @lexus4tw
      @lexus4tw 3 роки тому +5

      @@diydad7704 in cheap products they use colors which are availabel, got an cat5 cabel once with 3 green/white pairs :D

    • @Rx7man
      @Rx7man 3 роки тому +2

      @@lexus4tw were they connected properly???

    • @cojawfee
      @cojawfee 3 роки тому +5

      I'm guessing that adapter was made from spare ribbon cable, and that's why Ben happened to have cables of the same color, because they are all next to each other on rainbow colored ribbon cables. Whatever factory that made that adapter probably assumed that no one would ever need to open it, so no need to have standardized colors, so they just the next four wires.

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

    This was a fantastic video. Watching your videos along with the experience I have in hardware repair have given me the motivation to get into hardware design. Your videos are some of the most informative and thoroughly thought-out explanations of computing. I appreciate the effort that goes into these videos.

  • @JimRyan-AKA-Pigeon_Kicker
    @JimRyan-AKA-Pigeon_Kicker 3 роки тому

    I recently found your channel and absolutely love it. I have solved so many issues with my robots thanks to you. I really enjoy ripping old electronics apart and using the recovered chips and stuff. Keep em' coming.

  • @mikolanimator
    @mikolanimator 3 роки тому +3

    Ben, thank you so much for your videos. They are awesome. You make an intimidating subject seem so simple. Thank you for all that you’re doing. Would love to see you sometime building a fully functional keyboard controller the same way you built the video card. I don’t know if it’s feasible. If not from discrete logic, (would be cool though), maybe built around an existing IO chip. Also would be great , at some point, to learn how to interface it with 6502 or a Breadboard project. Thank you again. You are amazing.

  • @HisVirusness
    @HisVirusness 3 роки тому +14

    When this computer is completed, it's going to be the size of a refrigerator. We have indeed come full-circle.

    • @villesyrjala3354
      @villesyrjala3354 3 роки тому +7

      Nah, his next project will probably involve vacuum tubes and hand woven core memory. And it will fill up his garage.

    • @BetweenTheBorders
      @BetweenTheBorders 3 роки тому +5

      @@villesyrjala3354 Great, now I expect his I/O to be punch cards.

    • @renakunisaki
      @renakunisaki 3 роки тому +4

      Check out my new computer, it's literally a room full of people computing.

  • @harshavikramaraos7211
    @harshavikramaraos7211 3 роки тому +1

    Hats off to you, Sir. The way you arranged everything on the breadboard without any clumsiness. Awesome

  • @kaiisdabei
    @kaiisdabei 3 роки тому

    Your explanations are so brillant and clear. Excellent job!

  • @TarakuTIgrisPawpad
    @TarakuTIgrisPawpad 3 роки тому +3

    Thanks for this info. I was working on a old 8/16 computer and trying to build something to give me a monitor out and input for a keyboard. I managed to get a RGB TTL out and now a PS/2 keyboard to work thanks to your videos. I was about to give up. I work at a recycling place and we get in all kinds of 74 series logic. as well as old computers. now that I have this stuff at my disposal, I started building computers from the ground up. and with the help of your videos and others, things are getting better. I think everyone that is getting into computing and design should look into the older ways of doing things first. then they can improve and create things with a better knowledge and understanding on how things work. Maybe one day someone will redo the way computes work making them faster and better. If I decide to start a UA-cam channel . it will be all thanks to you and the amazing people that I have talked with.

  • @brianevans4
    @brianevans4 3 роки тому +12

    I can't even imagine how much work this video must've taken. The research, the testing, the scripting, the setup, the filming, the editing. many hours I'm sure. But it was worth it, such an interesting video

  • @MrFireSpy
    @MrFireSpy 3 роки тому +1

    I love this series.. even though a lot of it is over my head... I think I will end up purchasing your kits, simply because it interests me so much.. Thanks Ben for doing this series..

  • @BigMikeECV
    @BigMikeECV 3 роки тому +1

    That was tremendous fun to watch. I understood what you were doing even though I haven't built any digital circuits since college in the early '80s.

  • @zactron1997
    @zactron1997 3 роки тому +3

    27:10 "I've got 8, as far as you know..." that's a golden moment. Love this channel.

  • @progenitor_amborella
    @progenitor_amborella 3 роки тому +8

    “please add another one...please add another one”
    >25:52
    “YES!”
    >video continues
    “YOOOOOOO”

  • @darkstatehk
    @darkstatehk 3 роки тому +1

    Love this channel. I could sit, watch and listen all day long.

  • @bryanc1975
    @bryanc1975 3 роки тому

    Awesome video, as usual. And props for building >= 8 of those shift registers!

  • @minarashad511
    @minarashad511 3 роки тому +15

    I had a feeling throughout the video that something will explode, after watching ElectroBoom for 2 hours.

  • @sensibleb
    @sensibleb 3 роки тому +87

    I can't believe I didn't know how to convert 8-bit hex to binary by splitting it into two 4-bit chunks. That's so simple!

    • @okuno54
      @okuno54 3 роки тому +35

      It's why hex became so popular actually! If you read up on older computers, you'll find that octal was also quite popular for a while, because 9-, 12-, 24-, and 36-bit machines were fairly common (all of which have word sizes that break apart easily into three bits). Now that industry has standardized on 8-bit bytes, it's a little strange to see every programming language that support octal number literal, but they're there as legacy.

    • @SimonBuchanNz
      @SimonBuchanNz 3 роки тому +11

      @@okuno54 partially because of posix permission bits, which you might still consider legacy 😋
      But honestly it's so easy and safe to add them if you already have other base number forms you basically need a reason not to.

    • @scififan698
      @scififan698 3 роки тому +6

      Youngsters ;-)

    • @Kitulous
      @Kitulous 3 роки тому +8

      that's what we call "tetrady" (tetrads?) in Russian, from the word "tetra"-four (in greek)
      upd: yeah, you can call that a nibble, but who really uses nibbles in 21st century

    • @BlackEpyon
      @BlackEpyon 3 роки тому +1

      When my brain isn't working, I like to use the little calculator built into Windows for it's "programming" mode.

  • @orchidejczyk
    @orchidejczyk 3 роки тому +1

    best "thank you" at the end ever ! : DD love your videos !

  • @modelrogers.19
    @modelrogers.19 3 роки тому +1

    I saw the title on this and before I had another thought I am here. Thank you Ben!

  • @slabo8171
    @slabo8171 3 роки тому +5

    Those codes seem to originate from the IBM 3270 PC's 122-key keyboard (www.seasip.info/VintagePC/ibm_6110344.html) layout, which I've amended a little:
    live.staticflickr.com/65535/51017310028_3cc2b1fd1f_o.png
    I've put the codes from that model in decimal and made a connection of consecutive numbers. The effect looks like effective packing from left to right columns of 16 columns x 8 rows matrix. And I've also found a photo gallery of the actual circuitry, which collaborates that:
    deskthority.net/viewtopic.php?p=205760#p205760
    So the keys are numbered from left bottom to top, to right. That includes 5 keys not exposed externally (yellowish in the picture), maybe planned for layouts different from the US one. The numbers are not actual scan codes, although close, but continuous numbers starting with 1, given to the keys along the path of the matrix. The relation to physical scan codes is relatively simple, as if one decreases codes from 1 to 80 by 1, i.e. resulting in 0 to 79 and keep the rest as they are (this is because the numbering scheme skips TEST connection, which is present in the matrix, not in the keys, and makes the keyboard fail self-test if it is "pressed"), we get binary numbers in the form:
    0 CCCC RRR
    where:
    RRR - row from bottom to top, 0 to 7
    CCCC - column from left to right, 0 to 15
    But note two exceptions: the key number 2 is encoded as 131, and the key number 127 as 132. So far I haven't been able to find the reason for that.
    The keyboard above had function keys at the top, however, the keyboard that actually grown into the standard Ben observed in the video is the IBM PC AT keyboard, having 84 keys, and it looks like:
    www.seasip.info/VintagePC/ibm_6450225.html
    And it is just the previous one with some sections missing, but leaving the encoding of the rest exactly the same. And that's the encoding of physical positions of the keys, so F-keys on that model are encoded differently than that big section on the 122-key one. I've labeled them on my picture, according to the AT keyboard.
    So if you look at Ben's codes list for the F1-F10 keys there's a 1:1 relation. F11 is passed as 120, which was hidden in the original keyboard, at least in the US version, and for F12 the actual function key of the 122-key model is used. Also, we can observe where did the Esc key get its high number - it was originally a part of the keypad. And e.g. Caps Lock key corresponds to the right Alt on 122-key one, but at the exact same spot, the 84-key actually had the Caps Lock. So look at the keycaps of the latter for comparison with the list. I may prepare an update of the image to have all the AT labels and maybe hexadecimal values as well.
    The story of E0 is related to the actual AT keyboard, as what the 3270 is sending is now called "set 3", and the 84-key AT keyboard established standard known now as "set 2", in which keys not present on the original AT keyboard, i.e. unknown to older computers, would still produce some sensible results (E0 would be just ignored). So e.g. right Alt is understood as left Alt or separate arrow keys as their numeric keypad counterparts. And the Print Screen was just Shift + numpad "*", so that's exactly what Ben's keyboard produces.
    And no, I haven't known this before today. Watching Ben's video, missing his explanation of the codes, I felt motivated to learn where did those numbers come from, so I've spent a few hours researching, looking thru technical references, learning about the three scan codes sets, the fact that the set 2 came from AT keyboard, trying to find keyboards released at the same time, photos of the matrices, etc. Not being able to find the clear answer I've started connecting buttons in order, knowing that the way simpler encoding, XT one, called now "set 1", IBM given just continuous numbering for blocks of the keyboard, attempting to see the pattern. As a side note, the set 1 scheme is not based on the matrix, just on the order of keys visible outside: www.seasip.info/VintagePC/ibm_1501105.html. Human friendly!
    The John Elliot's site, www.seasip.info/VintagePC/index.html, has been the most helpful resource in my investigations. And thank you, Ben, for your great videos!

    • @haulin
      @haulin 3 роки тому

      Thank you for this write-up. Very interesting and saved me a couple of hours of research :) You ever found why 131 and 132 are special? I'm not sure I understand it fully, but it seems there is a translation from Set 2 to Set 1 happening and 0x83 and 0x84 have some special meaning: www.win.tue.nl/~aeb/linux/kbd/scancodes-10.html
      0x7F, aka 127 is unavailable for keypresses, because its break sequence would be 0xFF which is reserved code for keyboard error.

  • @devnol
    @devnol 3 роки тому +115

    What if you didn't invert the latch clock and just fed it a falling edge clock, so that when it rises it would trigger the latch?

    •  3 роки тому +15

      That's what I was thinking too. This is probably latching faster though, so you can use the falling edge clock to do some other processing of the latched data.

    • @burakyildiz8921
      @burakyildiz8921 3 роки тому +14

      I always look the comments before writing what I think and most of the time one other guy already wrote exactly what I think. How is that possible? By the way, this time there are two.

    • @pv2b
      @pv2b 3 роки тому +11

      Or just use the clock from before the inverter

    • @Redrield
      @Redrield 3 роки тому +7

      @@pv2b Exactly what I was thinking while watching, you get a delay of half a clock cycle and it ends on a rising edge so the data is going to be latched by the end

    • @devnol
      @devnol 3 роки тому +6

      @@burakyildiz8921 It's the power of collective thinking. ;)

  • @peteregan9750
    @peteregan9750 3 роки тому

    Your videos are great - love exploring chip functionality

  • @Lap343
    @Lap343 3 роки тому +1

    Your videos are incredible and very informative. Thank you for putting the time into this for a weirdo fascinated in this like me.

  • @alxcuisine9575
    @alxcuisine9575 3 роки тому +4

    The Printscreen sequence looks like a Macro for a Mortal Kombat Finisher / Fatality Combo 🤣🤣

  • @petarstoyanov9024
    @petarstoyanov9024 3 роки тому +2

    Your channel should be mandatory learning for all human beings starting at age 12. Thank you very much, this was extremely valuable. Im building a firmware/driver combo almost from scratch for an open source periphery ecosystem and this is my first step on the electronic/software part of my project!

  • @westerngodzilla
    @westerngodzilla 3 роки тому +1

    Brilliant! That is a really nice overview how a keyboard works.

  • @blueskyredkite
    @blueskyredkite 3 роки тому +1

    Fascinating, as always. Thank you.

  • @A11V1R15
    @A11V1R15 3 роки тому +8

    When he talked about adding a delay, I tought about Minecraft's redstone repeater and then the solution was exact what one could do in Minecraft withou a repeater: invert the signal twice

    • @B-System
      @B-System 3 роки тому +1

      Redstone engineering is entirely legit.

  • @valshaped
    @valshaped 3 роки тому +10

    You could probably just pump the scan codes into an eeprom, and have it output ASCII (or some control codes), and maybe check for E0/F0 in hardware if you needed them

  • @PrentisHancock1
    @PrentisHancock1 2 роки тому

    Brilliant demystification of keyboard codes! Thanks. I learnt a lot!

  • @Handskemager
    @Handskemager 3 роки тому +1

    How you don’t have more subscribers is beyond me, quality stuff with humor can’t be beat. Keep up the good work !

  • @pgriggs2112
    @pgriggs2112 3 роки тому +3

    You’ve explained the “is my PC locked up?” test of toggling the CapsLock key! If the PC cannot “talk” to the keyboard to turn on/off the CapsLock light, it’s locked up. Thanks!

    • @deedewald1707
      @deedewald1707 3 роки тому

      Fundamentally knowing & understanding those fundamentals !

  • @Qfeys
    @Qfeys 3 роки тому +9

    I would actually really be interested in seeing you build a circuit that puts the letters to asci, singles out the F-keys and maybe cause interrupts, and singles out the other special keys. Maybe if ctrl or alt is pressed that a key does not go to the letters register but to the commands register. Things like that would be really cool to see.

    • @mustafareason6571
      @mustafareason6571 3 роки тому +3

      One way of converting the 16 bit output to ascii is to use a 16 address line eprom, the output from the shift registers are connected to the address lines of the eprom, ascii comes out of the data lines. This converts the scan code “address” into an equivalent byte. It’s wasteful on space as most of the eprom is blank. This was how northgate (if anyone is old enough to remember their excellent keyboards) handled multi language keyboards. They used a larger eprom where the upper 4 address lines are linked to a dip switch that sets the appropriate language. A key cap puller was supplied to swap round the key cap.
      The scan codes are a direct result of the key matrix rows/columns. Some manufacturers use different matrix layouts and then added a converter to produce compatible scan codes.

  • @Claudiu.
    @Claudiu. 3 роки тому

    So dramatic and surprising to see how many boards you had prepared. Very well explained and educational as usual.
    Initially I was thinking that you would delay the shift cycle with a capacitor, but that would probably take way longer than the small delay you made with the double invertors.
    Excited to see your next ones. Thank you!

  • @monsterblood4209
    @monsterblood4209 3 роки тому

    Hey Ben, this is GREAT! I was researching ways to interface a keyboard with my 6502 kit! I came across a 5 pin din setup, but before I saved it the site went down. I have a Parallax Propeller chip on hand, but spin code is a bit intimidating for me yet. Your tutorials are so great even a caveman like me can do them! thank you for the inspiration, and thank you for everything you do.

  • @wChris_
    @wChris_ 3 роки тому +52

    The 6522 has an integrated shift register with automatic IRQ dispatching!
    So my solution would be to have some logic to only shift in those 8 data bits into the VIA chip and write a small routine reads from the Shift Register.
    Additionally you can have use a bit on port B to indicate the status if the key was valid.

    • @MultiMidden
      @MultiMidden 3 роки тому +1

      Some 8-bit 6502 based computers used a 6522 for the keyboard. I know for a fact that BBC Micro series of computers used one and I should imagine others did as well.

    • @H3wastooshort
      @H3wastooshort 3 роки тому

      bump

    • @canaDavid1
      @canaDavid1 3 роки тому +1

      @@MultiMidden Yeah, but there the 6522 interfaced the keyboard matrix directly (through porta and portb), not throug a serial interface.

    • @CaptainDangeax
      @CaptainDangeax 3 роки тому

      @@canaDavid1 The 6526 if the C64 also did the same, a 8x8 matrix for keyboard using PA and PB

  • @AnonymousMaykr
    @AnonymousMaykr 3 роки тому +38

    I like your EEVBlog multimeter ;)

    • @BlackEpyon
      @BlackEpyon 3 роки тому +1

      A lot of the computer hobby UA-cam channels I watch have them. I'd like to get one myself, but there's other things on my hobby list that come as higher priority.

    • @azzajohnson2123
      @azzajohnson2123 3 роки тому +1

      David, Aussie Downunder Represent! Great Chanel subscribe to David's Chanel, Mr Carlsons Lab and Jan Beta if you love electronics.

    • @MrSapps
      @MrSapps 3 роки тому

      @@azzajohnson2123 I like daves content but not some of his personal views like siding with that "thunderf00t" troll guy

  • @DaniilHomyak
    @DaniilHomyak 3 роки тому +1

    This part when Ben explains how NumPad numbers correspond with “E0” keys blew my mind! I just sat there thinking about how much work & engineering went into this small part of an input device like 30 years ago. And as Ben fully explained this to me (international relations & linguistics student, English being my second language) I felt shook to the core for some reason.
    Thank you, Ben Eater, for your great content & making it breathtaking at least for me!

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

    This is fantastic. I thank you for sharing your wealth of knowledge on how this works and doing so at such a fine grained level in a very understandable way. I appreciate you.🙏

  • @rishithegray9559
    @rishithegray9559 3 роки тому +13

    Wait you're telling me that the scancode for Backspace is 66? that really gives Order 66 a whole new meaning!

    • @nyckid
      @nyckid 3 роки тому +2

      Easter egg ;-)

  • @tripiecz
    @tripiecz 3 роки тому +4

    You could perhaps use a RS-232 to TTL convertor and connect an old computer terminal like the DEC VT100 to the breadboard computer. Then you'll need no keyboard interface and no video card and you'll see why terminals used to be so popular when these ICs were still expensive.

    • @brencostigan
      @brencostigan 3 роки тому +2

      Correct, and that is why I still have mine - the wife always complains about lugging the DEC VT320 with us when we’ve moved house. I’m never parting with it. Plus the orange text is beautiful.

  • @widicamdotnet
    @widicamdotnet 3 роки тому +1

    I just repaired my old AT Keyboard (DIN plug, electrically the same protocol) last week and I'm now using it again after 15 years. Thanks to this excellent demonstration and explanation I now think I understand a bit better what it's doing :-)

  • @umutk5614
    @umutk5614 3 роки тому +1

    I am so excited when I see a new video from Ben. I guess I'm not alone.

  • @joeo6378
    @joeo6378 3 роки тому +7

    “You can see i have about 8 of them here, as far as you know”. Lol. I like to imagine that there are more. Just keeps going. Able to keep track of hundreds of key presses will all the breadboards you have lined up.

  • @meylaul5007
    @meylaul5007 3 роки тому +4

    to people who try matching the oscilloscope-output to the lights: read the lights from right to left, while reading the oscilloscope from left to right. I recommend 17:51 for that. :) That may help with the occasional confusion as was the case for me. :D But great video!

  • @ColinTimmins
    @ColinTimmins 3 роки тому

    These videos are so well done, I wish I had these as a kid.

  • @li0nleo918
    @li0nleo918 3 роки тому

    love watching these videos, realy interesting not anyone else who shows how this sorta stuff works on youtube.

  • @euromicelli5970
    @euromicelli5970 3 роки тому +4

    28:55 On the keyboard of the original IBM PC (IBM 5150) the scan codes were straightforwardly assigned based on each key's physical location (what they now call "set 1"): Starting from the top of the main keyboard area (ESC key, 01), left-to-right and top-to-bottom; then the original function keys F1-F10; then the numeric keypad area. Extended scan codes were eventually added for newer keys like F11-F12, multimedia keys, etc. However modern keyboards use a different "set 2" by default (I believed introduced with the IBM AT Keyboard) which is what you describe in the video. I have no idea why the chaotic "set 2" assignments were chosen - someone please tell!
    The bewildering thing is that - for software compatibility reasons - the keyboard controller on the motherboard maps the scan codes back to "set 1" before handing them over to the keyboard interrupt handler (be it BIOS, Linux or Windows). So whatever the reasoning behind "set 2", it became moot! "Set 2" only matters if (like here) you need to interact with the keyboard hardware directly.

    • @halfacanuck
      @halfacanuck 2 роки тому +1

      There's also set 3 which imo is a much better design, but hardly ever used. Naturally ;)

  • @walthzer6910
    @walthzer6910 3 роки тому +5

    When you think he reached a top with the VGA graphics card he comes up with this. Just magnificent.

  • @GrahamDIY
    @GrahamDIY 3 роки тому

    Absolutely love your videos, Ben. 😍
    Breadboards remind me of my CRTS degree at UWE in 1992 here in the Uk 🇬🇧

  • @keevitajamees
    @keevitajamees 3 роки тому

    Thank you man! Videos You make are really the best!