Hacker News new | past | comments | ask | show | jobs | submit login
Build an 8-bit computer from scratch (eater.net)
489 points by kmooney on Dec 28, 2019 | hide | past | favorite | 52 comments



Another great resource is NAND to Tetris (currently auditable on Coursera for free):

https://www.coursera.org/learn/nand2tetris2


NAND 2 Tetris is great, I don't want to knock it at all, just want to emphasize a difference between it and Ben Eater's content. NAND 2 Tetris explicitly considers most electrical concepts out of scope, and abstracts them away. Eater on the other hand, dives right into them. This isn't a complaint, and it allows NAND 2 Tetris to focus on higher level concerns (such as writing a compiler), but I thought it should be brought up.


I did Nand2Tetris for my computer architecture class. Learned a lot! Definitely recommended. It actually got me into assembly programming as a hobby


This was huge for me. +1


This series is truly excellent. Ben Eater is a brilliant teacher, and I wish I have has this series growing up - I think I'd be in hardware/electronics now... at the very least, I would have wasted a lot of time tinkering with making my own stuff!

I followed along with the clock module and when I was done I had a Matrix style "I know kungfu" moment - it all was crystal clear. And the series doesn't brush over important details (like dealing with flaky inputs that would cause extra clock pulses etc) so even though I still don't know all the math needed for electronics, I'm far more confident in making my own stuff!


It’s channels like Ben Eater, Great Scott, Bitluni, and Andreas Spiess that have gotten me into tinkering more with physical electronics lately.

It’s such an accessible hobby thanks to the abundance of online information/ideas, cheap components, and simple tools. Plus you learn so much even with the most basic of projects, and considering how much our world now depends on electronics and technology, I think it’s practically useful as well as simply entertaining to learn this stuff.



Thanks, I should’ve linked them. Will remember to in future.


No worries, happy to help.


For the last couple years I've been toying with a relay computer design. Only a few prototype circuits have been built, but I do have (several) completed designs. I'm cautiously optimistic... it should be the fastest relay computer ever built, if I actually do build it. I have a whole bunch of reed relays on hand but the boards (and construction time!) are still expensive for a project of that size.

What fascinates me is that, even with a full design under my belt which works in simulation, computation remains somewhat magical to me.


For historical background, read up on Konrad Zuse[1], who built possibly the first programmable digital computer, using relays, the Z3[2], in 1941. (Neither ENIAC nor Colossus were operational for another couple of years.)

There is a much later Zuse design, from discrete transistors, the Z23, in the collection of the Computer History Museum[3].

[1] https://en.wikipedia.org/wiki/Konrad_Zuse

[2] https://en.wikipedia.org/wiki/Z3_(computer)

[3] https://www.computerhistory.org/collections/catalog/10266994...


Ben Eater is without a doubt in my top 10 youtubers. His videos are so in-depth and explained in such a great way that I come away learning huge amounts every time he posts.

I’m sure a lot of this stuff is basic to people here, but to a software guy, I’ve found his channel invaluable for understanding how computers work at an electronics level and also just wildly fascinating.


What a wonderful time for democratized independent media when one of your top ten YouTubers isn't even in my list of 30 subscriptions.

YouTube has been my _sole_ video source for years and I'm still discovering incredibly high quality creators for very specific topics.


I think a big part of it is that he goes out of his way to explain everything relevant, and to not gloss over any details. Most other people doing similar would gloss over those details without even realizing it.


share some others like him. i would like to explore other youtubers


3blue1brown is an amazing intro to mathematics and does an amazing job explaining hairy math concepts with great visuals etc


Cosign. He's a fantastic explainer.


Louis Rossmann does in depth component level Macbook motherboard repairs and circuitry explanations. If you're into good (and comedic) explanation on mechanical stuff, I highly recommend AvE and This Old Tony.


Eevblog

Smarter every day

LEMMINO

Socratica

Captain disillusion

Ahoy

Khan Academy

Moshix

Historia civilis

Computerphile

jpkiwigeek

Ippsec

Pydata

Deviantollam

Lockpickinglawyer

Numberphile

Strafefox

Company Man

Accursed Farms

Civvie11

... In no particular order. YouTube is great.


I would add thesignalpath and mikeselectricstuff to the list. Much more advanced, but very good to learn professional PCB design


Applied Science channel is worth mentioning.


I love this type of material - I was exposed to some of it in college and found it to be extremely valuable to me during my software career. It completely changed my approach to troubleshooting.


