I'm new in NES dev

Discuss technical or other issues relating to programming the Nintendo Entertainment System, Famicom, or compatible systems. See the NESdev wiki for more information.
User avatar
nesgamer
Posts: 8
Joined: Fri Jul 11, 2025 3:00 pm

Re: I'm new in NES dev

Post by nesgamer »

Dwedit wrote: Tue Jul 15, 2025 2:08 pm Anyway, there are two major options for which assembler to use: ASM6 or CA65.

ASM6 is simpler in how to use, and much more direct about emitting bytes. You put in an instruction or .db statement, and it emits a byte to your output file. Then for advanced memory layouts, you can pad out to fill the bank, reassign the current address $ to a different value, then emit more bytes. Reassigning the current address is an unusual feature for an assembler, and it gives ASM6 a lot of power. However, it also does not stop you from misusing symbols, such as trying to jump an address from the wrong bank.

Meanwhile CA65 uses sections, and you declare what memory those sections go into. Then your source code files need to declare what section they are generating code for. I haven't really used CA65 much.

No assembler has a GUI, they're all command-line programs. So you should make a .bat file to launch the assembler to build the code. If you want something like an IDE, you should install a program like TextPad. TextPad can be configured for syntax highlighting. You can also set up a "Tool" to invoke your build.bat file in the project directory, and also set it up to let you double click on errors to take you to that line number.
Ok. My assembler of my choice: asm6.
Even thought you said ASM6 is simple to use than CA65, i would use this on my MOST MMC5 CHR-RAM complex game ever :shock: :shock: :shock:
User avatar
nesgamer
Posts: 8
Joined: Fri Jul 11, 2025 3:00 pm

Re: I'm new in NES dev

Post by nesgamer »

Pokun wrote: Wed Jul 16, 2025 1:38 pm Yeah either $ dollar-sign or an * asterisk ("star label") is very commonly used in many many assemblers for referring to or even reassigning the current address of the assembly PC. 64tass uses the star label.

nesgamer wrote: Tue Jul 15, 2025 1:14 pm I just wanna need a assembler of my choice :cry:
So did you check out any of those I listed and Dwedit explained about?
I will now try ASM6 :)
User avatar
tokumaru
Posts: 12668
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: I'm new in NES dev

Post by tokumaru »

nesgamer wrote: Wed Jul 16, 2025 6:04 pmEven thought you said ASM6 is simple to use than CA65, i would use this on my MOST MMC5 CHR-RAM complex game ever :shock: :shock: :shock:
That's very ambitious of you, considering you're new to NES dev and all... but to tell you the truth, even a simple hex editor is enough to make the most complex NES game ever, if for whatever reason you decide to put the ROM together byte by byte. It'll just take a lot of time to do it and it'll be hell to maintain, but it's certainly possible.

The features of your assembler of choice can help you get things done faster, but there's no direct connection between the complexity of the assembler and the complexity of the games you make with it. The assembler doesn't imposes any limits on WHAT you can do, it only affects HOW you do it.
User avatar
chatty
Posts: 40
Joined: Wed Dec 11, 2024 9:41 am
Location: Brazil

Re: I'm new in NES dev

Post by chatty »

there's no direct connection between the complexity of the assembler and the complexity of the games you make with it. The assembler doesn't imposes any limits on WHAT you can do, it only affects HOW you do it.
I second this. While I'm not really currently into the "homebrew" aide of things, I'm currently trying to develop (and maintain) a translation of a videogame using xkas-plus, since it's the most suited tool for the job at hand.

Edit: I just wanted to add, too many people get stuck in analysis paralysis and can't seem to choose which is the right method or way of doing things. Really, just pick one thing to do, and stick to it 'till the end. :3
User avatar
matthughson
Formerly Goose2k
Posts: 341
Joined: Wed May 13, 2020 8:31 am

Re: I'm new in NES dev

Post by matthughson »

nesgamer wrote: Fri Jul 11, 2025 3:04 pm I'm new in NES dev, got any assemblers for Windows and begginer-friendly? :D
You might want to check out this page to get started.

https://www.nesdev.org/wiki/Programming_guide
User avatar
Anna_TeamRocket
Posts: 62
Joined: Sat Jan 04, 2025 3:21 am

Re: I'm new in NES dev

Post by Anna_TeamRocket »

CC65 works just about fine for me, but still, it's hard to keep track of everything on my own. So many diffirent variables. You got to practice, avoid complicated topics in order not to discourage yourself and to keep a positive atitude. In my experience, practice is always the anwser. You'll find the hints online one way or the other.
User avatar
nesgamer
Posts: 8
Joined: Fri Jul 11, 2025 3:00 pm

Re: I'm new in NES dev

Post by nesgamer »

Anna_TeamRocket wrote: Wed Jul 30, 2025 11:50 pm CC65 works just about fine for me, but still, it's hard to keep track of everything on my own. So many diffirent variables. You got to practice, avoid complicated topics in order not to discourage yourself and to keep a positive atitude. In my experience, practice is always the anwser. You'll find the hints online one way or the other.
Ok anna i actually made a compiler on Dev-C++ CONTAINING cc65
User avatar
Anna_TeamRocket
Posts: 62
Joined: Sat Jan 04, 2025 3:21 am

