How do I make an NES game?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
MrHuxo
Posts: 1
Joined: Tue Feb 22, 2022 10:55 am

How do I make an NES game?

Post by MrHuxo »

Hi. This is my first time posting here. I want to say that I have no experience in coding whatsoever and I've only had experience with sprite editing and pixel art. I want to make an NES game but I don't know where to start. Any suggestions to help? Any information is much appreciated :)
Pokun
Posts: 2681
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: How do I make an NES game?

Post by Pokun »

I recommend the Nerdy Nights tutorial series.
User avatar
Ziggy587
Posts: 174
Joined: Fri Oct 08, 2010 6:08 pm
Location: NY, USA

Re: How do I make an NES game?

Post by Ziggy587 »

One option would be NESmaker. It'll allow you to create NES games without having to write any code.

https://www.thenew8bitheroes.com/
User avatar
gauauu
Posts: 779
Joined: Sat Jan 09, 2016 9:21 pm
Location: Central Illinois, USA
Contact:

Re: How do I make an NES game?

Post by gauauu »

To elaborate on these answers above: you need to decide if you want to learn to code (which takes a ton of work, but would give you the most power and freedom in making your game), or if you want to focus on the art, and be happy clicking through a UI to make a game within a lot of constraints based on the tool, not the NES itself.

If you want to learn to code, read nerdy nights. If you just want to make a NES game, mostly focusing on the art side, and are ok with whatever arbitrary and limiting constraints NESmaker puts on you, NESmaker will be a lot easier.

It all depends on your goals and what motivates you.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I make an NES game?

Post by unregistered »

If you decide to code, there are a few basic ideas you should understand. :)

A.) The NES runs with a central processing chip called the 2A03. The 2A03 is Nintendo’s version of MOS Technologies’ 6502. The 2A03 is without Decimal mode… so all information fed to the 2A03’s registers will be in hexidecimal or binary. (Decimal, which the 2A03 doesn’t support, is another name for our base 10 numbering system (i.e. 0,1,2,3,4,5,6,7,8,9,10,…).) Nintendo’s 2A03 also works with their PPU Picture Processing Unit (allows programmer to define what is displayed on the screen).


B.) The https://wiki.nesdev.com/ site is super helpful; it covers, in great detail, the 2A03 and PPU; as well as tons of details on the Mappers. Nintendo, and then other companies, created many different mappers; each affects/adds new hardware to the NES, allowing games to store more information, provide better graphical support, etc.

That wiki can be way too complex if you’re just starting coding, but now you know about that great information source.


C.) The NES can be coded with asm (assembly language) or other high level languages (such as C++). If you choose to learn asm, you’ll need a 6502 assembler to translate your written code (text) into the binary (1s and 0s) that the 2A03 understands.

High level languages are “high level” because their written code must be compiled. Compile means to translate that written code into 1s and 0s that work on whatever machine your written code is compiled on (or compiled for… you would write your say C++ code on your computer and then compile it for the NES’s 2A03(&PPU) chip(s)).

Using assembly language allows the code to be written in a specific manner for the (its) chip. This also means your code won’t be sent through a compiler first, so it will be specific (probably faster). :)


EDIT: I recommend you use asm6 for your assembler, if you choose assembly. :) Is written extremely well and is what tokumaru recommended me when I began. Asm6 is run from the command line… if on Windows, search for and use cmd.exe. Once you figure out what your line of text will be to create your .nes file, that asm6 will produce from correctly written asm code, you should incorporate that text line into a .bat file. Then, instead of having to type that line out every time, you simply run your .bat file. Mine is assemble.bat, so I just type “assemble” in the appropriate folder on the command line, and thus I receive my .nes file to test with an emulator (I’m using Mesen, but there are many different ones to choose from).
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I make an NES game?

Post by unregistered »

You said, “any information is much appreciated”; so, here is a bit more:
unregistered wrote: Wed Feb 23, 2022 5:24 pm The 2A03 is without Decimal mode… so all information fed to the 2A03’s registers will be in hexadecimal or binary. (Decimal, which the 2A03 doesn’t support, is another name for our base 10 numbering system (i.e. 0,1,2,3,4,5,6,7,8,9,10,…).)
(I’m going to be talking about syntax with asm6 bc that’s what I’m used to; though, I’m sure my message will apply to other assemblers.)


The 2A03 IS without the 6502’s Decimal mode; however asm6 allows you to use decimal numbers in your code. For example:

Code: Select all

lda #128
;loads the accumulator register with a specified decimal value of 128
;However, asm6 will change #128 (Decimal) into #$80 (Hexadecimal)
;and feed that #$80 into the accumulator register.
;That’s perfectly fine bc #128 == #$80. :)

;’#’ tells asm6 that you are specifying an immediate value
;’$’ tells asm6 that you are specifying a hexadecimal value
;’;’ tells asm6 that everything to the right on that line is a comment (ignores comments)

I also talked about 1s and 0s. Binary is written with only 1s and 0s because it’s a base2 number system (so, it only contains 2 unique digits).

Hexadecimal is a base16 number system; thus, it must contain 16 unique digits. Since we only have 10 unique digits in our Decimal base10 number system (0 through 9), they were forced to create 6 other unique digits; A through F were chosen bc that was easy.

