NES Emulator Part #2: The CPU (6502 Implementation)

แชร์
ฝัง
  • เผยแพร่เมื่อ 7 มิ.ย. 2024
  • In this video I build a 6502 emulation in C++. I pay close attention to the instructions that can cause problems, ADC and SBC. Then I build a lightweight application to analyze running 6502 programs.
    Source: github.com/OneLoneCoder/olcNES
    TH-cam: / javidx9
    / javidx9extra
    Discord: / discord
    Twitter: / javidx9
    Twitch: / javidx9
    GitHub: www.github.com/onelonecoder
    Patreon: / javidx9
    Homepage: www.onelonecoder.com
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 749

  • @vspecky6681
    @vspecky6681 4 ปีที่แล้ว +1732

    Can we just take a moment and appreciate the fact that this guy didn't put a single ad on an hour long video?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +292

      Thanks! Or any of my videos as it happens 😊

    • @cecilectomy
      @cecilectomy 4 ปีที่แล้ว +89

      Never has, and doesn't intend to, iirc. Doesn't care about monetizing the channel, only cares about the community, code, and knowledge.

    • @CB3ROB-CyberBunker
      @CB3ROB-CyberBunker 4 ปีที่แล้ว +3

      don't even think you can monetize videos when the account is registered on most parts of the world other than the usa. can't find it anywhere in my account for one thing. lol. youtube never understood much of the 'open one office in pakistan and just send everyone bitcoin' thing and think they have to open 'local offices' with 'local payment bullshit' everywhere. lol. for all i care they just pop the cash in an envelope. works anywhere where there is a mailman ;)

    • @Empathia2k7
      @Empathia2k7 4 ปีที่แล้ว +7

      can i be your patron? :>

    • @javidx9
      @javidx9  4 ปีที่แล้ว +19

      @@Empathia2k7 you certainly can!

  • @74LS_NE555
    @74LS_NE555 4 ปีที่แล้ว +783

    Life goals, having a wife that can double check my opcodes

    • @user-cz9ss4yq4x
      @user-cz9ss4yq4x 3 ปีที่แล้ว +34

      "men only want one thing and it's disgusting"

    • @user-cz9ss4yq4x
      @user-cz9ss4yq4x 3 ปีที่แล้ว +16

      @Serena Williams No, having a wife that can double check your opcodes

    • @baileyharrison1030
      @baileyharrison1030 2 ปีที่แล้ว

      @Serena Williams Wants ≠ responsibilities

    • @tinker7722
      @tinker7722 2 ปีที่แล้ว

      😅👍

  • @waseinmalwar1854
    @waseinmalwar1854 4 ปีที่แล้ว +521

    1 hour of David speaking about opcodes? Is this heaven?

    • @javidx9
      @javidx9  4 ปีที่แล้ว +119

      Not only do you learn about code, but its an awesome insomnia remedy too!

    • @hadis93
      @hadis93 4 ปีที่แล้ว +6

      west Virginia

    • @lupinedreamexpress
      @lupinedreamexpress 4 ปีที่แล้ว +11

      machine code is great for those cold winter nights.

    • @aphexon.
      @aphexon. 4 ปีที่แล้ว

      Defeated swordsman pretty sure it's hell

    • @fdelduquenobre
      @fdelduquenobre 4 ปีที่แล้ว +2

      No. Just mean you are crazy, like the rest of us!

  • @emiljaszczuk1
    @emiljaszczuk1 4 ปีที่แล้ว +326

    Dude, your content is pure gold. I love the fact that you thoroughly explain every concept and not only show the code, while still being concise.

    • @javidx9
      @javidx9  4 ปีที่แล้ว +12

      Thanks remique!

    • @proxy1035
      @proxy1035 4 ปีที่แล้ว +12

      which is not only rare but also really awesome as you can follow along while programming in another language!

    • @slickmashable
      @slickmashable 2 ปีที่แล้ว +2

      Man we don’t deserve this!!!! Holy shit

  • @greatbullet7372
    @greatbullet7372 4 ปีที่แล้ว +249

    You are the personification for actual, usefull qualitycontent about c++. Be proud!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +39

      Thanks Great Bullet! I just want to show that fun applications are possible and far better to learn from than text books XD

    • @josemaria2094
      @josemaria2094 4 ปีที่แล้ว +7

      TheChernoProject, Universo Programado and Bisqwit are too, :)

    • @greatbullet7372
      @greatbullet7372 4 ปีที่แล้ว

      @@javidx9 thats my speech, books are outdated crap for the biggest part.

    • @greatbullet7372
      @greatbullet7372 4 ปีที่แล้ว

      @jj zun i have experience yes but understanding the whole background of a system is another level of expertise you have to gather, and im thankful for every useful plate someone is able to serve.

    • @Xd4LEM4ObX
      @Xd4LEM4ObX 3 ปีที่แล้ว +1

      @@josemaria2094 All the channels that i like... You're brazilian right?

  • @code-dredd
    @code-dredd 4 ปีที่แล้ว +182

    Chemists have The Periodic Table of Elements.
    We Software Engineers have The Mnemonic Table of Opcodes.

    • @skilz8098
      @skilz8098 4 ปีที่แล้ว +10

      Hardware Engineers have the Truth Tables, State Tables, Transition Tables, Implication Tables, and K-Maps of your Basic Logic Gates and the combinations of them!

    • @loernius
      @loernius 4 ปีที่แล้ว +3

      Of each processor

    • @bpark10001
      @bpark10001 3 ปีที่แล้ว +1

      ...but there is only one "machine" in chemistry, with a universal set of codes, versus many for the software guys! Can we compile C++ to chemistry?

    • @VanillaMidgetSSBM
      @VanillaMidgetSSBM 2 ปีที่แล้ว

      @@bpark10001 I mean Silicone is a chemical compound sooooo 🤔🤔🤔

  • @InfiniteQuest86
    @InfiniteQuest86 4 ปีที่แล้ว +71

    Wow, you have a very patient and understanding wife.

  • @victornpb
    @victornpb 4 ปีที่แล้ว +78

    I’m on TH-cam since 2005, I never been so excited to see a part 2 video in my entire life!

  • @VirtuelleWeltenMitKhan
    @VirtuelleWeltenMitKhan 4 ปีที่แล้ว +46

    The test ROMs are a super nice thing to have.
    A wife which is willing to check your code is even better.

  • @lallenlowe
    @lallenlowe 4 ปีที่แล้ว +50

    Oh man, this series is coming at the best time. I love you. May I recommend Ben Eater's 8 bit computer on bread boards series for anyone wanting to understand the electrical underpinnings of a CPU.

    • @skilz8098
      @skilz8098 4 ปีที่แล้ว +2

      Already Watched it; and if you want the math background check out 3Blue1Brown and for In Depth C++; check out Jason Turner!

    • @deathscreton
      @deathscreton 4 ปีที่แล้ว +6

      @@skilz8098 I wanna throw out "The Cherno" as well, his tutorials into C++ are succinct and to the point.

    • @skilz8098
      @skilz8098 4 ปีที่แล้ว

      @@deathscreton Yeah, he's good too!

    • @asandax6
      @asandax6 3 ปีที่แล้ว +1

      Interesting I am subscribed to all the people named here.

  • @zlatkovnik
    @zlatkovnik 4 ปีที่แล้ว +41

    Why are you much more interesting than my college professor when talking about the same subject? Good work!

  • @DDD-vs2pe
    @DDD-vs2pe 4 ปีที่แล้ว +1

    Dude you have explained everything and implemented everything so abstractly and succinctly that I watched the whole last one, saw this one come out and watched it straight away.. Thanks for a great video, and I really hope you make this a great series! It's absolutely fascinating!

  • @funposting8912
    @funposting8912 4 ปีที่แล้ว +1

    It’s beautiful seeing a deep-dive into the 6502 like this in video form. Even the simplest of microprocessor trainers don’t get this absolutely simple, I love it!
    Can’t wait to see you go through the rest of the NES’s hardware like this, this series is taking my knowledge from a rough, “good enough but never great” understanding to something much more refined and even simplified. Thank you very much for everything you’ve done so far, and I can’t wait for the rest of this series!

  • @WagnerSchmitt
    @WagnerSchmitt 4 ปีที่แล้ว +8

    Since your first video I already started building my own Emulator. You were right, it is such a wonderful project to work on.
    It was something I also wanted to do a long time ago, and your videos gave me the motivation to start.
    Thank you for that, and for making the videos so didactic.

  • @BackyardFilms2
    @BackyardFilms2 4 ปีที่แล้ว +5

    Finnaly to the end. took me a few sessions. This was an amazing video thank you!

  • @saraweber312
    @saraweber312 4 ปีที่แล้ว +26

    This is honestly amazing! This is basically a college course that's free. Keep up the good work man!

  • @w3ll1ngt0nd14s
    @w3ll1ngt0nd14s 4 ปีที่แล้ว +49

    YES! I was looking forward to second part of this new series.

    • @whatamievendoing
      @whatamievendoing 4 ปีที่แล้ว +1

      Same! I'm totally satisfied with this episode too, all the juicy details I wanted are included in a way which makes more sense than it ever did before!

  • @StuBonham
    @StuBonham 4 ปีที่แล้ว +11

    Incredible stuff - I programmed 6502 back in the day, and this brought back a lot of memories.

  • @manuellehmann267
    @manuellehmann267 4 ปีที่แล้ว +11

    Uhhhh... I was so looking forward for this!
    I just wanted to say: Thx for your awesome work here! I'm learning so much from every single video you are posting. So much detail, so much passion. Again: Thx for sharing this stuff with us.

    • @javidx9
      @javidx9  4 ปีที่แล้ว +3

      Hey my pleasure donnerbrenn!

  • @vtomasr5
    @vtomasr5 4 ปีที่แล้ว +31

    I think I'm more exited about the well organized and educational content rather than the NES emulator itself ;)

  • @Simple_Simon_UK
    @Simple_Simon_UK 4 ปีที่แล้ว +27

    I can't stop giggling. You have taken me right back in time.
    I wrote a 6800 Emulator (Dissassembler) in Pascal, during my second year at University in 1984!
    The Ureka moment for this most daunting of tasks was when I devised the table of Instructions and Addressing Modes. Once I'd created the table, the implementation of the CPU was a doddle.
    I love the elegance of your C++.
    You are a very clever cookie.

    • @kkeanie
      @kkeanie 4 ปีที่แล้ว +3

      jesus! Do you still have the code!

    • @Simple_Simon_UK
      @Simple_Simon_UK 4 ปีที่แล้ว +1

      @@kkeanie Sadly no. My wife's de-cluttering got rid of my history many years ago.

    • @skilz8098
      @skilz8098 4 ปีที่แล้ว +1

      @@Simple_Simon_UK Bad wife; bad wife!

    • @Simple_Simon_UK
      @Simple_Simon_UK 4 ปีที่แล้ว +1

      @@skilz8098 Nah. She's a fantastic Wife. She has put up with my s#it for over 37 years. She just likes to de-clutter once in a while.

  • @TheBeanhacker
    @TheBeanhacker 4 ปีที่แล้ว

    Incredible! Been eagerly awaiting this video all week. There's a crater in my office floor where I've been nervously tapping my foot! Awesome video, it paints processor emulation in a simple and elegant light, and makes it appear very achievable.

  • @Heisenberg2097
    @Heisenberg2097 4 ปีที่แล้ว +8

    Fills so many gaps I never cared about to fill back in the days though it was all in front of me... had to care about so many other things. Great video.

  • @renarsdilevka6573
    @renarsdilevka6573 4 ปีที่แล้ว +1

    David, you are great, just so easy to understand and watch. Every your video inspires me. Thank you!

  • @dtg5790
    @dtg5790 4 ปีที่แล้ว +1

    This is amazing work. I've been trying to get a 6502 emulator going in Common Lisp for the last few months and it has been slow... Your work is extremely useful! You've inspired me to revisit my own implementation.

  • @angulo_
    @angulo_ 4 ปีที่แล้ว +4

    Wow. Thank you! I'm studying computer science and I was having a bad time understanding assembly code and instructions. This project helped me a lot! Just finished writing my implementation in dotnet:)) looking forward for the next episode!!

  • @fabuloss77
    @fabuloss77 4 ปีที่แล้ว

    What a gold mine.. you have one of the best youtube channel ive came across. I can feel how passionate your are about this subject through your explanations and it shows in the overall quality of the content. Amazing work.

  • @joedempseysr.3376
    @joedempseysr.3376 4 ปีที่แล้ว

    Congratulations on your 100th video, David! Thoroughly enjoyed it and am looking forward to more. Thanks!

  • @sakealex
    @sakealex 4 ปีที่แล้ว +1

    Thanks for your work sir, I binged on your vids the past week, I was off from work. I wish you the best of luck in all your endeavors.

  • @jeanjcl
    @jeanjcl 4 ปีที่แล้ว +1

    Amazing content. This is pure gold to someone who is learning systems programming and low level stuff in general. Thank you!

  • @zgolkar
    @zgolkar 4 ปีที่แล้ว

    Outstanding. Simply outstanding. 10/10. Great explanations, great approach of showing the code incrementally, engaging at all times. Thanks a lot, I will be looking forward to the rest of the series!

  • @lozD83
    @lozD83 4 ปีที่แล้ว

    Only 5 minutes in and I can already tell this video is a great resource for anyone interested in 6502 and probably any processor/microcomputer understanding. Thanks for taking the time to explain things so well 😁

  • @Ali-io9lw
    @Ali-io9lw 4 ปีที่แล้ว

    Hi Javidx9! I just want to thank you for making this available!!! In my early teens I wanted to program my own emulator but never knew where to start. I was around the time when NeoRage (first neogeo emulator) was being developed purely in assembly in the 90s and was fascinated by the coders accomplishments. Forward 20 odd years later here I am trying to learn how to make a Nes emulator in C++. I don't have a strong programming background so I have had to watch this several times. I now understand most of your code in this video. I look forward to watching the rest of the series and seeing Nes emulating on my screen. Thank you for making this happen!

  • @Seftdelmer
    @Seftdelmer 4 ปีที่แล้ว

    Wow, these videos are excellent, with clear and concise explanations. You can tell a lot of time and effort went into making these videos by their quality. Thank you for making them and keep up the good work.

  • @skilz8098
    @skilz8098 4 ปีที่แล้ว

    I've tried to do something similar on my own before from reading the documentation from nesdev, and from listening to others but the one thing I kept struggling with was the different addressing modes. After following your source and typing it by hand in my own IDE, as I was reading through the mnemonics or functions and seeing how you implemented them in C++ then I started to understand the actual internal hardware of the CPU. I've worked in Logisim to create simple 4 bit single phase single address CPUs which are quite easy to build from basic gates, but now I think I finally got the full grasp of the different addressing modes of the 6502. I really appreciate videos like this; they help to fill in the gaps! After you complete this series I think building the 6502 - NES in Logisim as a step by step set of tutorial videos would be another exemplary set of worthwhile videos! I was hoping that Ben Eater would take his 8-bit Bread Board CPU and do the same in Logisim! Who know's maybe one day!

  • @podborski
    @podborski 4 ปีที่แล้ว +1

    Wow. What a great content!!! I'm waiting for the next part! Thank you, javidx9

  • @teslastellar
    @teslastellar 4 ปีที่แล้ว

    Thanks a lot David. Wonderful series. The time and effort you put into these videos is immensely appreciated.

  • @josephholten5088
    @josephholten5088 4 ปีที่แล้ว

    wow, this is just amazing! i have only taken a short course on c++ at uni but understood most of what you were talking about, it was all very clear and super interesting. i would have never thought i'd get that much involved into c++

  • @frankk6416
    @frankk6416 4 ปีที่แล้ว

    Thanks for putting this together. Your presentation is spot on and easy to follow - a pleasure to watch.

  • @JeremiahKellogg
    @JeremiahKellogg 4 ปีที่แล้ว +1

    This is amazing! I know it's a labor of love, but thanks so much for sharing. It really removes some of the more mysterious aspects behind how CPUs work. I'm really looking forward to the rest of the series.

  • @delnarlt
    @delnarlt 4 ปีที่แล้ว +5

    Amazing Video. I'm having fun cause I'm converting the code to C#. I've always wanted to write a NES emulator and I'm a C# guy so your video is a perfect match. You're helping me understand how they wrote a NES emulator in Javascript and other languages.

  • @samljer
    @samljer 4 ปีที่แล้ว +6

    Ive been refreshing your channel since part 1... this is SO GUD.

  • @RetroWK
    @RetroWK 4 ปีที่แล้ว +1

    Excellent Video! Congrats on 100 videos and thanks for your work & time!

  • @tomkirbygreen
    @tomkirbygreen 4 ปีที่แล้ว +3

    Fab video David! :-) I learned lots and as ever the process was entirely enjoyable!

  • @mikemontana7436
    @mikemontana7436 4 ปีที่แล้ว

    I am really enjoying this! Thank you! Brings back the days of typing in pages of POKES from Antic magazine!

  • @spjewkes
    @spjewkes 4 ปีที่แล้ว

    Thank you for yet another interesting and informative video. Also, congratulations on your 100th one. It’s been a fantastic journey so far and I’m looking forward to many future videos :)

  • @jacksmith3183
    @jacksmith3183 4 ปีที่แล้ว

    Super impressed, just blown away with how awesome this video series is

  • @krrishxxx
    @krrishxxx 4 ปีที่แล้ว

    The 2nd part is here and it is very informative, I learned a lot, thank you so much, I can't wait for the other parts :)

  • @schweizerd6303
    @schweizerd6303 4 ปีที่แล้ว +1

    Excellent content, very easy to understand and follow. Love how you break everything down and the object oriented nature of C++ makes everything so much easier to visualise. I am trying to emulate IA64 architecture and hopefully get it to run Linux and Windows

  • @jdragyn
    @jdragyn 4 ปีที่แล้ว

    Hobbyist programmer here, but I haven't had the opportunity to write any software in years. Watching you write this NES Emulator is both so incredibly satisfying (your presentation, voice, style and knowledge is amazing) and inspiring (I wanna write something like this now - you make this large project seem do-able!). Thank you for sharing your obvious passion!

  • @mannhansen9337
    @mannhansen9337 3 ปีที่แล้ว

    Excellent video. You are a great teacher with very good presentation skills. I'm a self-taught 6502 programmer on a KIM-1 back in 1980-81.Some years later when I got an IBM PC and developed a 6502 table driven assembler in Quick Basic,later Turbo Pascal.

  • @shampavmancg
    @shampavmancg 2 ปีที่แล้ว

    Very very well articulated. Having written device drivers for the early part of my life, I know how difficult it was to visualize things.. this is very well done

  • @jszoja
    @jszoja 2 ปีที่แล้ว

    Usually I'm watching videos like this with x1.75 speed to get quickly what I need to know, but there is no need to do that with your videos. Very good work. Much appreciated. God bless.

  • @boredfish80
    @boredfish80 หลายเดือนก่อน +1

    It takes some skill to create something that a curious layman can follow and yet someone more tech-minded can actually use without being condescending. Hats off to you, sir. There’s something for everyone here!

    • @javidx9
      @javidx9  หลายเดือนก่อน +1

      Thanks boredfish, I appreciate that, as it's what I aim for in my videos.

  • @FritsvanDoorn
    @FritsvanDoorn 4 ปีที่แล้ว

    I am half through this video and man this is pure fun of the highest level. Thank you so much for making these videos!!!!

  • @speedyc88
    @speedyc88 4 ปีที่แล้ว +1

    Just watched Part 2 of your emulator video, Javidx9 nice job, more please

  • @quincy1048
    @quincy1048 4 ปีที่แล้ว

    In 1985 I was in computer science school and we did a course where you did a simulation of a assigned processor archeture and proceeded to write an assembler to feed the first program you wrote. So I fired up my new ibm clone with 256ram and two 360k drives and i put turbo pascal 3 in it with a tsr to give me source level debugging and off I went. Our processor was limited so you got the idea of address modes and instruction variants without the repeated details of even a 6502. But yes this was a awesome walk down memory lane watching this video. I was yes, Yes, and YES the whole way through. Nice for you to say this was not your first effort on this but a refined result. Because it looked VERY refined...awesome.

  • @bitchain
    @bitchain 4 ปีที่แล้ว +1

    Totally hooked on this series having both played NES as a kid and later gone into _higher_ level programming; this brings back CompSci memories but if only those lectures were taught in this way.

  • @schnert0
    @schnert0 4 ปีที่แล้ว

    Funny that you happened to be writing an NES emulator at the same as me! Maybe I’ll be able to learn what I’ve been doing wrong when I run into emulation errors. Thanks for your awesome vids, can’t wait for part 3

  • @keigezellig
    @keigezellig 9 หลายเดือนก่อน

    I just found this series and it inspired me to build a Z80 emulator. It has a lot more instructions than 6502 but i use the ideas presented in this video/series during development. Thank you!

  • @Oingoboingo710
    @Oingoboingo710 4 ปีที่แล้ว +2

    This is so nice, this series is going to be really awesome!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +2

      I hope so Mah Moud, thanks!

  • @xotmatrix
    @xotmatrix 4 ปีที่แล้ว +1

    Really good. Easy to understand structure and excellent explanation of ADC/SBC and Overflow. Extra good for introducing your olcPixelGameEngine engine and the handy mass:werk assembler.

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Thanks xot!

  • @frisnitfrisnit
    @frisnitfrisnit 4 ปีที่แล้ว

    Great stuff, loving the series so far! As an ex 6502(ish) console coder for the SNES and a current C++ coder, it’s interesting to be thinking of both simultaneously. Looking forward to the rest

  • @amisner2k
    @amisner2k 4 ปีที่แล้ว +12

    You did your whole presentation, outside, in the heat and didn't take one sip of your soda.
    You absolute legend. XD

  • @xM0nsterFr3ak
    @xM0nsterFr3ak 4 ปีที่แล้ว

    man i am addicted to these videos. keep up the good work!

  • @ContractCAD
    @ContractCAD 4 ปีที่แล้ว +2

    I taught myself 6502 30-odd years ago as a 15 yr old and guessed at what your emu code would look like (which in fact was my assumption as to how I’d write one). This tho has been a masterclass. I can’t wait for the rest. Thank you sir!

    • @javidx9
      @javidx9  4 ปีที่แล้ว +1

      Thanks Matt, I'm approaching the series with broad strokes, and the devices get more complicated as we progress so it will need a bit of "filling in the gaps" later.

  • @cameronball3998
    @cameronball3998 3 ปีที่แล้ว +1

    I didn't expect to watch the entire hour+, but here I am. This was awesome

  • @kb3khs
    @kb3khs 4 ปีที่แล้ว

    Got a Sir David Frederick Attenborough vibe at 1:05:35
    Your inflection was good. And the resolution inflection made me feel like I was watching David on the BBC nature channel. LOL.
    I admire your work, and your choice to not put ads in your videos.

  • @philipthatcher2068
    @philipthatcher2068 4 ปีที่แล้ว +1

    An excellent and very well paced explanation. Great video.

  • @nathonbrown3596
    @nathonbrown3596 4 ปีที่แล้ว

    This video did not disappoint. Great job. Can't wait for another one

  • @jeyko666
    @jeyko666 4 ปีที่แล้ว +1

    I literally started reseraching this a week ago, and your videos are godsent man, ch8 m8

  • @Damaniel3
    @Damaniel3 4 ปีที่แล้ว

    I actually tried my hand at writing a 6502 emulator many years ago (I wanted to try making an NES emulator too), and I've got the code open while looking at what you're doing. Unsurprisingly, your implementation is *much* nicer - I used giant switch statements to process opcodes instead of function pointers, for example, and I never implemented a proper bus, choosing to just create a single 64K block of RAM, which meant I would have had to refactor things to get the other devices hooked up once I got past the mere CPU emulation stage. I doubt I'll revisit the project again, but I really enjoy watching someone that knows what they're doing go through the same steps that then-20-year old me did so many years ago.

  • @icupiii
    @icupiii 4 ปีที่แล้ว +1

    This is one of the best series on YT. Thanks!

  • @bruno-zl9qn
    @bruno-zl9qn ปีที่แล้ว

    Brilliant. I'm writing a Z80 emulator in Rust, and I am using your video for that purpose. Thanks a lot for the hard work put in those videos.

  • @GeneralVanRyberg
    @GeneralVanRyberg 4 ปีที่แล้ว +1

    This is a super-duper-awesome video. I can't imagine this video being much better... Thank you so much!

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      Cheers!

  • @code-dredd
    @code-dredd 4 ปีที่แล้ว +22

    @53:43:
    This is an attempt to clarify a potential point of confusion for others who may not be too familiar with the stack. Normally, the stack pointer (i.e. `stkp`) should be pointing to the element at the top of the stack. However, in the code as shown, the `stkp` isn't really pointing directly to the top element. Rather, it's pointing to the (logically) "empty" location where the next element should go when pushed, which is why the `write(0x0100 + stkp, a)` call is made first in `PHA` before decrementing the pointer with `stkp--`. Consistent with this, in `PLA`, you can see that the `stkp` is first incremented before reading, so that it moves from the (logically) "empty" stack position down to the actual top element in the stack.
    I mention this because "normally", you'd expect the `stkp` to be pointing to the top element directly at all times, which would mean that on push, you'd be `stkp--` and then `write(...)`, and on pop you'd be doing `read(...)` and then `stkp++`, in that order.
    BTW, if you're wondering why `stkp` is decremented in value when the stack itself is supposed to be growing in size (and vice-versa), the reason is that stacks grow from high memory addresses down to lower memory addresses.
    GG

    • @marklandgraf7667
      @marklandgraf7667 4 ปีที่แล้ว +1

      Thank you. I was confused.

    • @senatorpoopypants7182
      @senatorpoopypants7182 3 ปีที่แล้ว

      you misspelled stkp as stpk in some instances

    • @code-dredd
      @code-dredd 3 ปีที่แล้ว

      @@senatorpoopypants7182 Fixed. Thanks.

  • @tiagomelojuca7851
    @tiagomelojuca7851 2 ปีที่แล้ว

    Hey javid, thanks for this piece of art. Best IT channel in TH-cam. Seriously. Thanks for all the knowledge :)

  • @tecnoplayer
    @tecnoplayer 4 ปีที่แล้ว +1

    I'm very glad you're making this series. The acronyms and abbreviations of the code make it fast to read and write (r/w) but is far from being intuitive to grasp at first.

  • @theronster345
    @theronster345 4 ปีที่แล้ว +1

    System Designers back in the day were geniuses. I had to design a Single Cycle CPU that performed all the bit wise operations and arithmetic operations for my computer organization class. It fried my brain by the end of the semester. Thanks for the vid it improved my knowledge of system design but also C++.

  • @Inevitablerizzler
    @Inevitablerizzler 4 ปีที่แล้ว

    Again, nice to see useful information being spread to people about this sort of stuff, nice job!

  • @taik0
    @taik0 6 หลายเดือนก่อน

    Such an amazing video. Perfect explanation. 10/10 quality. There's a game called Turing Complete that helped me a lot to understand a lot of concepts about CPUs addressed in this video.

  • @christianbuendia5794
    @christianbuendia5794 4 ปีที่แล้ว +1

    how much i learn with this 2 videos thanks a lot! P.D. supporting ur channel is the only way can i say thanks.

  • @rfdave3980
    @rfdave3980 3 ปีที่แล้ว

    I spit my coffee out when you said your wife checked the lookup table. Wow you are a lucky guy. I have so much information to watch with your channel. Thanks Dr. David.

  • @johnhammer8668
    @johnhammer8668 4 ปีที่แล้ว

    Wow. This channel has very unique and rare content. I did not knew i lacked so much basic knowledge until i watched David's videos.

  • @suvetar
    @suvetar ปีที่แล้ว

    This is great work and very motivating; I really will get off my behind and start doing my own dream project! Thank you so much!

  • @adamwulf
    @adamwulf 4 ปีที่แล้ว

    incredible! very excited for this project, keep up the great work :)

  • @borgy33771
    @borgy33771 4 ปีที่แล้ว

    Man you are so good at explaining things! Good work!

  • @victorjosegonzalez1829
    @victorjosegonzalez1829 4 ปีที่แล้ว +2

    this man is incredible, your content is amazing

  • @nadiequintero9981
    @nadiequintero9981 4 ปีที่แล้ว

    We do not deserve this amount of quality content and amount of educational resources from your part. Thank you very much!
    Greetings from Mexico.

  • @minmaijd
    @minmaijd 4 ปีที่แล้ว

    Rarely in life have I made a decision so obviously right and immediately rewarding as subscribing to this channel.

  • @TheTugge
    @TheTugge 4 ปีที่แล้ว

    Really interesting stuff. Looking forward for more! Great stuff. Thumbs up!

  • @jsflood
    @jsflood 4 ปีที่แล้ว +1

    Great video. This brings me back, sweet nostalgia :-)

  • @user-ij5sm2wk7y
    @user-ij5sm2wk7y 4 ปีที่แล้ว

    What a great instructional video! You tell potential emulator writers first to choose the level of detail at which the emulation will take place, then consistently explain coding choices for staying at that level. I wish I could explain things just as well.

  • @walterdiaz2003
    @walterdiaz2003 ปีที่แล้ว

    I really enjoy learning from this channel. Excellent and high quality content and free.
    Reminds me of the channel "Self Sufficient Me", similar accent :)
    Thanks for sharing.

  • @AntonioKantek
    @AntonioKantek 2 ปีที่แล้ว

    This was the best 6502 video tutorial I ever watched! Congrats!

    • @javidx9
      @javidx9  2 ปีที่แล้ว +1

      Lol cheers Antonio! 😊

  • @nurikodev7858
    @nurikodev7858 4 ปีที่แล้ว

    I hust love this guy .... Please don't stop the good job ... You have all my support ! Thank you for such an amazing content ^^

  • @nikola8345
    @nikola8345 4 ปีที่แล้ว

    Love your videos!After finishing learning the core language ill start with libraries and your guides!

  • @frankkubrick865
    @frankkubrick865 3 ปีที่แล้ว +1

    You make complex programing so easy to understand, you sir are a legend!

    • @javidx9
      @javidx9  3 ปีที่แล้ว +1

      Thanks Frank!

  • @veganfoodsYOUTUBE
    @veganfoodsYOUTUBE 4 ปีที่แล้ว

    Keep up the good work looking forward to the refinement in these areas thanks 🙏

  • @RetroMarkyRM
    @RetroMarkyRM 4 ปีที่แล้ว +1

    amazing work and fab videos. Thanks for putting in so much effort into them and I can't stress how much I 'm learning :)

    • @javidx9
      @javidx9  4 ปีที่แล้ว

      My pleasure Retro Marky!