Jump to content

  • Log In with Google      Sign In   
  • Create Account

14 years ago on June 15th Gamedev.net was first launched! We want to thank all of you for being part of our community and hope the best years are ahead of us. Happy birthday Gamedev.net!

What were SNES games programmed in?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
23 replies to this topic

#1 GnuVince   Members   -  Reputation: 259

Like
0Likes
Like

Posted 05 September 2005 - 02:31 PM

Hello everyone, I was reading on the SNES today (article on Digg) and it mentionned that the CPU was 3.52 MHz and there were 128 kb of RAM. Considering those very small technical specs, I naturally began wondering about programming games for that platform. What were they written in? The various documents I was able to find seem to suggest that most games were written directly in Assembly. Is that correct? Or were they mostly programmed in C, Basic or a SNES-specific higher-level language (higher meaning higher than assembly). I would think that a language such as Forth would have been a better choice as it's higher level than assembly while still being very efficient speed-wise and even more so memory-wise. Forth also has other advantages such as being interactive, allowing inline assembly code and allowing advanced programming methods. Thanks for the input guys, Vincent.

Sponsor:

#2 Mercury   Members   -  Reputation: 776

Like
0Likes
Like

Posted 05 September 2005 - 02:33 PM

I'd imagine they would be coded in a split between C and Assembly.

#3 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 05 September 2005 - 02:43 PM

3.52 MHz and 128kb RAM? That's...incredible! I can't really believe you could run something like Secret of Mana/FFs on that...guess I'm jaded from this age of 2GHz+ processors.

#4 GnuVince   Members   -  Reputation: 259

Like
0Likes
Like

Posted 05 September 2005 - 02:52 PM

Quote:
Original post by Anonymous Poster
3.52 MHz and 128kb RAM? That's...incredible! I can't really believe you could run something like Secret of Mana/FFs on that...guess I'm jaded from this age of 2GHz+ processors.


That's why I'm asking, I'm a Ruby programmer mostly, and this machine couldn't even run the simplest Ruby "hello world" program :) Kudos to the guys who knew how to program back then.

#5 outRider   Members   -  Reputation: 851

Like
0Likes
Like

Posted 05 September 2005 - 04:29 PM

They were written in 65C816 assembly. I don't know if there were any C compilers for that CPU, but if they did exist they most likely weren't good enough. And yes, while the SNES had 128KB of RAM, most of the code was executed directly from the cartridge ROM, not copied to RAM like you might be familiar with on a PC.

I don't know anything about Forth, but from skimming Wikipedia it seems to be you'd end up with something that resembles a macro assembler. Anyway, I doubt anyone at Nintendo was concerned with such things in 1990.

#6 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 05 September 2005 - 08:29 PM

Yup, snes games were coded in pure assembly.

The reason why snes could still do so nice graphics, despite the weak cpu, is the sweet 2D graphics chip allowing for a lot of cool effects with clever coding.

#7 GnuVince   Members   -  Reputation: 259

Like
0Likes
Like

Posted 05 September 2005 - 11:12 PM

Quote:
Original post by Anonymous Poster
Yup, snes games were coded in pure assembly.

The reason why snes could still do so nice graphics, despite the weak cpu, is the sweet 2D graphics chip allowing for a lot of cool effects with clever coding.


Thank you. Well, I have to raise my hat to the people who wrote all those cool games. I must have been hell to debug!

#8 benryves   GDNet+   -  Reputation: 1883

Like
0Likes
Like

Posted 05 September 2005 - 11:58 PM

Quote:
Original post by Anonymous Poster
The reason why snes could still do so nice graphics, despite the weak cpu, is the sweet 2D graphics chip allowing for a lot of cool effects with clever coding.
Don't forget the awesome mode 7...

I love oldschool programming - if you look in my journal, you can see I'm currently developing a game for the Sega Game Gear in Z80 assembly.

If you're looking to develop for the SNES, I'd highly reccomend digging out a good debugging emulator (so you can look at the sprite tables/all memory locations/whatever) and a decent assembler (WLA-DX is my weapon of choice).
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

#9 Ravuya   Moderators   -  Reputation: 124

Like
0Likes
Like

Posted 06 September 2005 - 05:40 AM

I believe some American games were done in C, but I would bet that the vast majority were assembly.

#10 Ravyne   Members   -  Reputation: 2908

Like
0Likes
Like

Posted 06 September 2005 - 03:47 PM

C was probably a possibility, though I don't know for sure. I've done some limited Gameboy (original) homebrew using a C compiler and its specs are even more limited than the SNES... I also know that the same company that produced the SNES CPU offers a C compiler for it as well.

Also, while we tend to think of things like ASM as being instruction-level languages, theres no reason that an assembler can't impliment some higher-level constructs such as functions and loops. These systems are called high-level assemblers(also: Macro Assemblers.)

Probably most SNES games were done much as PC games were when limited capabilities were more of an issue than it is today. That is: speed critical elements were surely ASM, while some of the less critical code was written in an easier-to-maintain language such as C or high-level assembly.

If you'd like to see an excelent example of a high-level assembler, check out bripro.com, a custom HLA development tool by the creator of Grand Theftendo and other neat technical stuff.

#11 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 06 September 2005 - 04:32 PM

There's some info and tutorials in the Super NES Programming wikibook.

