Hi, i have a question for you.. How does a human being invent a new asembling language?? Let say if he does not have a second computer i.e. there are no computer at all in this world for example like alan turing. I mean how do you define "Add" function to the computer? If the function "add" is presumed as an individual character such that A is equals to some number (which can be converted into binary number) let use hexadecimal for easier purpose. If A=10, D=13, D=13; So we write it in binary: 1010, 1101 , 1101 with each the values written on the EPROM or harddisk or anything. Then, when the user's input is like this (i.e Add), the computer will execute addition function either through programming as you've mentioned in the video, or maybe design a new logic gate?? But my main concern is that how do we reduce the memory size for each character written? i.e due to the fact that "D" character in this example is greater than "A" character because D= 13 in hexadecimal and A= 10. How do we make all the characters on our keyboard to have same memory size when converting them into hexadecimal but still they are distinctive from each other? Hopefully you understand my question
@@footballCartoon91 >Then, when the user's input is like this (i.e Add), the computer will execute addition function either through programming as you've mentioned in the video, or maybe design a new logic gate?? we don't send the ASCII representation of the instruction mnemonics to the CPU. the assembler will turn our source code (which is that ASCII plain text) into the appropriate opcode. the CPU understands this opcode because its circuits are *designed to understand it.* remember that in memory, everything is just numbers. what matters is how the CPU treats them. it usually expects instructions, and depending on the instruction it might expect raw data. each instruction triggers the appropriate bits and logic gates to perform its function. so to answer your question, we don't really invent an assembly language. we invent a CPU and the assembly language is a byproduct of how the CPU's circuits work. since you mentioned the restriction of having only one computer in the world, in that case you would have to assemble the program by hand. >But my main concern is that how do we reduce the memory size for each character written? i.e due to the fact that "D" character in this example is greater than "A" character because D= 13 in hexadecimal and A= 10. those values still fit inside 4 bits. your main concern should be the width of the value in binary, not the value itself.
Graduated with a degree in Computer Engineering a few years ago and I WISH I had an instructor like this guy because I've understood more from these videos than all of my Computer Architecture classes combined!!
@@deang5622I mean, it’s one class out of dozens you take in college. I have the same degree (different college probably) and loved my computer architecture class, but there are other classes which had poor instruction. All college courses are hit or miss, because they’re taught mostly by researchers who just happen to be teachers. They are good researchers. There is a chance that they are good teachers. And they keep their job by doing good research, not by teaching well.
@pyropulse almost anyone can learn how to program computers as its not that expensive compared to doing something like learning to weld and machine or learning to fly a plane
@@krabsauce9792 what's kind of crazy is that I could read and understand what instructions the hex code were, and when he went "let's delete the #" I was "yeah, you'll get A5 instead of A9 ... because I programmed an Apple ][ in machine code without having an assembler back in 1980 when I was 17.
Four years on and these Videos are still being found and much appreciated by the likes of me. Thank you very much, Ben. Your Videos are THE BEST ones, to cover this topic.
What makes this channel so great and educational is that he shows the actual process of programming a chip from scratch including things like referring to the documentation and datasheets and so on. It's really helping me understand how these things work and how to work with microprocessors.
I never thought Assembly would ever make sense to me, but you've explained it so clearly. I think it really helped that you did this as a series, starting with the physical pins and connections made understanding how the instructions correspond to them so much easier. This has been a really awesome series, I'mma subscribe.
I have learned more about practical digital electronics from your videos than two semesters of dedicated digital electronics labs. Thanks for all your hard work!
@@BenEater time in the universe is not infinite. But i like your style of taking everything slow to really make us understand the process and really making us smarter for life
A blinking LED is the "Hello World " equivalent in the raw CPU assembly programming world. So, in some way he did it already. I wanna see his display code, though. It's always a bit of a mess in assembly.
badum-tsss... I can imagine some dad telling this joke to a waitron and the waitron awkwardly laughing because of a possible tip at the end of the super awkward exchange.
Man I love this 6502 series. I'm currently almost finished with the 8 bit cpu (I've made some upgrades). Money definitely well spent. Thanks for all you do Ben, from your semiconductor video to this video.
Back in 1985 that’s how I coded, with 6502 instruction set and paper and pencil and then typed the bytes. I had to count the bytes for the jumps by hand and if I had to jump more than 256 bytes I coded smaller jumps by hand. We had no compiler to do that.
PaulsMagicVideos I had the Print-out of the Apple 2 OS in the back of the Apple Manual, so I knew Assemblers existed, but we didn’t have that at school. yes, 6502 programming was a school topic in 1985! It was awesome. I met and thanked my science teacher for it 36 years later! The 6502 had a clock speed of about 961 kHz, not even 1 MHz!! We entered the bytes with a poke statement for each byte.
You want pain? Had to toggle in addresses and instructions individually on the high school's brand new PDP-11 circa '72. Big hoorays when they later that year 'upgraded' with a punched papertape reader/writer. Ah the good ol days. LOL.
This highlights both the beauty and the frustration (for me, anyway) of programming. I started out self teaching on all this at 12-13 yrs of age. This all made sense, was intensely fascinating but remembering and recalling all of the "fiddly" little quirks like the carry bit, "little" vs "big" endian etc, is what caused the frustration.....which caused me to give up programming almost before I started it. Unbeknownst to my 12-13 yr old self and parents and teachers, I had ADHD. A fact I didn't learn until I was diagnosed at age 38. Looking at this now, knowing what I know now, considering my own neurocognitive "quirks", i'm getting tempted to dive back in. The fascination and the fact it makes perfect sense is all still alive but now I can include workarounds for the working and processing memory deficiencies (meat, not silicon) I have. Thanks for rekindling the memory of being an enthralled kid!
These Videos are CRAZY in the amount of complicated content, presented in a very clear way. Very well done and one thing that is making this happen is that he repeats information relatively often. But also the calm voice and the "its really easy tone". Very well done. TopNotch teaching. Coming from a fellow teacher.
I love your approach in these videos so far. You always show the manual or raw way to accomplish something, and then you show another way that is more efficient or natural to accomplish the same task. ie. using labels instead of the actual hard coded address values. It makes so much sense when presented this way. I learn much faster by example, and your videos are exactly this!!!
I had an entire semester of 6500 training back in 1989, we built and interfaced circuits just like this. I wrote an assembler program in a relational database that was called Paradox and downloaded programs from my PC through a serial link to the processor. This brings me right back to the great times I had !
I have little to no idea of what is going on most of the time in these videos but it's super enjoyable and I get the sense that, if I were to stay and listen for long enough, I might learn a lot!
I remember when these details were much more ‘bleeding edge’ than a walk down memory lane. I’m glad someone young is still paying attention to these details…
I took this course in Digital Electronics with Laboratory through Cleveland Institute of Electronics many years ago. We built a 4-bit computer for one project! We used RAM chips, switches to do addressing and a 1Hz clock (whew!!!). It had 1 kbye of memory, 2 input registers and 4 instructions: AND, OR, XOR, NOT. It did not fetch instruction and decode them though. We do that manually. It was just a tool for learning how a computer works. These kind of projects like the 6502 remind me of the good old days! I used to used the Motorola 6809e, Intel 8085, Zilog Z80 and others. Embedded computing was a lot harder in the old days. Today they have so many microcontroller boards that are way more powerful, cheaper and easier to use, but using them robs one of the underlying knowledge that makes it work.
I don't do it for a living, but I've written some asm and took applied electonics classes, so I pretty much know everything he talks about, still, pretty good entertainement.
lol as others have already pointed out, I also smiled when I saw the thanks to you on the download link. I use vasm myself from time to time as I have a homebuilt 6502 from the late 90's that does various automation tasks that I built to replace a pic based system when it became too limiting... it used to do quite a bit from lighting to door locking and things but now it just mainly keeps plants watered... of course these days you can do plenty more and a lot quicker on a $2 arduino uno clone but back then I used to repair arcade boards when there were still plenty of arcades about I often had donor boards about and 6502s, z80s and eeproms were pretty abdundent, as well as an unbelievable amount of ttl glue logic. Kind of funny that now the technology is more available and easier to build and use the less I do :P
Hello! I am trying to do this project and vasm isn't working for me, I can't find anywhere online about how to fix this, so you are my last resort. I'm trying to compile a file but it says no input specified, I've tried everything, I am using Cygwin for windows 10 64bit, I put in the command: "./vasm6502_oldstyle -Fbin -dotdir blink.s" am I doing something wrong?
It seems sooo incredible today that we had learned all these stuff in the 80s without internet, without youtube... Wish I had a teacher like you when I learned assembly!
It is so cool seeing you make these circuits and then programming the hardware. I took an embedded systems class last semester and we coded in HCS12 Assembly Language and it is so cool seeing everything that I learned in that class applied here.
These LCDs are quite fun to play around with. I once made a 2x16 character display with 5x8 pixels per character draw a ping pong ball moving around pixel by pixel and bouncing off the edges as well as a small pixelated image moving across the display pixel by pixel with the 8 user-definable characters that the display offered. The assembly language is incredibly powerful once you make use of subroutines.
For my machine language program I wanted to increment A from 00 to FF and send it to the LEDs. That worked, but in plain 6502 assembly there’s no INcrement A mnemonic (op code 1A). After doing a little googling I see 65C02 added a few really useful instructions beyond the MOS 6502 and vasm supports them if you add the -c02 option on the command line! Actually for this chip there’s the -wdc02 option which includes even more instructions added by WDC.
@@SypakaAdding one to A is a good idea as has already been mentioned but depending on the scenario you might also use the X or Y register with INX and then store it with STX for example. Those registers are made specifically to be counters/indexes to increment, but if you need to do other things with that value it'll take an extra transfer.
I've been into computers for almost 15 years by now, and it's with these videos of yours, especially the bread board CPU series, that I finally get to learn how they actually work underneath all the software and hardware abstractions. Thanks a lot, this is great work!
ปีที่แล้ว
Congratulations teacher for this brilliant series! I have learned a lot from your videos! The Lord has my best salute!
I'm far too stupid to understand most of what you do, but I find it fascinating none the less. I also think it's great that you don't edit your videos to remove little things that go wrong like compiler errors, but instead show how you fixed them. Excellent stuff, keep it up!
These videos remind me of when I built a Z80 based computer from a kit (a complete computer with a proper video display - B&W of course - and cassette tape storage) and then entered Microsoft BASIC for the TRS-80 into it, one hexadecimal instruction at a time, saving it on tape between sessions, and finally altered it so it would run on the kit computer. That was fun. The kit computer had a display half the size of the TRS-80 and used a different method for saving and loading on tapes and accessed the keyboard differently, so I had to alter all three of those sections of the code. Yes, I made it work. I used it for quite a while until computers which used disk drives became affordable.
Learnt more here in 15 minutes than I did in an entire term's module on Microprocessor programming at university 20 odd years ago ( I was probably hungover most of the time back then mind :D)
In my first job, I wrote 680x assembly programs, and by wrote, I mean I had to write them down on lined paper, then write the machine code next to each line in the margin, then type all the bytes into a BBC micro which had a ROM burner attached. My biggest program was almost 8k which, for reference, is a full ring-binder worth. You guys have it so easy these days, with your fancy assemblers!
@@craftsmanwoodturner - well, long answer is that we also used the (awsome) Dataman S3 programmers, and to do software updates we would call out any changed bytes on the telephone to our customer, who would be typing them into their Dataman. In order to make this work, each page of code was divided into 4 line groups, and when your code got to the end of a page (only one page allowed per subroutine!) the remaining bytes in the final group of 4 were left blank - to allow for pudent modification of that page of code without affecting any other page. An assembler *might* rearrange a whole load of other code after an update. While a similar approach could probably have been forced with an assembler, my Boss was an eccentric PDP owner/operator, and insisted it was done this way. As a 'rookie' it certainly was a good way to learn the careful writing of code. It's a process that younger generations might find hard to imagine!
Opcodes were how we did do it back in the day! Literally by writing DATA statements in BASIC, and reading those and POKE'ing the values into memory addresses. Back then we used to be able to memorize the decimal values for the opcdes (there weren't that many to memorize for the 6502).
Brings back memories of programming in assembly on old GM 6800 series car/truck ECMs from the early 80's. Kind of fun to program on since they did not require a bootable operating system like the later ones, which meant you could use them for simple control projects.
While i would lie if i sad i would pass my computer technology class only with your videos, but those are by far the best ilustrationon of what the hell is going on:) keep up the good work i really helps me to understand it
Ben In every video you make, you blow my mind! You have an amazing skill of explanation and you present the ideas in a great order! For years I have been looking to understand computers, and never found nothing as clear as your videos (besides the book of J. Clark titled But how do it know). Thank you very much!
Another Ben Eater video! I'm really excited for this series of videos. I look up to your skill and ability to teach others and hope to be like you one day.
I used to program primarily in machine code on my TI-84+ because you can type the code in hexadecimal on-calc and I didn't have a computer. I got really, really good at memorizing the addresses of all my routines. I still code this way, too, because it's just so convenient when I need to quickly test something. No compiling, no typing out so many characters to spell out one instruction, and I don't have to set up sending a binary from my computer to my calculator.
I won't lie. A large amount of what you do on your channel is way over my head but I find the content both fascinating and somewhat philosophical. I always say that computers turn stupid electricity either from a wall socket or battery into smart electricity that can dazzle our senses and create worlds and realities beyond most of our imaginations. I often draw parallels between things that happen in everyday life like the predictable nature of my dog when I give it basic commands like sit or roll over to the pure logic nature of computers and sometimes wonder where is the 6502 chip(s) controlling my dog. It's just interesting seeing the "magic" happen bit by bit and realizing it's not magic at all but just a crap ton of very basic commands. It's really quite enlightening.
Wow as a Kid wanted to understand assembly etc. Over time it made sense but it was always something I never fully understood. Thanks for making it clear. I wish I knew how to do Assembly programming back in the Z80 days!
I've been programming in assembler for (yikes) about 40 years.... but it's still great to watch this series and see you helping othrrs pick up my dubious habits. ;)
I'll be damned: after watching the previous 2 vids, i started thinking about building a similar project, just using some things differently, such as not using the 6522 chip and such. Then, on the day i started planning it all out, you released a vid which mentions that you'll be using it to drive an LCD, which was one of the things i planned on doing once i got it running
I literally just messaged a buddy of mine about this guys channel. We were in a microprocessors class where we were not learning SHIT. We did the best we could, we r3ad the text book, we asked questions, we wrote down ever note the prof gave us and then some. Everyone in that class was lost as hell. After seeing this guys series om Assembly code I actually want to take a second shot at it. I want a round two cause I came to college wanting to learn, low and behold I am almost done and all I want is that stupid piece of paper
Really fun stuff! This reminds me of my one-and-only assembly language program that I wrote for our family's Commodore VIC-20, back when I was in my teens. It just put a little Pac Man character on the screen and made his mouth open and close. Nothing thrilling, but I was stoked to have figured it out. I'm kinda wishing I'd stuck with assembly language stuff beyond that one program, but I've been coding in other languages over the years, so at least the programming vibe is still alive and well.
One thing about the ROR and ROL instructions is that if you look one of the "on" leds seems to disappear for one rotation before reappearing on the other side. That's because ROR and ROL run the bits through the Carry 'C' flag in the processor status, acting as a "9th bit" for additions/subtractions and moving bits around. This makes it easier to chain bytes together and interpret them as a variable larger than 8 bits. If you want to leave the carry out, on the 6502 it's easy to put a CMP #$80 before the ROL instruction because this will essentially copy the highest bit to C before you rotate it back into the lowest bit.
My first paid software was a 6502 assembly user port device driver for a custom piece of industrial hardware for the c64. One of the guys i worked with wrote all his programs in machine code. Just straight typing in the hex numbers. We all thought he was nuts, even back then.
Just got the use of Arduino 3 Years ago... And this Assambly Code makes a whole lot more sense to me than what you have to deal on the Arduino IDE.. I kinda like Assambly 😁
Thank you thank you, i was searching for ages for a compiler for Z80. I am remaking the z80 for college license in logisim and i was looking for a compiler so i don't program it by hand. Will be looking in the future to program it in a fpga for a more complex project. Your videos helped a lot and i must say, you are the one that made me understand and i've been searching for a while for someone. You are the best!
Super cool, keep up the good work! I'd love this series to continue all the way to high level languages maybe mock C(++) style language, similar to the *Nand2Tetris* program series. Hardware -> Binary -> Assembly -> C style code -> Object oriented
Things I normally do over Christmas/New year holidays: drink, eat, sleep. Things I've done this year: write C code, compile to assembly, read every line with the instruction datasheet next to me.
Ben: "No one actually writes software this way" Ben moments later: "hold my beer, in my last video actually I DID write this program by writing out the machine code by hand".
I wish someone would have told me this back in the 1980s. I wrote a few video games and my own disk operating system in 6502 machine language. Yes, typing in hexadecimal. (It can be done.)
It's all pretty simple, but many find it hard to grasp. Kudos to Ben for making the knowledge so accessible and easy to follow. And who would've thought the 6502 would teach people how computers work so long after it was conceived? Modern processors work in much the same way, so it's still relevant. Using Arduinos and whatnot seems like overkill, and quite wasteful to me, for small hobby projects.
One thing that became obvious to me when programming a Z80 processor emulator in x86 assembly language is that there are patterns to these opcodes. For instance, if you look at the adc instruction (add with carry) for the 6502, there are eight different opcodes depending on if what you're adding is an immediate value, an absolute memory reference, etc. All the opcodes begin (in hexadecimal) with 6 or 7 and end with 1, 5, 9, or D. When you convert that to binary, the adc instruction is 011xxx01 with the x bits changing depending on where the value is. The processor uses five bits to determine it's an adc instruction and the other three to figure out what to add. If you look at the opcodes for the sbc (subtract with carry) instruction, they're the same except they begin with E or F instead of 6 or 7. That means the binary changes by only one bit from adc to become 111xxx01 and you fill in the x bits the same way as with adc. Not all instructions fit into this same pattern, but many do if they involve taking some value from somewhere in memory and moving it into the accumulator or combining it via some operation with what's already in the accumulator. That gives you a hint as to how the processor works at the hardware level. Even the sta instruction fits into this pattern even though the direction is the opposite. There's just no opcode for when it's an immediate value because it doesn't make sense to do so. It does make me wonder what would happen if you send it an $89 opcode though, if the processor would fault out for invalid instruction, actually overwrite the next value in memory and keep going, or something in between. I may have to try that as an experiment.
I found out what the $89 opcode does. It apparently does nothing, like the nop instruction, but with an 8-byte operand that it ignores. There are apparently a lot of these amongst the undocumented opcodes, as well as some that crash the processor and some that have interesting but inconsistent results.
Programming in assembly on the Sym 1 (6502 single board computer) was hand asembly. Instead of an assembler, you had a photocopied worksheet to write down your assembly language and hand-encode into machine language and then input into the computer via the monitor program. Of course, with 6502, that's pretty straightforward.
2:35 lol Glossing over the "Thanks to Ben Eater for providing the Mac and Windows versions."
You're really a gem.
Ha! No joke!
Cool how high level Assembly looks right now because you got us started with just logic gates...
@pyropulse lol same
@pyropulse Now you write code for minecraft mods using abstract mathematical functions describing the behaviors of all of the electrons in your PC
Hi, i have a question for you..
How does a human being invent a new asembling language??
Let say if he does not have a second computer i.e. there are no computer at all in this world for example like alan turing.
I mean how do you define "Add" function to the computer?
If the function "add" is presumed as an individual character such that A is
equals to some number (which can be converted into binary number) let use hexadecimal for easier purpose. If A=10, D=13, D=13;
So we write it in binary:
1010, 1101 , 1101 with each the values written on the EPROM or harddisk or anything. Then, when the
user's input is like this (i.e Add), the computer will execute addition function either through programming as you've mentioned in the video, or maybe design a new logic gate??
But my main concern is that how do we reduce the memory size for each character written? i.e due to the fact that "D" character in this example is greater than "A" character because D= 13 in hexadecimal and A= 10.
How do we make all the characters on our keyboard to have same memory size when converting them into hexadecimal but still they are distinctive from each other?
Hopefully you understand my question
@pyropulse karnaugh maps
@@footballCartoon91
>Then, when the user's input is like this (i.e Add), the computer will execute addition function either through programming as you've mentioned in the video, or maybe design a new logic gate??
we don't send the ASCII representation of the instruction mnemonics to the CPU. the assembler will turn our source code (which is that ASCII plain text) into the appropriate opcode. the CPU understands this opcode because its circuits are *designed to understand it.*
remember that in memory, everything is just numbers. what matters is how the CPU treats them. it usually expects instructions, and depending on the instruction it might expect raw data. each instruction triggers the appropriate bits and logic gates to perform its function.
so to answer your question, we don't really invent an assembly language. we invent a CPU and the assembly language is a byproduct of how the CPU's circuits work.
since you mentioned the restriction of having only one computer in the world, in that case you would have to assemble the program by hand.
>But my main concern is that how do we reduce the memory size for each character written? i.e due to the fact that "D" character in this example is greater than "A" character because D= 13 in hexadecimal and A= 10.
those values still fit inside 4 bits. your main concern should be the width of the value in binary, not the value itself.
Graduated with a degree in Computer Engineering a few years ago and I WISH I had an instructor like this guy because I've understood more from these videos than all of my Computer Architecture classes combined!!
So true man
Agreed. Same situation for me in 1987. Too bad Ben was not my instructor.
So your computer engineering degree must be worthless then? Which college was this?
@@deang5622I mean, it’s one class out of dozens you take in college. I have the same degree (different college probably) and loved my computer architecture class, but there are other classes which had poor instruction. All college courses are hit or miss, because they’re taught mostly by researchers who just happen to be teachers. They are good researchers. There is a chance that they are good teachers. And they keep their job by doing good research, not by teaching well.
@@ckannan90 I learnt more about computer architecture than I did in my university degree by self study.
Nice little shoutout to you for Mac and Windows version :D 2:37
Should make an open source for Linux. I spoke too soon. It is ooen source....
@@rty1955 It is open source... These are just prebuilt binaries
@@dentjoener awesome. I left M$ decades ago... Its shareware at best
I don't think windows or Mac will run on a 6502.
@@rty1955 Why?? He should eventually do Eatix ;) that's the point of building your own computing system )
This series really shows how we're standing on the shoulders of giants when we use our PC
Or any modern science really
@pyropulse almost anyone can learn how to program computers as its not that expensive compared to doing something like learning to weld and machine or learning to fly a plane
@@loserface3962 I would have 5000x more chance of learning how to fly as opposed to learning any of the magic I'm watching right now.
@@krabsauce9792 You think that, but it's really a matter of repetition and coursework with a competent instructor.
@@krabsauce9792 what's kind of crazy is that I could read and understand what instructions the hex code were, and when he went "let's delete the #" I was "yeah, you'll get A5 instead of A9 ... because I programmed an Apple ][ in machine code without having an assembler back in 1980 when I was 17.
Four years on and these Videos are still being found and much appreciated by the likes of me.
Thank you very much, Ben. Your Videos are THE BEST ones, to cover this topic.
What makes this channel so great and educational is that he shows the actual process of programming a chip from scratch including things like referring to the documentation and datasheets and so on. It's really helping me understand how these things work and how to work with microprocessors.
I never thought Assembly would ever make sense to me, but you've explained it so clearly. I think it really helped that you did this as a series, starting with the physical pins and connections made understanding how the instructions correspond to them so much easier. This has been a really awesome series, I'mma subscribe.
You are the only reason I'm passing my embedded systems class in college. I love you.
This is my favorite series on TH-cam right now. Nothing makes me excited like seeing a new video about this 😊
yepp ... and he is not the only one on yt :)
th-cam.com/video/QgDR8LrRZhk/w-d-xo.html
@Memes On Piano It's all about the content, i.e. the music not just the piano.
"Normal people" watch Netflix or TV.
I am here watching a video series about microprocessors ...
I have learned more about practical digital electronics from your videos than two semesters of dedicated digital electronics labs. Thanks for all your hard work!
pyropulse
>plays minecraft
I bet you’re a subhuman with a double digit IQ that wants to look smart.
Bad labs then
@pyropulse Excuse me?
TL;DW: Still no "HELLO WORLD" :D
I'm sure you have this a lot, but I have to say it too: your videos are amazing! Thank you very much for doing them.
It will definitely* happen in the next video! And really, is there any reason it should take fewer than four videos to print "hello world"?
*probably
@@BenEater time in the universe is not infinite. But i like your style of taking everything slow to really make us understand the process and really making us smarter for life
A blinking LED is the "Hello World
" equivalent in the raw CPU assembly programming world. So, in some way he did it already. I wanna see his display code, though. It's always a bit of a mess in assembly.
@@BenEater thanks again, great videos, great tutor
@@BenEater yes dude, you are awesome!
14:20 - my dad once worked on a nine-bit processor.
It was a bit much.
badum-tsss... I can imagine some dad telling this joke to a waitron and the waitron awkwardly laughing because of a possible tip at the end of the super awkward exchange.
@@spongerobert There's a nonzero chance that he did exactly that at some point. That's the sort of thing he would do.
womp womp lmao
Is your dad any good at dad jokes?
this meme was indeed kek.
Amazing! This is when the magic disappears and instead engineering starts. Thank you, Ben, for enlightening this world! You are truly the teacher!
This video series is weirdly relaxing and I appreciate it immensely.
Man I love this 6502 series. I'm currently almost finished with the 8 bit cpu (I've made some upgrades). Money definitely well spent. Thanks for all you do Ben, from your semiconductor video to this video.
Not yet, I want to finish first so I don't post anything that's broken and could mislead others
Back in 1985 that’s how I coded, with 6502 instruction set and paper and pencil and then typed the bytes. I had to count the bytes for the jumps by hand and if I had to jump more than 256 bytes I coded smaller jumps by hand.
We had no compiler to do that.
Did they not have assemblers back then?
@@MrSapps probably did but they were also expensive
@@MrSapps yes there was,but nobody know it was stone age. people do their own assembler or becouse they were so good on machine code they not need
PaulsMagicVideos I had the Print-out of the Apple 2 OS in the back of the Apple Manual, so I knew Assemblers existed, but we didn’t have that at school. yes, 6502 programming was a school topic in 1985! It was awesome. I met and thanked my science teacher for it 36 years later! The 6502 had a clock speed of about 961 kHz, not even 1 MHz!! We entered the bytes with a poke statement for each byte.
You want pain? Had to toggle in addresses and instructions individually on the high school's brand new PDP-11
circa '72. Big hoorays when they later that year 'upgraded' with a punched papertape reader/writer. Ah the good ol days. LOL.
Please keep doing video like this. I'm sure everyone is learning a lot and at this speed no beginners are left behind.
Honestly glad we haven't reached "Hello World". That would mean we're done learning cool stuff, and who wants that!? Thanks for all your hard work.
well this didn't age well
@@matthewe3813 lol
This highlights both the beauty and the frustration (for me, anyway) of programming. I started out self teaching on all this at 12-13 yrs of age. This all made sense, was intensely fascinating but remembering and recalling all of the "fiddly" little quirks like the carry bit, "little" vs "big" endian etc, is what caused the frustration.....which caused me to give up programming almost before I started it. Unbeknownst to my 12-13 yr old self and parents and teachers, I had ADHD. A fact I didn't learn until I was diagnosed at age 38.
Looking at this now, knowing what I know now, considering my own neurocognitive "quirks", i'm getting tempted to dive back in. The fascination and the fact it makes perfect sense is all still alive but now I can include workarounds for the working and processing memory deficiencies (meat, not silicon) I have.
Thanks for rekindling the memory of being an enthralled kid!
I'm autistic 😅
These Videos are CRAZY in the amount of complicated content, presented in a very clear way. Very well done and one thing that is making this happen is that he repeats information relatively often. But also the calm voice and the "its really easy tone". Very well done. TopNotch teaching. Coming from a fellow teacher.
I love your approach in these videos so far. You always show the manual or raw way to accomplish something, and then you show another way that is more efficient or natural to accomplish the same task. ie. using labels instead of the actual hard coded address values. It makes so much sense when presented this way. I learn much faster by example, and your videos are exactly this!!!
I had an entire semester of 6500 training back in 1989, we built and interfaced circuits just like this. I wrote an assembler program in a relational database that was called Paradox and downloaded programs from my PC through a serial link to the processor. This brings me right back to the great times I had !
What a fun way to show assembly instructions background without passing through pages of deep down content.
I should have learned this stuff thirty years ago. Thanks, Ben, for making it so accessible.
Introduction of very single new little feature of the assembler made me literally smile, bringing back memories from the mid 80s. Great lessons !
I haven't used zero page in close to 25 years. Nostalgia.
I've been wondering for years how the bridge between software and hardware works, and here it is, and in such an easy to follow way! Thanks so much!
I think the shorter but more frequent videos are better than waiting 2 months for a long one. thx :)
Nile Red needs to learn that.
These are some of the best videos I have ever seen. Organized, easy to follow, professional quality. Thank you Ben.
I have little to no idea of what is going on most of the time in these videos but it's super enjoyable and I get the sense that, if I were to stay and listen for long enough, I might learn a lot!
I remember when these details were much more ‘bleeding edge’ than a walk down memory lane. I’m glad someone young is still paying attention to these details…
This is my new favorite channel.
It is so complex, with some explanations so logical yet so ground level and hard to learn. Amazing work.
@Ben Eater
You're not only exceptionally good at what you do, you're exceptionally good at explaining it too!
I took this course in Digital Electronics with Laboratory through Cleveland Institute of Electronics many years ago. We built a 4-bit computer for one project! We used RAM chips, switches to do addressing and a 1Hz clock (whew!!!). It had 1 kbye of memory, 2 input registers and 4 instructions: AND, OR, XOR, NOT. It did not fetch instruction and decode them though. We do that manually. It was just a tool for learning how a computer works. These kind of projects like the 6502 remind me of the good old days! I used to used the Motorola 6809e, Intel 8085, Zilog Z80 and others.
Embedded computing was a lot harder in the old days.
Today they have so many microcontroller boards that are way more powerful, cheaper and easier to use, but using them robs one of the underlying knowledge that makes it work.
I'm not here to learn (I write embedded software for a living), but I still enjoy watching your videos. Good stuff.
I don't do it for a living, but I've written some asm and took applied electonics classes, so I pretty much know everything he talks about, still, pretty good entertainement.
lol as others have already pointed out, I also smiled when I saw the thanks to you on the download link. I use vasm myself from time to time as I have a homebuilt 6502 from the late 90's that does various automation tasks that I built to replace a pic based system when it became too limiting... it used to do quite a bit from lighting to door locking and things but now it just mainly keeps plants watered... of course these days you can do plenty more and a lot quicker on a $2 arduino uno clone but back then I used to repair arcade boards when there were still plenty of arcades about I often had donor boards about and 6502s, z80s and eeproms were pretty abdundent, as well as an unbelievable amount of ttl glue logic. Kind of funny that now the technology is more available and easier to build and use the less I do :P
Hello! I am trying to do this project and vasm isn't working for me, I can't find anywhere online about how to fix this, so you are my last resort. I'm trying to compile a file but it says no input specified, I've tried everything, I am using Cygwin for windows 10 64bit, I put in the command: "./vasm6502_oldstyle -Fbin -dotdir blink.s" am I doing something wrong?
This is the kind of thing id like to see all the kids in school doing. Would be a great thing for kids to have fun learning.
It seems sooo incredible today that we had learned all these stuff in the 80s without internet, without youtube...
Wish I had a teacher like you when I learned assembly!
It is so cool seeing you make these circuits and then programming the hardware. I took an embedded systems class last semester and we coded in HCS12 Assembly Language and it is so cool seeing everything that I learned in that class applied here.
14:42 "not to say that blinking leds can't be fun"
I love you.
These LCDs are quite fun to play around with. I once made a 2x16 character display with 5x8 pixels per character draw a ping pong ball moving around pixel by pixel and bouncing off the edges as well as a small pixelated image moving across the display pixel by pixel with the 8 user-definable characters that the display offered. The assembly language is incredibly powerful once you make use of subroutines.
Even though I'm neck deep in C64 assembly programming, I still enjoy your explanation. Low level is just great.
For my machine language program I wanted to increment A from 00 to FF and send it to the LEDs. That worked, but in plain 6502 assembly there’s no INcrement A mnemonic (op code 1A). After doing a little googling I see 65C02 added a few really useful instructions beyond the MOS 6502 and vasm supports them if you add the -c02 option on the command line! Actually for this chip there’s the -wdc02 option which includes even more instructions added by WDC.
so without "INC A", you would have to write extra code? How would that look like? Just 3 lines of code?
@@SypakaADD A, 1
@@Veliki-k3i Why ask for something complex, if the solution is actually simple. I seriously forgot increasing is adding by 1..
@@SypakaAdding one to A is a good idea as has already been mentioned but depending on the scenario you might also use the X or Y register with INX and then store it with STX for example. Those registers are made specifically to be counters/indexes to increment, but if you need to do other things with that value it'll take an extra transfer.
I've been into computers for almost 15 years by now, and it's with these videos of yours, especially the bread board CPU series, that I finally get to learn how they actually work underneath all the software and hardware abstractions. Thanks a lot, this is great work!
Congratulations teacher for this brilliant series! I have learned a lot from your videos!
The Lord has my best salute!
I'm far too stupid to understand most of what you do, but I find it fascinating none the less. I also think it's great that you don't edit your videos to remove little things that go wrong like compiler errors, but instead show how you fixed them. Excellent stuff, keep it up!
You aren’t stupid, just un-knowledgeable. You can learn all this stuff and anything you want as long as you are willing to. I believe in you :3
These videos remind me of when I built a Z80 based computer from a kit (a complete computer with a proper video display - B&W of course - and cassette tape storage) and then entered Microsoft BASIC for the TRS-80 into it, one hexadecimal instruction at a time, saving it on tape between sessions, and finally altered it so it would run on the kit computer. That was fun.
The kit computer had a display half the size of the TRS-80 and used a different method for saving and loading on tapes and accessed the keyboard differently, so I had to alter all three of those sections of the code.
Yes, I made it work. I used it for quite a while until computers which used disk drives became affordable.
Learnt more here in 15 minutes than I did in an entire term's module on Microprocessor programming at university 20 odd years ago ( I was probably hungover most of the time back then mind :D)
I would have never though I would be learning assembly. It’s crazy how much our compilers do for us.
In my first job, I wrote 680x assembly programs, and by wrote, I mean I had to write them down on lined paper, then write the machine code next to each line in the margin, then type all the bytes into a BBC micro which had a ROM burner attached. My biggest program was almost 8k which, for reference, is a full ring-binder worth.
You guys have it so easy these days, with your fancy assemblers!
It was a very long time ago, so I could be mistaken, but I seem to remember that BBC Basic had built-in 6502 assembler support?
@@craftsmanwoodturner - well, long answer is that we also used the (awsome) Dataman S3 programmers, and to do software updates we would call out any changed bytes on the telephone to our customer, who would be typing them into their Dataman. In order to make this work, each page of code was divided into 4 line groups, and when your code got to the end of a page (only one page allowed per subroutine!) the remaining bytes in the final group of 4 were left blank - to allow for pudent modification of that page of code without affecting any other page. An assembler *might* rearrange a whole load of other code after an update.
While a similar approach could probably have been forced with an assembler, my Boss was an eccentric PDP owner/operator, and insisted it was done this way. As a 'rookie' it certainly was a good way to learn the careful writing of code.
It's a process that younger generations might find hard to imagine!
Opcodes were how we did do it back in the day! Literally by writing DATA statements in BASIC, and reading those and POKE'ing the values into memory addresses. Back then we used to be able to memorize the decimal values for the opcdes (there weren't that many to memorize for the 6502).
boy oh boy this brought me back in the early 70's, thank you
Oh my gosh, Ben. What a cliffhanger! Your videos are simply awesome. Thank you so much.
As a C# developer, I'm glad there are smart people like you out there who make my life much much simpler :)
It amazes me how much I enjoy watching something I'm clueless about.
Brings back memories of programming in assembly on old GM 6800 series car/truck ECMs from the early 80's. Kind of fun to program on since they did not require a bootable operating system like the later ones, which meant you could use them for simple control projects.
My favorite channel and content on TH-cam.
While i would lie if i sad i would pass my computer technology class only with your videos, but those are by far the best ilustrationon of what the hell is going on:) keep up the good work i really helps me to understand it
Ben
In every video you make, you blow my mind!
You have an amazing skill of explanation and you present the ideas in a great order!
For years I have been looking to understand computers, and never found nothing as clear as your videos (besides the book of J. Clark titled But how do it know).
Thank you very much!
Another Ben Eater video! I'm really excited for this series of videos. I look up to your skill and ability to teach others and hope to be like you one day.
I want to build 6502 computer for a competition in my school and you fell from heaven for me :D
This guys was born with a breadboard in hand, never seen someone going to much into machine level details
It satisfies me so much so see your circuits. It is also the main reason why I watch your videos tbh😂😂
I used to program primarily in machine code on my TI-84+ because you can type the code in hexadecimal on-calc and I didn't have a computer. I got really, really good at memorizing the addresses of all my routines. I still code this way, too, because it's just so convenient when I need to quickly test something. No compiling, no typing out so many characters to spell out one instruction, and I don't have to set up sending a binary from my computer to my calculator.
I won't lie. A large amount of what you do on your channel is way over my head but I find the content both fascinating and somewhat philosophical. I always say that computers turn stupid electricity either from a wall socket or battery into smart electricity that can dazzle our senses and create worlds and realities beyond most of our imaginations.
I often draw parallels between things that happen in everyday life like the predictable nature of my dog when I give it basic commands like sit or roll over to the pure logic nature of computers and sometimes wonder where is the 6502 chip(s) controlling my dog. It's just interesting seeing the "magic" happen bit by bit and realizing it's not magic at all but just a crap ton of very basic commands. It's really quite enlightening.
Wow as a Kid wanted to understand assembly etc. Over time it made sense but it was always something I never fully understood. Thanks for making it clear. I wish I knew how to do Assembly programming back in the Z80 days!
I've been programming in assembler for (yikes) about 40 years.... but it's still great to watch this series and see you helping othrrs pick up my dubious habits. ;)
2:32 good on you for providing the Mac and Windows versions
This takes me back. Damn do I miss those old days. This is a lot of fun.
I'll be damned: after watching the previous 2 vids, i started thinking about building a similar project, just using some things differently, such as not using the 6522 chip and such. Then, on the day i started planning it all out, you released a vid which mentions that you'll be using it to drive an LCD, which was one of the things i planned on doing once i got it running
I literally just messaged a buddy of mine about this guys channel. We were in a microprocessors class where we were not learning SHIT. We did the best we could, we r3ad the text book, we asked questions, we wrote down ever note the prof gave us and then some. Everyone in that class was lost as hell. After seeing this guys series om Assembly code I actually want to take a second shot at it. I want a round two cause I came to college wanting to learn, low and behold I am almost done and all I want is that stupid piece of paper
Wow, you made the mac and Windows versions of vasm! Well done!
@@tau8550 My personal question is, can Vasm be compiled without using make?
Otto Bass he just compiled the code and then uploaded the binaries.
James Nguyen Yeah. You could just execute the commands in the makefile by hand
Thanks for teaching me about computers! You make everything easy to understand. Thank you.
Really fun stuff! This reminds me of my one-and-only assembly language program that I wrote for our family's Commodore VIC-20, back when I was in my teens. It just put a little Pac Man character on the screen and made his mouth open and close. Nothing thrilling, but I was stoked to have figured it out. I'm kinda wishing I'd stuck with assembly language stuff beyond that one program, but I've been coding in other languages over the years, so at least the programming vibe is still alive and well.
This series is so good! This part is my favorite so far. So instructive!
Can't wait to start earning and be your patron.
Thank you for everything!
This is ingeniously brilliant! Thank you for this series!
I'm so assembling this computer some time soon!
Thank you sir!
One thing about the ROR and ROL instructions is that if you look one of the "on" leds seems to disappear for one rotation before reappearing on the other side. That's because ROR and ROL run the bits through the Carry 'C' flag in the processor status, acting as a "9th bit" for additions/subtractions and moving bits around. This makes it easier to chain bytes together and interpret them as a variable larger than 8 bits. If you want to leave the carry out, on the 6502 it's easy to put a CMP #$80 before the ROL instruction because this will essentially copy the highest bit to C before you rotate it back into the lowest bit.
I miss my 68HC11 board with the BUFFALO (bit user's fast friendly aid logical operations).
Thank you mr. Tony Fourcroy for composing BUFFALO.
My first paid software was a 6502 assembly user port device driver for a custom piece of industrial hardware for the c64. One of the guys i worked with wrote all his programs in machine code. Just straight typing in the hex numbers. We all thought he was nuts, even back then.
Just got the use of Arduino 3 Years ago... And this Assambly Code makes a whole lot more sense to me than what you have to deal on the Arduino IDE.. I kinda like Assambly 😁
I don't understand any of this but I find it fascinating. You are a very smart person. :)
Thank you thank you, i was searching for ages for a compiler for Z80. I am remaking the z80 for college license in logisim and i was looking for a compiler so i don't program it by hand. Will be looking in the future to program it in a fpga for a more complex project. Your videos helped a lot and i must say, you are the one that made me understand and i've been searching for a while for someone. You are the best!
멋진 동영상입니다! US$2.00 상당의 환호를 보냅니다. 👏
Excellent way of teaching, please sir make some video tutorials for AVR microcontrollers in assembly. Thank for providing us such a great knowledge.
I look forward to seeing the next video in this series drop, every time I get notified you have posted I can’t wait to check it out.
Super cool, keep up the good work! I'd love this series to continue all the way to high level languages maybe mock C(++) style language, similar to the *Nand2Tetris* program series. Hardware -> Binary -> Assembly -> C style code -> Object oriented
cc65.org you get assembler and c
The language brings back memories of my programming the C64 (which used a variant of the 6502). I used to program everything in hex.
Things I normally do over Christmas/New year holidays: drink, eat, sleep.
Things I've done this year: write C code, compile to assembly, read every line with the instruction datasheet next to me.
Ben: "No one actually writes software this way"
Ben moments later: "hold my beer, in my last video actually I DID write this program by writing out the machine code by hand".
I wish someone would have told me this back in the 1980s. I wrote a few video games and my own disk operating system in 6502 machine language. Yes, typing in hexadecimal. (It can be done.)
@@TheGuyThatEveryoneIgnores what a madlad
@@TheGuyThatEveryoneIgnores oh dear god
It's all pretty simple, but many find it hard to grasp. Kudos to Ben for making the knowledge so accessible and easy to follow.
And who would've thought the 6502 would teach people how computers work so long after it was conceived? Modern processors work in much the same way, so it's still relevant. Using Arduinos and whatnot seems like overkill, and quite wasteful to me, for small hobby projects.
One thing that became obvious to me when programming a Z80 processor emulator in x86 assembly language is that there are patterns to these opcodes. For instance, if you look at the adc instruction (add with carry) for the 6502, there are eight different opcodes depending on if what you're adding is an immediate value, an absolute memory reference, etc. All the opcodes begin (in hexadecimal) with 6 or 7 and end with 1, 5, 9, or D. When you convert that to binary, the adc instruction is 011xxx01 with the x bits changing depending on where the value is. The processor uses five bits to determine it's an adc instruction and the other three to figure out what to add.
If you look at the opcodes for the sbc (subtract with carry) instruction, they're the same except they begin with E or F instead of 6 or 7. That means the binary changes by only one bit from adc to become 111xxx01 and you fill in the x bits the same way as with adc. Not all instructions fit into this same pattern, but many do if they involve taking some value from somewhere in memory and moving it into the accumulator or combining it via some operation with what's already in the accumulator. That gives you a hint as to how the processor works at the hardware level.
Even the sta instruction fits into this pattern even though the direction is the opposite. There's just no opcode for when it's an immediate value because it doesn't make sense to do so. It does make me wonder what would happen if you send it an $89 opcode though, if the processor would fault out for invalid instruction, actually overwrite the next value in memory and keep going, or something in between. I may have to try that as an experiment.
I found out what the $89 opcode does. It apparently does nothing, like the nop instruction, but with an 8-byte operand that it ignores. There are apparently a lot of these amongst the undocumented opcodes, as well as some that crash the processor and some that have interesting but inconsistent results.
Programming in assembly on the Sym 1 (6502 single board computer) was hand asembly. Instead of an assembler, you had a photocopied worksheet to write down your assembly language and hand-encode into machine language and then input into the computer via the monitor program. Of course, with 6502, that's pretty straightforward.
2:32 >thanks to Ben Eater for providing the Mac and Windows versions
Yep, thanks, when my 6502AD arrives I'll use the windows one a lot
Next, can you make a time machine and send these videos back to 1986? I could have really used them about that time. Still fascinating to watch.
I toggled machine code into a Dec PDP-8 long before the 6502. And wrote tons of BAL (assembly language). Things are a *lot* easier now.
Thank you Mr. Eater. Great video and I'm learning so much. I can't wait for the next one.