The first time I built a computer from scratch using TTL components was in 1978 for my senior project. I have repeated the effort a couple of times on FPGA's. If you have never tried building your own computer from scratch, you should, it is a great learning experience and also, kind of a lot of fun, I guess if you are a geek which a lot of us on HN are :)


That’s a project many generations of electrical engineering students did in the university in Dresden. It was fun and great experience and admission for final thesis. I think, it’s a must for every electrical engineer since electrical systems barely exist without software nowadays.


I'm just starting on a project emulating a 4004 system and it's gotten all my geeky brain juices flowing :)


I’ve been working through Ben’s videos on the 6502 since September. It’s been a highly enjoyable way to relax and learn for me. It’s very easy to go beyond what he’s teaching. There’s so much material out there (6502.org for instance). The most rewarding for me has been taking the basics he gives on address decoding and going beyond it.


Just started on a fun educational project to emulate a Z80 processor in C. Trying not to look at any existing work, only documentation. Thinking I'll need to expand the project (emulating the rest of an actual, vintage computer) in order to run existing software and get the full kick out of it though. Suggestions? Looking for simplicity as I don't need another forever-project.

Edit: asking because there's so many to choose from https://en.wikipedia.org/wiki/Category:Z80-based_home_comput...


Be careful, if you haven't done this before or done much network programming it's easy to get weird issues with endienness. Check out the ntohs etc. macros.

IMO you should try to find a really simple computer to do first. The advantage here is you have other people's software to run which makes for a nice integration test. My first time I did the original apple and had it run the monitor program (which is nice you can just keep adding opcodes going up from the beginning of the program until it works.) For the Z80 I think maybe the ZX80 is the one where it was pretty much just a Z80, a ROM and SDRAM chip and some glue logic?


Speaking of simple computers to emulate, Advent of Code 2019 featured an imaginary computer that you gradually implement. (But do note that not all of the days are about said imaginary computer.)

I am still catching up with it because I didn’t put so much time into it yet but so far I have completed up to and including day 5 of AoC 2019.

For me, this is the first time I have implemented an emulator, and what I like about this imaginary computer is that it is so simple that I was able to build what I have built so far without relying on any external resources.

The fun part of it is working through it yourself of course, so even though I am tempted to link to my implementation on my GitHub I will instead only leave a link for AoC 2019.

https://adventofcode.com/2019


the one people try at first is CHIP8. Really simple and even with that you can not get it right on the first try


I've been meaning to do through his videos for a long while now and finally over christmas I've managed to binge watch nearly all this series.

As a software guy currently doing the Embedded Systems course on edX, Ben's videos have really helped solidify what I've read in the course.

Big example was tri-state drivers, after reading about them in the course they hadn't quite clicked, and I searched YouTube and came across Ben's video. He explained the concept so incredibly well, it clicked immediately and I've found it a good companion for the course.


I watched the whole video series in the last two weeks. I quite enjoyed it.

It suffered from my classes in that Eater actually deals with the minutiae of working with real electricity — debouncing, clock edge detection, and so forth — because he's building his CPU in the real world on breadboards. That was interesting for me to see.


For anyone itching for more Ben Eater, he's currently working on a series where he takes a 6502-type processor and turns it into a usable computer.

Here's the first video: https://www.youtube.com/watch?v=LnzuMJLZRdU


I just recently found his videos for the 6502. I really wish I'd seen these when I was going through my computing logic class. The text for that was terrible, but these videos explain tremendously well for computers work.



The description says:

> I built a programmable 8-bit computer from scratch on breadboards using only simple logic gates.

Sorry, but this is slightly incorrect. First, he is using ready-made adders in ALU which are not "simple logic gates", second he seems to use ROM in control logic which replaces tens or hundreds of logic gates one has to use of they don't have a ROM and a programmer.

If I was building a CPU, I would make 1-bit ALU and shift data bit-by-bit to save ICs because 1-bit ALU requires 4-5 simple ICs and 8-bit ALU would require 8 times more and that's too much.

Next, I would use 4-bit registers instead of 8-bit because 8-bit register requires 2 ICs and 4-bit register can be implemented with one IC. Also it allows to reduce the number of wires and amount of work to connect them. This makes CPU slower though because it has to access memory twice as often.

Also I was surprised to read in comments that in some universities students are designing CPUs as a practical project. Must be interesting.