Re: I'm new in NES dev

Post by Anna_TeamRocket »

nesgamer wrote: Sun Sep 07, 2025 12:22 pm
Anna_TeamRocket wrote: Wed Jul 30, 2025 11:50 pm CC65 works just about fine for me, but still, it's hard to keep track of everything on my own. So many diffirent variables. You got to practice, avoid complicated topics in order not to discourage yourself and to keep a positive atitude. In my experience, practice is always the anwser. You'll find the hints online one way or the other.
Ok anna i actually made a compiler on Dev-C++ CONTAINING cc65
I just use notepad and the .bat file for compilation. It's been a while since I've actually had any progress though.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: I'm new in NES dev

Post by segaloco »

My suggestion for anyone using cc65 is to get familiar with UNIX make. The whole point of cc65 is to model the UNIX-style cc/as/ld development environment, of which make is another crucial part.

Here is a simple NROM cc65 Makefile project template: https://gitlab.com/segaloco/templates/- ... r/nes/nrom

This should run from any UNIX shell with cc65 installed. For Windows, I would recommend WSL or MinGW, something like that. Even if you aren't going to use make, there are countless useful utilities granted by the UNIX command-line, things like od for data analysis, dd for data snipping, sed and awk for data processing, and even stuff like iconv for making character encoding conversions. You ain't getting that stuff on CMD by default. UNIX CLI is meant to actually be a functional operating system for development, the first thing UNIX was used for was software development.
stan423321
Posts: 127
Joined: Wed Sep 09, 2020 3:08 am

Re: I'm new in NES dev

Post by stan423321 »

For what it's worth, I think make and its replacements are of the more obvious interest for someone not convinced of posix... uh... style of doing things... than all the other tools you mentioned. I don't remember ever using them directly, aside from dd writing a Linux pendrive on Linux systems, and then only where installing some GUI image writer was impractical at the moment. Definitely not directly for development, though likely as a dependency to other tools like git.

With NES size of things, a batch script may be sufficient, though.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: I'm new in NES dev

Post by segaloco »

So here are some details:

od - This is octal dump. As the name suggests, by default it dumps a file as octal. However, it is a general file analyzer that you can change bases and other representations in. For instance, say I don't want to mess with a graphical hex editor. I want to see 64 bytes at offset 0x1000 in a file, I can do this:

Code: Select all

% od -Ax -txC -j 0x1000 -N 64 smb3.nes
0001000    b0  a1  4c  1b  d0  a9  08  9d  61  06  a9  1f  9d  18  05  60
0001010    20  e7  d5  4c  4d  d0  20  01  d6  4c  1b  d0  20  18  d6  4c
0001020    1b  d0  20  f0  d5  4c  1b  d0  20  e7  d5  a5  ce  d0  35  bd
0001030    eb  06  f0  21  fe  eb  06  c9  90  d0  03  4c  32  d4  a9  04
0001040
Or I want to see what characters might be in a string:

Code: Select all

% od -Ax -c -j 0x3FFF0 -N 64 smb3.nes
003fff0  377 377 377   S   U   P   E   R       M   A   R   I   O       3
0040000   \0  \0   l   V 003  \0 001  \f 001   - 206 364   0 377 225 367
0040010   \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0040030
I've got that information faster than it takes to open a start menu, click on an icon, and wait for the graphical stuff to bootstrap, not to mention the overhead of starting a graphical environment in the first place. My computers don't even start X by default anymore, I issue a "startx" if I need graphics for anything but I mostly just sit in GNU screen at terminals.

This is a UNIX utility too so it uses stdin and stdout, you can use it in pipelines. This is where stuff like sed then really shines, you can dock the addresses with -An and then you just get raw bytes to pipe into other tools, I can do something like this to get a series of bytes printed one hex value per line, capitalized. First, the raw input:

Code: Select all

% od -An -txC -j 0x3FFF3 -N 10 smb3.nes                      
           53  55  50  45  52  20  4d  41  52  49                        
But I want one per line, so:

Code: Select all

% od -An -txC -j 0x3FFF3 -N 10 smb3.nes | tr "[a-z]" "[A-Z]" | sed -e "/^$/d" -e "s/^[^0-9A-F]*//g" -e "s/\([0-9A-F]*\) */\1\n/g"
53
55
50
45
52
20
4D
41
52
49

So pulled in tr, which does very basic character conversions (iconv is more sophisticated), then sed to snip out unneeded bits and then the result are the bytes I wanted in the format I wanted. I can then put this in a script and I forever have a mechanism to print a file in hex one byte per line, useful for then adding to a script that, for example, adds ".byte $" to the front of each line to rapidly convert a binary BLOB into .byte directives to feed into ca65.