Hexadecimal was created due to the fact that binary numbers take tons of room (i.e. 128 == 10000000b). $80 is much shorter and so it takes less room; room was scarce back when computers were invented.


(asm6 allows binary numbers to be specified with either a leading ‘%’ or a trailing ‘b’; I prefer to use the trailing ‘b’, but other assemblers only allow the leading ‘%’.

In asm6, %10000000 == 10000000b.)



General programming notes:
In programming, ‘=‘ is a declaration statement (i.e. “you = me + 34” would state/declare the you are going to instantly be 34 ahead of me, after that statement runs).

Also, ‘==‘ is an equivalence statement (i.e. “you == me + 34” would be interpreted as a ‘1’, if you is actually 34 ahead of me, or as a ‘0’, if you isn’t 34 ahead of me).

And, a ‘0’ value is definitely always false in equivalence statements; a ‘1’ value is definitely always true in equivalence statements.


‘!’ is a not modifier… so, !0 == 1… and therefore, any value that’s not zero is always interpreted as true in equivalence statements (i.e. in an equivalence statement, 201 is true bc it’s not 0).



EDIT: Further note: “000 == 0” always evaluates to true, bc false is equivalent to false. :)


—-
FINAL_EDIT: Replaced “numbers” with “unique digits” four times bc numbers was too general of a term, imo.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I make an NES game?

Post by unregistered »

unregistered wrote: Thu Feb 24, 2022 3:36 pmHexadecimal was created due to the fact that binary numbers take tons of room (i.e. 128 == 10000000b). $80 is much shorter and so it takes less room; room was scarce back when computers were invented.
”$80” is a much shorter piece of text; that saves bytes in written program text. But, computer memory is built with tiny transistors. (At least, that’s what I was taught in 2004; technology can change.)

A transistor CAN simply hold a charge. If it’s uncharged, that’s considered a ‘0’ (false); if it’s charged, that’s considered a ‘1’ (true).

So, the lda #128 actually ends up loading the accumulator, a byte, 8 transistors, with 10000000b.


Hexadecimal being shorter than binary only greatly affects program length (oh, and programmers’ hands too); computers run on 1s and 0s. Hexadecimal is easily converted into binary; binary changed into hexadecimal is also simple; a trivial search engine search will return many pages that explain how this works. 🙂


EDIT: Struckthrough statements above bc storage in computer circuitry/chips is built with transistors; memory uses a similar item, but I believe tepples told me that it’s NOT transistors.
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: How do I make an NES game?

Post by Quietust »

Transistors do not "store" information - at their most basic "digital" level, they are nothing more than switches that can be turned on and off electronically, and in a typical SRAM chip it takes six transistors to store a single bit of data.

unregistered wrote: Thu Feb 24, 2022 3:36 pm You said, “any information is much appreciated”; so, here is a bit more:
unregistered wrote: Wed Feb 23, 2022 5:24 pm The 2A03 is without Decimal mode… so all information fed to the 2A03’s registers will be in hexadecimal or binary. (Decimal, which the 2A03 doesn’t support, is another name for our base 10 numbering system (i.e. 0,1,2,3,4,5,6,7,8,9,10,…).)
(I’m going to be talking about syntax with asm6 bc that’s what I’m used to; though, I’m sure my message will apply to other assemblers.)


The 2A03 IS without the 6502’s Decimal mode; however asm6 allows you to use decimal numbers in your code.
The "decimal mode" present on the 6502 (and absent from the 2A03) has nothing to do with the storage of numbers in registers - those are all effectively converted to binary no matter what you do. What "decimal mode" actually does is change the behavior of math instructions to treat the numbers as (packed) Binary Coded Decimal, which would greatly simplify the process of converting the numbers into a format that can be conveniently displayed on the screen.

Since the NES CPU doesn't have that, you instead have to do the relevant base conversion in software - for example, this code converts a 16-bit (2-byte) number into five base-10 digits in about 700 cycles (just over 6 scanlines).
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
unregistered
Posts: 1318
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: How do I make an NES game?

Post by unregistered »

Quietust wrote: Wed Mar 09, 2022 5:52 pm Transistors do not "store" information - at their most basic "digital" level, they are nothing more than switches that can be turned on and off electronically, and in a typical SRAM chip it takes six transistors to store a single bit of data.



The "decimal mode" present on the 6502 (and absent from the 2A03) has nothing to do with the storage of numbers in registers - those are all effectively converted to binary no matter what you do.
unregistered wrote: Wed Mar 09, 2022 2:35 pmHexadecimal being shorter than binary only greatly affects program length (oh, and programmers’ hands too); computers run on 1s and 0s.
Thank you Quietust. I failed to properly explain 6502’s decimal mode; and I had forgotten how decimal mode works. My wording, quoted in Quietust’s post, IS terribly incorrect; never meant to convey that decimal mode would allow decimal values to be stored in registers. Please forgive me OP.

And, well, transistors do store information… charged or uncharged… they allow bits to be used… but, agreeing with Quietust, it’s not 1 transistor per bit. (Implementing logic gates is a bit beyond this thread. ;) )


EDIT: Sigh, I’m very sorry 😞; my “A.)” seems to be incorrectly claiming that decimal numbers could be stored in registers. :shock:
Post Reply