getting started on SNES

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Nicole
Posts: 218
Joined: Sun Mar 27, 2016 7:56 pm

Re: getting started on SNES

Post by Nicole » Fri Mar 03, 2017 9:09 am

zkip wrote:Actually, I'm pretty sure that this is the exact purpose of having this bit there anyway as I see no other reason for it.
It's necessary for moving sprites partially off the left side of the screen.
Last edited by Nicole on Fri Mar 03, 2017 4:12 pm, edited 1 time in total.

Revenant
Posts: 442
Joined: Sat Apr 25, 2015 1:47 pm
Location: FL

Re: getting started on SNES

Post by Revenant » Fri Mar 03, 2017 9:43 am

I believe you can also set the Y coordinate to 240 if you don't want to have to touch the high table, as long as your sprites aren't larger than 16x16 (otherwise they'll wrap around and be partially visible at the top of the screen).

psycopathicteen
Posts: 2980
Joined: Wed May 19, 2010 6:12 pm

Re: getting started on SNES

Post by psycopathicteen » Fri Mar 03, 2017 10:02 am

You can't smoothly scroll sprites in from the left side of the screen, with the sprite partially onscreen, without the hioam.

As for dealing with hioam, I always just stored the full x-coordinates and size bits on a separate table, and then afterwards, jump to a routine that builds the hioam all at once.

psycopathicteen
Posts: 2980
Joined: Wed May 19, 2010 6:12 pm

Re: getting started on SNES

Post by psycopathicteen » Sat Mar 04, 2017 5:04 pm

zkip wrote:
pushing unused sprites offscreen
You can use the 9th bit for the X location (located in the second OAM table) of the sprite to move it off-screen. Actually, I'm pretty sure that this is the exact purpose of having this bit there anyway as I see no other reason for it.
Sometimes I just get a bit disillusioned with how SNES homebrew never seems to be able to get out of the ghetto...
I agree. There's some sort of jump-start that NESDEV got that SNES didn't.
One day I am going to make a tutorial on how to make a giant screen filling robot with rotating limbs and body, once I actually make a demo of one. If that doesn't make people want to do SNES homebrew then I don't know what will. The nice thing about rotating sprites is that if you run out of CPU speed and RAM, you can pre-render everything else in ROM.

User avatar
dougeff
Posts: 2825
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: getting started on SNES

Post by dougeff » Sun Mar 05, 2017 7:50 pm

Revenant wrote:I believe you can also set the Y coordinate to 240 if you don't want to have to touch the high table, as long as your sprites aren't larger than 16x16 (otherwise they'll wrap around and be partially visible at the top of the screen).
Thanks. I think this would be the easiest method.
nesdoug.com -- blog/tutorial on programming for the NES

User avatar
Zebbo
Posts: 2
Joined: Tue Dec 29, 2020 6:07 am

Re: getting started on SNES

Post by Zebbo » Tue Dec 29, 2020 6:38 am

Hello forum, another SNES dev beginner here.

I bump this thread up as I wish to get some advice on how to, well, get started.

I am a ex-web dev and I have had many years this idea of learning how to code for SNES. I made attempt couple of years ago, by following some German code repo, but the learning curve was a bit steep. Now I am in the midst of my second try. I successfully followed the SNES Assembly Adventure. I quite liked the tutorial, but unfortunately it does not go very far.

Based on what I understood by the tutorial and the fantastic YouTube series of Retro Game Mechanics , I proceeded to follow Bazz's well-known tutorial, but hit a wall. As the first tutorial uses cc65 and Bazz uses WLA-DX, there was confusion with syntax. This combined to the fact that I wasn't able to figure out what is going on at all times seems puts a bit of hurdles in front of my learning goals. I was googling different assemblers and found the conversation about cc65 on this forum.

My first question is: how should I setup my development environment as a beginner? Does the SNES dev community have consensus about this? Right now I have been using cc65. As I work on macOS, I run bsnes-plus and Tilemap Studio on VirtualBox.

Another barrier is that, as each of the tutorials state, the information is scattered. Many of the tutorials and sample codes use different styles and practices. This is, of course, fine as that's how it seems to be with many other dev communities as well. However, I would like to hear if anyone has clear opinions on what is the easiest entry point to SNES development and on top of what it is best to build the forthcoming knowledge.

Lastly, coming from frontend web development world, the whole ASM seems like a... complex and mystical place! It seems to take quite a while to understand the whole essence of it. So, if you have clear, dummy friendly perspectives on what it is about in simple terms, I would be happy to hear. Right now, to me it seems that essentially it is all about moving data between registers in right order - which is a quite different mindset compared to eg. functional programming I am used to do in JavaScript world.

Thank you in advance for your help and comments!

secondsun
Posts: 31
Joined: Tue Jul 31, 2018 9:37 am

Re: getting started on SNES

Post by secondsun » Tue Dec 29, 2020 7:44 am

libSFX (https://github.com/Optiroc/libSFX) has several example projects which may help with getting your source layout started.

redllama7
Posts: 3
Joined: Sun Dec 27, 2020 2:59 am

Re: getting started on SNES

Post by redllama7 » Tue Dec 29, 2020 8:30 am

Hi,

You can try Wiz https://github.com/wiz-lang/wiz. It is what I have been using lately and I am quite happy with it.

User avatar
Nikku4211
Posts: 383
Joined: Sun Dec 15, 2019 1:28 pm
Location: Bronx, New York
Contact:

Re: getting started on SNES

Post by Nikku4211 » Tue Dec 29, 2020 8:52 am

secondsun wrote:
Tue Dec 29, 2020 7:44 am
libSFX (https://github.com/Optiroc/libSFX) has several example projects which may help with getting your source layout started.
Aww man, I was about to come into this thread and post about LibSFX!

Hey sir, do you have a minute to speak about our lord and saviour LibSFX?
I have an ASD, so empathy is not natural for me. If I hurt you, I apologise.

User avatar
dougeff
Posts: 2825
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: getting started on SNES

Post by dougeff » Tue Dec 29, 2020 1:16 pm

nesdoug.com -- blog/tutorial on programming for the NES

creaothceann
Posts: 280
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: getting started on SNES

Post by creaothceann » Tue Dec 29, 2020 5:46 pm

Zebbo wrote:
Tue Dec 29, 2020 6:38 am
Lastly, coming from frontend web development world, the whole ASM seems like a... complex and mystical place! It seems to take quite a while to understand the whole essence of it. So, if you have clear, dummy friendly perspectives on what it is about in simple terms, I would be happy to hear. Right now, to me it seems that essentially it is all about moving data between registers in right order - which is a quite different mindset compared to eg. functional programming I am used to do in JavaScript world.
The 6502 talk
Matt Godbolt - Emulating a 6502 system in JavaScript
Ben Eater - Build a 65c02-based computer from scratch
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10

Pokun
Posts: 1760
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: getting started on SNES

Post by Pokun » Tue Dec 29, 2020 7:22 pm

Zebbo wrote:
Tue Dec 29, 2020 6:38 am
My first question is: how should I setup my development environment as a beginner? Does the SNES dev community have consensus about this? Right now I have been using cc65. As I work on macOS, I run bsnes-plus and Tilemap Studio on VirtualBox.
Doug (who posted above) has a tutorial that seems very good and touches this subject, using ca65 to boot. I haven't really followed it though and I can't say how beginner friendly it is as I'm no longer that much of a beginner to assembly.
If you want you can also look at my own recent attempt in learning SNES development.
My own development environment currently mainly consists of 64tass as the assembler, Notepad++ as the editor, Gimp for creating art (after looking at a tutorial on how to set it up for pixel art with an 8x8 dot grid and no antialiasing), Optiroc's superfamiconv for converting the art to the 2bpp and 4bpp SNES formats, Optiroc's superfamicheck for fixing the checksum after assembly (not strictly necessary) and a shell script to glue the tool chain together and build the ROM. I prefer my development environment to not be too complicated (I'm a hobby programmer and still quite a novice).
I haven't started with sound yet (except initializing the APU and playing a square wave tone), but I plan to use ca65 with the SPC700 macro set as assembler and there is Bregalad's brrtools for converting sound samples to BRR sample sources that the APU takes.

Anyway, I'd recommend ca65 or 64tass for SNES assembly (the latter being a bit better for 65816 as ca65 has trouble with moving the direct page), but not WLA-DX as it's a bit buggy when it comes to 65816 and very buggy when it comes to SPC700.

Zebbo wrote:
Tue Dec 29, 2020 6:38 am
Another barrier is that, as each of the tutorials state, the information is scattered. Many of the tutorials and sample codes use different styles and practices. This is, of course, fine as that's how it seems to be with many other dev communities as well. However, I would like to hear if anyone has clear opinions on what is the easiest entry point to SNES development and on top of what it is best to build the forthcoming knowledge.
Assembly conventions are far less strict than they tend to be on higher level languages, which is both good and bad. It might take a while until you find a style that suits you, and before you stop getting annoyed by the fact that other people have different styles (I sure still haven't).
And yeah, SNES development is really scattered. The among best sources you have is Nocash' fullsnes, Anomie's documents and the superfamicon.org wiki. The video series you mentioned are also gold.

Zebbo wrote:
Tue Dec 29, 2020 6:38 am
Lastly, coming from frontend web development world, the whole ASM seems like a... complex and mystical place! It seems to take quite a while to understand the whole essence of it. So, if you have clear, dummy friendly perspectives on what it is about in simple terms, I would be happy to hear. Right now, to me it seems that essentially it is all about moving data between registers in right order - which is a quite different mindset compared to eg. functional programming I am used to do in JavaScript world.
I'll give it a try:
Moving data between registers in right order, that describes what microprocessors do pretty well. Though they also do math and control flow a lot. In assembly everything is exactly what it says it is. There are no abstract things. You use the instructions the microprocessor is designed with to control it however you want. You write a value to a register and that's it from the point of the CPU. If that register is connected to the screen drawing hardware (called PPU on the SNES) then that data will affect the screen accordingly. The CPU just writes a value on its address and data pins, which are then routed to the PPU using other hardware. The PPU just does what it's designed to do automatically. As the programmer you only control the CPU directly (though you send indirect commands to the PPU via various registers). Now let's say that register was an entry in the CGRAM (palette memory) and the value you wrote changes the color of a palette entry and all pixels on the screen using it. You could also do some math on the value first to change the color in a certain way (like subtract from it to make it darker, assuming a lower value means darker color). And wrapping this math in a loop (which is done manually of course using branch instructions) and you might have a fade-out effect as the value is subtracted and then written each loop. So yeah the CPU really mostly just does control flow (the loop), math (subtracting the color value) and reading or writing to registers (writing the palette entry).

Assembly isn't hard because it's complex. It's hard because it's so darn simple, and about everything has to be done manually. It also requires you to know how the hardware works to a certain degree.

I think understanding the terminology is very important for understanding a subject. If you encounter words you don't understand on your journey make sure to look them up as much as possible.

User avatar
Zebbo
Posts: 2
Joined: Tue Dec 29, 2020 6:07 am

Re: getting started on SNES

Post by Zebbo » Wed Dec 30, 2020 5:24 am

First, thank you all for the great input! I am really happy to see the community being very helpful!

@secondsun & @Nikku4211, libFSX looks great to me. I think I will first try to understand a bit better the fundamentals before diving into the framework, as I am a bit concerned that if I would use too large of a framework I would get lost in it when I face issues.
Nikku4211 wrote:
Tue Dec 29, 2020 8:52 am
Hey sir, do you have a minute to speak about our lord and saviour LibSFX?
By all means, I would be really glad to hear more and specifically why you think this framework is great!

@redllama7 I didn't have time to delve into Wiz yet, but will definitely take a better look later! :)

@dougeff thank you, will definitely go through all of these resources one by one. I also found your tutorials (the same @Pokun mentions) and git earlier. To me, it looks like your examples are really clear, so I think my next step will be that I read your articles and fiddle with the code. Is it okay for you if I might PM you if I don't get something?

@creaothceann that seems like a good video to watch on my next lunch break. Also, I am always interested in the JS angle!

@Pokun thank you very much for the resources and taking the time to elaborate your views. I surely will go through the thread you posted.
Pokun wrote:
Tue Dec 29, 2020 7:22 pm
It might take a while until you find a style that suits you, and before you stop getting annoyed by the fact that other people have different styles (I sure still haven't).
Well, surely minor frustration is there, but it would not be programming otherwise :D. I might slide a bit off topic here, but I think it is quite normal to have different styles - although I support the idea of following common and best practices, in a way programming is also a form of self-expression. People arrange and comprehend things differently in their minds, so surely it reflects into code as well.

Instead of style I suppose more frustration is caused when trying to follow code and everything seems so delicate. If I don't understand one line and it is not commented, there is a big chance I do not understand why something is happening there. Of course, then I have no way to assess the importance of the line or why it is there. That said, I want to be clear that I am no expecting people making tutorials to comment everything.
Pokun wrote:
Tue Dec 29, 2020 7:22 pm

Moving data between registers in right order, that describes what microprocessors do pretty well. Though they also do math and control flow a lot. In assembly everything is exactly what it says it is. There are no abstract things. You use the instructions the microprocessor is designed with to control it however you want. You write a value to a register and that's it from the point of the CPU. [...]

Assembly isn't hard because it's complex. It's hard because it's so darn simple, and about everything has to be done manually. It also requires you to know how the hardware works to a certain degree.

I think understanding the terminology is very important for understanding a subject. If you encounter words you don't understand on your journey make sure to look them up as much as possible.
Thank you very much for this description and the tips. I understand it might seem weird for more experienced programmers why I ask to summarize this, as I expect it to be obvious for them. For me personally, it helps to steer my thinking and perspective when attempting to grasp complex subjects. So, these last three paragraphs are really golden to me.

I think next I will go through the tutorials provided one by one. I might also revoke the SNES beginner questions thread for asking more specific, technical questions, unless there is more appropriate place in the forum for them.

User avatar
dougeff
Posts: 2825
Joined: Fri May 08, 2015 7:17 pm
Location: DIGDUG
Contact:

Re: getting started on SNES

Post by dougeff » Wed Dec 30, 2020 10:03 am

I recommend you start a new thread, and ask questions there, rather than posting on old threads.
nesdoug.com -- blog/tutorial on programming for the NES

93143
Posts: 1314
Joined: Fri Jul 04, 2014 9:31 pm

Re: getting started on SNES

Post by 93143 » Wed Dec 30, 2020 11:25 am

Zebbo wrote:
Wed Dec 30, 2020 5:24 am
If I don't understand one line and it is not commented, there is a big chance I do not understand why something is happening there. Of course, then I have no way to assess the importance of the line or why it is there.
A well-known SNES romhacker and emulator developer once remarked that 65c816 assembly is a "write-only language".

In my opinion he was exaggerating (he's got a hyperbolic style when annoyed), but the point remains: comment your code thoroughly, making clear to future you not just what the instructions are doing but why. Use well-named macros and subroutines where appropriate. Code rot has taken down SNES projects before.

Post Reply