man...there is something magical about being able to control the console you loved so much in your childhood! I wanted to learn programming for myself, for fun but having a big trouble with high-level languages. somehow I've instantly hooked in assembly and today discovered 6502 and NES homebrew! now I found it more fun than UE5, lol. thank you a lot!
Absolutely underrated channel. Thanks for the great content! Love learning the deep dark secrets of one of my favorite pieces of tech! Keep up the good work!
Wanted to thank you. I am working on a new Zelda 2 Randomizer that uses a different approach to the randomization and I used your videos to help me figure out why certain maps in the game don't respect the level exit data, and I was able to follow a trace and find the code. Using your videos and some 6502 ASM wikis I managed to figure it out. For some reasons maps with a map number greater than 29, ignore the level exits and default to all "go outside" exits. Thanks for the help =).
I really like the way you explain about NES Programming e.i. such an intricate topic, it’s so intuitive & concise. Thanks you very much for putting time & effort to do all these stuff which I believe will inspire many people loving retro game. Much appreciated, keep doing your great work man 🙏🏻❤️❤️
im 2 years late finding out your channel. but i'll catch up eventually on your latest material. these stuff are the "gems" buried in the youtube landfill. i hope you always find more inspiration and energy so you can continue making these videos. the way you present and deliver the information shows your talent, knowledge, attention to details, and passion. as a non dev and old soul, i get inspired to nerd out about this subject. i guess childhood dreams will forever haunt us if we always ignore them. thank you for the reminder and showing a direction on how to start this journey.
Please don't stop this channel 🥺, now I can finally make nes games. I knew programming but never found this content except nesdev which is very complicated to understand
'kay like, what the fuck. Like, when I was into NES dev with cc65 a year ago. The best we had was Michael Cheeseburger's series the 'Zero Pages', which don't get me wrong, is pretty okay. But I just looked up NES dev again today and I found this absolute GOLD MINE of nes dev tutorials. You sir, are a god send. These tutorials are so incredibly easy to understand and digestible with your animations and way of explaining things. Keep up the good work man.
For anyone running into the issue of compiling 'wrapper.s' instead of the example file, I could solve it by changing cl65config.json, adding "input" and changing "params" like this: "input": "wrapper.s", "params": "--verbose --target nes examples\\01_XandY.s" I'm guessing that this has something to do with dependencies and the order in which the files are compiled, and there might be a better way to configure it, but it worked for me.
OMG THANK YOU SOO MUCH THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU
I changed the file to this and it didn't work { "executable": "C:\\cc65\\bin\\cl65", "input": "wrapper.s", "params": "--verbose --target nes examples\\01_XandY.s" } why ?
I've just discovered your youtube channel and these videos make my day. I'm planning to make my own NES game and every piece of advice and information is very valuable.
Love the way you explain. I will start to develop NES based on your content. I got also the book from 8bit workshop, so my childhood dream might come true :) i hope you have time for more videos!
Hey mate, I've had a since long stalled nes emulator I was writing in golang. I've wanted to pick it back up again and get it working. It has all the CPU instructions written but goes out of memory and crashes frequently. This video really helped get my brain back in gear and thinking about debugging it again. Appreciate it!
Former 6502 games programmer here (for C64, not NES, but still the same processor). Never have I ever pronounced the DEX instruction like the word "decks". It's always been DEE-EEE-EX. 🤷♂
@@scootergirl3662 I bet if someone pronounced NES as "knees", you'd have something to say about that. Also, I wasn't saying that "decks" is wrong; I just said that in all of the years that I was writing 6502 code, neither I nor anyone I worked with ever pronounced it that way.
It’s actually decrement X. Just like INX is increment X. So DEX (as it’s spelt) makes sense. “DEE-EEE-EEX” does not make sense. DEX is also easier to say, with less palette movement, which is the purpose of acronyms. Leave the man alone and be word by yourself.
When I run build task on any of the examples, it builds a rom of the wrapper. The key difference is that when you do it it executes the task directly but on my terminal it executes the task in the folder.
I got the execute the task in the folder when I used the git bash, but I use cmd prompt it works fine. I got the wrapper as well, the contents is the same as those in the video.
I have absolutely no idea what I'm getting wrong here, but from the 8:55 mark after running the build task, the resulting code in my terminal is word-for-word exactly the same as what appears in your terminal, however the assembler doesn't produce a ROM file in the examples directory. In fact, it doesn't produce one anywhere. I have no idea what's going wrong as I've followed along step-by-step since the "NES Development Environment" video.
It seems it's a problem with the cl65config.json file included in the crash course documents. My file's "params" section was pointing to "wrapper.s" I followed the instructions posted by @DamianLDF in the comments to get my config file to point to the correct location and it's now working again. Seems a few of us are having this problem. Might be worth "pinning" Damian's comment!
Hi Ryan, you are the only youtuber of this niche. I wonder is it possible to learn how a nes game written in code and make a very similar game on windows with C++ or with other languages ?
I'm just a student now, but I'm remembering the Atari 2600. Unlike many here, I'm older than the 6502 chip! and knew people who started on the original C64, for example, who went on to code higher languages on Windows, so I know the answer to your question. Of course the principles of programming are the same, if this is your first low level language, it will help you to learn others. OTOH, it's also like asking if you can build a dam after learning to build a swimming pool. The point of C specifically, and the C family generally, is to hide what is going on at lower levels, to do things in one line that takes several lines of assembly. Here's another metaphor -it's like wanting to grow an orchard after learning to grow algae cultures in petri dishes. It's much better to get an NES emulator in Windows for those games. You can use the latest VS Code or Codium editors in Windows to write 6502 code, and test it on an emulator. and the final product should run on the real hardware. But to make a Windows game? That like making a winter wardrobe out of summer clothes sewn together. It's not impossible, but you are going to see it's a lot of hard work for no reason.
Nice, I have about the same. I think communicating this stuff is really fun, but it is quite hard to strike a balance for those without many years of programming experience.
If you got the message "Unknown ROM file format" by FCEUX 2.6.1(or higher). Don't worry. Insert five lines code of demo (begin from .segment "HEADER"...) to your .s file.
The 6502 was an amazing CPU in its day, and remains one of the best choices for microcontroller foundations 50 years later. It's architecture and assembly language offer a straightforward path to creating sophisticated apps without high-level languages/compilers. It has a few things that have to be digested, like the difference between indirect-indexed and indexed-indirect modes (also known as indirect-x and indirect-y), but the ability to use either as the situation demands is super power, and permits C-like pointers and pointers to pointers to be easily created in assembly. It's a time-tested chip with utility that extends far beyond the typical useful life of such a complex-purpose unit.
I agree wholeheartedly. I think 6502 is my favorite assembly language to work in because it is incredibly expressive given such a concise instruction set. While working in on comparable architectures like Z80 I really miss the indexed addressing modes 😭
Lemme guess: You’re a professional programmer? I’m a CS student taking my first assembly course, for an Atmega16. I LOVE it. Being a big fan of C and HATING courses in Android and .NET, dev, it’s so enriching and fun to mess with hardware. Hardware is the platform! ❤
the intellect that takes you from a finite set of instructions on what to do with a 0 or 1 to AI threatening mankind when given free will is quite an accomplishment...
I'm having some problems on the debbuging phase, i reset the ROM file into de FCEUX and add the breakpoint, but the counter just starts at 0000 address. What can i do?
So, this has been a great resource so far. I have been learning a lot, especially with VS code. However, I have run into a snag. When I try to run the code for Lesson 1, I get an error code like this, "ld65: Warning: C:\cc65\cfg/nes.cfg:63: Segment 'HEADER' does not exist", for this , "STARTUP", "VECTORS", and "CHARS". I did not change anything in the .json file. Any thoughts as to what I might be missing?
I like your video, simple and informative . I have 2 questions: 1-how can I start 6502 programming? 2- what software are you using for programming 6502? keep up the good work
At 6:28, you mentioned not to worry about the lines that started with the dot. Could you explain what those lines do? I get that they provide information to the assembler, but what information do they give? Why are they necessary?
The 6502 in the nes, is it a stock 6502 with simply some features removed? Does it have a proprietary pin-out or could a nes be repaired with a standard 6502?
I know this is 2 month old comment lol. The 6502 for the NES was manufactured by Ricoh, and lacks the decimal mode of the original MOS6502. The same package also contains the sound generator. So I wouldn't expect it to work if you replaced it with some other 6502.
Haha, the scary part is that hello world is way more complex than most of the examples I’ve shown on the channel thus far. I will do one… just need to build up to it a bit ;)
I ran the build task, but I got this error: _cl65 : The term 'cl65' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling_ _of the name, or if a path was included, verify _ _that the path is correct and try again._
Did you install CC65 as part of setting up your development environment? I have a video detailing all the steps that are required to perform builds using VSCode here: ruclips.net/video/RtY5FV5TrIU/видео.html. Lemme know if you're still seeing issues, and cheers!
Sorry for the late reply! Okay, if you’re seeing that error then it means that windows cannot find the cl65.exe file on your computer. The cl65config.json file in the source repository expects it to be at exactly “C:\cc65\bin\cl65.exe” so that would be the first thing to check to ensure that it is there (which it should be given you’ve followed the instructions from the development environment video). Other than that it might be an issue with not having permission to access the file… though that seems unlikely. Unfortunately I cannot think of another reason why this might be happening :(
Thank you. I've compiled with `cl65 01_XandY.s --verbose --target nes -o 01_XandY.nes` on Linux and it failed with "Unknown ROM file format". It is great that you have provided DevEnvironmentDemo. I had to add header .segment "HEADER" ; .byte "NES", $1A ; iNES header identifier .byte $4E, $45, $53, $1A .byte 2 ; 2x 16KB PRG code .segment "VECTORS" ;; When an NMI happens (once per frame if enabled) the label nmi: .addr 0 ;; When the processor first turns on or is reset, it will jump to the label reset: .addr Main Without vectors it failed to reach 8000
Don’t know if this will help, but try it. 1st. Make sure you have a working assembling process (on his video NES Development) 2nd. You have to change the “input” and “params” lines on the cl65config.json code to indicate what’s the target and end result. For example: If you create a .s file named “example.s”, then your cl65config.json has to read (if you have the exact default setup that he explains in the NES development video) this: { ”executable”: “C:\\cc65\\bin\\cl65”, “input”: “example.s”, “params”: “-verbose -target nes -o example.nes” } Note how you have to change the input (which code are you targeting) and params (to what do you want to change that code).
For some reason when I get to the step at 8:50 it doesn't make the additional XandY file and instead keeps doing it to Wrapper. was there a step I missed?
I also had this problem. Go to the file that points to cl65 on the first line. In input chang buffer.s to XandY.s and in output change buffer.nes to XandY.nes
One thing that strikes me right in the nerd feels when I think about programming is: the distinction between code and data is purely conceptual. In the real world, code is just data that works on other data.
I was reading something somewhere where this concept is really only central to von Neumann architectures. But since for serial computing that basically just means “any computer” it feels like this concept is fundamental.
This is random and may or may not help someone but I know it’s helped me remember the difference between data and storage. Data comes from the Latin verb do dare which means to give, data is it’s perfect passive participle meaning things having been given. So storage is where you store the things having been known or given 🙂
Hello, great video ! I wanted to start learning and creating games for NES for a while (more than 1 year) and you made me start, so thanks for being able to break my lazyness xD ! Could you share the code that helps to prevent the grey screen on FCEUX ? I visited some websites but don't really understand if it's due to the emulator, an error in the code or just basic NES functionning. Also, do you plan on creating a video about the base code of a NES game (explaining VECTORS/HEADER segments, how to display a simple sprite on the screen, etc...) ? I really think it would be helpful, especially from you ! I hope you're having a great day !
When doing the run and build for the XandY code, the compiler kept building the wrapper file instead of the XandYs. I configured the default build task to be on the XandYs, although I don't know if that does anything different. Either way, after compiling, it doesn't make a .NES file, it just makes a blank file that can't be used by the emulator. I don't know why it does this.
i have the FCEUX 2.6.6, and when i wanna execute the file "01_XandY.s" says "Unknown ROM file format. what can i do? i cant open the debugger cos dont open the file.
My primary reference is the MOS Microcomputers 6502 Programming manual. The only big thing to watch out for is that the 2A02 on the NES doesn’t have the decimal mode circuitry (they replaced it with the APU), so that stuff doesn’t work… But otherwise yeah, everything else is pretty much the same when it comes to the CPU.
most of it will work, the biggest difference is NES is for old TV CRTs, and it won't work without adjustment for a modern monitor. Does the C. X16 have a "RCA" video cable? that might work better. And for example, Atari 2600 code is VERY much based on old TV screens, it will not work at all on a monitor unless you have an emulator of some sort.
what parameters should i use in the cl65config.json file? the default params dont work and ive tried the ones shown on the github and the files they make dont work with FCEUX.
@NesHacker goof point. I've noticed that while it doesn't make the correct file for 01_XandY, it does make it for the "wrapper" file which is interesting
Hi just a quick one. I got myself a nes programming course. It teaches 60hz programming, and would like to know how easy or difficult it would be to convert to 50hz has it doesn't teach that. Thanks in advance.
Well the difference is gonna be in the feel of the game. You should be able to use most emulators to see how it feels in 50 vs 60hz. Other than that the core programming concepts should be pretty much the same. Happy hacking!
At 7:00 you start with an assembler without explaining it is an assembler. Try to explain MC with a simple MC editor only before jumping into assembler editors.
I'm not even watching this series to make NES games. I'm watching it so I can make one into a servo controller for an R2 unit (no joke, I am planning on controlling an R2 unit with a 6502.) I wonder if I could use an NES emulator and monitor certain memory address writes to treat them as servo addresses, though at this point I should probably just buy a 65C02 and wire it up.
@@NesHackeralso idk if this will help but when you build the example project in console it talks about startup, vector, chars and some other segments, but when i compile the same code, i get warnings about segments CHARS, VECTORS, STARTUP and HEADER not existing. Thanks for help though
@NesHacker i added this code: .segment "HEADER" .byte "NES" .byte $1A .byte $02 .byte $01 .byte $00 .segment "STARTUP" RESET: INFLOOP: JMP INFLOOP NMI: RTI it doesn't make any errors and shows a grey screen. There is code at address 8000, but X is 0, although i set it to 5 in the code. Also, it's visible that you have a lot of code in the file when you open it in the debugger, so i think these files may be a problem. Hope that helps
@@NesHacker your videos are very interesting. I learned by reverse engineering code on the Atari 800 using Omnimon which was a real-time editor/debugger that you could jump into anytime with a two key sequence. Learned a whole lot that way… those were the fun days of computers… your videos bring back a lot of memories for me. Thanks and nice job.
I don't know what is happening but whenever I want to make my own workspace and follow your command it never works! But your code is perfectly working without any fault. Even I copied all of your code into a new workspace and it's not working
Because most games were made in assembly back in the day, it gives you more control, it's very useful to know when debugging, essential for ROM hacking, and most important of all: because I like assembly ;)
Hi Ryan, RUclips recently recommended you yo me. I like your stuff and am doing a little diving through your back catalog. 1. I know why you dropped it, but the intro is bitching. 2. omg the shirt in this one.
This gets me one step closer to understanding how the original Legend of Zelda and Super Mario Bros. games were made.
One step at a time :)
@@NesHacker One inx at the time. uwu
man...there is something magical about being able to control the console you loved so much in your childhood!
I wanted to learn programming for myself, for fun but having a big trouble with high-level languages. somehow I've instantly hooked in assembly and today discovered 6502 and NES homebrew! now I found it more fun than UE5, lol.
thank you a lot!
That. 100%, that’s exactly why I started messing around with NES programming. Knowing others were out there like me was why I started the channel :)
Absolutely underrated channel. Thanks for the great content! Love learning the deep dark secrets of one of my favorite pieces of tech! Keep up the good work!
Thank you so much! Yeah the NES is near and dear to my heart cause it was the first video game system I had when I was a kid.
It is fascinating to learn how the games I loved in my childhood were built. Thank you for this series!
For sure, the whole reason I do these videos is for people like yourself :)
Wanted to thank you. I am working on a new Zelda 2 Randomizer that uses a different approach to the randomization and I used your videos to help me figure out why certain maps in the game don't respect the level exit data, and I was able to follow a trace and find the code. Using your videos and some 6502 ASM wikis I managed to figure it out. For some reasons maps with a map number greater than 29, ignore the level exits and default to all "go outside" exits. Thanks for the help =).
That’s super-super-super cool. Helping folks do stuff with oldschool games is kinda the point of the channel, and I am really happy to have helped :D
I really like the way you explain about NES Programming e.i. such an intricate topic, it’s so intuitive & concise. Thanks you very much for putting time & effort to do all these stuff which I believe will inspire many people loving retro game. Much appreciated, keep doing your great work man 🙏🏻❤️❤️
Thanks! I really appreciate the kinds words :D
im 2 years late finding out your channel. but i'll catch up eventually on your latest material.
these stuff are the "gems" buried in the youtube landfill.
i hope you always find more inspiration and energy so you can continue making these videos. the way you present and deliver the information shows your talent, knowledge, attention to details, and passion.
as a non dev and old soul, i get inspired to nerd out about this subject.
i guess childhood dreams will forever haunt us if we always ignore them.
thank you for the reminder and showing a direction on how to start this journey.
Welcome to the channel, I’m happy you found it and please enjoy 😉
I'm a SMB3 rom hacker and I am very thankful for your instruction on assembly programming. bitwise operations video helped me a lot.
Please don't stop this channel 🥺, now I can finally make nes games. I knew programming but never found this content except nesdev which is very complicated to understand
'kay like, what the fuck. Like, when I was into NES dev with cc65 a year ago. The best we had was Michael Cheeseburger's series the 'Zero Pages', which don't get me wrong, is pretty okay. But I just looked up NES dev again today and I found this absolute GOLD MINE of nes dev tutorials. You sir, are a god send. These tutorials are so incredibly easy to understand and digestible with your animations and way of explaining things. Keep up the good work man.
Glad you like the channel :D
Your videos kinda remind me of Ben Eater's 6502 series but with NES flavor. I really like your way of explaining this stuff. Keep up the good work!
For anyone running into the issue of compiling 'wrapper.s' instead of the example file, I could solve it by changing cl65config.json, adding "input" and changing "params" like this:
"input": "wrapper.s",
"params": "--verbose --target nes examples\\01_XandY.s"
I'm guessing that this has something to do with dependencies and the order in which the files are compiled, and there might be a better way to configure it, but it worked for me.
Thanks, I was just about to give up
This worked for me, thank you!
OMG THANK YOU SOO MUCH
THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU
Yes this solved my problem of build task not created 01_XandY file. Followed exact instructions you laid out and it worked straight away. Thank you.
I changed the file to this and it didn't work
{
"executable": "C:\\cc65\\bin\\cl65",
"input": "wrapper.s",
"params": "--verbose --target nes examples\\01_XandY.s"
}
why ?
I've just discovered your youtube channel and these videos make my day. I'm planning to make my own NES game and every piece of advice and information is very valuable.
Excellent video - please make more. I cannot believe only 39k views! You definitely deserve more.
So thankful I stumbled onto your channel. I'm really interested in people two keep continuing to create 8-bit gaming.
great job keeping assembly development very simple. me, who has no assembly experience, easily followed along.
Glad you found the video helpful!
Love the way you explain. I will start to develop NES based on your content. I got also the book from 8bit workshop, so my childhood dream might come true :) i hope you have time for more videos!
This lesson is like an icebreaker, against the ice that around assembly language. Thank you a lot
So, so, so, so happy I found this channel!!!!!!!!!
Welcome! I’m currently on a rest month but new videos are starting up in October, glad you’re enjoying the channel thus far!
Again, massive help Ryan. I have been looking at how I can start running Assembly script but also debug at the same time. Thanks again mate. :)
Excellent video and unique approach into teaching the basics using the NES ecosystem at the same time. Subscribed :D
Thanks! Yeah I liked the idea of teaching 6502 and helping people get more comfortable with building games at the same time.
this channel is underrated
Hey mate, I've had a since long stalled nes emulator I was writing in golang. I've wanted to pick it back up again and get it working. It has all the CPU instructions written but goes out of memory and crashes frequently.
This video really helped get my brain back in gear and thinking about debugging it again. Appreciate it!
These videos are an amazing resource! Thank you so much. This has already been very helpful.
dude, this is really really cool of you to do. thank you
Good stuff. The dev cart magazines got me interested in assembly.
This was going to be my next question. Thank you so much. I wanted to know more about 6502
Wow, what a channel. Keep going man
Excellent video. Thank you.
Former 6502 games programmer here (for C64, not NES, but still the same processor). Never have I ever pronounced the DEX instruction like the word "decks". It's always been DEE-EEE-EX. 🤷♂
Haha, yeah… that’s just how I first read it and it stuck with me. Hope it doesn’t put ya on tilt 😆
Anything in tech, you can always expect someone to comment on pronunciation of something
@@scootergirl3662 I bet if someone pronounced NES as "knees", you'd have something to say about that. Also, I wasn't saying that "decks" is wrong; I just said that in all of the years that I was writing 6502 code, neither I nor anyone I worked with ever pronounced it that way.
How about just "decrease X" ?
It’s actually decrement X. Just like INX is increment X. So DEX (as it’s spelt) makes sense. “DEE-EEE-EEX” does not make sense. DEX is also easier to say, with less palette movement, which is the purpose of acronyms. Leave the man alone and be word by yourself.
When I run build task on any of the examples, it builds a rom of the wrapper. The key difference is that when you do it it executes the task directly but on my terminal it executes the task in the folder.
Same issue here. If I figure it out I will update how.
I got the execute the task in the folder when I used the git bash, but I use cmd prompt it works fine. I got the wrapper as well, the contents is the same as those in the video.
You're a legend. Thanks!
You’re welcome :)
I have absolutely no idea what I'm getting wrong here, but from the 8:55 mark after running the build task, the resulting code in my terminal is word-for-word exactly the same as what appears in your terminal, however the assembler doesn't produce a ROM file in the examples directory. In fact, it doesn't produce one anywhere. I have no idea what's going wrong as I've followed along step-by-step since the "NES Development Environment" video.
It seems it's a problem with the cl65config.json file included in the crash course documents. My file's "params" section was pointing to "wrapper.s" I followed the instructions posted by @DamianLDF in the comments to get my config file to point to the correct location and it's now working again. Seems a few of us are having this problem. Might be worth "pinning" Damian's comment!
YOOOO, how did you make those awesome sildes with animated text and such? They really add to the value of the video!
Hi Ryan, you are the only youtuber of this niche. I wonder is it possible to learn how a nes game written in code and make a very similar game on windows with C++ or with other languages ?
I'm just a student now, but I'm remembering the Atari 2600. Unlike many here, I'm older than the 6502 chip! and knew people who started on the original C64, for example, who went on to code higher languages on Windows, so I know the answer to your question. Of course the principles of programming are the same, if this is your first low level language, it will help you to learn others. OTOH, it's also like asking if you can build a dam after learning to build a swimming pool. The point of C specifically, and the C family generally, is to hide what is going on at lower levels, to do things in one line that takes several lines of assembly. Here's another metaphor -it's like wanting to grow an orchard after learning to grow algae cultures in petri dishes. It's much better to get an NES emulator in Windows for those games. You can use the latest VS Code or Codium editors in Windows to write 6502 code, and test it on an emulator. and the final product should run on the real hardware. But to make a Windows game? That like making a winter wardrobe out of summer clothes sewn together. It's not impossible, but you are going to see it's a lot of hard work for no reason.
thank for you video. great class about it.
after 30 years of programming sure I know this but it's all about the delivery. That was fun
Nice, I have about the same. I think communicating this stuff is really fun, but it is quite hard to strike a balance for those without many years of programming experience.
eh you nailed it and when 01010000 01000101 01000010 01000011 01000001 01000011 the teacher is all that matters @@NesHacker
Keep it up, nice video clip, thank you for sharing it :)
If you got the message "Unknown ROM file format" by FCEUX 2.6.1(or higher). Don't worry. Insert five lines code of demo (begin from .segment "HEADER"...) to your .s file.
Please explain more, what do you mean by “demo”?
@@SuperSomieStuff Add the following lines to the beginning of your code:
.segment "HEADER"
; .byte "NES", $1A ; iNES header identifier
.byte $4E, $45, $53, $1A
.byte 2 ; 2x 16KB PRG code
.byte 1 ; 1x 8KB CHR data
.byte $01, $00 ; mapper 0, vertical mirroring
Respect for you genius ❤❤❤
The 6502 was an amazing CPU in its day, and remains one of the best choices for microcontroller foundations 50 years later. It's architecture and assembly language offer a straightforward path to creating sophisticated apps without high-level languages/compilers. It has a few things that have to be digested, like the difference between indirect-indexed and indexed-indirect modes (also known as indirect-x and indirect-y), but the ability to use either as the situation demands is super power, and permits C-like pointers and pointers to pointers to be easily created in assembly. It's a time-tested chip with utility that extends far beyond the typical useful life of such a complex-purpose unit.
I agree wholeheartedly. I think 6502 is my favorite assembly language to work in because it is incredibly expressive given such a concise instruction set. While working in on comparable architectures like Z80 I really miss the indexed addressing modes 😭
Lemme guess: You’re a professional programmer? I’m a CS student taking my first assembly course, for an Atmega16. I LOVE it. Being a big fan of C and HATING courses in Android and .NET, dev, it’s so enriching and fun to mess with hardware. Hardware is the platform! ❤
I was for many years, but now I’m a RUclipsr 😂
the intellect that takes you from a finite set of instructions on what to do with a 0 or 1 to AI threatening mankind when given free will is quite an accomplishment...
I'm having some problems on the debbuging phase, i reset the ROM file into de FCEUX and add the breakpoint, but the counter just starts at 0000 address. What can i do?
Amazing video!
So, this has been a great resource so far. I have been learning a lot, especially with VS code. However, I have run into a snag. When I try to run the code for Lesson 1, I get an error code like this, "ld65: Warning: C:\cc65\cfg/nes.cfg:63: Segment 'HEADER' does not exist", for this , "STARTUP", "VECTORS", and "CHARS". I did not change anything in the .json file. Any thoughts as to what I might be missing?
you most probably dont have the wrapper assembly file or otherwise have it misconfigured
Great tutorial, very helpful, thanks
You’re welcome ☺️
Nice content, I was specting some kind of app to program nes games no raw assembly code
6502 was also used in slight variations on Atari 2600s and Commodore 64, if you want to program games for those consoles.
I like your video, simple and informative . I have 2 questions:
1-how can I start 6502 programming?
2- what software are you using for programming 6502?
keep up the good work
Check out my “NES Dev Environment” video. I show how to get started and what software to use there.
At 6:28, you mentioned not to worry about the lines that started with the dot. Could you explain what those lines do? I get that they provide information to the assembler, but what information do they give? Why are they necessary?
The 6502 in the nes, is it a stock 6502 with simply some features removed? Does it have a proprietary pin-out or could a nes be repaired with a standard 6502?
I know this is 2 month old comment lol. The 6502 for the NES was manufactured by Ricoh, and lacks the decimal mode of the original MOS6502. The same package also contains the sound generator. So I wouldn't expect it to work if you replaced it with some other 6502.
@@cletusthefetus23 Thanks! That line lines up pretty well with what I've read since. :)
i'm kinda hoping this is done for snes stuff as well
Wow it's scary 😭 I hope you do a hello world example
Haha, the scary part is that hello world is way more complex than most of the examples I’ve shown on the channel thus far. I will do one… just need to build up to it a bit ;)
I ran the build task, but I got this error:
_cl65 : The term 'cl65' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling_ _of the name, or if a path was included, verify _
_that the path is correct and try again._
Did you install CC65 as part of setting up your development environment? I have a video detailing all the steps that are required to perform builds using VSCode here: ruclips.net/video/RtY5FV5TrIU/видео.html. Lemme know if you're still seeing issues, and cheers!
@@NesHacker yes, I did. And thanks, I'll take a look at ir
Still not working...
Sorry for the late reply! Okay, if you’re seeing that error then it means that windows cannot find the cl65.exe file on your computer. The cl65config.json file in the source repository expects it to be at exactly “C:\cc65\bin\cl65.exe” so that would be the first thing to check to ensure that it is there (which it should be given you’ve followed the instructions from the development environment video). Other than that it might be an issue with not having permission to access the file… though that seems unlikely. Unfortunately I cannot think of another reason why this might be happening :(
@@NesHacker Hello again! I waited for a month or 2... and It works! :D
Stay away from me!!!!!!!!!!!!!! You're too smart. Love your Tutorial
Thank you. I've compiled with `cl65 01_XandY.s --verbose --target nes -o 01_XandY.nes` on Linux and it failed with "Unknown ROM file format". It is great that you have provided DevEnvironmentDemo. I had to add header
.segment "HEADER"
; .byte "NES", $1A ; iNES header identifier
.byte $4E, $45, $53, $1A
.byte 2 ; 2x 16KB PRG code
.segment "VECTORS"
;; When an NMI happens (once per frame if enabled) the label nmi:
.addr 0
;; When the processor first turns on or is reset, it will jump to the label reset:
.addr Main
Without vectors it failed to reach 8000
If we have cc65, why not use C?
Finally got my dev environment working on my M1 Mac!
I’m trying to follow this, but “run build task” just makes an .o file that FCEUX can’t use. Any idea of how to make it work would be appreciated
Don’t know if this will help, but try it.
1st. Make sure you have a working assembling process (on his video NES Development)
2nd. You have to change the “input” and “params” lines on the cl65config.json code to indicate what’s the target and end result.
For example:
If you create a .s file named “example.s”, then your cl65config.json has to read (if you have the exact default setup that he explains in the NES development video) this:
{
”executable”: “C:\\cc65\\bin\\cl65”,
“input”: “example.s”,
“params”: “-verbose -target nes -o example.nes”
}
Note how you have to change the input (which code are you targeting) and params (to what do you want to change that code).
I suggest Mesen for the NES emulator as it's much more accurate than FCEUX and it also has an excellent debugger.
For some reason when I get to the step at 8:50 it doesn't make the additional XandY file and instead keeps doing it to Wrapper. was there a step I missed?
I also had this problem. Go to the file that points to cl65 on the first line. In input chang buffer.s to XandY.s and in output change buffer.nes to XandY.nes
GREAT!!
One thing that strikes me right in the nerd feels when I think about programming is: the distinction between code and data is purely conceptual. In the real world, code is just data that works on other data.
I was reading something somewhere where this concept is really only central to von Neumann architectures. But since for serial computing that basically just means “any computer” it feels like this concept is fundamental.
This is random and may or may not help someone but I know it’s helped me remember the difference between data and storage. Data comes from the Latin verb do dare which means to give, data is it’s perfect passive participle meaning things having been given. So storage is where you store the things having been known or given 🙂
*reply with mind explosion gif* 😳
when i run build task to make the xandy a rom i dont get the new green letter file above the example like you did
Hello, great video ! I wanted to start learning and creating games for NES for a while (more than 1 year) and you made me start, so thanks for being able to break my lazyness xD !
Could you share the code that helps to prevent the grey screen on FCEUX ? I visited some websites but don't really understand if it's due to the emulator, an error in the code or just basic NES functionning.
Also, do you plan on creating a video about the base code of a NES game (explaining VECTORS/HEADER segments, how to display a simple sprite on the screen, etc...) ? I really think it would be helpful, especially from you !
I hope you're having a great day !
Deserves more views...
When doing the run and build for the XandY code, the compiler kept building the wrapper file instead of the XandYs. I configured the default build task to be on the XandYs, although I don't know if that does anything different. Either way, after compiling, it doesn't make a .NES file, it just makes a blank file that can't be used by the emulator. I don't know why it does this.
if you rename the file to include .nes at the end of the file, an emulator should be able to open it
What do i do if it compiles wrapper.s instead of 01_XandY.s
i have the FCEUX 2.6.6, and when i wanna execute the file "01_XandY.s" says "Unknown ROM file format.
what can i do? i cant open the debugger cos dont open the file.
this is best channel
Do instructions contain the data by itself lie OPCODE and OPERAND ?
Thanks for the series !!!
I used 6502 assembly at first and then i used x86 assembly and it is much easier to have 16 bit and 32 bit register.
Awesome Video, But When I Follow The Link, There Is No "Demo Repository".
I need a 6502 book I think. I have an original book form the 80's that I got for programming my Commodore 64, will it work?
My primary reference is the MOS Microcomputers 6502 Programming manual. The only big thing to watch out for is that the 2A02 on the NES doesn’t have the decimal mode circuitry (they replaced it with the APU), so that stuff doesn’t work… But otherwise yeah, everything else is pretty much the same when it comes to the CPU.
for some reason it keeps generating me wrapper file instead of the 01_XandY file, even tho i’ve followed exactly your manipulation
Will all of this work on the Commander X16?
most of it will work, the biggest difference is NES is for old TV CRTs, and it won't work without adjustment for a modern monitor. Does the C. X16 have a "RCA" video cable? that might work better. And for example, Atari 2600 code is VERY much based on old TV screens, it will not work at all on a monitor unless you have an emulator of some sort.
Not here for the gaming stuff but really interesting!
what parameters should i use in the cl65config.json file? the default params dont work and ive tried the ones shown on the github and the files they make dont work with FCEUX.
Interesting, let me take a look at it as sometimes software gets updated and the steps may have changed.
@NesHacker goof point. I've noticed that while it doesn't make the correct file for 01_XandY, it does make it for the "wrapper" file which is interesting
Hi just a quick one. I got myself a nes programming course. It teaches 60hz programming, and would like to know how easy or difficult it would be to convert to 50hz has it doesn't teach that. Thanks in advance.
Well the difference is gonna be in the feel of the game. You should be able to use most emulators to see how it feels in 50 vs 60hz. Other than that the core programming concepts should be pretty much the same. Happy hacking!
most games just didn't gave a %%%% so the game just runs 17% slower. and a couple just had different constants (like increased speed)
When I try to build the rom, I get the message "no build task to run found".
At 7:00 you start with an assembler without explaining it is an assembler. Try to explain MC with a simple MC editor only before jumping into assembler editors.
I'm not even watching this series to make NES games. I'm watching it so I can make one into a servo controller for an R2 unit (no joke, I am planning on controlling an R2 unit with a 6502.) I wonder if I could use an NES emulator and monitor certain memory address writes to treat them as servo addresses, though at this point I should probably just buy a 65C02 and wire it up.
I assume this could be used for making Atari games.
Nice shirt!
I know this video's kinda old, but when i try to run smth except the hello program, fceux just says "unknown ROM file format". Can anyone help?
You’re not the only one who’s said this recently. I gotta check it out and see what is going on…
Might be time for me to make an updated video :)
@@NesHackerhow do you respond that quickly?😂
@@NesHackeralso idk if this will help but when you build the example project in console it talks about startup, vector, chars and some other segments, but when i compile the same code, i get warnings about segments CHARS, VECTORS, STARTUP and HEADER not existing. Thanks for help though
@NesHacker i added this code:
.segment "HEADER"
.byte "NES"
.byte $1A
.byte $02
.byte $01
.byte $00
.segment "STARTUP"
RESET:
INFLOOP:
JMP INFLOOP
NMI:
RTI
it doesn't make any errors and shows a grey screen. There is code at address 8000, but X is 0, although i set it to 5 in the code. Also, it's visible that you have a lot of code in the file when you open it in the debugger, so i think these files may be a problem. Hope that helps
Was good at 6502 back in the 80’s. Very nice limited size instruction set compared to todays CPUs
Haha, I wasn't... but you're not joking. Even modern micro controllers make the 6502 look like it was invented shortly after the wheel 😆
@@NesHacker your videos are very interesting. I learned by reverse engineering code on the Atari 800 using Omnimon which was a real-time editor/debugger that you could jump into anytime with a two key sequence. Learned a whole lot that way… those were the fun days of computers… your videos bring back a lot of memories for me. Thanks and nice job.
i know the first thing about 6502 assembly, just not the second thing.
Mood
Why my code in debugger start in index $8070?
I LOVE C64 👍🥂🎩
I don't know what is happening but whenever I want to make my own workspace and follow your command it never works! But your code is perfectly working without any fault. Even I copied all of your code into a new workspace and it's not working
how could we make games for the snes because the processor core is still 6502
I’m hoping to branch out and do some snes stuff too in the future. Focusing on the nes for now until I get more of the bases covered for the system :)
Build a EFI computer and a CNC lathe with a C64 a fair while back. All with Assembly.
i have spent the last 4 hours trying to do a "hello world" and didn't got it yet.
but was it a FUN four hours? ;)
Wadawow!
Assembly language is difficult for many people. Why not make lessons for the C language?
Because most games were made in assembly back in the day, it gives you more control, it's very useful to know when debugging, essential for ROM hacking, and most important of all: because I like assembly ;)
@@NesHackerAssembly languages are also different. It is important to mention which one is used. Otherwise, assembler of brain occurs.. 🙂
I triple dog dare you to talk about self-modifying code.
i am GOING to learn 6502 for a SCHOOL PPROJECT in 6 WEEKS. wish me luck, i HOPE its possible
I bet you can learn it in a week or two if you really buckle down and work on some serious projects 😀
@@NesHacker why thank you for the support!
Hi Ryan, RUclips recently recommended you yo me. I like your stuff and am doing a little diving through your back catalog.
1. I know why you dropped it, but the intro is bitching.
2. omg the shirt in this one.