Author Topic: Learn SNES Programming?  (Read 8804 times)

0 Members and 1 Guest are viewing this topic.

Offline stuntpenguin007

  • Newbie
  • *
  • Posts: 8
Learn SNES Programming?
« on: April 06, 2011, 04:42:28 AM »
Is SNES programming usually done with assembly?  All the resources I can find online for SNES programming are for assembly.  Are there any good tutorials for SNES programming in C?

Thanks.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: Learn SNES Programming?
« Reply #1 on: April 06, 2011, 04:55:27 AM »
Quote
Is SNES programming usually done with assembly?
Yes.

Quote
Are there any good tutorials for SNES programming in C?
Tutorials? No. But you can get a C compiler here: http://www.neoflash.com/forum/index.php/topic,6108.0.html
That's the compiler I use for the SNES Myth menu code.



Offline stuntpenguin007

  • Newbie
  • *
  • Posts: 8
Re: Learn SNES Programming?
« Reply #2 on: April 06, 2011, 11:01:23 AM »
Maybe I shouldn't be trying to jump right into snes development because I have all of these questions, but now do I have to set up the tools in my compiler?  How exactly do you learn to use these libraries?  The code in sdk is called a library right?  Is there any source code floating around that I can look at and try to compile?

Thanks.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: Learn SNES Programming?
« Reply #3 on: April 06, 2011, 01:19:27 PM »
Yeah, if you're not comfortable with using a C compiler, then trying to use a C compiler for SNES development probably won't help ;)

I'd suggest doing some C programming for Windows / Linux or something like the GBA first. Then read up on the SNES and try to get a grasp of how it works.

Offline dieudunet1977

  • Newbie
  • *
  • Posts: 4
  • NEO newbie
Re: Learn SNES Programming?
« Reply #4 on: April 06, 2011, 04:56:33 PM »
But a C Compiler on Snes isn't too slow ?

I use ASM & WLA-DX, this is hard but not impossible to understand (and very interesting to learn ).

And the very cool things is that all Nintendo Hardware use the same technical 2D architecture. So if you learn how to ASM the SNES (with VRAM,BG memory, OAM) you can easily work after on all 2D Nintendo hardware.

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: Learn SNES Programming?
« Reply #5 on: April 06, 2011, 05:13:52 PM »
Quote
But a C Compiler on Snes isn't too slow ?

Depends on the game. For a high-speed scrolling action game with lots of moving sprite and complex enemy logic you'll probably have to write a lot of it in assembly. For simpler games it's entirely possible to use C, though you might still want to write critical stuff (like the NMI handler) in assembly.

The menu for the SNES Myth is written in approx 50% C and 50% assembly.

Offline YoshiInAVoid

  • Newbie
  • *
  • Posts: 44
  • NEO newbie
Re: Learn SNES Programming?
« Reply #6 on: December 29, 2011, 08:51:48 PM »
I know this is old. But out of curriosity how do you mix assembly into a C compiler? Do you somehow compile the ASM code with WLA DX and then include it in your C files like this: #include "CompiledASMCode.bin" or is there some kind of other method? I thought you had to have either C or ASM for making SNES games?

Offline mic_

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 632
Re: Learn SNES Programming?
« Reply #7 on: December 29, 2011, 09:33:24 PM »
You compile all the files separately and then link all the object files together, something like this:

Code: [Select]
..\bin\816-tcc.exe -Wall -I../include -o main.ps -c main.c
..\bin\816-opt.py main.ps > main.s
..\bin\wla-65816.exe -io main.s main.obj

..\bin\wla-65816.exe -io handwritten_assembly.asm handwritten_assembly.obj

..\bin\wlalink.exe -dvso main.obj handwritten_assembly.obj BESTGAMEEVER.SMC


Offline YoshiInAVoid

  • Newbie
  • *
  • Posts: 44
  • NEO newbie
Re: Learn SNES Programming?
« Reply #8 on: December 29, 2011, 11:09:33 PM »
Thanks!