Embedded - 468: Designed to Kill All Humans

Episode Date: January 12, 2024

Anders Nielsen joined us to talk about why the 6502 is the best processor.  Anders also sells 65uino kits on his store: imania.dk. For more explanation of what they are, how they work, attaching peri...pherals, and programming in assembly, look at Anders’ YouTube channel @AndersNielsenAA, read his blog on abnielsen.com, or read about it on its Hackaday.io project page.** We also mentioned Ben Eater’s 6502 Kit, Adrian's Digital Basement - YouTube, and Rodnay Zaks’ Programming the 6502. ** Anders was a two time semi-finalist for the Hackaday Challenge but we didn’t talk about that. Here is his Hackaday page. Transcript Memfault is making software the most reliable part of the IoT with its device reliability platform that enables teams to be more proactive with remote debugging, monitoring and OTA update capabilities. Try Memfault's new sandbox demo at demo.memfault.com. Embedded.fm listeners receive 25% off their first-year contract with Memfault by booking a demo here: https://go.memfault.com/demo-request-embedded.

Transcript
Discussion (0)
Starting point is 00:00:00 Welcome to Embedded. I am Elysia White, alongside Christopher White, who is easily distracted by the 6502 book, Sitting in His Lap. Our guest this week is Anders Nielsen, and if you've been waiting for a show devoted to the 6502, we are finally here for you. Hi, Anders. Thanks for joining us on this time machine, time warp thing.
Starting point is 00:00:31 Thanks for having me. Could you tell us about yourself as if we met at, I don't know, Electronica? A retrocomputing conference. A retrocomputer conference. Thank you. Not that it makes a difference. So I'm a master of IT management. My job title for the last five years, though, has been a Mac expert at Aalborg University, Denmark, where I manage about a thousand Macs.
Starting point is 00:00:56 And in my free time, I like to put integrated circuits from the 70s and 80s into new use. I have a small YouTube channel where I try to document some of the things I work on and try to make the subjects more accessible to more people. And I'm also a licensed radio amateur. Excellent. All three of us are. Sort of. That's true.
Starting point is 00:01:19 Not practicing. Are you ready for lightning round? Yes. Well, sorry, I'll put the book down. Unless you're going to ask questions about the bit instruction. Favorite processor. That would be the 6502. Favorite bash tool. Oh, we stumped him on this one. Cat? Cat. Favorite 6502 instruction and why is it tax? I just like tax.
Starting point is 00:01:48 Sounds funny. It would be the bit instruction. Bit, okay. What's the best way to learn electronics if you're a software person? I would say build a retro computer. First place someone should go when visiting Denmark? Top of my mind, the Sioux. Would you rather take apart one board all at once
Starting point is 00:02:08 or take apart a dozen boards kind of at the same time? Oh, I hate to hurt boards. Ooh, the salvaging thing's going to get more interesting, I bet. How tired of Hamlet are people in Denmark? Is this really a question?
Starting point is 00:02:23 It doesn't help me, really. I think Shakespeare got some things wrong. Favorite fictional robot? That would be Bender from Futurama, because he has a 6502 for a brain. But I guess the Terminator would also count on that criteria. Terminator had a 6502 for a brain? You bet. I did not know that. That's awesome. I think there's
Starting point is 00:02:50 a scene where you can see the assembly code scrolling past. Oh, right. Yeah, I do remember that. Right. Like a HUD overlay where you're looking through his eyes in a couple scenes and it's scrolling text by and there's a bunch of assembly source.
Starting point is 00:03:05 And they were both designed to kill all humans. So, I guess 6502 is a good for that. All right, better. We are happy to be sponsored this week by Memfault. Memfault provides a device reliability platform for IoT monitoring, debugging, and updates. Device operation no longer needs to be a scramble as issues with fielded units pile up.
Starting point is 00:03:42 Instead, Memfault gives developers a more scalable and sustainable process to accelerate time to market, de-risk product launches, cut development costs, and deliver higher quality products. So if you're wondering how you're going to monitor your units once they're shipped, or whether your firmware update plan is secure enough, it's time to take a look at Memfault. Or you can read their interrupt blog for all of its fantastic goodies on how to debug hard faults, monitor units, or generally write good embedded code. Embedded FM listeners will get 25% off their first year with Memfault. If you request a demo through go.memfault.com slash demo dash request dash embedded FM. It's a link you can find in our show notes.
Starting point is 00:04:21 Thank you to Memfault for sponsoring this week's show. Okay, then let's go to the 6502. One of the listener questions was, in fact, what is your favorite processor and why is it the 6502? So let's go ahead and go with the second part of that. Why the 6502? It's not certainly the latest and greatest. Well, I think it's cool because it really started something. Well, it's a processor from the middle of the 70s, so what could it possibly have to offer? But I think the cool thing about it is the history and what it made possible. Suddenly, because building a microcomputer in the 70s wasn't something you just did in the weekend. It was expensive and it was hard and you needed to
Starting point is 00:05:14 learn a lot of things. And the 6502 came along and suddenly you could get it at a tenth of the price of a 6800. And it was simple to use, had fewer instructions, and it was just ready to revolutionize. And that's what it did. And back then, there weren't a lot of choices. I mean, we talk about embedded these days. And I know these were microcomputers, not embedded projects and things. But some of the projects people did with microprocessors would seem very familiar to people making little arduino projects now and they weren't necessarily full-fledged computers but now we've got oh is you know 600 000 picks and 35 different million
Starting point is 00:05:57 flavors of sts and you know just so many microprocessors and microcontrollers out there but back then it was what you know a half dozen that a hobbyist really had access to? Yeah, I'm not even sure you did. You take something from Intel or Motorola and that's about it. Where does the 8051 fit in this? I'm familiar with that one. More familiar than the 6502. Well, I think it came later in the beginning of the 80s, like that.
Starting point is 00:06:28 And, of course, it came with, I think it has about twice as many instructions. And it has a Harvard architecture, which makes putting it all together a little bit more complicated if you need a separate memory space for, separate address space for RAM and code. One of the really cool things about the 6502 is not only that it was one of the first wiki that people could get their hands on,
Starting point is 00:06:57 it feels like one of the last ones that you could write a book about and the book could be a couple hundred pages long like if you if you look at the current processors you can get a manual that's a thousand pages long and still has pointers to whole other manuals it isn't a complete manual at all but the 6502 you cannot understand all of it yeah and this book wastes 100 pages on explaining binary to you and stacks and basic programming techniques before it even starts talking about the chip. The 6500 reference manual, it doesn't read like a legal document.
Starting point is 00:07:41 If you read an STM32 reference manual for any chip, it's going to read like a legal document like uh if you read an stm32 reference manual for any chip it's going to read like a legal document not like a like a book if you read the 6500 programming manual it's going to sound like a book something you actually want to read in your your free time it's uh it's amazing when what what people do when they don't have a template that says we have to protect our behinds. Right. Right. And I mean, the ST manuals, sorry to bash on ST today, but all of the microprocessor vendors, the manual does end up being a contract of what they're providing. But the 6502 didn't have that formalization. That was a different time.
Starting point is 00:08:34 I mean, when you bought a computer in the late 70s, early 80s, half the time it came with a service manual and the source code of the ROMs and a schematic. What was the last product you bought that didn't come from, you know, EMSL that had a schematic? Okay, so the 8051 came a bit later and had way more instructions. And then we have, that's another processor that people know about, the Arduino UNO's at Mega 328. I just want to jump in here, because those are microcontrollers.
Starting point is 00:09:08 There's a slight difference. Okay. In that the microcontroller has most of what it needs in the package. It has the memory, it has the... All the clocking stuff. Clocking stuff. If you're building a computer or a project with 6502, you have a lot more work to do. Right?
Starting point is 00:09:25 Because it needs... Like if you talk about an 8051, you have four I.O. ports, you have timers, you sometimes even have a serial port. You have, at least for the modern ones, you have flash and RAM and everything built in. And the external stuff, usually you can get away with a one-chip solution for an 8051. But with a 6502, everything is just, you get an address space, a completely empty address space
Starting point is 00:09:56 from zero to FFFF, and you just fill it in with whatever RAM and peripherals and ROM you can think of. So it's kind of like the CPU in a modern microcontroller. It's like the ARM Cortex M0 part, not the whole chip. Yeah. And so with the 6502, you had to build out a whole computer around it. Yes.
Starting point is 00:10:25 Okay. It's funny because we don't often have to make that distinction any longer. The Raspberry Pi Pico doesn't come with flash, and that was kind of a mind bender for me. I mean, sure, it made it a lot cheaper, but I'm so used to having flash. It's been like a decade since I had to worry about where my flash came from. It's always been on the chip, but that hasn't always been true. And apparently with the 6502, it was never true. Okay. So the Atmega 328 in the Arduino Uno has flash, has all of these IOs, and it has a core.
Starting point is 00:11:05 It's the AVR core, the ATtiny core. I don't remember what it is. It was the 8-bit Atmel core. Do you know how that's different from a 6502? I think the architecture of it is somewhere in between a Harvard architecture and a von Neumann, because it does separate RAM and ROM, but you have instructions to read the code and write the code anyway, to write the flash. So I'm not really sure. But it has an ADC and it has everything built in you could dream of and it's funny because we're comparing microcontrollers from 20 years ago and 40 years ago and and almost 50 years ago for for the processor for for the 6502 and and of course the appeal of the 6502 is that everybody knows it from their favorite childhood gaming platform or computer.
Starting point is 00:12:10 Or the Commodore 64, the Atari 2600, the… Apple II. The Apple II, of course, the Apple II. All the Apples. And the Commodore PET. All of them. And the funny thing was, I read an interview, an old interview with Chuck Petal a few weeks ago, and he made it completely clear. The 6502 was not supposed to go in computers.
Starting point is 00:12:42 It was supposed to go into every single cash register in the US. And that was it. Yeah. single cache register in the US. And that was it. That was the intention. Make it an embedded processor to make something you can use to make a cache register. That's it. And make it cheap. Hence the binary code of decimal. Okay, so what's the
Starting point is 00:12:58 6507? Is that how you say it? Yes, that is how I intended for people to say it. It's a 6502 core in a 6507 package. That's a tiny bit smaller. In a 28-pin package, then it's got a ROM chip, and then it's got a RIOT, which is my favorite acronym of all time,
Starting point is 00:13:21 because it's a RAM, I-O, and timer module, a peripheral that connects to the 6502, and it includes two IO ports, and that's it. Okay, RAM, IO, and timer stands for Riot, or other way, but Riot is those. Yes, and then we have the ROM and the CPU, and that's everything you need to make a, well, basically anything you need to make a microcontroller.
Starting point is 00:13:48 Just split up. Is this in a chip? Is this on a board? This is on... It's basically an Atari 2600 and an Arduino clone at the same time. Okay. So... And the 6502, how does it, you said it just has address space. Does it have
Starting point is 00:14:09 address lines coming out of it to go to the ROM? It has a data bus of 8 bits and 16 address lines. Well, technically the 6502 does, but the 6507 on this board only has 12.
Starting point is 00:14:28 So we only get, what is that? That is 8K of address space from 0 to 1 FFF. And so you actually have to have parallel bus. Everything. Address and data comes in over lots of lines. And you have this Riot chip and a ROM chip and the 6502 core inside the 6507. Was that what you said?
Starting point is 00:14:53 Yeah. And so all of these together go on a board that is in the Arduino form factor. Correct. Cool. And then there is one tiny piece of address decoding needed, and that's an inverter that takes the top address line and dedicates half the board to the ROM, so you can read 4k of ROM, and the rest is dedicated to the... So there is
Starting point is 00:15:19 half of all the address space dedicated to a timer and two I.O. ports, which might seem wasteful, but it's... Well, how else are you going to split it? That's how it worked on the Atari 2600 too. You don't need it, why bother? How do you program this? You don't use the 6502 to write to the ROM, and you called it ROM, like it's really read-only memory.
Starting point is 00:15:45 My intention here is that it works exactly like an Arduino Uno. You grab your serial, and then you connect that, and you use the bootloader in ROM to write to RAM. So it's a little bit like an Arduino Uno, except it's a little bit more volatile. Okay, so you have to program every time you start. So you can write about 50 lines of 6502 assembly and get it in RAM. And then if you are going to reuse those lines, you put them in ROM and you flash a chip. Okay. What if I wanted 100 lines? Then you have to put them in RAM twice and flash the chip twice.
Starting point is 00:16:26 Okay, all right. I do have a little project going on with some people we're talking about. Let's put a bootloader on it, put that in the ROM, then make the read-write line available to a flash ROM. So it is possible to swap over the bootloader, throw that in RAM, flash the ROM, and then put the bootloader back. A little bit...
Starting point is 00:16:54 Yeah, a little bit like the goat and the lettuce and the boat and the chicken? No, the wolf. Yeah, you can just write a script to do it, though. Yeah. What are you hoping to use these 65 Luinos for? Well, a lot of the things we do these days, at least as a hobbyist, is twiddling bits.
Starting point is 00:17:18 Just twiddle a few bits. We want to turn on an LED. We want to talk to some I2C peripheral. So a lot of the things you would use a normal Arduino Uno clone for. We're not going to be doing DSP with it, but it'll do a lot of the same things. And hopefully it'll teach some things along the way. Do you program it in 6502 assembly? Is there a compiler? some things along the way. Do you program it in 6502 assembly?
Starting point is 00:17:46 Is there a compiler? How does a compiler only get to like 50 lines? Well, there is a compiler. I'm actually using the CC65 compiler package, but I'm only using the assembler for now at least. And that means, yes, I have a few videos out where I teach some basic 65 or 2 assembly and go through what you can do with it and how I wrote some of the routines. And it's basically to teach this is an I squared C bus. This is how you can do it by just putting the lines to high impedance and use what you have available.
Starting point is 00:18:29 I2C is hard though. I2C requires a state machine and you can have errors. Why I2C? Because then you can talk to a lot of things. And like I said, it's an Atari 2600, but if it only has the CPU and the ROM and a cartridge and a Riot chip, then what do you see? So I need a little I2C display on it to act as the screen if I want to make a little Flappy Bird clone for it.
Starting point is 00:19:01 So the cool thing, just a little digression, because you were talking about programming it in assembly, Alicia. The cool thing about these chips, and you kind of alluded to it with talking about the ARM reference manual and stuff, but the cool thing about these chips is they're very simple. Like the instruction set.
Starting point is 00:19:20 I am holding the instruction set reference pages here in this book. It's 70 pages. And there's a giant diagram, and each instruction is one page with a giant diagram of how it works. That's it. I mean, you could learn enough to write a simple program using, you know, the 6502 instruction set in an hour. Maybe not an hour, but it's extremely simple. So, I mean, the choice between C and 6502 assembly doesn't seem that big a deal to me.
Starting point is 00:19:54 But as a learning platform for how computers work, starting with this instead of starting with something modern seems like a great idea. And the limitations mean you understand the underneath of things. Instead of in C, like, people can really learn C and still not truly understand what memory is or how it's laid out in the processor. You don't get that if you're actually dealing with individual addresses.
Starting point is 00:20:28 And Anders said I squared C when I asked, but one of the things he didn't say is, he's only got two I.O. ports, he can't do SPI. Right, right. Oh, of course I can. I have two 8-bit I.O. ports. Oh, okay. Oh, okay. They're wider than, okay, they're I.O. ports. Oh, okay. Oh, okay. They're wider than, okay, they're two 8-bit ports. Okay, okay.
Starting point is 00:20:48 That's not so bad. I thought you had two GPIOs. Yeah, I thought it was two GPIOs. It just seemed like not enough. But, you know, the basic concepts haven't changed. They're just built on, right? So this has stacks and interrupts and flags and all that stuff. And the instructions do kind of the same thing that modern instructions do,
Starting point is 00:21:07 just a lot less of it. And the memory map isn't something you get from the linker. It's something you make as your program, and you have to remember what it is, because if you want to talk to that memory again... No, no, no, no, no. No? No. Okay, tell me. It's not something you make.
Starting point is 00:21:27 It's something you put together on your board that is hard-coded. If you don't put in that inverter, you will have code and nothing else because you haven't split your memory map into two yet. Right. Your memory map is half is wires. Wires. 4K going to the ROM and the rest going to the Riot chip. If the 13th bit isn't flipped, then we're talking to something else. If the RAM output is connected to, what is it the address line 12, basically.
Starting point is 00:22:07 I was thinking about where you're putting variables in your code. When we deal with C, C puts the variables wherever it thinks they should be, whether they should be on the stack or globals that are initialized go in data and ones that aren't go in BSS. And C keeps track of where they are for you. You don't ever have to say, my address is at this address
Starting point is 00:22:32 or my variable is at this address. But when you program in assembly... You just kind of set some macros up and say, well, this is a variable at this address and this is a variable at this address and you kind of partition stuff out. I just define everything at the beginning and overwrite a lot of stuff and
Starting point is 00:22:49 make sure my pointers are all over the place. Because you're the compiler. And it makes you appreciate C very quickly. But of course, the fact that it only has 128 bytes of RAM means... You can get to know each one individually.
Starting point is 00:23:07 Yes. But it's those macros. And I will know when the stack grows downwards and hits what I thought I put in RAM. Yeah. It's those macros that I think of as the memory map in a software sort of way. Because you have to do it yourself. And the CC65 compiler, it does have a memory map file where I get to define what do I have set aside for RAM and stack and ROM. And what do I expect it to do.
Starting point is 00:23:41 But it's kind of a nuisance to me because I don't use it very much. So I just have to fill it out and forget about it from there. So you mentioned you do some salvaging of parts. Is the 6502 a salvaged sort of part or are there new ones being made? Oh, in my case, most of them are absolutely salvaged, but not by me. I would not want, I can't recommend anybody to start desoldering components from boards from the 70s or 80s. If I have a 2600 lying somewhere that's kind of broken, I will fix that right up because that's just too sad. But back in the 90s, there was a lot of Atari 2600s and Nintendos lying around that just were going to the dumps. And from the dumps, where did they go? They went to China where all these boards were salvaged.
Starting point is 00:24:43 And of course, they saved the chips. So now they're coming back. Because you can just go on the markets and get these chips. And I promise you, they come from repurposed Atari 2600s that suffered a very sad fate. So you can buy chips that have been taken off of boards, that have been shipped across the ocean, that have been thrown away, that have been toys that were probably originally built in China
Starting point is 00:25:20 and then shipped across the ocean? It's what they call the circular economy, I guess. I guess that's better than the circle of life. But in general, I think I just saw a scary, scary Veritasium video where he explains the dangers of lead poisoning and lead in baby teeth and all that stuff and how it makes you lose a lot of IQ points. So I wouldn't recommend anybody to play with that amount of leaded solder in these days. So absolutely do it in factories and let's save some old chips, but don't try this at home.
Starting point is 00:25:56 This seems like a good way to break the chips. I mean, if I was desoldering them, most of them would probably be melted by the time I was done. Hey, if you're working on something old enough, they're just socketed. That's true. Do you worry about the chips you get? Are they usually working? I absolutely worry about them. I think what happened is a lot of people complain that they get chips with the wrong markings.
Starting point is 00:26:29 And yesterday I got two shipments of the same 6532 Riot. I got 12 in one package and 20 in the other. And the 12 of them I ordered as Rockwell ICs. But I can see from the packages that they all have the same writing, but they're all from different manufacturers, basically. And in that case, 3 out of 12 were bad. I had to sit and individually test them all. And the other package, 19 out of 20 were good.
Starting point is 00:27:01 But basically, I think they are pretty aggressive with them when they take them out of these boards or did take them out of the boards in the 90s, I guess. So in a lot of the cases, they do have to rewrite the markings. And I think they almost do it to order. If I order 20 UM6532s, I get 20 UM6532s, but they might have been something completely else, completely different yesterday. So it's the same IC in there, just from a different manufacturer. And it probably works. Do you worry about the way they're treated or about the silicon degrading itself? Not really, because these are for hobby use. I would never put them into production.
Starting point is 00:27:51 I would never trust my life on them. But when it's for experimenting, I think it's a very cool way to get really, really cheap chips. And you said you test them. How do you verify the component? I put them in a socket. I usually have some software to test the ports. And there's not a lot to test. Usually, if an address line is bad, then it doesn't work. If the port is in a bad state, then I can see that easily because it's either pulled high or pulled low or something's up.
Starting point is 00:28:33 So if I can see that it behaves like it usually would, then it's probably good. So I can test most of it in software. Of course, if I went through, so many people have written so many routines to test 6502s over the years that I can find. Like down to the instruction level tests for how does this instruction affect this flag that it's not supposed to affect. It's so cool. I don't go that deep, but I could if I was worried about the quality. So you make YouTube videos and you make the 65 Ueno to help people learn more about what's actually in the chip
Starting point is 00:29:19 to rip away some of the abstraction and start to understand the concrete what's happening. Why do you do this? Well, I think if you separate the CPU from the peripherals, it's easier to understand the relationship between them. And if you know a little bit about the logic, the way the address lines are moved around to address certain peripherals and ROM and RAM,
Starting point is 00:29:45 it's easier to understand how everything works, how a computer is made, how a microcontroller works on the inside, because you can't really take apart an Atmega 328 and see how it's made on the inside. And who are you making these things for? To be honest, mostly myself, maybe. I don't think I'll make a video that is just teaching basics, because usually I learn a lot myself.
Starting point is 00:30:17 How did you get into making the videos? Or what came first, the 6502s or the videos? 6502 predates almost all video. So it predates me, that's for sure. Thank you, Captain Obvious. When you started working on this, did you start working on the 6502 as a board first or the videos first? Oh, I started with the board first. I think I stumbled on Ben Eater's videos and I started making my full-size 6502 computer.
Starting point is 00:30:57 It's a little bit more full-fledged. It has VGA, it has everything you need in a decent size. Not like the 128 bytes of RAM, but more like 32K of RAM. So it can actually do some stuff. And when I had that going, I started putting out some videos. I think my first video was about, can I make this 6502 computer running at 2 MHz? Can I use that to drive WS2812 LEDs? Can I do that?
Starting point is 00:31:30 So it was more like a personal feeling. Can I do this? It's been done before in so many other ways. Can I do it this way? Quests. So we were talking about what other chips were around at that time. There was the other one that comes up a lot, which was also in arcade, like console arcade games. Not console.
Starting point is 00:31:53 The cabinets. That's the word I'm looking for. Arcade cabinets in big arcades. It was the Z80, which is another 8-bit processor that everybody loved. Which I think was actually a little bit, it was similar in price, I think, to the 6502 at the time. And there were some home computers that were based on the Z80. But there was a Z80
Starting point is 00:32:10 later on, I think RadioShack used the 6809 and a couple of things, but there were these a lot of these 8-bit processors. And some of them kind of continued on in their lives. The Z80 was, I think it was related to the 8080, right? And so...
Starting point is 00:32:28 I'm shrugging my shoulders going, uh-huh, uh-huh. Yeah, I think so. So it kind of, you know, is a part of the family tree of X86. Oh, I think I remember now. It was, his name was, was it, it was, okay, don't quote me on my history here, but I think it was Federico Fagan that was on the Intel
Starting point is 00:32:54 4004 team and then he went off to make Cylog. Yeah, that sounds right. So it was the same guy that went off and made a better CPU at a different company. And the 6800 was Motorola, and they then made the 68000, and then PowerPC, and all of those sort of kind of exist. Here, I finally arrived at the question.
Starting point is 00:33:16 Why do you think the 6502 kind of died? Because they had the 16-bit version that went in the Apple IIgs, and then that was kind of it. Better things came along. Better, more powerful things. Like, Commodore kept using the same old, same old 6502, no optimizations until they called it the 80 series, the way later series before they optimized that. It was just underpowered. That's what I think. The world had moved on.
Starting point is 00:33:55 Have you ever played with the 65816? C816, that was it. Nope, I have not. I have stumbled on a 65 co2 once in a while uh yeah usually i try to make everything uh absolutely compatible with both both the 6502 the original and the the cmos version because they do have a little bit of a bit of an incompatibility so i try when i make a board to make a little jumper. You can switch if you use a CO2 instead. I try not to use the, what do we call them?
Starting point is 00:34:35 Not the, well, let's just call them what they are, the illegal instructions that you can. Wow, that was my next question. Because it has 56 instructions, but it also has a bunch more that'll also do this thing, but also randomly transfer the accumulator to X at the same time. So you save some time like that. But of course, they only work if the silicon is exactly the same,
Starting point is 00:35:00 and they are unintentional from the designer. Ah, okay. I didn't know the whole story behind those. I knew of those because the opcode is what? Is it 8 bits? Yeah. So there's only 56 populated in there. 200 are free?
Starting point is 00:35:18 You can do whatever you want with them. Oh, yes. And I think Rockwell and Western Design Center did. Western Design Center put some instructions in there. Rockwell also put some instructions in there, but not the same ones all the time, I think. Of course not.
Starting point is 00:35:39 Were those undocumented or secret Rockwell instructions? I think they did manage to stick with some of the same ones for the CO2. But I think they all lost the undocumented ones when they remade the 6502 into the 65CO2. Because brand new silicon, so those random opcodes didn't do the same thing anymore. I think they were used heavily in the Nintendo, the Nintendo Entertainment System. A lot of programmers needed that extra oomph. I found a list of some 8-bit processors and their timings, so let me clear that up. The 8080 and 6800 were launched in 1974.
Starting point is 00:36:27 The 6502 arrived in 1975. Darn. The Z80 in 1976 and the 6809 in 1978. Okay. And so there were also the ones of the 1980s in no particular order, the 65C02 and 65802, and the 8051, and the AVRs, which are the core of the ATmega. Oh, those are 80s? The AVR, yeah, that's an 80s core. And it's 8-bit.
Starting point is 00:37:00 Yeah. it's 8-bit. So it wasn't like, I mean, yes, they were 20 years apart, but they were both 8-bits and they were both chips that were initially programmed in assembly more than C. And then there's the 68HC, which is in the 80s as well. So that's a little bit of the history. The Z80 was in the TRS-80 right, hence the 80 I guess I guess now putting it that way makes it obvious, yes so yeah
Starting point is 00:37:35 that's a little bit of the 8-bit history of early processors and then things went to 16-bit although they did it in a very inconsistent way and then now we to 16-bit, although they did it in a very inconsistent way. And then now we're in 32 and 64. What about picks? We don't talk about those in this show.
Starting point is 00:37:55 No one knows where those came from. Given the way that their instructions is? No, I mean, picks have a good history, and they do fit in here. I don't remember their risk. By comparison, every single processor you're talking about is risk. Well, yes. So we don't get to talk about Intel at all? Go ahead.
Starting point is 00:38:21 I didn't. Did they have an 80? IBM liked them in the beginning of the 80s. Yeah, the 8080 and the 8088 were 8-bit. Well, the 8080 was 8-bit in 74. So that was Intel, and that was one of the earliest, as opposed to the Motorola 6800. Pix came out in 76. Yeah, I wonder why Pix weren't on my list.
Starting point is 00:38:47 They don't have a number. I think I have my PCXT motherboard here, which I would call my favorite salvage. Yeah, it has an 8088 CPU. And I think the funny thing about that is it has an internal 16-bit bus, but external 8-bit buses. So is it a 16-bit? Well...
Starting point is 00:39:11 But it has 16-bit instructions, right? It can do 16-bit things, whereas the 6502 couldn't, if I remember. So you have salvaged boards? You said you don't salvage the chips yourselves do you salvage the boards yourself
Starting point is 00:39:28 or do you buy those from somewhere if I find something I can fix up I will absolutely do that I won't buy things just to tear them apart where do you find things to salvage that would be on the Danish version of
Starting point is 00:39:44 Craigslist or something like that. I wish I had a better place to go. No, it works. And are there, like, how do you do it? Do you just open it up and look for something wrong? Or are there tools you use? Is this about checking volts?
Starting point is 00:40:04 Although you may not have a schematic, so how do you... Tools and techniques, what do you have? I start with a multimeter. First, let's check if all the power lines are shorted. That's a very good place to start because everything old has bad caps, right? Yeah. And if you... And of course, what we didn't have in the 80s, we have Google. Every board has its usual suspects by now, if it's that old.
Starting point is 00:40:35 And it doesn't matter if it's a PS2 or PC XT or an original PC or an Atari 2600, they all have the usual suspects when it comes to bad caps and what degrades and where does the electrolytic fluid run out and where does it go and how to fix a bad floppy drive. What is it?
Starting point is 00:41:00 Adrian's digital basement, I saw him do a session where he just fixed, what was it, 50 five and a quarter inch floppy drives. You can find anything about how fixing anything old by now. I bet even Chad GPT knows.
Starting point is 00:41:17 Yeah, I should probably open up this Apple II and make sure the caps are alright. Last time I ran it was eight years ago. And weren't you going to get the ethernet working yeah i bought an ethernet board for it but i never used it i was gonna put it on the internet or something i don't know it's amazing i mean you asked about the hardware degrading or the silicon degrading it's it's pretty i mean the chips themselves are pretty resilient i had some ram chips go bad but I don't know how often a CPU goes bad if nothing bad has happened to it.
Starting point is 00:41:48 Don't tell me. Well, speaking of Steve Wozniak, when he was making the Apple II, he was going to the edge of what this poor 6502 could handle. So he said he always needed a fresh 6502 at hand because the ones he had would go bad. And what he was talking about was the capacitance rating on the internal caps going down a little bit with burn-in. I see. So he was trying to stop the clock for more than 40 microseconds. But it turns out he was wrong when he read the Synergy Data Sheet,
Starting point is 00:42:35 because it didn't say he could stop the clock for 40 microseconds. It said you could lower the cycle time to 40 microseconds, but it still had to be a 50-50 cycle. So he was trying to stop it for 40 microseconds, but they only said, don't go over 20. So he would lose registers while he was trying to write the screen. He settled on something different, something a little bit better. But that's the stuff you're up against.
Starting point is 00:43:09 So if you don't try to run it at multi-megahertz, you'll be fine. And I think, what was it? It was, they interviewed someone who had a lot to do with the original 6502. And they said, if it does three megaHz, we put a good rating on it. If it doesn't do 3 MHz, we call it 1 MHz. So that's how they sorted them in the beginning. Either it does 3 and it's a good one, or it doesn't do 3 and we'll see. Isn't that how they sort ST chips now?
Starting point is 00:43:44 I mean, there is chip binning still for all kinds of things. Memory more than anything. How much good slash you have. GPUs as well. You had a question for us, Anders. Do you want to ask it or do you want me to look up what I have? I can ask it. Go ahead.
Starting point is 00:44:03 Why do you think it's so common, it seems to me that way at least, to start when you're making something new, that you start with an overpowered MCU or development board for something really simple. And then when you finally get to production, you try to work your way down and you fail to actually do it when you need to make a million of something. You start with a board that has Bluetooth,
Starting point is 00:44:28 so you use Bluetooth and Wi-Fi and everything, and then you realize, oh, it has to scale too. When does it make more sense to start with a 10-cent CH32V003, 10-cent micro, and then work your way up instead? It depends on how long you have between time to market and when you're starting. Because Moore's Law works in our favor. If I have a chip that's $5 now and I need it to be $2 for the bulk of my sales, and my ship date is in two years. I have a good chance of making it.
Starting point is 00:45:17 The processors get cheaper all the time, and engineering gets more expensive all the time. And engineering gets more expensive all the time. So if you start with an overpowered processor and you just wait for it to get cheaper, that is an option. But if you start with an underpowered processor and you don't have enough engineering resources to understand that level of engineering, or you have a marketing team that isn't sure what they want, which seems to be all marketing teams, the overpowered MCU gives you so much more flexibility, as well as putting you in a space where you might be able to get more skilled and experienced engineers. If you start out with an 8051, sure, or a 6502 core, you have a lot of people who like it and who enjoy it, but don't necessarily program professionally for it. And so you want somebody who can play Tetris with what few resources you have,
Starting point is 00:46:31 and they need to be an expert, and they need to be given time and understanding of what the goals are. And if you change the goals, they're going to start the assembly all over again. You don't get the flexibility of parallel processing a lot. And so it's just simpler to start with something too big and let the market take the pain of the price away, ideally. Do you have a different thought? Those thoughts, plus a couple other things. One is, I haven't actually seen that be a problem that often. The opposite problem has happened more often, where you bought something
Starting point is 00:47:11 you thought was overpowered, and then by the end of the project, you realize you don't fit in that either. Especially with modern stuff, like, you know, you're talking about Bluetooth or networking. And then you say OTA, and suddenly you need twice the amount of flash. Or the worst thing, a display. Oh my God, yes. You want graphics. And once graphics gets involved in a display, well, now you have a huge amount of memory moving around,
Starting point is 00:47:33 and you have to move it around at a certain rate. And if you don't pick the right processor, then you don't have enough for, say, double buffering or storing assets and things. And this is where marketing starts to input. And they say, oh, we want this to be fancier. We want the graphics to be fancier. And as they move up the fancy, faster, smoother ramp, your processor starts to be not enough. Even when on paper at the beginning of the project, it's all fine.
Starting point is 00:47:58 We can fit all of this. But, you know. We can totally sample 44.1 kilohertz audio and do this and that and signal processing and yay. Oh, but then we added a display. Oh, crap. Now we can't do anything. So I haven't seen it be that often where it definitely happened, but on much larger projects where people are spending tens of thousands on electronics when they should be spending hundreds rather than something that's $5 and they might be able to get away with something that's a quarter. The other thing is that double E's hate changing parts. And once they make a board, they don't want to hear from you in a year that you need to put a different micro on it,
Starting point is 00:48:35 in my experience. And then that goes on all the things that Lisa's talking about with having to, you know, if you don't have a big enough part, you can get away with things, but then you have to be a specialist in different ways. Whereas now there's so much infrastructure for STM32s and AVRs, any microcontroller out there, there's libraries and things to help you. Even though I complain about tools all the time, there's just a ton of infrastructure and language support. And if you want to write software quickly, you want those things, even all the way up to things like MicroPython or CircuitPython, where if you've got this overpowered processor, now you can write code in very high-level languages that people are used
Starting point is 00:49:19 to from desktop world. So I agree it can be a problem, but it's going to be highly project dependent and oftentimes you're hurting yourself by trying to fit into a small space too early, I think. And you hear about it more often than it actually happens. You hear about it because it's a big deal when it goes that way. Or it makes projects fail, or it makes companies fail that they couldn't deliver on time or for the right price point.
Starting point is 00:49:58 But I guess as a EE, you don't get paid more to go 10 times under bomb cost for one part. Right. You don't get a promotion for that. You wasted our time. We have to write more complicated code now. Or something like that. And there is a trade-off between code complexity and processors to some
Starting point is 00:50:17 extent. When I worked at LeafFragant, when we made toys, and we did ship in the millions, then we used some pretty sketchy processors. Yeah, the huge volume push definitely puts pressure on. But when I work with smaller companies now that are more startup range, I strongly encourage them to overplan because they won't make it without a product in the market.
Starting point is 00:50:49 And cost reducing second is so much simpler when you know what you're making. And startups don't usually know what they're making. Or what they're making when they start isn't the same as what they're making when they end, and so you need the flexibility. It's a trade-off between flexibility and cost more than anything else. Yeah, it's hard. And the design phase is hard too. Fitbit was difficult the flexibility. It's a trade-off between flexibility and cost more than anything else.
Starting point is 00:51:09 Yeah, it's hard. And the design phase is hard too. Fitbit was difficult because those were all ARM Cortex somethings, I think, for the most part. And, you know, so they're designing, say, a smartwatch, and you've got a lot of inputs to that spreadsheet to tell you whether or not you've got a part that can do your thing, and there's a lot of you've got a lot of inputs to that spreadsheet to to tell you whether or not you've got a part that can do your thing and there's a lot of unknowns animation speed yeah all of that number of animations marketing truly needs versus how many they want and so yeah and so i'm just remembering back to like trying to come up with clever algorithms to cheat stuff because this thing just didn't have the speed. Oh, it works.
Starting point is 00:51:48 And they were still expensive chips. Yeah. You know, a few dollars a pop probably, which isn't, you know, when you're making a $100 wearable or whatever, that's a lot. But when you're making a $20 toy, you are still talking about 8051s and chips that you maybe never heard of.
Starting point is 00:52:06 At LeapFrog, we used Sun Pluses, and they were very specialized to program. Very few instructions. I want to know why somebody hasn't put a massively parallel 6502 core together with like a million 6502s. That's not what the propeller is, is it? No. Those were like basic stamps or something? I don't remember what those were. I think they were some custom thing.
Starting point is 00:52:29 Weren't they in like an FPGA? I don't know. Were they in FPGA or something? The parallax propeller, yeah. 32-bit RISC chips of some kind, yeah. But of course, people still do use 6502s, like for the same reason they use an 8051. Yeah, because you don't have to pay ARM for the CPU core. You can just pop it in there and add your own stuff and make your own processor.
Starting point is 00:53:00 What is the status of the 6502 IP? Is that public domain now? Can I make my own? If you make the... Oh, don't quote me on this. That's fine. I am not a lawyer. I think if you stick with the original 6502 and MOS design,
Starting point is 00:53:20 and you just copy that, and don't try to copy the 6502, then you're fine. Because Western Design Center, they are still selling 6502 cores. Really? Okay. I wonder who's buying those. We should see if Tiny Tape Out would do those. Don't know. All right. So many ideas. Let's see. You are selling your 65 Ueno as kits, as boards, as both?
Starting point is 00:53:52 I'm selling them as kits. I did a sponsored video and I got way too many boards. So I gave a few away and now I'm just selling the rest. And so people can find them on your website? Yes, I have an old web shop I used to do something completely different. So I reused that web shop and I'm selling the boards on that site. Which is? Which is imaniadk. I hope you'll put the link in the show notes. So we get it in English and not Danish and all those kinds of funny things. iMania.dk.
Starting point is 00:54:29 But I've sent to the whole world by now. They went to Australia and Canada and the U.S. just fine. From Canada to Melbourne. And did you in fact talk to Nelson? I did. Wow, that's a treasure trove he has there. I have no idea how to use that many parts, but it would be so cool to make a, like a how to use the small device C compiler with 8051s and stuff like that. I would love to do a video and stuff like that. Well, you two are talking to each other. I have a few more folks who have emailed to talk to Nelson.
Starting point is 00:55:08 So I'm excited that his parts will be going out into the world to find other uses and hopefully more people who can use these bards to learn things and to teach others. Anders, it's been really great to talk to you. Do you have any thoughts you'd like to leave us with? I would just like to say thank you so much for doing this for over 10 years. It's been absolutely amazing to listen to you so often. And thank you so much to your supporters as well. Thank you for doing something to keep this going longer. Our guest has been Anders Nielsen, Mac expert at Aalborg University in Denmark.
Starting point is 00:55:50 You can check out his YouTube channel and you can buy your own 65 Awina kits on his store at imania.dk. Or check out his website at abnielsen.com. There'll be a link in the show notes. Thanks, Anders. Thank you so much. at abneilson.com. There'll be a link in the show notes. Thanks, Andrews. Thank you so much. Thank you to Christopher for producing and co-hosting. Thank you to Memfault for sponsoring the show.
Starting point is 00:56:16 Thank you to our Patreon listener Slack group for their questions. And of course, thank you for listening. You can always contact us at showatembedded.fm or hit the contact link on Embedded FM. And now a small factoid to leave you with. Do you remember hearing about the Cray, the super powerful, super computer amazing Cray? Yeah, the Raspberry Pi 3B is nearly 10 times more powerful than the first Cray.

There aren't comments yet for this episode. Click on any sentence in the transcript to leave a comment.