Programming the NES - Everything you need to know

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 มิ.ย. 2024
  • This is a tutorial for how to program the Nintendo Entertainment System (NES) and the Family Computer (Famicom). This guide covers setting up a basic NES program in 6502 Assembly and then looks further into working with basic sprites. At the end of the video and down below I provide more resources as a jumping off point as you begin to program the NES. The six chapters are broken down as follows:
    Intro 0:00
    NES Architecture 0:47
    Setting Up Your Programming Environment 3:32
    Understanding Your Assembly File 5:36
    Getting Started with Sprites 10:59
    More on Sprites 20:08
    Where to go next 27:53
    Prerequisites:
    A computer with internet access
    A working knowledge of 6502 assembly
    Final boiler plate program:
    github.com/InkboxSoftware/NES...
    Architecture note:
    The APU is a part of the NES' CPU, but programmatically it can be thought of as a separate device, and so that is what I treat it as in my video.
    Setting up your environment resources:
    Notepad++
    notepad-plus-plus.org/
    Sublime Text
    www.sublimetext.com/
    Notepad++ NES 6502 custom language config
    github.com/xram64/6502-npp-sy...
    My version of it:
    drive.google.com/file/d/1tmMk...
    YYCHR
    www.smwcentral.net/?p=section...
    www.romhacking.net/utilities/...
    CC65
    cc65.github.io/
    github.com/cc65/cc65
    FCEUX
    fceux.com/web/home.html
    Resources and further reading:
    Nesdev Wiki
    www.nesdev.org/wiki/Nesdev_Wiki
    Learn Assembly links
    www.masswerk.at/6502/6502_ins...
    en.wikibooks.org/wiki/6502_As...
    archive.org/search.php?query=...
    NES 2.0 Header:
    www.nesdev.org/wiki/NES_2.0
    A list of errors to keep in mind:
    www.nesdev.org/wiki/Errata
    Other Guides:
    The Zero Pages
    • Episode 1 - Getting St...
    notin.tokyo
  • วิทยาศาสตร์และเทคโนโลยี

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

  • @mattgio1172
    @mattgio1172 ปีที่แล้ว +36

    I doubt I'll ever make a game - but you do such an amazing job of explaining it all! It's super interesting! Also - the music is SO good!

  • @jatoxo
    @jatoxo 8 หลายเดือนก่อน +7

    I wrote an NES emulator but this was still pretty entertaining. For once seeing things from the perspective of the developer instead of the hardware

  • @RealHubertCZGameplayLetsPlay
    @RealHubertCZGameplayLetsPlay ปีที่แล้ว +9

    Great video. I dont plan to program anything on NES, but its cool to see how its done. BTW you deserve well more subs and views

  • @anon_y_mousse
    @anon_y_mousse ปีที่แล้ว +70

    It's almost like there's some cosmic force pushing me to write a game. I have had some ideas floating around for a few decades. Though I'm not so sure I'd want to be limited by the NES, I suppose it would actually work for what I want to do.

    • @InkboxSoftware
      @InkboxSoftware  ปีที่แล้ว +28

      Just do it 🗸

    • @jc_dogen
      @jc_dogen ปีที่แล้ว +16

      maybe try pc engine/turbografx? it's still 6502 but running a lot faster, with more ram, sprites, colors, etc

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

      Just do-it-yourself!🎉🎉🎉

    • @dingusbingus7463
      @dingusbingus7463 8 หลายเดือนก่อน +2

      @@jc_dogenDepends on the game he wants to make, NES/FC has a lot of charm, the PCE wasn't as popular because of its original price, a lot of people missed out on it because of the price difference until now

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

      another interesting option is the x16 (i haven't tried it yet)

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

    This is a great video, while i don’t understand 6502 assembly, i definitely wanna learn it and start development for the nes, im not exactly sure where or what to start with, but your video has made me view the nes/famicom in a completely different angle, in a good way

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

    Super! All in one video to get started with NES programming.

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

    I was looking for this exactly the other day!

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

    Yeah! I remember when you had 16 subs. 😊 Congrats on the success.

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

    You should do this type of video for the the Atari 7800, because it also deserves to have a much larger homebrew community, its even more interesting than the NES.

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

    You deserve 100k+ subscriptions. This is a great educational video.

  • @iRemainNameless
    @iRemainNameless 9 หลายเดือนก่อน +2

    How does one ever first start understanding this? Impressive for sure

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

    Depending on the assembler and linker, there can be issues with:
    .byte "NES"
    .byte $1A
    On some, this will result in the hex dump of the header showing as "CE C5 D3 1A" which will be an incorrect header. There are some ways to fix this that I haven't figured out yet. It seems to be related to PETSCII character translation. But an easy work around is to use this instead as the first header line:
    .byte $4E, $45, $53, $1A
    This will ensure the "NES" is properly in the header.

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

    Excellent video!! I think everything is very clear, thank you! It would be nice, a high level explanation like in this video, but about mappers. Nice channel, greetings!

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

    Thanks for the excellent starter guide. I believe that programming games for the NES in C is also viable (though it comes with drawbacks of its own). The book "Making Games for The NES" by Steven Hugg is a good tutorial.

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

      If you have a good compiler, then maybe, but sometimes trying to make sense of something not working correctly would be much harder in C in my opinion, because if you make it in C you may not know some quirks that exist and can destroy your day lol

    • @eldiesoft2198
      @eldiesoft2198 5 หลายเดือนก่อน

      I got that book, and while it is a pretty good tutorial, it does have its drawbacks.
      For one thing, it is a book, and unlike an online forum, it can't be updated if new info or techniques come out. A lot of the software that the book recommends is either from an abandoned project, like Famitracker for the music, or were not made in English, and do not have the best English translation (unfortunately, documentation seems to be a problem across the board with programmers).
      Secondly, the book is specifically for making a platformer. If you want to make a game that is anything but a platformer that scrolls on the Y-axis, then you are probably out of luck. It tells you that you CAN make these types of games, but not HOW.
      Thirdly, it uses a specific IDE (integrated development environment) called 8BitWorkshop, which has its own sprite sheets, sound libraries and compilers, so it doesn't tell you how to make games with something like VSCode (I know that's kinda petty, but I like VSCode).
      Finally, it has great information about sprite and music data, but but doesn't go much further than their own tutorials. If you want to make a sprite that's bigger than 8x8 pixels or import your own audio or music, the guide pretty much says "figure it out," without providing any resources or other guides, and when they do, it's probably a dead link, like Famitracker (sorry to bring that up again, but that is what gave me the most grief when working with it).
      But besides that, it gives a great foundation for making NES games and understanding NES hardware. I would pick it up if you are interested.

  • @thedave4369
    @thedave4369 8 หลายเดือนก่อน

    Awesome! I would love to see such a video for the Game Boy as well!

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

    Great video. And if I may, thank goodness for high level programming languages!

  • @martin128
    @martin128 4 หลายเดือนก่อน

    Great video, thanks for explaining all of this. This would be just a headache if i didnt know any of this.

  • @CelestialHunter-
    @CelestialHunter- 8 หลายเดือนก่อน

    That Gymnopedie 1 rendition is from heaven

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

    Excellent keep it up

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

    everybody sleepin on my boy inkbox when he makin some good shit, def gonna get my old ass NES out and try some dis

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

    Darn, no description link to the chiptune cover of Gymnopedies?

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

    Inkbox: "So we need to set this to $FF, not $00, to make sure the VBlank registers are ready for writing and now we'll store the variable at the CHRROM address..."
    Me, enjoying the computer words and comprehending nothing: "ah yes, of course"
    Fr though, really enjoyed this, I became curious as to how older games were programmed back in the day out of nowhere and this was a really interesting and somehow terrifying insight into what an absolute nightmare Assembly is to program in!

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

      Assembly might seem complicated, but these old machines are really simply designed and the documentation is very thorough. 6502 Assembly isn't harder than any other programming language, I would highly recommend giving it a go.

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

    holy shit i was listening to this in the background and noticed the awesome rendition of chopin's ballade no 1!

  • @shuttittuppitt9355
    @shuttittuppitt9355 11 หลายเดือนก่อน

    Not (much) related, but the guys that programmed "Disney's Pocahontas" for the Sega Genesis (a good game) said that they also tried to port it to the SNES, but that it was a LOT more difficult to do that, leading them to eventually give up.

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

    After your amazing video, I have nothing to say... except : please, make other NES related videos !
    You're SO GOOD man that even a half moron like me is able to understand the way the NES works...
    Fantastic teaching skills soooooo INSTA-SUB here ! 👍👍👍

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

    awesome

  • @AnonymousAccount514
    @AnonymousAccount514 8 หลายเดือนก่อน

    TH-cam is the best thing ever

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

    Omg thank you! 😄

  • @StephenAnimations
    @StephenAnimations 11 หลายเดือนก่อน

    Underated channel

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

    Wow very helpful. Subscribed. Can RESET and NMI be written after segments, or do they need to be defined prior to being referenced like functions in C? I am very picky about how my code is structured.

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

      No such restrictions, feel free to reference it in any order

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

    Honestly didn't even realize that you can code for an NES still. I gotta try making a game at some point on it.

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

    nice!

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

    My assembly from that era is 8080/Z80. Does the assembler give you the ability to give names to the common addresses you regularly use?

  • @draynaruegames
    @draynaruegames 2 หลายเดือนก่อน

    This has been a huge help in getting me started on NES game development. Only issue I'm running into right now is that I can't get YY-CHR to create an 8kb .CHR file, for whatever reason any new file I create is 16kb big instead of 8kb. Any tips on how I can create an 8kb file?

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

      I have not yet found a way to create anything other than the default 16KB file through YYCHR itself, what I do is copy an another 8KB file (usually a CHR ROM file from another project), open it in YYCHR, then clear the contents for a fresh start

  • @Destroyanad
    @Destroyanad 8 หลายเดือนก่อน

    How do i reference cc65 in my .bat file at 10:22 ?

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

    Mesen is a more accurate NES emulator and has a really good debugger as well.

  • @trxgreder
    @trxgreder 8 หลายเดือนก่อน

    very cool, one thing though. in command prompt, it doesnt do anything when i run compile.bat

  • @ClassyJacket
    @ClassyJacket 10 หลายเดือนก่อน

    Great video but I got lost on the batch file segment. The cmd gave me errors just like you said might happen in that one part. It says this:
    cc65\bin\ca65 program\cart.s -o program\cart.o -t nes
    program\cart.s:15: Error: ':' expected
    cc65\bin\ld65 program\cart.o -o program\cart.nes -t nes
    ld65:Error: Input file 'program\cart.o' not found
    Did I make a syntax mistake or is there something more to the problem I don't understand?

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

      It looks like on line 15 of your assembly code you have an error, fix that and it should compile.

    • @ClassyJacket
      @ClassyJacket 10 หลายเดือนก่อน

      @@InkboxSoftware It was such a simple issue, so embarrassed not really but you know what I mean thank you very much for helping!!!🤘👽👍

  • @cheesirehat
    @cheesirehat 2 หลายเดือนก่อน

    How do i get my palette data?

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

    New upload?

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

    I’m a bit confused, I’m trying to compile my background, but it only loads the first 16 lines, so it only draws half of the background. How can I get my full background to draw if I’m using a full 960 bytes (32 rows) for the background?

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

      Make sure that when you copy your background data to VRAM your loop runs 960 (3C0) times. Reach out with your code if you're still having trouble.

    • @famitronic9870
      @famitronic9870 4 หลายเดือนก่อน

      @@InkboxSoftware Thank you! I’m gonna give it a shot when I got free time 👍

    • @famitronic9870
      @famitronic9870 4 หลายเดือนก่อน

      @@InkboxSoftware I couldn’t quite figure it out, so I reached out via email if you get the chance.

  • @TheBxzr
    @TheBxzr 8 หลายเดือนก่อน

    I keep getting errors about how "....\ca65" is not recognized as an internal or external command, and it doesn't seem like the batch file is recognising it as a command. Is my cc65 okay, because there is no bin folder either?

    • @InkboxSoftware
      @InkboxSoftware  8 หลายเดือนก่อน

      Make sure your command points to wherever your ca65.exe is located, you may just want to use the full path from your C drive if you're having troubles with the syntax

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

    Can you tell us on how would you go about making your very own console and game from this in making your own brand? Instead of making it for the NES system. And Talk about the hardware and software side,

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

    Is it possible to manually write sprite data? Like just using a text editor instead of YYCHR.

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

      Sure, at the end of the day the CHR ROM is just binary data, you can use a byte editor to directly edit a file as you wish.

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

      @@InkboxSoftware Alright, thanks
      Also, i'm trying to compile the code (9:48) in ca65 but it's giving me:
      Error: Symbol 'RESET' is undefined
      Error: Symbol 'NMI' is undefined
      Nevermind, I don't know what I did but it works now

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

    Why do you need a CLI to evoke the NMI, as it is non maskable?

    • @InkboxSoftware
      @InkboxSoftware  10 หลายเดือนก่อน

      Earlier in the program we used the instruction SEI, the Set Interrupt Disable instruction, to return to normal NMI functionality we use CLI, the Clear Interrupt Disable instruction.

  • @micknin-
    @micknin- ปีที่แล้ว

    How can I configure the size of the Chr rom?
    games like Kirby’s Adventure, super mario Bros 3 and gimmick! has the Chr rom bigger than 8k.

    • @doomtho42
      @doomtho42 11 หลายเดือนก่อน

      The 4th byte under the “HEADER” segment determines the “amount of CHR ROM in 8K units.” So, for example, if you were to change that value from $01 to $02 you would have a CHR ROM of 16K.
      The PRG ROM can be changed in a similar manner with the 3rd byte in that segment, except for that one each unit of memory equates to 16K instead of 8K.

  • @flameofthephoenix8395
    @flameofthephoenix8395 7 หลายเดือนก่อน

    Oh, I see. I thought this was talking about programming an emulator. Either way it's interesting.

  • @pedroxdw
    @pedroxdw 11 หลายเดือนก่อน

    Hi, Inkbox! I hope this question isn't stupid... In YY-CHR (build 2021/06/06) when I click on "File > New" I get a new file, but, it has 1 024 tiles instead of 512 and that's why my code doesn't compile. Is there a solution? By the way, your videos are great! Keep going! (Sorry if my English grammar/orthography isn't perfect, English isn't my native language.)

    • @InkboxSoftware
      @InkboxSoftware  11 หลายเดือนก่อน

      That's something that happens to me too, and I don't know how to create a default smaller file. What I do is just copy a file of the size I want and then treat that like my new file.
      There are ways to increase the amount of CHR ROM in an NES file, but if you want the standard amount, just follow the above.

    • @pedroxdw
      @pedroxdw 11 หลายเดือนก่อน

      @@InkboxSoftware OK. Thank you for your help!

  • @Nbrother1607
    @Nbrother1607 7 หลายเดือนก่อน

    maybe you should do another one for the x16

  • @Koridai011
    @Koridai011 5 หลายเดือนก่อน

    I used theses methods on wine with my mac, can you use batch with wine

    • @AkamiChannel
      @AkamiChannel 28 วันที่ผ่านมา

      I don't know, but you can figure out how to execute the commands just in your terminal on mac. You may need to figure out where the ca65 and ld65 files are located so you can execute them as commands

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

    it took me a while to realize the odd sounds i kept hearing were part of the background music

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

    🤯 ❤

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

    Could you do a tutorial on how to put NESOS on the NES

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

    You know it's retro when notepad++ shows up

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

    9:55 nice totally legit Visual Studio you got there. +100 Social Credit

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

    faz esse tutorial para SNES..
    sou do brasil

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

    so you've basically covered most of the nerdy nights in one video?

  • @JarppaGuru
    @JarppaGuru 3 หลายเดือนก่อน

    this is all we need know. now we can make NES BASIC. pad is byte you can make keyboard LOL

  • @bb.cute.channel
    @bb.cute.channel ปีที่แล้ว +3

    How about programming for SNES and Wii? 👍👍👍👍

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

      pretty sure you could program in C or another high-level language for the Wii
      that being said, I'd also be super interested in a video for that

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

      @@elipticalecliptic481 You could program in C for the NES too, it'd just be a bit harder in some areas and easier in others.

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

      @@anon_y_mousse No

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

    I can't do this, I did exactly what you said, and I'm still only getting a gray screen when I should be getting a mushroom.

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

      I'd check your code for a loop that isn't properly closed, and make sure you've allowed interrupts at the end.

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

      @@InkboxSoftware Thank you I've fixed it.

  • @LunaticEdit
    @LunaticEdit 3 หลายเดือนก่อน

    I feel stupid for spending 30 minutes trying to understand why rts was failing but realized he was clearing the stack segment ($100). So if you're following along and use procs, make sure you DONT clear the stack, you kinda need it.

    • @InkboxSoftware
      @InkboxSoftware  3 หลายเดือนก่อน

      Did you call JSR for your PROC?

    • @LunaticEdit
      @LunaticEdit 2 หลายเดือนก่อน

      Yup. The problem was obvious once I debugged with Mesen and saw RTS was returning to $0000.@@InkboxSoftware

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

    I make geometry dash in nes soon it seems easy to do

    • @Destroyanad
      @Destroyanad 8 หลายเดือนก่อน

      How did it turn out?

    • @WindowsDrawer
      @WindowsDrawer 8 หลายเดือนก่อน

      @@Destroyanad I didn't finish it i only made flappy bird bc the scrolling things were too hard and vacation ended

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

    Fourth

  • @The-E-Base
    @The-E-Base ปีที่แล้ว

    0:29 -- Well, there goes this option...
    ------
    Guess i'll lose hope

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

    ill code'

  • @b213videoz
    @b213videoz 3 หลายเดือนก่อน

    Oh please.. NES... Genesis!

  • @jengelenm
    @jengelenm 11 หลายเดือนก่อน

    I want to make a NES game, wtf did i get myself into OH LORD!

    • @Destroyanad
      @Destroyanad 8 หลายเดือนก่อน

      How did your project turn out? I'm learning how to make an NES game too, but i'm thinking the same thing XD

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

    First

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

    The music is really killing me. I can even play this piece of music. But it is a very strong sublime music that ask to be listened. Not good for this.

  • @crawhey
    @crawhey 7 หลายเดือนก่อน

    lol mor on sprites lol

  • @LifeIsGood-qg3xv
    @LifeIsGood-qg3xv หลายเดือนก่อน

    "Everything you need to know"
    **only shows how to display a sprite**

  • @thepeternetwork
    @thepeternetwork 10 หลายเดือนก่อน

    I'll stick to Mario Maker. I do better visually.