Translation: I like to crap on other peoples accomplishments. I don't realize that adders are simple logic gates for the people who were actually there when 7400 TTL was a new thing and building ALUs out of adders is one of the oldest ways of building them (unlike "cheating" using a 74181, for example). Or that using PROMs to replace logic is just as old. I propose my "better" way of doing things that unlike the OP I'll never actually do, but I get to crap on him. I'm so disconnected from reality (or went to such a low grade school) I don't know that people actually learn how to build CPUs in school, as opposed to this knowledge being imparted from mystical higher beings directly into CPU architects skulls, or some such.

But mostly, I like to crap on other peoples accomplishments.


    "You need to enable JavaScript to view this site."
I was expecting an interactive 8-bit computer simulation webapp, but all I got was something that could've been several pages on a static site. More disappointingly, it apparently requires a very "modern" browser to view :-(

In my experience, to see this sort of anti-accessibility from someone who knows the "low-level" enough to build CPUs successfully is unusual, but unfortunately getting more prevalent. The others I'm aware of, http://www.homebrewcpu.com/ and https://www.bigmessowires.com/bmow1/ , have far more accessible sites.

Edit: looks like others here think accessibility is not a concern anymore. That's really disappointing, especially for low-level stuff.


Maybe tone? If it makes you feel any better, I agree wholeheartedly and appreciate the links to concrete example you think are done right.


imagine finding such amazing content and then being mad that it was built with modern tools.

what about the site violates accessibility? JS generated sites should be usable on screen readers. you can violate accessibility, but you can do that without js too


Not everything modern is good or positive or even acceptable. JS is not uncontroversial, for good reasons, both technical and political via its influence on society.

Lamenting that it is used when there is no need for it seems reasonable to me. The grandparent even made an effort to not just offer destructive criticism but also constructive alternative approaches.


Indeed, for me "modern" has become an overused buzzword with a negative connotation --- well-deserved too, I think. What's really sad is that this is an article about low-level stuff, and not some more "typical" topic like web applications; I'd be far less surprised, though no less annoyed, if it was the latter.


It's literally just a static page that's dumped out of a JavaScript file, Shopify iframes excluded. But if you want accessibility issues:

* The header image, saying “Ben Eater”, has no alt-text. That would be fine, except the letters are individual SVG paths.

* Likewise, the social media sharing buttons also have no alt-text. A screenreader will just see four images with links at the beginning of the page.

* The YouTube videos are constructed out of multiple links without text each, including SVG images.

* The YouTube video links open into the same window, harming usability. The "target" attribute should only really be used in sites built out of frames, and this is not one of the exceptions.

* My screenreader-type program, in "just read the proper text" mode, misses half of the headings. Outside of this mode, I have to sit through over a minute of drivel before the content, because there's no skip-nav link, and then again for the video links. (This one doesn't quite count, because it's 'cause my screenreader-type program sucks and ignores aria-hidden when I set it to "all". But the lack of skip-nav is an issue.)

* Can't even read the plain, boring old text without JavaScript. This in itself is an accessibility issue.

I got bored at this point, but I'll list some other issues I spotted while looking through the dynamically-constructed DOM:

* Identical SVG images are copied-and-pasted throughout the file, but with different CSS styles – some browsers might waste time re-rendering.

* The page makes seventeen requests even with external JavaScript blocked, eleven of which are to external domains.

* The DOM contains, no joke, eight consecutive </div>s. The removal of some of these wrapping <div>s makes no perceptible difference to the page.

* Mixing and matching semantic and non-semantic HTML tags, confusing certain "reader mode" tools.

And it turns out that this page is actually multiple pages, with no machine-accessible links between them, bundled up into one file stretched across multiple URIs. This is not the proper way to handle caching the next page. I'm struggling to articulate how bad this is.

When I click on the "kits" page, random loading animations partially obscure the top of some of the paragraphs as it tries, and fails, to add some kind of inline purchase widget. There's significant DOM bloat, and displaying the page takes up an entire core of my laptop.

Because of the caching failure I failed to properly articulate earlier, refreshing a page other than the one you initially clicked onto causes a cache miss for all of them, and the retransmission of the HTML page (though fortunately not the thirteen pages worth of stuff, which are stored in the ~0.2MB JavaScript file).