This is just one example, of course, but I am kicking myself for all the years I didn't bother to learn this stuff. I've managed to eliminate most graphical applications from my process. Heck, even my graphics tools only require a desktop for presentation. I've got a couple sets of pipelines for converting CHR graphics to bitmaps and PNGs and you only need a desktop if you want to *view* the results. All the generation is just CLI programs, one for each concern (e.g. decode a display list into a nametable, convert a CHR into a common image format, assemble a set of images in a grid based on a nametable description, etc.) so I can do any one of the jobs independently if need be without having to care about the other parts. One key benefit to this tool-based approach is dependability. If you scope each tool narrowly and it does one job, then you can operate in confidence that your nametable generator will always work, doesn't matter how you hack up your CHR converter under the hood, the nametable generator simply consumes its results, it doesn't care about internal implementation. Doing things this way insulates unrelated items from each others' implementation details.

Lastly just because it's one of my irks, dd has a bit of a reputation as strictly a disk copying tool. That's all I ever see people cite it in the context of, but dd is not by definition a disk tool, however much people have tried to make the names disk dumper and disk duplicator stick. The name dd derives from "data definition", a card type in the IBM mainframe operating systems that sets up I/O properties of an operation. Since it derives from an old IBM JCL command, that is why it doesn't use typical UNIX arguments but the whole if= of= etc. this is directly from the old job card syntax. Ultimately dd is just a read-write loop from standard input (or if=) to standard output (or of=). You are given control over the starting position of the read, starting position of the write, and the size of the data to copy, as well as a couple of configuration parameters like "notrunc". I mention "notrunc" because with this feature, dd can operate as a simple patcher. You simply say pass a "skip" to say where in the first file you want to copy the patch from, "count" to say how much to copy (both can be omitted if you're copying all of input), "seek" can then be used to say where in the output file to print the new bytes, and then "conv=notrunc" tells dd to *not* use its default behavior of truncating anything in the destination file after the write. This is just again an example, but that I came up with this via my own trial and error rather than this being established practice in the world for streaming a set of bytes over an offset in a file is shocking to me. It is just about the lowest level way to do that sort of thing without writing a program, indeed most of my scripts turn to dd for things I would use read, write, and lseek to do in C.

So yeah, my advice there is don't pooh pooh UNIX utilities as old or esoteric, they allow you to get *so* much done without once having to touch a mouse or rely on any amount of graphical toolkits.
stan423321
Posts: 127
Joined: Wed Sep 09, 2020 3:08 am

Re: I'm new in NES dev

Post by stan423321 »

Oh, you think I'm insulting UNIX utilities? You should really see me insulting certain fans of UNIX utilities. The ones who claim to praise them while pulling out their embarrassing childhood photos with skin infections and edgy hoodies. It is quite a sight to behold.

Seriously though, this pitch is actually a great demonstration of many reasons why someone may dislike POSIX style of doing things, some of which I can relate to and at least one I cannot. But if you like using them daily, good for you. Really! You should probably figure out a way to view pngs without entering a full GUI, I'm pretty sure I've seen something like that out there.

The magical thing about make is that if you like the CLI invocations, you probably view Makefiles as a peculiar form of shell scripting, but for people who don't like CLI invocations, Makefiles are a great way to gather a subset of sanitized CLI invocations and hide them behind an even more sanitized CLI invocation. The less magical thing about it is that the resulting Makefiles are sometimes very different.
User avatar
segaloco
Posts: 913
Joined: Fri Aug 25, 2023 11:56 am

Re: I'm new in NES dev

Post by segaloco »

Jesus Christ dude I was just suggesting some software tools chill.
Pokun
Posts: 3442
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: I'm new in NES dev

Post by Pokun »

segaloco wrote: Thu Sep 11, 2025 12:03 pm I've managed to eliminate most graphical applications from my process. Heck, even my graphics tools only require a desktop for presentation. I've got a couple sets of pipelines for converting CHR graphics to bitmaps and PNGs and you only need a desktop if you want to *view* the results. All the generation is just CLI programs, one for each concern (e.g. decode a display list into a nametable, convert a CHR into a common image format, assemble a set of images in a grid based on a nametable description, etc.) so I can do any one of the jobs independently if need be without having to care about the other parts.
Pixel art editing benefits from a graphical environment though. I hope Graphics Gale is supported well enough by Wine once I officially migrate to Linux.

segaloco wrote: Thu Sep 11, 2025 12:03 pm So yeah, my advice there is don't pooh pooh UNIX utilities as old or esoteric, they allow you to get *so* much done without once having to touch a mouse or rely on any amount of graphical toolkits.
I agree, Unix/Posix has so many useful little tools that doesn't seem to have any counterparts in DOS, at least not something included with the OS by default while the Unix ones are included in about every Linux distro.

I'd like to get into the habit of using these much more than I do (one reason why I look forward to when I officially migrate to Linux), learning when and how to use them. There are so many little things that I'd like to automate but I don't want to write a program for every little thing, but then I'm unable to find an existing program that can do it or it's too bloated for such a simple little thing.