My day job is working in a the mechanical engineering field. Long story short after an issue with a machine at work ive fallen down the computer rabbit hole and am finding this so fascinating that ill be studying computer science while working full time in 2022. Really glad I found your channel. Also awesome to find a fellow aspergers guy.
Thanks everyone. From everything I’ve watched and read the C family of languages seems to be the way to go. I just brought the book “The C programming language” so looking forward to it.
@@WilliamPayneNZ I support going thru C family, however depending on the goals you have you might need to consider some "scripting" dynamic typed alternatives as well.
Latest upload to the tech curious, is a great demonstrator for how even multi million dollar budgets can miss the mark on what should be easily mastered tiny detail, but historically failing this I have stepped in to objectively improve the visual experience without question. I know no matter how hard I try, to beat Dave at the optimization game is realistically therefore probabilistically impossible.
Makes me all nostalgic. It's like they say, you never forget your first kiss. I still remember 6502 Assembly code from back in the 80's. But my memory of Amiga assembly code etc, has faded - but the C64 (6502 processor based) will always be inside my mind. Useless information, but meh.... it was our time.
Exact same way. I looked at so much 6502 back in the day I could look at byte code and tell what the code was doing. My assembler didn't have the < or > for low and high byte. Now that's new. Not sure why I find these videos so interesting but like you said, first kiss. I did work, as a kid, for a company called perspective software. They wrote C-NET BBS software for the C64. I learned a very cool trick that stuck with me for years which was that RAM and ROM lived at same address and we would toggle between the two at 60HZ to be able to use the RAM under the ROM. It was a clever trick someone taught me and I still see this today on modern ARM SoCs.... anyway, love the videos...
@@DavidHathaway Oh yes, that's how it started. First Basic, then you'd meticoulously type in all those numbers with Machine Code data that you read in a computer magazine untill you got yourself an Assembler. My first assembler was the Hes Mon 64 cartridge, no such luxuries like Macro Assembly, no - we wrote directly to memory and changed code on the fly, disassembled the rom + numerous games just to see how it all was done, and changing it to learn, snippet by snipped. Oh good times. I was only 13 at the time, my parents thought Games were akin to Gambling so they were against it. My math teacher came up to me once when he saw me sitting there alone in the schools new computer room. What are you doing there? Oh how did you make those objects move across the basic screen without basic, and live while you're typing? Interrupts I told him. He was fascinated, I otherwise sucked at math in school, but the fact I was sitting there doing machine code blew his mind. Pity I couldn't get that inty my grades :)
@@joonglegamer9898 yes, and then my folks got me a Timex-Sinclair 1000, and I saved my paperboy money to get the 16K memory expansion module. Such a good time learning Z80 except for that craptastic membrane keyboard.
@@DavidHathaway Haha, I have that one in my drawers, original packaging and all. It brings even more memoris tolife, when you told me of the Sinclair (which is essentially a ZX-81 with 2 KB of ram instead of 1, right?), anyway - my best friend back then had a ZX-81, and he would constantly stress how superior the Z80 processor instruction set was to the 6502, he was right of course, but the C64 ended up more "overall" powerful because of the specialized hardware, custom sound chip, custom VIC chip etc. The Timex/ZX-81 essentially had a faster processor, 3.25 MHz if I remember correctly? But used a lot of the speed for drawing the graphics screen. He eventually ended up with a C64 himself.
This made me laugh so much, I love this less edited, more laid back approach so much personally. Also I find low level programming like this to be completely fascinating, and I really hope I can get comfortable with stuff like this eventually.
Wow, I watched this 2 years ago as I started my journey with assembly via Ben Eaters 6502. Rewatching and now understanding 6502 assembly is amazing. This was my first of your videos and whilst you have many amazing vids, this has to be one of your greatest in my opinion:-) Thank you Dave
Dave, you walk us through this so well. No fluff, direct to what matters, and in a very easy way to understand. Thank you so much, you'd be an excellent mentor.
Fascinating - at school we had one camp who were Z80 aficionados, and another who were proponents of the 6502. I did heaps of assembly in the 80’s, even writing a modem driver in VAX macro assembly language. I was on the Z80 camp, and looking at your code to draw the characters, I would have loaded the bitmask into the accumulator, then run a loop of 8 left shifts, and test each time through the loop if the carry flag was set then draw the block character. No need to draw a space as the screen is cleared totally before drawing the time. I’m interested as to why you chose to do a logical AND and shift that value around instead, it seems quite a lot more work than just shifting bits left and testing the carry flag. Loving your channel by the way, my MS badge number was 168860, 2001-2011. 😀
Z80 amateur here - wrote a space invaders game in Z80 machine code, pencil and paper, didn't even use assembly. Entered in hex by hand and stored on audio cassette tape. Might have got a better degree if I had spent the time on something more useful!
I was familiar with 6502, but drooled over the Z80,000 spec instruction set. So disappointed it never saw the light of day (that I am aware of), because it so mimicked the IBM S360/370 instruction set. I was subcontracting to IBM around the time the PCs came out, doing mainframe OS subsystem software development. We just couldn't understand how they went with Motorola as a chip, rather than get on the Zilog path. It made no sense, it must have been pricing.
What I love most about this channel is it gives me the feeling, if I put my mind to it, I could learn assembly or programming or anything else. I wouldn't say you make it look easy, but you make it accessible and explain things logically.
I used to code assembly on 6502s back in the day too.. I was a broke kid so I didn't have a program to compile and link so I'd write the code on paper then write out the op codes and calculate the target memory addresses for jumps and jsr's myself then type it all as straight op-codes. Still lots of fun, just super time consuming.. It blows my mind how fast we could make programs run back then with so little.. Thanks for what you do. I love the MS war stories you share!
Ha! Very cool, it all comes back to me now. The 6502 was such a simple and fun CPU, very easy to work with. :) I started programming with the C64, but never got serious until I got an Amiga. The 68000 is my all-time favorite processor, but the 6502 was always fun to me as well. A bundle of joy! Keep up the great work Dave, love your channel. :)
My first ever computer I touched was a Pet whilst being baby sat, I was hooked and was given a VIC-20 for Christmas. Never looked back progressing to commodore basic then to6502 assembly for speed. C64 and then to Amiga with Devpac assembler. The 6502 made me want to get a job designing microprocessor that I did for a bit until working on 3D graphics accelerators and eventually image processors. Learning to code used to be so much easier even writing in assembly language. Such a simple set of instructions and direct hardware registers rather than complex Object oriented languages that we use today. Was certainly a golden time to be a kid with a computer. Thanks for this trip down memory lane!!!
Gotta say your videos represent everything good about youtube. Your presentation is clear and you get straight to the point. Love the lens you use that creates a lovely bokeh background. My fav channel! Thanks so much for the time you lavish on this and sharing your knowledge! This episode brought back memories from 1983 when I graduated from a Sinclair to the first IBM PC, bought Peter Norton's Assembly Language Book for the IBM PC, (which amazingly, is still for sale), and in a fit of masochism, wrote a word processor in assembly. I looked back on the code and I have to say yours is way more elegant. Cheers.
Personally never experienced 6502-assembler, my days began with 8086-assembler (I'm a late bloomer), I still enjoyed the ride along down memory lane, thanks for sharing Dave!
Does anyone remember Dr. Dobb's Journal? (Full name was Dr. Dobb's Journal of Computer Calisthenics and Orthodontia. LOL). They published a ton of assembly source code for everything from games to floating point math, mostly for the Intel 8080, but some for the Z80 and the Motorola 6800 family, as well. Truly great publication in its day.
Best monthly for learning Real programming. Ported tiny basic to an intel dev kit. Wonderful days....Running Light without overbyte. Very very clever play on words.
I love 6502, I still program it frequently. I do a lot of assembly on my channel, I still fervently believe that it’s the foundation for learning how to learn to program. And it’s easier than all those web frameworks with 1000s of objects and methods, ugh. Instead of just knowing a handful of instructions and building things up from that. Assembly is like that old skool lego, where you had a few hundred different bricks. Today’s frameworks are like modern day lego with terrible bespoke pieces for each new box, ugghh.
Man, it's been over 30 years since I've done anything in Assembly language... I'm amazed at how much I remembered, honestly. I only had to back up and re-watch a couple of times to get it all. Thanks!
Great video Dave, brings back some fond memories. The '80's - the 'golden age' for assembly programming. A stunning level of required critical thinking and innovation, particularly for games programming, by folk who quickly developed a strong, deep passion for this subject, and who literally knew this language inside out, fluently - and at a time with no internet and few books...almost zero examples. You had to think outside the box, in fact, there wasn't a box in the first place, lol. While there are numerous benefits, of course, we've definitely lost something extremely important for every programmer when we offloaded so much critical thinking to online, with such 'wonders' as stackoverflow to provide a solution to every question. Question: as our expertise(!) in assembly language is rapidly becoming reduced primarily to a curious afterthought (I'd hope C++ is the exception), are we leaving some extremely serious doors open for some 'state sponsored' (or otherwise) nefarious activities...???
Loved this, always wondered about assembly language having started my computing career programming a Texas TI58. The coolest programmable calculator. Someone saw me doing that and said I'd like the new micro computers. This was 1979 and by taking some equity out of my move from one apartment to another I funded an Apple IIe, No car, no money and a computer costing 2/3 of my annual salary. My mother said it was the most stupid thing I had ever bought. I went on to have a good career in computers so I think I proved her wrong.
Learning 65c02 assembly was my goal for 2021. The "basics" down but much to learn I still have. More 65c02 videos are always appreciated. Thank you Dave!
I took every electronics class offered from jr high thru high school. Our teacher was able to source an entire cabinet full of Rockwell AIM 6502 computers complete with register tape, breadboards & oscilloscopes.. We would write code and build projects that would do everything from measuring temperature to controlling a robotic arm and power transformers to cook hot dogs for class parties / holidays etc. . These were great times. You have my attention anytime you start talking 6502.... ;)
The good old days of assembly programming brings back a lot of memories Dave. My Canadian highschool had a Commodore 8032 lab. I remember writing programs that had more LOC than there were transistors on the 6502. 🤣
My God... I love this channel. It brings me back into the late 90s where everything that our forefathers taught us comes back to the present. And here we are 25 years later - rediscovering the past. I haven't been back to this information in ages. This type of information is a special spice that only a few people remember. Ancient Recipes!
Love the coding vids the most! Keep it up! I never had a 6502 machine, but basically did the same on 8086 as a kid in the 80's. Brings me back to simpler times.
If you want some 8088 come to my channel. I also do sone 6502 in hacking old games, to achieve a certain goal. Z80,68000 we also have and a whole course on ARM64
This sure brings back fond memories for me. The first non-homebrew computer I ever owned was a Commodore PET (with the old Chicklet keyboard and cassette storage). One of the first programs I wrote was a mimic of Pong, written in BASIC. It ran far too slow to be usable, forcing me to rewrite it in 6502 assembly language. I didn’t own an assembler, so I had to hand-assemble my code using pencil and paper, and then type in the hex using a “monitor” program. It was tedious, but I sure learned a lot. My beginner programming buddies thought I was a genius for pulling it off.
You had a "monitor" program? I remember POKEing my hand-assembled code into memory. (VIC-20) Eventually I got a VICMON cartridge, but that was years later. The Apple was such a leap forward with CALL -151. :-)
I wrote 6502 assembly language when I was in college. Since then, I've written assembly language for a Z-80, several DPS chips, including the TMS320C30, the 68000 processor, and Intel X86 processor, mostly because I wanted to do efficient signal processing using the SSE1, SSE2, and SSE3 instructions. At one point, I was fluent in all these processors. Naturally, even back then, I wrote mostly C, and later mostly C and C++. It's been a long time since I wrote assembly code, and while I could still write Intel assembly language code, I don't recall any 6502 assembler now. 99% of software jobs today could be advertised with, "No assembly required."
Wow this takes me back. Still have my first ever assessment in IT for my work in ASM at Amex. Praised because it was a dying skill. Though that was the last year i ever used it professionally. Started on a 6502 at school and i was hooked :). As a kid that loved logic puzzles I didnt know what i wanted to do in life but found this was my calling. Surpised how much i could still understand. Helps that you didnt try too many tricks,
Light bulb on! Zero page is pointers! Brilliant! I would love to see a segment on some methods of disassembling back into ASM. I realize that can be a tall task, but some tips and pointers on how you tackle such a task, even with just a simple program, I think would be a fantastic video! Keep up the great content, Dave! You're making RU-vid worth watching!
Wow. Having bought an Apple ][ in 1977 this brings back memories. I definitely did NOT code in such a structured method. In fact it was load fire aim back then lots of experimentation and trouble shooting. It is so cool to see a properly disciplined and structured assembly code for a computer that’s slightly older than my marriage. Thank you for this. Keep it up.
Oh man I love this. 6502 is where it all started for me on the Apple ][+ "wait? What? There's more than FP Basic in here???" Call -151 & the Editor/Assembler started a whole new life for me. Thanks for this.
I started assembly code with the TMS9900, which was the first 16 bit processor, released in 1976. As a very junior engineer they asked me to design built in test equipment (BITE) to test memory cards on a ship borne system. The only display device was an oscilloscope, so I went into deep development mode for a few weeks (we had quite a free hand) and came up with code that ran all the tests then converted it to text messages via a digital to analog converter (DAC) that would scroll across the oscilloscope screen once the right time base and voltage range was selected. It became a standard test bed for the memory cards wherever they were used in the system. Happy days.
Gosh Dave, this takes me way back. I taught myself assembly on a C64 (also to write games), which served me well over the years as I learned 6811, Intel, and pic assembly. I eventually graduated to C, but always loved assembly for the pure control of the system. These videos are great!
I moved from Seattle to Honolulu in October of this year and I'm glad I did. I don't miss that weather. Growing up in the upstate NY area I wasn't a fan of snow to begin with and seeing you're dealing with snow convinces me I made the right decision.
I love how you explain every little bit for the curious viewers at, for instance, 4:00 :-) Great video, as always! And happy new year from The Netherlands!
I have a million great compliments to give in regards to your videos. I'm watching this to get inspired by how you teach this subject. So this time I settled on giving many 👏👏👏 for the fact that all code is perfectly readable also on a small phone, where I personally watch RU-vid on.
Looking at Dave's Green monochrome screen brings back a special feeling of those early days. It's hard to describe the feeling of looking at monochrome text on a green or amber screen which I did for a number of years.
To anyone in the UK wanting a generic introduction to what is inside a Microprocessor/computer chip I can highly recommend the Open University course T224 "Computers and processors" - which you can still buy the student books for - even though I see the course itself has been replaced by a newer course. That course explains processor cores, CISC and RISC, memory system architectures and things like bus bridges (as in Northbridge etc) and allows you to see what happens - step by step - when one of the asembly language steps used in Dave's tutorial is executed. In the early 1980s I did absolute oceans of machine code for the SC/MP microprocessor (Nat semiconductor chip) and then a little for the 8086 (Intel's first 8 bit MP) and yes, it gives you a knowledge of the basic processor like *nothing* else can. Nevertheless my goal was not to study processors it was to create useful programs and consequently I was very happy to move on to BASIC which I always likened to "flying after spending years crawling on hands and knees"! Visual Basic and then C++ and Jscript etc experience all followed though I did have a brief regession around 2000 when I had to write some assembly language code for an Atmel AVR microcontroller - which taught me huge amounts about that architecture, but reminded me how much work for relatively little result - albeit that the resulting code ran within the memory constraints and very fast.
Was very interesting to see "2022"-era coding style applied to this older architecture. I started learning assembly in 6502 on an Apple//e in school in the mid 80s. My mind went to "how to optimize" this code at each step - those old habits are so hard to step around.
yes, That was a very interesting setup, all round, the bit that was only slightly touched on pet, was pet's memory and resources , (lack of), and resources being used to 2022 had software, hardware talking, communicating, to the same goal? Was anyone thinking a flip clock, as Dave was moving the time back and forth with the PET's clicking keyboard sound going and number changing on the screen?
Reminds of a scrolling Times Square display I wrote for fun in assembly for the Sinclair ZX81. It was all hand-assembled using a Z80 processor reference and ZX81 memory map. Lots of fun! I later landed a job at Motorola programming their early cellular switching system, which used fault-tolerant Z80 boards. The project somehow impressed my interviewer, along with a similar hand-assembled Space Invaders game. I hated calculating those relative jumps by hand. Stayed at Motorola for 30 years.
Toad My only class in coding has been doing Assembly on a thing called a "Wang 3000" desktop calculator. It had 14 Nixie tubes for a display. That was 1975. I fell in love with coding, as a hobby, and still do!
Great video ! You have to appreciate today with almost limitless memory and explicit programming languages ! Back in the day they must think about everything and take all in account. Hope you have nice holyday ! Love your videos great stuff ! Thank you for sharing your knowledge. Wish you the best 👍
Assembly is the 1st language I learned. I struggled for years trying to learn OO programming. One day I stumbled on a book on assembly and started reading. It began with how a CPU worked and what each instructions was doing inside the CPU. It all suddenly clicked! I thought to myself, "I thought assembly was supposed to be the hardest language but it's the easiest!"
I was way too old to learn to program in assembly language 😂 but I did, a whole 1k of memory was huge 😱 I used to design games etc. Sadly things went mad and I couldn't keep up. But at least for a couple of years, I was a computer programmer. 😀 I was about the first in my local building construction industry to have a website, 20years later it is still providing me with more work than I can handle.
20:58 where on earth am i going to run into people crying that the 6502 doesn't have any registers Dave. anyway priceless video. nice massive house too, practically a castle(i can only imagine how many life times it would take me to own such a house).
Jim Butterfield was my hero back in the 80’s. I didn’t hear any mention of TPUG or TPUG magazine. As I remember Jim’s contributions to the club and the whole 6502 club were many!
I wrote a couple of utilities for the C64 and Amiga in ASM back in the day and this video brings back the memories and headaches :) I wrote a utility to open a disk on the C64 move, copy delete, etc files and even make the disk self-starting and made it do it all in a popup Windows. I personally used it for the rest of my c64 life. The Amiga was for Amigas that had add-on cards so you could pick your start up depending on the addon card for booting. Both are out there somewhere. After those, I retired :)
Great video with just the right balance between technical depth and length - and I quite like the result, too. BTW: Isn't it incredibly satisfying when all your test cases work? Perfect code! 🙂
It's amazing what can be done with a couple registers, a few dozen instructions, and a handful of illegal opcodes. By the way, the fact you can write to memory and "the rest just happens magically" is extremely convenient. Not so on the Atari 2600! Edit: If you want to continue this series, it might be fun to take advantage of the green-on-black display and add a Matrix background behind the digits!
sta (zptmp), y Ahhh indirect indexed addressing mode. That was when I really grasped that you can point the processor anywhere. It blew my mind. It was the single most important instruction I ever learned cause it's the one that taught me pointers to pointer tables, to pointer tables, that could go on infinitely. I was on an Atari 800. It had memory mapped video also. Used to point it to the OS and watch the OS work by watching the characters change. It was an ad hoc way to find things, as the Atari had a closed architecture and info was scarce.
I can hardly think of a better way to spend this uncharacteristically snowy evening than to knock back a few pints and learn some 6502! Regards from Bellevue, Dave!
A small change if writing this for the BBC Micro would be to read the character definitions from ROM that are used for screen modes 0 to 6 but display the clock in mode 7.
Back in 1988 I was taking an electronics course in which I had a crash course with 6502 assembly on the BBC Micro. I had created a light pen for the BBC and had to write the assembly routines to read the pen to get the screen position! All the pen was was a light sensor so all the actual work was in the assembly code.
@@martinrwolfe I think there might even be a 'licit' way to obtain the character definitions through some system call on the Beeb, believe it or not. Definitely Acorn tried to write their APIs {as you might truly call them} as if it were already 'the future'. Pity the 6502 was unable to code a relative jump (except for a conditional of short range - i.e. 8' signed). Motorola's 8-bit was the belle of the ball - but they (Acorn) had their own solution in the pipeline, as we know well! My blood was almost boiling when I heard him talking about jumping into the right place in the ROM... but then I thought, how cool it would be to prove that to be the case with a comprehensive a step-wise debugger! (emulated or otherwise.)
While I was in college, I had a job in the Physics Department doing lab tech stuff. One of the computer labs was being upgraded, so we got a bunch of Apple // computers, but no floppy drives. I wanted to make some basic logic analyzers to use in the digital electronics classes. So I designed and wire-wrapped an 8-bit input card and wrote an assembly capture program for it. I wrote the display and control program in BASIC. The problem was how do I get the programs onto the machines w/o drives. So I made a boot loader that pretended to be a disk controller card so the Apple would call a routine on it when it was turned on. I burned the BASIC program into an EPROM, along with a little assembly program that could copy it out into RAM in the spot the interpreter was expecting it. Then pretend to type "RUN" so it would launch the program.