#12 Will F   Members   -  Reputation: 1069

Like
0Likes
Like

Posted 06 September 2005 - 04:35 PM

hmm... the above was me, I somehow got logged out

Here's the link to the SNES wikibook.

#13 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 06 September 2005 - 05:28 PM

Quote:
Original post by Anonymous Poster
Yup, snes games were coded in pure assembly.

The reason why snes could still do so nice graphics, despite the weak cpu, is the sweet 2D graphics chip allowing for a lot of cool effects with clever coding.

True dat. Then, of course, there were those enhanced cartridges which granted some games even greater graphics capabilities, such as true 3D.



#14 GnuVince   Members   -  Reputation: 259

Like
0Likes
Like

Posted 06 September 2005 - 11:21 PM

Quote:
Original post by Ravyne
Also, while we tend to think of things like ASM as being instruction-level languages, theres no reason that an assembler can't impliment some higher-level constructs such as functions and loops. These systems are called high-level assemblers(also: Macro Assemblers.)


Yeah, you can probably implement those in Assembler, but the logic of the game remains hidden behind all these MOV, ADD, JMP, etc. With a language that's higher level, like C or Forth already mentionned, you can talk about the elements of the games (NPC's, items, enemies, etc.) with words that make sense. That's why I'm so impressed that among all these instructions, the programmers were able to keep track of the game.

#15 benryves   GDNet+   -  Reputation: 1883

Like
0Likes
Like

Posted 06 September 2005 - 11:29 PM

I don't see how
move_and_draw_player(3,43);

function move_and_draw_player(dx, dy) {
player_x += player_dx;
player_y += player_dy;
draw_player_sprite(player_x, player_y);
}
is really any different in terms of "remembering" as

ld b,3
ld c,43
call move_and_draw_player

move_and_draw_player:
ld a,(player_x)
add a,b
ld (player_x),a
ld b,a
ld a,(player_y)
add a,c
ld (player_y),a
call draw_player_sprite ; Assumes routine takes b,a as args
ret
Just because it's assembly doesn't mean you can't use sensible variable names and routine names! Structured code in ASM is entirely possible, and if anything more important than in other languages where you need to be able to keep track easily.
Unless you mean an object-orientated system, which is easy enough to implement through arrays and such.
[Website] [+++ Divide By Cucumber Error. Please Reinstall Universe And Reboot +++]

#16 nerd_boy   Members   -  Reputation: 671

Like
0Likes
Like

Posted 07 September 2005 - 05:23 AM

And there is always plentiful commenting to keep confusion at bay...

#17 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

0Likes

Posted 07 September 2005 - 05:31 AM

A fair few well built Macros helped me in my Snes coding days, arr fun days, dug out my source code to Street Racer to remind myself what it was like. Mode 7 was very cool indeed :)

#18 Zahlman   Moderators   -  Reputation: 1666

Like
0Likes
Like

Posted 12 September 2005 - 09:21 AM

I'm pretty sure that spec is for the original Nintendo. Genesis had a combination of a Z-80 and a 68000. A CPU speed of 3.52 MHz suggests likely an Intel 8088 or something along those lines, and the 68000 kicked the ass of that (and Genesis wasn't that much ahead of SNES AFAIK) - ran 7.83 MHz IIRC and was more bang for the buck - er, clock cycle - besides. (I should know, I grew up on the Macs running 68000s :) )

But anyway. :)

#19 doynax   Members   -  Reputation: 850

Like
0Likes
Like

Posted 12 September 2005 - 09:43 AM

Quote:
Original post by Zahlman
I'm pretty sure that spec is for the original Nintendo. Genesis had a combination of a Z-80 and a 68000. A CPU speed of 3.52 MHz suggests likely an Intel 8088 or something along those lines, and the 68000 kicked the ass of that (and Genesis wasn't that much ahead of SNES AFAIK) - ran 7.83 MHz IIRC and was more bang for the buck - er, clock cycle - besides. (I should know, I grew up on the Macs running 68000s :) )
Nope, it was 'only' a 3.52 MHz system, though some games with slow rom chips only ran at about 2 MHz instead. The original NES ran at about 1.78 MHz (I should know, I'm currently coding for it).
There's a big difference between the RISC-like 6502 (65816 in this case) and a 68000 though. Most 68000 took between 4-20 cycles to execute while the 6502 could handle them in about 2-7 instead.

#20 Ravyne   Members   -  Reputation: 2908

Like
0Likes
Like

Posted 12 September 2005 - 03:32 PM

Quote:
Original post by doynax
There's a big difference between the RISC-like 6502 (65816 in this case) and a 68000 though. Most 68000 took between 4-20 cycles to execute while the 6502 could handle them in about 2-7 instead.


I don't know if its accurate to call the 65816 'risc-like' If I remember correctly It supported memory modes not usually associated with a risc system, also it only had a couple general purpose regs. It only really seems to hold the risc ideal in that it basically executed 'simple' instructions quickly. The 68000, on the other hand, has 16 registers and IIRC, was closer to the classic risc load-store ideal. On the other hand, as you stated, cycle times were quite long for a risc system.

In the end its probably a wash as to which system is more or less RISC. Suffice it to say that they were probably equally powerful, give or take. What really set the SNES apart from the Genesis, was the GPU and sound quality of the SNES.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS