It is currently Mon May 20, 2019 11:31 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 53 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
PostPosted: Wed Feb 20, 2019 6:00 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
:oops: Looking for a general direction I can go as far as creating something simple for the NES so I can understand how this works.

I have 2 programs so far

Notepad ++
Fami Tracker

The first one is for coding and the second one is for music (For anyone who doesn't understand). What can I do to start I've programmed in python so I kinda know what's going on the same with c++ and java.. also HTML.

I know that the NES has it's limitations I think it reads and wrights to ram and memory. It also uses two different chips one for sound and the other for code?

Anyways I wanted to start and learn and I thought what a fun way to start by coding a game of pong for the NES.

Thank you for your time! :)


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 6:20 am 
Offline
User avatar

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 58
The best place to start is probably the Nerdy Nights NES programming tutorials:

http://nintendoage.com/forum/messageview.cfm?catid=22&threadid=7155

Not all the information is totally accurate or up-to-date, but I think it's still a great place to start. I taught me enough to make my first game. You'll need an emulator for testing. I'd recommend Mesen and FCEUX (Mesen is the better emulator, but FCEUX has some nice features that make debugging easier).

You'll also need to become familiar with the 6502 instruction set:

http://www.6502.org/tutorials/6502opcodes.html

This site's wiki is also a great source once you are familiar with the basics:

http://wiki.nesdev.com/w/index.php/Programming_guide

Good luck, and happy coding!


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 6:56 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
Thank you so much, I'm currently checking them out as we speak.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 7:07 am 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2018
Location: Gothenburg, Sweden
Yes, the NES largely consists of:
-a simpler variant of the 6502 CPU. Any 6502 programming guide will help, but keep in mind that decimal mode is not present. Also, unlike a c64 or apple computer or whatever, each game is its own self-contained ROM system. You have full access to the internal RAM.
-a music synthesizer (called APU or audio processing unit)
-hardware accelerated graphics (called PPU or picture processing unit - think of it as a specialized, yet limited GPU) with its own RAM not directly usable to the CPU.
-2kB:s of internal RAM.
-in/out ports
-a total 64kB address range (of which most is connected to your ROM memory on cartridge).

In addition, your cartridge might contain additional hardware features.

You program for the CPU. But reading and writing data to certain addresses connected to the controllers, the PPU (for graphics) or APU (for sound/music) will have these units perform hardware accelerated tasks for you. You don't have to render a picture in software - the PPU does that for you!

Music is often a combination of programmed software features and predefined hardware features. For example, your vibrato or glissando effect might be either, depending on what you want.

At this point in time, several people have written drivers for the APU which you can use: famitracker comes with its own driver, which is very flexible for people mainly interested in chip music but may be impractical for more ambitious games. For a pong demo, though, it's more than adequate. Then there's also famitone2, pently, ggsound and penguin. Maybe some more.

Note that the famitracker driver doesn't have a way to handle sound fx.


You'll need an assembler to turn your text document code into machine code. I'd recommend asm6 as a first-time assembler because it is easy to use, but i believe the nerdy nights tutorials were written for nesasm. That means syntax will be a bit different. You need to do a bit of translation if using asm6 and that specific tutorial.

--
edited a typo

_________________
http://www.frankengraphics.com - personal NES blog


Last edited by FrankenGraphics on Wed Feb 20, 2019 1:50 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 8:26 am 
Offline
User avatar

Joined: Sat Jul 25, 2015 1:22 pm
Posts: 520
Personal recommendations:

I like recommending this before nerdy nights. It's really simple, and while it's using the same instructions you'll use on NES, it eliminates the need to deal with NES graphics or other complexities while you're taking your first couple steps:

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

I'd do that, THEN Nerdy Nights.

For a reference, I pretty much have this page open all of the time when I'm doing 6502:

http://www.obelisk.me.uk/

On the left side, click on 6502 and pull that down. The "Reference" page is probably the most valuable, but they're all helpful.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 9:34 am 
Offline
User avatar

Joined: Sun Apr 08, 2018 11:45 pm
Posts: 46
Location: Southern California
This youtube channel has some good videos that talk about NES development:
https://www.youtube.com/watch?v=JgdcGcJ ... PqwliHEuEk

There are two playlists. The first is "The Zero Pages", which are instructional videos. The second playlist is "NES Programming", where he is coding a game and learning as he goes. Both can be helpful, but I would recommend starting with "The Zero Pages" first.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 1:41 pm 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
darryl.revok wrote:
Personal recommendations:

I like recommending this before nerdy nights. It's really simple, and while it's using the same instructions you'll use on NES, it eliminates the need to deal with NES graphics or other complexities while you're taking your first couple steps:

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

I'd do that, THEN Nerdy Nights.

For a reference, I pretty much have this page open all of the time when I'm doing 6502:

http://www.obelisk.me.uk/

On the left side, click on 6502 and pull that down. The "Reference" page is probably the most valuable, but they're all helpful.


Not going to lie that simulator is pretty neat! Also learned quite a bit from it as well.
Also, thank you, everyone, for the replies, I'm still looking at everything to learn it all will take forever so I'm working step by step to getting a grip on things.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 2:48 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 668
gravelstudios wrote:
[...] but FCEUX has some nice features that make debugging easier).
Offtopic but, what in FCEUX makes you say it is easier to debug at this point? I believe I've essentially incorporated all of its debugging features (and added a lot more on top of them), with the exception of a TAS editor, if that counts as one. (I don't mean this as a complaint, by the way, just genuinely curious to know - I can't improve the debugger if people don't tell me what they don't like about it, after all)

