Earlier quoted context omitted.
If you're not using the value you can't “want it”. There is only one sane way to interpret the following two expressions statements (in C), and it is that they are equal. g++; ++g;
Well, no, you can do stupid code like: if(g++) { //do something } Which obviously will do something if g was non-zero before incrementing it by one. It's a really poor way of writing code, but I have seen it done.
How to program an NES game in C
41–50 of 70 posts
Re: How to program an NES game in C
#42How did they actually make NES games? By that I mean, what types of computers were they using for creating NES games? Other 6502-based computers? Could they run the NES games on there? Or did they have to burn to a cart to test things every time? How did they design graphics? Was it basically graph paper, which then they translated into sprites by hand?
I might be wrong but I seem to remember the Sharp X68000 being a preferred platform in the early days? https://en.wikipedia.org/wiki/X68000
Re: How to program an NES game in C
#43How did they actually make NES games? By that I mean, what types of computers were they using for creating NES games? Other 6502-based computers? Could they run the NES games on there? Or did they have to burn to a cart to test things every time? How did they design graphics? Was it basically graph paper, which then they translated into sprites by hand?
Re: How to program an NES game in C
#44IMHO a 6502 is too limited to be effectively programmed in C; even this part of the article gives all the limitations: https://nesdoug.com/2015/11/15/2-how-cc65-works/ With this important note: "clean unaltered C code will compile into very slow code that takes up too much of the limited memory space." In other words, "C" written for such a CPU will be in a vastly different style from more "normal" C, so that it migh…
Does c65 turn structs into parallel arrays? If you have something like struct Monster { unsigned char hitPoints; unsigned char damage; unsigned char shieldLevel; char* name; }; static Monster s_monsters[] = { { 5, 1, 0, "orc", }, { 50, 10, 5, "dragon", }, { 10, 3, 1, "goblin", }, }; that's a no-no on 6502. You generally need to store those in parallel byte arrays including the string pointer's upper and lower bytes e…
Edit: Found it online here: https://github.com/ESWAT/john-carmack-plan-archive/blob/mast...
Re: How to program an NES game in C
#45Yeah, making an NES game is on my bucket list. I'm very new at (complex) programming, but I think I might just do it in assembly. If you're going to run a marathon, why not actually do a triathlon?
Might be easier (but just as much fun) to whet your palate by creating a pico-8 game first: https://www.lexaloffle.com/pico-8.php
Re: How to program an NES game in C
#46> All NES assembers are command line programs. What does that mean? It has no graphic user interface. Who the hell is this written for?
At first I found it a little disorienting because the technical level of the writing would fluctuate, but at the same time I can appreciate it being accessible for someone who might not know much about programming.
Re: How to program an NES game in C
#47IMHO a 6502 is too limited to be effectively programmed in C; even this part of the article gives all the limitations: https://nesdoug.com/2015/11/15/2-how-cc65-works/ With this important note: "clean unaltered C code will compile into very slow code that takes up too much of the limited memory space." In other words, "C" written for such a CPU will be in a vastly different style from more "normal" C, so that it migh…
I feel like handling ROM banking would be the most challenging part of coding in C. You have to swap portions of your program in and out constantly (unless you manage to fit it all in a single bank). It seems hard to abstract that efficiently from a high level language. I heard there were C compilers for the Game Boy as well but as far I know they were never widely used.
Re: How to program an NES game in C
#48How did they actually make NES games? By that I mean, what types of computers were they using for creating NES games? Other 6502-based computers? Could they run the NES games on there? Or did they have to burn to a cart to test things every time? How did they design graphics? Was it basically graph paper, which then they translated into sprites by hand?
http://i.kinja-img.com/gawker-media/image/upload/s--09WfR60x...
Re: How to program an NES game in C
#49Earlier quoted context omitted.
A 8080 has a linear 64K address space, like the 8085 and the Z80. Perhaps you were thinking of 8086? In any case, 64K address space is not the real limiter with a 6502 --- it's other things, like the tiny number of registers, relative shortage of 16-bit addressing modes, and fixed(!) 256-byte stack which make it difficult to program in C. Even the 6800, with its 16-bit index and stack pointer registers, would be easi…
Yeah, I thought 8086 also had segments, did not bother to cross-check it.
Re: How to program an NES game in C
#50Earlier quoted context omitted.
I feel like handling ROM banking would be the most challenging part of coding in C. You have to swap portions of your program in and out constantly (unless you manage to fit it all in a single bank). It seems hard to abstract that efficiently from a high level language. I heard there were C compilers for the Game Boy as well but as far I know they were never widely used.
C programmers used to handle banks of EMS RAM, on the PC. Ditto with program overlays. I'd assume that NES ROM banks could be handled similarly.