Programming the NES - Everything you need to know

Ғылым және технология

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 Жыл бұрын

    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
    @jatoxo8 ай бұрын

    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

  • @anon_y_mousse
    @anon_y_mousse Жыл бұрын

    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

    Жыл бұрын

    Just do it 🗸

  • @jc_dogen

    @jc_dogen

    Жыл бұрын

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

  • @victor_silva6142

    @victor_silva6142

    Жыл бұрын

    Just do-it-yourself!🎉🎉🎉

  • @dingusbingus7463

    @dingusbingus7463

    8 ай бұрын

    @@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 ай бұрын

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

  • @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.

  • @RealHubertCZGameplayLetsPlay
    @RealHubertCZGameplayLetsPlay Жыл бұрын

    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

  • @EndlessLands
    @EndlessLands Жыл бұрын

    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.

  • @iRemainNameless
    @iRemainNameless9 ай бұрын

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

  • @YourAppleSalesman
    @YourAppleSalesman11 ай бұрын

    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.

  • @wormwoodroadshow
    @wormwoodroadshow Жыл бұрын

    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

    Жыл бұрын

    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.

  • @cuntman7411
    @cuntman7411 Жыл бұрын

    I was looking for this exactly the other day!

  • @EricGranata
    @EricGranata Жыл бұрын

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

  • @ShahabSheikhzadeh
    @ShahabSheikhzadeh6 ай бұрын

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

  • @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!

  • @theleviathan3902
    @theleviathan3902 Жыл бұрын

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

  • @thedave4369
    @thedave43698 ай бұрын

    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!

  • @storebrandchocopops8041
    @storebrandchocopops8041 Жыл бұрын

    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

    Жыл бұрын

    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.

  • @martin128
    @martin1284 ай бұрын

    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 Жыл бұрын

    Excellent keep it up

  • @NonTwinBrothers
    @NonTwinBrothers Жыл бұрын

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

  • @nickgennady
    @nickgennady Жыл бұрын

    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

    Жыл бұрын

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

  • @Weirdo_Studios775
    @Weirdo_Studios7759 ай бұрын

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

  • @wawztzta8296
    @wawztzta8296 Жыл бұрын

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

  • @lilithcal
    @lilithcal9 ай бұрын

    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?

  • @InkboxSoftware

    @InkboxSoftware

    9 ай бұрын

    Yes it does

  • @Destroyanad
    @Destroyanad8 ай бұрын

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

  • @StephenAnimations
    @StephenAnimations11 ай бұрын

    Underated channel

  • @TheBxzr
    @TheBxzr8 ай бұрын

    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

  • @ClassyJacket
    @ClassyJacket10 ай бұрын

    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 ай бұрын

    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!!!🤘👽👍

  • @violator1017
    @violator1017 Жыл бұрын

    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 ! 👍👍👍

  • @famitronic9870
    @famitronic98704 ай бұрын

    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 ай бұрын

    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.

  • @ramakrishnamishra8179
    @ramakrishnamishra8179 Жыл бұрын

    awesome

  • @Nikku4211
    @Nikku4211 Жыл бұрын

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

  • @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.

  • @kez963
    @kez963 Жыл бұрын

    Omg thank you! 😄

  • @draynaruegames
    @draynaruegames2 ай бұрын

    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 ай бұрын

    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

  • @AnonymousAccount514
    @AnonymousAccount5148 ай бұрын

    KZread is the best thing ever

  • @SHD69
    @SHD69 Жыл бұрын

    nice!

  • @shuttittuppitt9355
    @shuttittuppitt935511 ай бұрын

    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.

  • @brockpiano
    @brockpiano Жыл бұрын

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

  • @InkboxSoftware

    @InkboxSoftware

    Жыл бұрын

    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

  • @trxgreder
    @trxgreder8 ай бұрын

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

  • @cheesirehat
    @cheesirehat2 ай бұрын

    How do i get my palette data?

  • @digitalalchemy1438
    @digitalalchemy143810 ай бұрын

    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.

  • @guestguest8278
    @guestguest8278 Жыл бұрын

    New upload?

  • @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,

  • @pedroxdw
    @pedroxdw11 ай бұрын

    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!

  • @Koridai011
    @Koridai0115 ай бұрын

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

  • @AkamiChannel

    @AkamiChannel

    24 күн бұрын

    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

  • @andyortlieb3768
    @andyortlieb376811 ай бұрын

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

  • @juliocesarcastaneda8215
    @juliocesarcastaneda8215 Жыл бұрын

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

  • @DavidCarrizoGuitarra

    @DavidCarrizoGuitarra

    11 ай бұрын

    It's a rom link in that video

  • @flameofthephoenix8395
    @flameofthephoenix83957 ай бұрын

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

  • @kennyroger22
    @kennyroger229 ай бұрын

    faz esse tutorial para SNES.. sou do brasil

  • @aweawd
    @aweawd9 ай бұрын

    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.

  • @Nbrother1607
    @Nbrother16077 ай бұрын

    maybe you should do another one for the x16

  • @bb.cute.channel
    @bb.cute.channel Жыл бұрын

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

  • @elipticalecliptic481

    @elipticalecliptic481

    Жыл бұрын

    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

    Жыл бұрын

    @@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

  • @R2AUK
    @R2AUK Жыл бұрын

    🤯 ❤

  • @JarppaGuru
    @JarppaGuru3 ай бұрын

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

  • @Adiee5Priv
    @Adiee5Priv Жыл бұрын

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

  • @perguto
    @perguto Жыл бұрын

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

  • @LunaticEdit
    @LunaticEdit2 ай бұрын

    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

    2 ай бұрын

    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 Жыл бұрын

    Fourth

  • @hemsaks1695

    @hemsaks1695

    Жыл бұрын

    Bruh

  • @jengelenm
    @jengelenm11 ай бұрын

    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

  • @The-E-Base
    @The-E-Base Жыл бұрын

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

  • @b213videoz
    @b213videoz3 ай бұрын

    Oh please.. NES... Genesis!

  • @GamerCentral123
    @GamerCentral123Ай бұрын

    ill code'

  • @khayoblego3294
    @khayoblego3294 Жыл бұрын

    First

  • @hemsaks1695

    @hemsaks1695

    Жыл бұрын

    Bruh

  • @crawhey
    @crawhey7 ай бұрын

    lol mor on sprites lol

  • @LifeIsGood-qg3xv
    @LifeIsGood-qg3xvАй бұрын

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

  • @kwccoin3115
    @kwccoin31156 ай бұрын

    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.

  • @thepeternetwork
    @thepeternetwork10 ай бұрын

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

Келесі