Machine Code Explained - Computerphile

109,480
49
Published 2024-01-03
Explaining machine code from the ground up! Famous for 'Compiler Explorer,' Matt Godbolt's code has appeared before on Computerphile but this is his debut.

EXTRA BITS:    • EXTRA BITS - Machine Code - Computerp...  

Find out more about Matt from his blog: bit.ly/C_MGodbolt

www.facebook.com/computerphile
twitter.com/computer_phile

This video was filmed and edited by Sean Riley.

Computer Science at the University of Nottingham: bit.ly/nottscomputer

Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharanblog.com/

Thank you to Jane Street for their support of this channel. Learn more: www.janestreet.com/

All Comments (21)
  • @buddy.abc123
    I'm a seasoned dev with 15 years experience but I'll never get tired of hearing someone talk about the fundamentals and basics of computers
  • As far as programming goes, I think the main thing that has changed over half a century is adding more and more layers of abstraction — microcode (hardware), micro-operations, machine language, low-level compiled languages, virtual machines, high-level languages, and libraries on top of libraries on top of libraries. Understanding the layer underneath where you usually work can help you take better advantage of it in your code.
  • @Bzh__
    Great to see Mr. Godbolt on here. Great communicator
  • @DavePoo
    Thanks Matt & Sean (for this and the compiler explorer). I know for many this topic can be "dry stuff", but this fundamental understanding of computing really helps someone go a very long way, and it pulls back the curtain and reveals that actually, computers aren't magic, they do very little, very fast. I think the old 8-bit model of understanding a CPU is really how we will all have to think about computers when being taught to children today, and those old computers still certainly have a place as educational tools, where the pixels are so big you can see them, and memory addresses are so few you can count them.
  • @ChopeZzz
    This is what all CS students need to start with, not HTML, CSS etc. Huge respect, great video, enjoyed every second of it! 😎👍
  • @rudiklein
    I've been in the computer industry for 40 years, and all this stuff still amazes me. The same with working on a remote computer on a terminal: when you hit a character on you keyboard, it's send to the remote computer, which in turn sends the character to the terminal and displays it. Ff'ing amazing.
  • @martinbakker7615
    Ben Eater has a great series on that. Complete from simple logic element to how to create and code the microcode in eeprom.
  • @bradleystone6498
    This is one of the best ComputerPhile episodes that I have seen. I learned more from programming a "Tandy Microcomputer Trainer" in the early 1980s than from most of the computer engineering studies that I have undertaken since. Great analogy. I love it!
  • @vincei4252
    I bought a ZX81 kit from the UK circa 1981 from Nigeria. I was 15. After seeing it boot for the first time I was then curious about how it worked. Less than a year later I'd taken the Z80 out of the ZX81 and built my own machine on a veroboard. I've never been the same ever since. 🙃
  • My first computer was an Amstrad CPC 6128, another Z80-based computer with a whooping 128KB or RAM (which the CPU couldn't access at once, so it used a paging system and the second 64KB could only be used to store data for longer term -because it was slow to retrieve it-). That's the computer I taught myself programming on (first in BASIC, then in Assembly), and my mental model of machine code is pretty much the same as Matt's. I remember how in the CPC 6128 the last 16KB of the first 64KB of RAM would map directly on the screen, so that just by putting numbers in those addresses pixels would light up in various colours. I think that helped make programming "click" for me, in that I had direct, visual feedback of what I was doing just by storing numbers at specific addresses. From there it was easy to "get" how the computer worked. I even remember the available registers of the Z80 CPU. There was A, the accumulator from the video, the relatively free BC and DE 16-bit registers, F which contained bit flags representing various states of the computer and AFAIK was read-only, or at least needed to be treated with care, and finally there was HL, the register that contained the memory index Matt mentioned. Funny that I still remember these details after so many years (nearly 40 years ago!).
  • @garywalker8493
    Wrote assembler on multiple cpus myself so I didn't expect to learn anything, yet this explanation was still interesting to me. Teaching done well is interesting it's a shame that students are so often bored.
  • @Darkev77
    This is so well executed. We request a part 2!!!
  • @benjyb843
    Very well explained 👏, my first "mental model" from high school programming had the class trying to "command" a volunteer student (who acted as the robot) to stand up, walk in a circle, and sit back down using a limited instruction set. It was explained in a very similar way.
  • @Satscape
    This is the best description of machine code I've ever heard. I've only ever wrote one machine code program in 6502, I was so proud and shocked that it worked! It was on an Oric 1 though, not a BBC micro. The Oric had a sort of BBC Mode 7 that the Electron lacked. So in 6502 Machine code I made a program display 'teletext-style' pages as a Point-of-sale display in a shop window on Mansfield Road in 1983. It was FAST because it used BLIT to move the teletext page into display memory... Rock 'n' roll ! 😁✌
  • @CuteSkyler
    There's just something about the extreme basics of computing that fascinates me immensely, please do more in the future!
  • @hashtagPoundsign
    I highly recommend Ben Eater on youtube. Ben’s video series starts with basic electronics and progresses to building an 8-bit cpu from scratch with breadboards.
  • @magicknight8412
    Still amazes me that typing codes in makes a computer do things.
  • @supertron6039
    I love this channel so much, can't believe I sat throw and enjoyed an entire video teaching machine code AND understood everything.
  • @cthutu
    Matt and I have such similar backgrounds, it's scary. I too learned machine code from that Usbourne book. I think we share the same first computer too. Also, my name is Matt. I still program in Z80.
  • @Labs51Research
    Wow I still have this collection of USBORNE books to this day .. I learned exactly the same way. still a software developer.