-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|645|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
spinal
Created : 22 February 2010
 

Learning ASM...



OK, As I could find almost no information about coding C for the SNES, I'm going to have to learn ASM.

65816 ASM to be exact, but I'm going to start with the basics as I have never even considered learning this stuff before.

I'm going to post my findings here so that anyone knowing ASM already can correct me or expand on my learnings.

The first site I found that offers to teach me ASM basics (for the 65816) is https://acmlm.kafuka.org/board/thread.php?id=99.
Now having read the first part of the post, I think I have a rough understanding of the LDA, STA and RTS opcodes.

Here is what I think I know, correct me if I'm wrong...

LDA - Loads the Accumulator with a value, which is either a number or a memory address. the Accumulator as I understand it, seems to be a variable, perhaps the ONLY variable I can truly use?

STA - Stores the Accumulator to a memory address. Sounds simple enough, it suggests that if I want to store a number, I must first put it in the accumulator then copy it to an address.

RTS - basically this seems to be the RETURN command in various languages. The page hints that I would get to my subroutine using the JSR opcode, which I havent read about yet.

So a subroutine to copy a number to a memory location would look something like...



Does that look right so far?

 

Comments


Monday, 22 February 2010, 15:14
Phoenix
The accumulator is a processor register. A register is the form of memory closest to the CPU, hence also the fastest. Arithmetic/logical operations are carried out in that register.

I haven't done any 65816 assembly, but you seem to have gotten it right.
Thursday, 25 February 2010, 12:41
spinal
Someone is going to have to explain the X,Y registers to me, I just don't understand what they do.
Saturday, 27 February 2010, 23:15
Sticky
I just got Sublime Text today and I'm trying to write a syntax highlighter for Flat Assembler in that. Once I've got it highlighting nicely and everything, I'll be trying to learn assembly too. I think Flat Assembler is arguably easier than what you'll be learning, though.
Monday, 08 March 2010, 09:10
spinal
YES! Tiles on the screen!!!!!



I'm not 100% sure how the tile map knows where the actual tiles are yet, but I got them on the screen at least!
Monday, 08 March 2010, 09:43
Jayenkai
woot!
Well done!!