Language…
19 users online: bradcomp, cletus_deletus, DanMario24YT, Domokun007, Green Jerry, GRIMMKIN, hhuxy, JezJitzu, lo fang 123, Nayfal, Nemesis1407, playagmes169, prisvag, Shomi,  shovda, sinseiga, SMW Magic, TheXander, Torchkas - Guests: 274 - Bots: 378
Users: 64,795 (2,374 active)
Latest user: mathew

Schwa's ASM tutorial

Originally posted by GoldyoshiEgg
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL

Here's the fixed code. Insert it as an asm file.
<blm> zsnes users are the flatearthers of emulation
Originally posted by Alcaro
Originally posted by GoldyoshiEgg
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL

Here's the fixed code. Insert it as an asm file.


Nope. he also wanted to compare it. Then it's
Originally posted by Alcaro and me
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA $19
CMP #$02
BEQ Return
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL

Your layout has been removed.
Originally posted by Superyoshi
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA $19
CMP #$02
BEQ Return
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL

One: Where's the Return: label?
Two: Do you know how useless that is? $19 will be #$02 when the code is ran anyways. Or maybe he wants to waste some cycles and time... who knows what he wants?
<blm> zsnes users are the flatearthers of emulation
i just want a block that makes mario a cape.also,wich one should i use?
Gah T_T I write Return because I always do this in my blocks <-<
Originally posted by Superyoshi
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA $19
CMP #$02
BEQ MarioFireBall
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL


Also, it would end if the PUp is cape. If it's not cape, it capyfies.
Your layout has been removed.
Better yet, use Alcaro's code.

JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
MarioBelow: MarioAbove: MarioSide:
LDA #$02
STA $19
SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL


 
thanks to alcaro's code my game freezes T_T

EDIT:the same happens with SY's when on impact with it...
Try this then:

JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall

MarioBelow:
MarioAbove:
MarioSide:
LDA #$02
STA $19
SpriteV:
SpriteH:
MarioCape:
MarioFireBall:
RTL


 
nope,still the same...
Are you sure you're inserting the block properly? Those codes look fine to me..
i do insert the blocks properly,but i got some different ones that boing made.and thanks for the help you all!
I would like to mention this is a tutorial thread, not a help thread. Keep the questions in the other help sticky. I also can't see the point to keep this thread unlocked, so I am just going to lock it.
My blog. I could post stuff now and then

My Assembly for the SNES tutorial (it's actually finished now!)
Originally posted by 12cf23

LDA $7E (First we load Mario's screen x position into "A").
CLC (This goes by itself, and ADC always comes right after.)
ADC #$40 (What this command does is add a value to "A". So if the value (in this case Mario's screen x-position) is, say, 24, now it's 64.)
STA $7E (Now that we've taken the X position and added 40 to it, let's store the new value back into the Ram, essentially moving Mario to the right 40 pixels.)
RTS (Finish the code.)



How do I decrease a value instead?

Tag (div) was not closed.
Tag (div) was not closed.
Originally posted by SomeGuy
Originally posted by 12cf23

LDA $7E (First we load Mario's screen x position into "A").
CLC (This goes by itself, and ADC always comes right after.)
ADC #$40 (What this command does is add a value to "A". So if the value (in this case Mario's screen x-position) is, say, 24, now it's 64.)
STA $7E (Now that we've taken the X position and added 40 to it, let's store the new value back into the Ram, essentially moving Mario to the right 40 pixels.)
RTS (Finish the code.)



How do I decrease a value instead?

First, close your quote tags correctly.

Second, in order to decrease a value, use

Code
SEC
SBC #$40

to decrease the value instead.

Third,

Originally posted by Ersanio
I would like to mention this is a tutorial thread, not a help thread. Keep the questions in the other help sticky.
If you want to decrease by 1 i.e.

SEC
SBC #$01

You can do DEC instead. DEC $xx and DEC $xxxx work. You can also do DEC $xxxx,X as well.

Also, I don't see what's so wrong with asking questions here. If you don't understand something in a tutorial or find something vague, it's not wrong to ask a question in this thread. Besides, many questions have been asked in this thread and sometimes people are ignored in the help thread.
THANKSS !

Finally i can learn this
I'm trying to make a block that launches Mario to the right, speed depenting on his current power-up. When i test it, it doesn't launch Mario anywhere; it instead changes how fast Mario walks while he's on the block. Here's my code:

Code
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall

MarioAbove:
LDY $19
LDA Speed,y
STA $7B
LDA #$29  ;\
STA $1DF9 ;/Sound effect (Bullet Bill bang)
MarioBelow: MarioSide: SpriteV: SpriteH: MarioCape: MarioFireBall:
RTL
Speed:
dcb $15,$25,$50,$7F

(Made quickly, so i only commented the sound effect part)

Nevermind, fixed it myself.
I love myself.
I was just wondering, what is the opcode NOP?
NOP stands for No Operation. It does nothing. Zilch. Nodda. All it does is take up one (maybe more, not entirely sure...) CPU cycle. This is good for a couple of things.

A) When you hijack and address, you will generally overwrite a whole command, then just a part of the next command. For instance, if the code you hijack looks like this:
Originally posted by code
LDA #$03
STA $1234
That is 5 bytes. A JSL only takes up four bytes, so if you RTL right back to here, it will try to execute whatever opcode 12 corresponds to (Happens to be the ORA opcode) and will destroy your ROM. In order to fix this, instead of just JSLing, you should JSL, then write a NOP right after the JSL, getting rid of the byte 12.

B) I'm a little hazy on this, but I've heard that some things take a few cycles to do, for instance a particular randomized number routine. It sends the number to be randomized, but it takes a few cycles to return the number into the accumulator, so if you try to just store the value right away, you won't get the correct value, therefore you have to have the computer wait a few cycles by inserting a few NOP commands.
Ok, so this all made sense, up until the part about binary. Also, where's the part about loading graphics into a sprite? Is that a more advanced thing?