The 6502 assembler has the advantage of being able to assume that it's a 16-bit value. In C it could be literally anything and it's impossible to make an assumption like that. The assembler isn't doing a better job with the single pass, it's merely doing a possible job. (Possible only because it has no such thing as type safety... or types at all.)HihiDanni wrote:Yet another bullet point on the list of reasons why C is not a good language. When even assemblers do a better job at this...rainwarrior wrote:It's a "one-pass" assemble, but it does fill in forward references (unlike C, which requires forward declarations to even compile).
Anyways, to bring it back to the question of how to organize files... at least in ca65, in general keep your RAM / ZP reservations at the top of the source file. If your file becomes large enough it's useful to split things up by function. You can put the music code and music data in their own file, for example. This separation can help keep things more manageable-- the music source file now doesn't have to worry about anything that's in the other files, it only has its own concerns.
It's fine to stick everything in one file until later when the program grows large enough, or even keep just a single file assembly through the whole project. Both approaches are currently practical for an NES game.