| NES WORLD Forum | |
|
https://www.nesworld.com/cgi-bin/yabb/YaBB.pl
System Specific Boards >> Nintendo Entertainment System >> Learning 6502 Assembly https://www.nesworld.com/cgi-bin/yabb/YaBB.pl?num=1263859326 Message started by JJM07 on 19. Jan 2010 at 00:02 |
|
|
Title: Learning 6502 Assembly Post by JJM07 on 19. Jan 2010 at 00:02
I read that in order to make an NES game (.rom file), you have to learn 6502 assembly. I've been trying to look something accessable online where I can learn assembly. The books and sources focusing on 6502 focus on Atari, Apple II, and C64, but not on NES... AND they have to be purchased online. I'm kinda confused and I need a place to start. Any starting tips, help or advice?
|
|
Title: Re: Learning 6502 Assembly Post by albailey on 19. Jan 2010 at 18:40
Here's some helpful tools and links:
1) 6502 Macroassembler and simulator: http://home.pacbell.net/michal_k/ Its a little painful to use, but basically if you want to try out a small snippet of code, you can open an existing example, and put in your code to see if what you have written seems OK. It also supports contextual help for most instructions, so you can type CMP and see some examples, flags affected, etc.. 2) Online docs http://www.obelisk.demon.co.uk/6502/ This site is pretty good. It mentions the different instructions and addressing modes, what flags are affected, etc.. 3) CA65 Everyone has their own personal favorite assembler. A lot of people like nesasm. A few like ASM65 or TASM. My favorite is CA65. However it is a bit difficult to get going (actually a lot difficult) http://www.cc65.org http://www.cc65.org/doc/ca65.html 4) FCEUX (emulator) http://fceux.com/web/home.html The debugger, nametable viewer etc.. is very useful. I find I generally use the earlier one (FCEU) since I like the memory viewer better. 5) www.nesdev.com (FORUM) Detailed info, lots of active homebrewers, good place to ask technical and specific questions once you get going. Al |
|
Title: Re: Learning 6502 Assembly Post by JJM07 on 22. Jan 2010 at 17:29
@albailey - Thank you very much! I will definitely check it out.
|
|
Title: Re: Learning 6502 Assembly Post by JJM07 on 22. Jan 2010 at 17:30
@albailey - Thank you very much! I will definitely check it out.
|
|
Title: Re: Learning 6502 Assembly Post by albailey on 22. Jan 2010 at 20:25
If you do decide to use CA65 as your assembler, setup is very difficult. I will attempt to help with a very basic linker file for you. This linker file assumes you are creating a simple NROM game. NROM are the simplest games, they have essentially no mapper. You get 2 PRG banks to hold your data, which is plenty for most starting projects (sudoku only used 1).
Copy this chunk into a file called nes.ini
Now you need a simple makefile. I use cygwin since I have a Unix background. I suspect that if you are not familiar with makefiles, this will be difficult to read and understand. Copy these contents into file called "makefile"
|
|
Title: Re: Learning 6502 Assembly Post by albailey on 22. Jan 2010 at 20:26
Now the last step (actually not even close to the last step) is a simple ASM file that makes use of those values in the nes.ini file to properly align the vectors, banks, header, etc.. so that if you run the makefile with "make run" and have your environment setup, you can almost see something working. Since I am limited to the number of chars per post, I'll leave the reset handler blank. You can fill it with the sample reset handler on nesdev's wiki
Al |
|
Title: Re: Learning 6502 Assembly Post by albailey on 22. Jan 2010 at 20:28
You'll need to make a resources folder, with an 8K file called example.chr (just use one from SMB or something) in order for this to build.
It wont do anything though, just display a boring screen. You'll need to fill in the reset handler from the wiki, and fill in the nmiHandler with whatever code you want to run each screen. It is best to code based on the nmiHandler instead of the infiniteLoop section of the resetHandler, otherwise timing gets weird. Good luck. Al |
|
Title: Re: Learning 6502 Assembly Post by Dutch nes gamer on 18. Mar 2010 at 19:56
I learned some nes programming last year.
Learned about now it all worked etc. But i only got to making backgrounds/demo screens. The hardest thing to find information about is making a game. Not much info on that point. |
|
NES WORLD Forum » Powered by YaBB 2.5.2! YaBB Forum Software © 2000-2022. All Rights Reserved. |