Loading the "kits" page directly and following all of the instructions the page provides (not my default configuration) causes my nice new shiny laptop to max out a core for three seconds while the browser requests the website, waits for the request to complete, parses the HTML, requests the JavaScript, requests the CSS, compiles the CSS, renders the DOM according to the CSS, compiles the JavaScript, runs the JavaScript, repeatedly polls something due to a setInterval call, performs 9 DOM Events (notorious for being the slowest API of the web), recalculates the style for and re-renders the DOM, completely hangs for 0.3 seconds for reasons unknown, recalculates, re-renders, runs some DOM events, fires off DOMContentLoaded (prematurely, not that the browser has any reason to know that – this might have accessibility impacts), runs more JavaScript to mutate the DOM further, performs several dozen incremental style updates and multiple repaints, fires off another DOMContentLoaded event, fires off the load event, fires off yet another DOMContentLoaded event, and another, and another (in amongst repeated recalculating and repainting of the DOM), fires off two more load events, etc.… Leaving behind one and a half seconds' worth of leisurely garbage collection after the page has finished loading, meaning I can't scroll until 4½ seconds after I click onto the page.

This is the only computing device I own capable of rendering the page in less than five seconds, even with my very fast network connection. Normal websites with an order of magnitude more writing, plus images and links, take an order of magnitude less time to load than this.

This website is not good. But it's nowhere near the worst out there – in fact, this would probably be in the top 60% of pages I use regularly, if I did.


Thanks for the free a11y audit!

I fixed a number of the low-hanging a11y issues that you identified.

As for using modern web tooling, keep in mind there are many business and technical tradeoffs that go into any engineering decision. In this case, dynamically rendering the content makes it easier in the future to require aspiring hardware engineers to pass a test demonstrating knowledge of WCAG 2.0 standards before unlocking any educational hardware content.


It's much better now; thanks. Most of my remaining complaints are now obsolete or easily avoidable. I think the only remaining issue is the contrast on the Projects, Shop, About, FAQ, Support text, but your existing design might be pretty enough to justify that.

… Wait, those changes applied to all of the pages‽ I'm starting to finally see the appeal of those web frameworks.


I think a big part of the reason why people don't care about accessibility anymore is because you can't make a website without someone pulling out a Bible-length list of asinine complaints, and that is for a site "in the top 60% of pages".

I know that I have stopped caring for "accessibility" almost entirely beyond the most obvious things. Most of these complaints are either totally inane and unnoticeable, or will affect so few people over the site's lifetime that I can count them on one hand. I think it's good for people to try and make your website as accessible as possible, but there's a limit to how hard you can indignantly demand people bend over backwards for you.


Most of the issues I've listed aren't accessibility problems. They're caching, efficiency and usability problems. Only the first six are accessibility issues.

The list contains “inane and unnoticeable” issues because I was checking it manually, only spotting what came to mind. This is because external accessibility tools cannot check this website for accessibility issues, because they cannot access it.

I did not pick up on, for example, the issue of content flashing up on the screen in distinct parts, hitting the "three flicker limit" heuristic for seizure safety. Sure, that's only going to effect very few people, and it's fairly low contrast compared to other sites, and on a high-end gaming PC this would all occur within a single frame (making the point moot), but it's still something to consider and attempt to minimise.

Personally, I'm more concerned with the bandwidth; the fact that the page makes requests to Google's CDN for images and fonts that should be hosted on the same domain (and ideally provided on the same connection); and the ridiculous amount of processing my browser has to perform to draw the page. There are many more issues with the page than just a11y.


Take a deep breath and understand that nothing will ever be perfect. If you have that high a standard, download the source, examine it for security and privacy concerns, an proceed if satisfied.


This project looks awesome, and I may purchase Ben's kit to do with my 7 year-old son. My love of computers and software was largely inspired by the 6502 processor. I grew up with the commodore VIC20, C64 and 128 and reading books by Rodnay Zaks in the 1980's. https://en.wikipedia.org/wiki/Rodnay_Zaks

Perhaps I should look to see if any of my old books are still at my Dad's house. This one is going for nearly $1k on Amazon. Not sure how a book from 1981 can be sold as "new" but wow.

https://www.amazon.com/Programming-6502-Rodnay-Zaks-1981-09-...


There is an iOS version of this at: https://apps.apple.com/ca/app/cpu8/id1448776028


I built a Z80 computer for my high school senior project in the early 80s. I got CP/M mostly running; the floppy controller had some bugs I never quite worked out. Pretty much started me on the career path I've taken.

I'm building a 68000 system now for fun. I know I'll never really understand my desktop, so I'd like to have at least one computer in the house that I really fundamentally understand.


I am continually impressed that that number of breadboard connections actually works for a lot of people. I never had such luck even with 3M boards.




Consider applying for YC's first-ever Fall batch! Applications are open till Aug 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: