Any noob-friendly tutorial?

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.

Moderator: Moderators

Post Reply
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Any noob-friendly tutorial?

Post by darkhog »

Is there any tutorial "for dummies" to NES coding?

What I want is something that is written with someone who has experience with programming in high-level languages but no experience with assembly (or C for that matter) that takes you through making a simple game (say, Pong) with things like custom graphics, sound and music so I can learn all facets of NES gamedev. And then perhaps something that involves scrolling as well.

<---- Pictured: someone who has experience with programming in high-level languages but no experience with assembly (or C for that matter).

The tutorial should use language understandable by a complete dumbbell who flunked high school math.

<---- Pictured: a complete dumbbell who flunked high school math.

Anyone knows of such tutorial or is willing to write one?
lidnariq
Posts: 11430
Joined: Sun Apr 13, 2008 11:12 am

Re: Any noob-friendly tutorial?

Post by lidnariq »

I know you say you already have an HLL background, but have you read through dougeff's tutorial anyway?
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Re: Any noob-friendly tutorial?

Post by darkhog »

I don't cosider C or even C++ (except for C++11) "high level". I consider Java or C# high-level. Anyway, I really want to do it in assembly since then I can finetune performance + will have 1:1 (sans comments) equality between sources and disassembly while debugging.
User avatar
pubby
Posts: 583
Joined: Thu Mar 31, 2016 11:15 am

Re: Any noob-friendly tutorial?

Post by pubby »

You've seen Nerdy Nights I presume?
User avatar
iamerror
Posts: 13
Joined: Fri Sep 22, 2017 10:13 am
Location: Netherlands

Re: Any noob-friendly tutorial?

Post by iamerror »

I have the a similar background and started coding for the NES about a year ago. Many of the (tutorial) resources I could find, already assumed some level of knowledge that I didn't have.

The folllowing ASM6 tutorial got me started
https://squareknot.com/workshop/3805/project/5933

The following reference will come in handy as well
http://www.obelisk.me.uk/6502/reference.html
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Any noob-friendly tutorial?

Post by Sumez »

Basically the Nesdev Wiki got me started. This tutorial, which was also referred there, is a -really- good start to 6502 programming, I think. Very beginner friendly, with a helpful "emulator" included for testing out and playing with instructions of your own:

https://skilldrick.github.io/easy6502/

Once you've completed it, read up on the NES registers, which is everything that makes this system unique, especially the PPU, which essentially is what you're using to communicate with "the outside world" :P I spent probably a few days casually reading about the various aspects of the NES hardware before I even started writing my first line of code. On the other hand I never followed any kind of "make your first game" tutorial step by step, I just jumped right out into it.

There are some other really good links on this page: https://wiki.nesdev.com/w/index.php/Programming_guide


Compared to stuff like C# and Java, Assembly languages are obviously the complete opposite camp, and you'll quickly find out why C/C++ is also considered high level in comparison. But that doesn't mean it's any more difficult - in fact, with assembly you're working with a lot fewer restrictions, and the ability to build up your code any way you like. There are fewer things you -can- do, meaning it's a lot quicker to learn. The only drawback is that getting anything done usually takes hell of a lot more legwork. For your first test project you may want to work with existing CHR data (the graphics ROM) stolen from someone else, so you know that part works as it should.

With knowledge from C#, etc. there is not much you can re-use in assembly, but experience with logic based programming in general is universal, and should help give you a quicker start. I'd guess most people here came from a more high-level background before picking up 6502.
darkhog
Posts: 192
Joined: Tue Jun 28, 2011 2:39 pm

Re: Any noob-friendly tutorial?

Post by darkhog »

Sumez wrote:But that doesn't mean it's any more difficult - in fact, with assembly you're working with a lot fewer restrictions, and the ability to build up your code any way you like. There are fewer things you -can- do, meaning it's a lot quicker to learn.
I know, that's why I want to learn the assembly, because it makes me able to get close and personal with the hardware. And I'll check out that easy6502 site you provided. As for using "stolen" chr data, I don't think I'll have to since there are some great CHR editors such as YY-CHR. Anyway, do you know a good resource on NES' memory map? Because interacting with hardware on other old machines, like e.g. Atari consoles is done by interacting with specific write-only or read-only memory addresses so I assume it's the most important part. I had tried nes dev in the past, even going as far as displaying a title screen (made from solid colored blocks, think ASCII- or PETSCII-art), that slided to the bottom of the screen and displayed "Press start", but nothing really past that - I've used NESICIDE for that, though I don't remember if I done it in C or asm. Anyway, my point is that I know something about nes HW, just not enough to make a proper game (for example, I'd need a state machine to manage game's "scenes" such as titlescreen, options and game itself, however from what I've read, NMI is supposed to be static?)

Anyway, I appreciate your help.
User avatar
Sumez
Posts: 919
Joined: Thu Sep 15, 2016 6:29 am
Location: Denmark (PAL)

Re: Any noob-friendly tutorial?

Post by Sumez »

You're right. Basically every single part of making a game on the NES involves reading and writing addresses.
Some addresses are RAM read/write addresses, some are ROM space, which in the case of the NES work exactly like RAM except it's read-only, and then you have the register addresses where writing to them (or in some cases reading from them) interfaces with the hardware in different ways - writing to the graphics chip, playing music, reading controllers, etc.

Here's a great overview of the memory addresses available to the CPU, which are the ones you'll be working with:
https://wiki.nesdev.com/w/index.php/CPU_memory_map
For the stuff in "cartridge space", check the definition in the various mapper types. The classic NROM defines the basic standard of $8000-$ffff being ROM data:
https://wiki.nesdev.com/w/index.php/NROM

One thing that could confuse a beginner could be the fact that there is also a memory space available only to the graphics chip, consisting of both the CHR ROM and video RAM. You can never access these directly using your code, and need to use the PPU's read/write registers (or the OAM DMA channel for sprites). Here's a map of this space:
https://wiki.nesdev.com/w/index.php/PPU_memory_map
User avatar
GradualGames
Posts: 1106
Joined: Sun Nov 09, 2008 9:18 pm
Location: Pennsylvania, USA
Contact:

Re: Any noob-friendly tutorial?

Post by GradualGames »

As supplementary material, I have always felt Assembly Language: Step by Step is a great resource. It's the closest thing to a "for dummies" book on assembly language I can think of, only it's for x86 not 6502. To be honest though, most assembly languages have concepts that transfer over fairly easily. It was my first step into assembly language and it cleared up a lot of things that I was uncomfortable with in lower level code. If I hadn't gone through that book I am not certain I would have gotten into NES coding when I did (back in 2008, there were very few complete tutorials around, and the ones that were around didn't hold your hand very much...).
User avatar
nesrocks
Posts: 563
Joined: Thu Aug 13, 2015 4:40 pm
Location: Rio de Janeiro - Brazil
Contact:

Re: Any noob-friendly tutorial?

Post by nesrocks »

I started on nerdy nights, didn't complete it, but what really helped me was dougef's tutorial. Even though I did all assembly code.
https://twitter.com/bitinkstudios <- Follow me on twitter! Thanks!
https://www.patreon.com/bitinkstudios <- Support me on Patreon!
russellsprouts
Posts: 53
Joined: Sun Jan 31, 2016 9:55 pm

Re: Any noob-friendly tutorial?

Post by russellsprouts »

Yeah. Doug's tutorial is what got me into this as well. I also do everything with assembly code, but the tutorial example code and explanations were what I needed to get started.
Post Reply