It is currently Wed Nov 22, 2017 9:58 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Mon Oct 23, 2017 1:55 pm 
Offline

Joined: Tue Jun 28, 2011 2:39 pm
Posts: 152
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?


Top
 Profile  
 
PostPosted: Mon Oct 23, 2017 1:57 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6448
Location: UK (temporarily)
I know you say you already have an HLL background, but have you read through dougeff's tutorial anyway?


Top
 Profile  
 
PostPosted: Mon Oct 23, 2017 2:04 pm 
Offline

Joined: Tue Jun 28, 2011 2:39 pm
Posts: 152
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.


Top
 Profile  
 
PostPosted: Mon Oct 23, 2017 2:42 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 211
You've seen Nerdy Nights I presume?


Top
 Profile  
 
PostPosted: Mon Oct 23, 2017 10:57 pm 
Offline
User avatar

Joined: Fri Sep 22, 2017 10:13 am
Posts: 9
Location: Netherlands
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


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 2:40 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 382
Location: Denmark (PAL)
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.


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 5:18 am 
Offline

Joined: Tue Jun 28, 2011 2:39 pm
Posts: 152
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.


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 5:34 am 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 382
Location: Denmark (PAL)
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


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 6:20 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 987
Location: Pennsylvania, USA
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...).


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 8:10 am 
Offline
User avatar

Joined: Thu Aug 13, 2015 4:40 pm
Posts: 115
Location: Rio de Janeiro - Brazil
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.

_________________
http://nesrocks.com/blog/superpitfall30th/


Top
 Profile  
 
PostPosted: Tue Oct 24, 2017 10:04 am 
Offline

Joined: Sun Jan 31, 2016 9:55 pm
Posts: 36
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group