FCEUX is definitely faster and better for debugging on low-end devices, though.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 4:38 pm 
Offline
User avatar

Joined: Mon Mar 13, 2017 5:21 pm
Posts: 58
Quote:
Offtopic but, what in FCEUX makes you say it is easier to debug at this point? I believe I've essentially incorporated all of its debugging features (and added a lot more on top of them), with the exception of a TAS editor, if that counts as one. (I don't mean this as a complaint, by the way, just genuinely curious to know - I can't improve the debugger if people don't tell me what they don't like about it, after all)

You know what, I retract that statement. I only just started using Mesen a few days ago, and didn't really know where everything was located, or how to use it. after I read your post, I looked again and found some of the stuff I was looking for. Sorry about that.


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 11:51 pm 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
I Also have a graphics editor called YY-CHR although I don't know if it's good to have it or not


Top
 Profile  
 
PostPosted: Wed Feb 20, 2019 11:59 pm 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
FrankenGraphics wrote:
Yes, the NES largely consists of:
-a simpler variant of the 6502 CPU. Any 6502 programming guide will help, but keep in mind that decimal mode is not present. Also, unlike a c64 or apple computer or whatever, each game is its own self-contained ROM system. You have full access to the internal RAM.
-a music synthesizer (called APU or audio processing unit)
-hardware accelerated graphics (called PPU or picture processing unit - think of it as a specialized, yet limited GPU) with its own RAM not directly usable to the CPU.
-2kB:s of internal RAM.
-in/out ports
-a total 64kB address range (of which most is connected to your ROM memory on cartridge).

In addition, your cartridge might contain additional hardware features.

You program for the CPU. But reading and writing data to certain addresses connected to the controllers, the PPU (for graphics) or APU (for sound/music) will have these units perform hardware accelerated tasks for you. You don't have to render a picture in software - the PPU does that for you!

Music is often a combination of programmed software features and predefined hardware features. For example, your vibrato or glissando effect might be either, depending on what you want.

At this point in time, several people have written drivers for the APU which you can use: famitracker comes with its own driver, which is very flexible for people mainly interested in chip music but may be impractical for more ambitious games. For a pong demo, though, it's more than adequate. Then there's also famitone2, pently, ggsound and penguin. Maybe some more.

Note that the famitracker driver doesn't have a way to handle sound fx.


You'll need an assembler to turn your text document code into machine code. I'd recommend asm6 as a first-time assembler because it is easy to use, but i believe the nerdy nights tutorials were written for nesasm. That means syntax will be a bit different. You need to do a bit of translation if using asm6 and that specific tutorial.

--
edited a typo


It seems like ASM6 closes out immediately when I run the program :?


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 1:42 am 
Offline
User avatar

Joined: Sun Dec 12, 2010 10:27 pm
Posts: 348
Location: Hong Kong
This is the correct behaviour as it's a console app.
Read this apparently recent thread.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 1:52 am 
Offline
User avatar

Joined: Tue Feb 19, 2019 11:54 pm
Posts: 23
Location: Planet Earth, Milky Way
Gilbert wrote:
This is the correct behaviour as it's a console app.
Read this apparently recent thread.

I'm still confused as what to do with this.. unfortunately.


Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 3:12 am 
Offline
Formerly WheelInventor
User avatar

Joined: Thu Apr 14, 2016 2:55 am
Posts: 2018
Location: Gothenburg, Sweden
The easiest way is to simply drag and drop your text file onto asm6.exe. If your code contains syntax errors, you'll hardly notice anything and it won't produce a file. If your code is error-free, then it will produce a file (theNameOfYourTextfile.bin) in the same folder. So this method is good when you want to do something quick. But it's probably not the best method if you don't know your way around the syntax just yet.

But the proper way (most of the time) is to either:

A)
-open command prompt in your project folder
-type: asm6 yourMainCodeTextFile.asm myGame.nes listing.txt

or

B)
-make a new text file
-type this:
Code:
asm6 yourMainCodeTextFile.asm myGame.nes listing.txt
pause

-and save as "assemble.bat" or something like that.
-double click assemble.bat

the pause is important to be able to have a chance to get a look at the program readout.

obviously, replace my mockup file names with something that makes sense to your project.


as a suggestion, keep a copy of asm6 in each project folder. It simplifies things like not needing to specify full paths in the command line or batch (.bat) file.


For reference, here's what the readme file says:
Code:
Usage:

        asm6 [-options] sourcefile [outputfile] [listfile]

Options:

        -?         Show some help
        -l         Create listing
        -L         Create verbose listing (expand REPT, MACRO)
        -d<name>:  Define a symbol and make it equal to 1
   -q         Quiet mode (suppress all output unless there's an error)
        Default output is <sourcefile>.bin
        Default listing is <sourcefile>.lst


It says other things too that are important to read.

_________________
http://www.frankengraphics.com - personal NES blog


Last edited by FrankenGraphics on Thu Feb 21, 2019 3:18 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Feb 21, 2019 3:17 am 
Offline

Joined: Tue May 28, 2013 5:49 am
Posts: 1161
Location: Hokkaido, Japan
Look at the command prompt tutorial in that link or google for another tutorial. Using commandline programs is a basic computer skill you need to learn.

I think Nerdy Nights teaches you that though. Here are the Nerdy Nights lesson files in asm6 so you don't have to learn how to convert from nesasm.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 53 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Google [Bot] and 2 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