Live data from Hacker News

How to program an NES game in C

nesdoug.com

31–40 of 70 posts

Re: How to program an NES game in C

#31

Earlier quoted context omitted.

From that page, "use ++g instead of g++ (it’s faster)" I've seen people say this a repeatedly when talking about "embedded" environments, but never understood why - won't it end up compiling to the same thing either way?

I'd argue you regardless you should write what you mean If you mean "increment g" then write "++g" If you mean "temp = g; increment g; return g" then write "g++" It doesn't really matter that the compiler may optimize out the "temp". If you're writing "g++" you're indicating you want the value before it's been incremented.

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;

Re: How to program an NES game in C

#32

Earlier quoted context omitted.

I'd argue you regardless you should write what you mean If you mean "increment g" then write "++g" If you mean "temp = g; increment g; return g" then write "g++" It doesn't really matter that the compiler may optimize out the "temp". If you're writing "g++" you're indicating you want the value before it's been incremented.

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.

Re: How to program an NES game in C

#34

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.

First of all, I don't agree that code like that is stupid regardless of circumstances. Any programmer worth his salt understands that condition perfectly well without having to think about it.

However, it's an altogether different situation to the one I wrote about, given that the value of the incrementing expression is specifically used in that case.

Re: How to program an NES game in C

#37
post #29

How 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?

As I recall, Nintendo (eventually) had an official NES devkit which had a special ram cartridge and was linked to a pc running ms dos with an assembler and other programs to make graphics and sound, but there were NES devkits from third parties as well.

Re: How to program an NES game in C

#38
post #29

How 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?

Here's a neat video, where Miyamoto describes some of the processes. You can see near the beginning that the sprites were hand drawn on graph paper and translated onto the computer. https://www.youtube.com/watch?v=DLoRd6_a1CI

Re: How to program an NES game in C

#39
post #29

How 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

#40
post #38
post #29

How 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?

Here's a neat video, where Miyamoto describes some of the processes. You can see near the beginning that the sprites were hand drawn on graph paper and translated onto the computer. https://www.youtube.com/watch?v=DLoRd6_a1CI

Alllllll that tooling had to be built in-house. Sprite editors, level editors, debug and test tools. Doing it well requires multiple people working across multiple games.

I guess smaller studios were left having to roll their own stuff, which set them at an even further disadvantage to the Capcoms and Konamis of the world.

IIRC an NES dev kit was mostly just the hardware and a manual, not even an assembler

Post reply on HN