I've been playing with Atari 2600 programming on and off for the past few years and it is so fun programming directly against the specific hardware. I can't help but occasionally wonder if I could piece together a similar system, but I have 0 experience with electronics. I can only imagine how satisfying it must be to actually pull it off.
It really is super satisfying to get this far, I still turn it on sometimes just to check if it really works.
And I also had zero experience with electronics (and I still don't know as much as I should...), so yeah I think you could piece together something like this. :)
I feel this on a personal level, albeit on my much smaller, less complicated projects. Thanks for the amazing write-up, you are an inspiration to us all.
Is it fast enough for multi-input / multi-player?
The only multi-input game I have right now is Tetris for 2 players.
My girlfriend doesn't complaint while playing it (except when I win :P), so I'd say it's pretty responsive, even with the somewhat convoluted way the CPU communicates with the PPU and the double-buffering.
I think it will work for other types of games as well.
With all the hardware, firmware for the 3 microcontrollers, bootloader software, compiler toolchain and tools, I still haven't gotten around to actually make a lot of games for it.
I can even imagine a part II with modern components after learning this level of basics.
Such a beautifully designed chip.
I know that feeling ;)
I think we need more of that too. Everyone seems to be on a quest for perfection: perfect code, 3D printed casing, everything intellectualised to the nth degree. There's a lot to be said for the "rough and ready" approach of experimentation. However to do that you really need to be on a pursuit for personal gratification because the internet is a harsh bitch for pointing out ones mistakes.
I would love to learn more and be able to work with faster circuits like you.
Yes it's way easier to work with "slow" digital circuits I had very little issues using breadboards and really long wires, that probably look cringy to you and others.
Can I ask how you incrementally tested the video circuit as you built it? Did you have a test pattern generator or something? I know very little about TV signals, I spent some time trying to wire up an analog camera and just ragequit because I lacked a good fundamental debug process.
Well, I think it isn't that hard to get an analog video signal going.
Having a TV that took an RGB analog signal, meant that I could connect the microcontroller directly to the TV (using resistors to convert the voltage and for the color DAC).
Then all I did was get the timing right, especially with the sync signal. Along with other resources, I used this image ( http://martin.hinner.info/vga/pal_tv_diagram_non_interlace.j... ) to understand when to set the Sync signal to 0 or to 1.
When using a microcontroller you can use interrupts or you can have well-timed instructions to set the sync signal on or off at the correct time, I chose the latter. The micros I used are AVR 8-bit architecture based, so most instructions always take 1 cycle, others take from 2 to 4 cycles to execute, simply by looking up in the manual I could calculate when certain instructions would execute and build a program in assembly that would generate the sync signal successfully. And if everything was right, my TV picture would switch to black, meaning it detected a valid PAL signal.
Of course, it wasn't always this easy, for example, I had a bug when I started, I wasn't setting one of the registers correctly and it took me a day to solve it, I had to look at the code over and over until I figured out what was wrong. Not having an oscilloscope nor a logic analyzer certainly made it harder.
Another lucky thing for me, was that the TV I have (an old CRT TV) is actually quite forgiving and even if I don't feed the timings exactly, it will still show a picture, so that helped.
Once I had a valid signal going I tested sending pixels to the screen, and I did use patterns to see if I had the timing right for each pixel, if I took too long switching pixels they would get wide. So I tried some checker patterns and stuff like that, but nothing fancy.
I hope this answers your question. It really isn't that difficult to generate a video signal and also I was quite lucky to get it working early on.
I probably didn't do things like they should be done, but it worked for me.
I would say that best thing is have a logic analyzer or oscilloscope to check if the signal you're generating corresponds to what it should be, that makes it a lot easier.
However, I’m not sure if there is an easier way to get quickly prototype electronics. Opting for more ICs and a lower BoM count helps, because there’s less wiring to do in the first place.
- Being able to detect noise from the system clock crystal oscillator all cross the breadboard (using my oscilloscope)
- Seeing certain I/O pins float to a bit too high of a voltage, when they were supposed to be "low", probably due to breadboard capacitance
- Accidentally making an AM radio when I forgot to connect a wire on an LM386 I was testing as an audio amplifier
Things got a lot cleaner when I went to a PCB, but I did make it all work on breadboards first.
And thanks :)
Cardboard is a fantastic material. You can draw the schematic on, and then run copper tape along the schematic. It's easy to annotate, since you just need to use a pen. It's able to handle much more current than a breadboard, since the copper tape has a lot more metal than thin wires. You can solder directly to it, and with tape (or some other insulating material) you can cross wires without having them short.
You can also work with SMT ICs. Using a pair of scissors, you can make your own pads and solder to them. I connected an SO8 to read off the SPI data using copper tape. I built an amplifier using a spare Novena amplifier IC on cardboard with copper tape. And I have a level shifter done on cardboard with copper tape.
Bunnie has a good article on it here, including an example power regulator that's handling 2A on cardboard: https://www.bunniestudios.com/blog/?p=5259
(It seems like it's still a thing in fact http://www.nutsvolts.com/magazine/article/wire_wrap_is_alive...)
It's a really nice way to work, you solder your components onto one of those pcbs with a lot of holes, solder the pins next to em, and from that point on you can wire, unwire, and rewire to your hearts content. Its great to easily be able to undo a connection when you make a mistake.
I've kept this project to myself and would only describe it occasionally to some coworkers and friends. I never thought that many people would find it cool. And always thought that people with more knowledge than me would find a lot of flaws.
So it's really awesome to read yours and all the other comments. :)
I don't think I could write a book, but I have though in writing other posts, giving more detail in certain aspects of the console.
There's really a lot I could say about it and I only realised how much there was to say when I started writing this.
Firstly, anyone who nitpicks on a totally handbuilt computer has almost certainly not built their own, so their criticisms can be taken with a pinch of salt (that is to say while they may be valid, can probably be ignored... they're bust criticizing other people's work while you are actually getting on with building something)
secondly if they HAVE designed/built their own computer (not just built up an arduino into a thing) then they are probably more likely to help you ("Hey, have you tried.... to get around..." etc.) than try and fault you. so the only reason to hide your project is to protect it from someone "stealing" it. but I don't think that is a concern, nor is anyone planning on releasing a new design of 8-bit computer/console that's not compatible with anything that's come before.
what I'm trying to say in a long-winded way, is that this is an amazing project, and keep at it as it obviously brings you a lot of joy.
my electronics projects are all currently stalled and finding the motivation to carry them forward it hard right now, so I applaud you!
That's what you thought about building a video game console from scratch, and look how that turned out :)
A kit for this console would be crazy though, too many components, too much complexity. But for a smaller version, it could be done.
Branding...yeah, I could never get a name for it, til this day I don't know what to call it, I'm terrible with names.
Maybe I'll take your suggestion :).
I think most people are just amazed at what you accomplished :) I am!
Please consider writing a book or blog posts or at least something! But if you don't I totally understand, don't feel bad about not doing something requested, or anything else either. It's your life and your project :D
We are here just to support you and say thanks for inspiring us!
I have zero knowledge about electronics, consoles, or any of this and I am fascinated by what you did with your free time. Please write a book and publish it here. I'm sure lot and lots of people would love to read it.
Start writing a book and keep writing posts on some of the details and use them to collect emails of people interested in buying the book once it comes out. Also, get on twitter for the same reason.
He wrote a handful of game programming books in the 90’s as well.
I've reading up about the architectures and programming of computers and consoles from the 80s and early 90s lately, and have been itching to do a similar project of my own, but have been kind of floundering on where to get started. The fact that you pulled this off inspires that this sorta thing can be done.
Have you considered doing a series of blog posts going into more detail on each section of the console and your journey in getting each bit working, describing failures and successes both? I think such would be instructional to other people who want to do some similar homebrew computer/console hacking.
I was kind of surprised that your PPU design was frame buffered instead of line buffered, but I suppose I perhaps shouldn't be. I imagine the PPU chips of old were line-buffered because RAM was expensive in the 80s, and it was a good enough interface to control a scanline-based display. In my recent reading about the architecture of 3rd, 4th, and 5th gen consoles, I noticed that the 5th gen systems became fully frame buffered, as memory had become cheap and fast enough in the early-mid 90s. And a frame buffer certainly feels a bit simpler and more intuitive to think with than a scanline buffer.
I am considering doing a series of blog posts, I don't know how often I could write them or if I could keep them going, but I will try.
I'm not big in social media and I have never written any posts or anything like before this one, which is weird, I'll admit it, so all this is kind of new, but I think I'll give it go.
Old systems used line-buffers like the Neo Geo or no buffers like the NES, for example.
So yeah, going with a frame-buffered approach was definitely easier, but this was not the only reason I chose this way.
I had a lot of restrictions, I was learning a lot of stuff, I didn't know how to work with FPGAs and I stuck with DIP package ICs that I could put on breadboards and experiment. And that's why I picked the AVR microcontrollers, which are awesome but have their disavantages. They have good performance (20Mhz), but not many pins and I had to bit-bang things like external RAM access (actually the PPU accesses 3 RAMs with only 32 IO pins available), which meant that it takes "some time" to access external memory.
That's why I chose 2 microcontrollers for video instead of just one, one of them could take "all the time in the world" (one frame) to fetch information and write a frame to the frame buffer while the other would generate the video signal and dump the a frame to the TV. Connecting the two, I felt a double buffer was better.
I definitely would have preferred doing a more "traditional" non-buffered render system, but this was the solution I found with what I had to work with.
I hope serves as a good explanation and maybe I'll get to explain these details better in another post :).
One somewhat personal question, if you don't mind. You say you are Portuguese. Is English a second language for you? I don't see the telltale signs of a Portuguese -> English speaker (I have a lot of experience interacting with Portuguese speakers, and their English mistakes are pretty uniform due to the specific differences between the languages, esp regarding prepositions and tense). Your article, as many have noted, is beautifully written even for a native English speaker.
And yes I am Portuguese, born and raised and I do know what you mean, there are mistakes that are somewhat common for Portuguese speaking English and I do make an effort not to make the same mistakes. However I know my English is far form perfect and it's always easier when it's in written form.
I think that the fact that I've always spent too much time watching american/british movies and TV shows made me pay more attention to how English should be spoken :).
But anyway, thank you for saying I speak perfect English, it's actually a great compliment. :)
This is not the case. Different people make different mistakes, as any exposure to a high-school level English class will allow you to discover. There's a case for clusters of similar errors, but then again any generalizing statement is true for a sufficiently high level of clustering.
I can see how you could draw that conclusion from my post, however. I assure you there was no intent to generalize.
My apologies for misunderstanding, then. And thanks for making that clear.
I'm going to read this a few more times. It's like reading a good book about my hopes and dreams.
I actually started building a much smaller video game console with a cheap Cyclone II FPGA board (a friend of mine wanted one and I tried to figure it out how I could make something smaller and cheaper but still retro and cool) and I'm using VHDL, it's not exactly easy to learn but it's pretty cool, and I find it really hard to find good resources to learn from.
If I was to start all over again, I would use an FPGA for the graphics, for sure, at the time I just didn't know how.
And thanks again for the comment :)
I guess that the availability of information and materials through the internet has helped a lot. And also more people have knowledge in electronics and programming.
Great job, Sérgio. É muito giro.
Nowadays is so much easier to get information on how to build something apparently very complex. You don't need to go to a library or seek out and go talk to experts, you actually have access to all that through the internet in forums, articles, posts and videos.
Also it's easy nowadays to order all the things you need for a project online.
I'm actually a bit overwhelmed with all the comments and I'm trying to answer at least a few of them.
Just wanted to say that, even without knowing you, I think you could absolutely be a tinkerer or creator, just choose something you would like to build, start small and go from there. :)
Can you recommend the materials you used when learning? Books or resources etc.
This was a really interesting read, thanks for sharing.
Well nowadays there's a lot of material online, I did find a book interesting, though: "Make: Electronics", it teaches the basics in a very nice way.
Aside from that the key, I guess, is to start small and incrementally go for more and more complex stuff going towards things you like (video games, robotics, etc). If you consistently achieve small victories I think it's enough to stay motivated.
Everytime I managed to overcome something, I took it as a victory (generating the video signal, getting a program to run on the CPU, etc) and this helped me get to the next problem to solve.
I started with discrete logic and an Arduino, went on to programming microncontrollers similar to the one on the Arduino and moved from there to CPUs, RAMs, FPGAs, etc.
Also Youtube channels like EEVblog and GreatScott! are great learning resources.
For what its worth(1), I think that "learn a bunch of stuff -> go build something cool on the first try" isn't quite the right approach. I think you have to set for yourself a series of tasks and then fight like hell to figure out how to accomplish them. Start with a single blinking led. Just google "how to blink an led" and try to do it a few different ways.
In short the only "material" you might use to get started is google, by typing in "how do I..." while chasing modest goals that look like they might be in roughly the right direction. If there is a magic book out there that will "teach you electronics", I haven't found it yet. It sounds a lot like the sort of book that might "teach you astronauting".
"Electronics" is broad enough that it might be more like learning a language than learning a skill.
(1)My own meandering opinion
There might be also some kind of misconception in the way that you're
seeing something cool and now also want to get this cool stuff. But if you
aren't interested in the fundamentals - in this case electronics - and
don't have fun learning these by simple experiments - like you described -
then it's neither worthwhile for you nor you will get to the cool projects.
Once you have all that, get the Arduino do turn on an LED when you press a button on the breadboard. Incorporate some kind of sensor, if you want. After that experience, you should be ready to tackle a bigger project. Now that you have a test bed, you can incrementally build circuits from books and the Internet and actually understand what’s going on.
It turns serial signal into parallel output.
They are often found in kits like this: https://www.amazon.com/Smraza-Breadboard-Resistors-Mega2560-... (research a better one than this)
Get a Raspberry Pi (Any controller really, get what you what)
Build something useless like this: https://www.youtube.com/watch?v=Lgnopk1qmkk
There are lots of learning kits available on Amazon. That's how I "taught myself" hobby electronics. I don't know much, but this stuff is magic! So it's impressive to most just to implement a simple shift register! Blinkenlights for the win!
I am proud and honestly reading all these comments of people like you saying awesome stuff and also saying this inspires them makes me even prouder :)
Seeing all these breadboard cables going into a scart lead fills me with dread. One bump of the table and the chunky scart lead flexes in an unpredictable direction and rips out a subset of 4 hours of carefully set jumper cables. Not to mention the EM interference that so many wires must be generating.
This is very cool.
The one thing that irks me about the console design is the amount of RAM it needs. In the age where 8-bit consoles were actually being built, RAM was the most expensive part of the devices by a far margin. It is no accident that the Atari 2600, for example, only had 256 bytes of main memory, and even the very popular NES/Famicom ran on only 2kB of main memory. This "retro" design, by contrast, employs a lot of RAM chips in a variety of places, even where they are not actually needed: the CPU and PPU can be connected with different technologies (as the article hints at), and double buffering via a second VRAM chip is the kind of feature that classical home consoles would never do due to cost reasons.
Don't get me wrong though, it's still an amazing project!
But yeah, they also had less colors to work with and palettes (which were costier to implement in a software renderer). And this CPU is also faster than of those consoles.
I did give myself a more confortable system in terms of RAM and computational power.
But my aim was for a machine that would sit somewhere between the 3rd and 4th generation.
The double buffering I understand as well, if I was working with an FPGA I would not have gone with frame buffers, for sure, but that was the solution I found at the time using the components I was using and it worked.
The attention this has gotten, especially here in HN is still a bit unbelievable to me (and amazing of course). I don't want people to think this is an optimal console design or anything.
This is by no means a perfect project or "the way to go" in terms of homebrew video game consoles, it's just the way I found to do one while learning electronics along the way.
One thing that I am curious about though is whether you could use such a big project as yours for employment. E.g. if you had absolutely no formal qualifications and applied to a (relevant) company by using such projects in your CV, would they consider you?
Answering your question, well, even thought this is an electronics engineering project, I don't feel qualified to work with electronics professionally, for example, there's a lot of knowledge I lack.
I do work as a software engineer and I have done a couple of interviews myself to hire people and I do believe this helps when applying to a job, I'm not saying it completely replaces your qualifications but it might at least give you an edge. I'm seeing this as someone who would want to hire someone skillful. A technical project certainly is on the very least a nice thing to have in a CV. Of course this is just my opinion.
And if you are feeling like applying for a job based on your projects, just give it a go.
One advice I can give is: if you do have projects of your own, big or small, don't do it like me and keep them to yourself for years :P.
I really had no idea so many people would appreciate my pet project.
And in this case "a handful of 74244" is a lot more complexity and it got a to a point where I really wanted to minimize the amount of ICs I used.
Also I was felt bank switching added complexity when developing for it. This way I can write a C program have it access data and I don't have to worry about the code being split in more than one bank or having the data be in a different bank than the code, etc.
It's a nice catch though, thanks for the comment.
I once made a virtual machine for a console designed from scratch as "fantasy hardware", with its own architecture, assembly language, CPU, and so on. I'd like to be able to bring it to life some day as you have.
• TL;DR: Basically an iPad with detachable controllers and open-source OS, SDK, app store and sideloading. OR: Basically a Switch with fewer OS limitations, sideloading and lower barriers to development and publishing.
• Nintendo Switch form factor.
• Capable of connecting to external displays and using wireless controllers, mice and keyboards.
• A semi-multitasking OS, where only one app has screen focus but you can have messaging etc. apps in the background, notification overlays and use a web browser at any time. (I'm mostly thinking of the dear old PS Vita here.)
• A single, centralized app store while still allowing users to run apps downloaded from anywhere else.
• An SDK that lets you write games in the language of your choice (but if we had to choose: Swift, please.)
Ideally I'd like to see as few dangling wires when making something like this, because I have fat finger syndrome. :) I prefer joint wires with headers in them (like ATA cables) but that's just me.
I'm always impressed when someone is skilled at both hardware and software to make a finished product. It's Woz-like.
Very impressive work.
Also I had set myself a specific set of goals that obviously are not going to make sense to most people and I understand that.
It could seem like a daunting task at first, but breaking it into milestones actually makes it easier and makes the journey a lot better.
Incrível e inspirador! Thanks for sharing this and congratulations for this amazing accomplishment!
Thanks for the comment :)
This is awesome work, as someone else mentioned, I would totally buy the book.
Thank you for making such a project and for putting it online for the world to see. Your friends were right ;)
If you haven't already you should definitely add your project to hackaday.io (the community driven part of hackaday).
It's amazing how "accessories" can make even an 8-bit processor go far
Projeto fixe demais!
I built a 68k machine (no video, just CPU, Serial I/O, RAM/ROM) in high school and it was really nostalgic to see your incredible and awesome project!
Congrats on such an awesome build!!!
Can you do the same for a new project from start to finish?
Would you mind sharing what books (and kits) you decided to buy? I'd like to work on my electronics a bit as well :)
There are plenty of videos online for almost any topic in electronics, and projects online using all kinds of components and for all kinds of purposes.
Check out EEVblog, the forums are good, and there are some videos for beginners and also the Youtube channel GreatScott!.
I’ve been dreaming of building a Z80 computer for literally 20 years. I think you inspired me to stop dreaming and start doing.
This is amazing.
I'm gonna try and keep posting.
It's unfortunate how often people share files directly from their camera without first compressing and resizing them appropriately these days.
And yeah you're right...my bad...
(EDIT) It should be a bit better now, thanks for the warning
Sometimes I talk to people about some ideas and they say "too dificult, find a simpler project". Sending your post to these lazy devs.
Yeah, I already have another ongoing project based on a cheap FPGA board with a Cyclone II (quite old but it does the job), the idea is to keep it cheaper and much less complex.
The FPGA has a Z80 implementation, video, sound and handle the game controllers. An external Atmega328 is used to handle the SD Card and then just RAM, an ICs for composite video and an op-amp.
I also have some ideas for a better console, maybe a generation forward and an 8-bit computer, but...these are just ideas, I doubt I'll actually get around to do them.
Unfortunately, the physical hardware and later the code were both stolen in separate incidents. I was able to recover some version of the latter I had shared with a peer. It's posted in the same repo but probably not worth reviewing as it's from my college days and a total mess.
I'm sorry the hardware and code were stolen.
And of course it's always worth reviewing, I got inspiration out of projects just like that and besides my code is a mess too, don't worry about that.
So thank you again b/c this is legit inspiring and exciting!
I would be really curious for:
A porting guide
An fpga tutorial
(surprised by the lack of Bandersnatch jokes)
Great job on this!
how does one obtain a z80 if it's not manufactured anymore?
Actually they are still being manufactured to this day, that's one thing I didn't mention in the blog post is that you can get a brand new Zilog Z80 today, the 6502 (the CMOS version, 65C02) is also available.
You can probably get them from all the major electronic components stores (Digikey, Mouser, etc).