| The basics of ASM |
|
Forum Index - SMW Hacking - General SMW Hacking Help - Tutorials - The basics of ASM |
|
|
|
|
| Posted on 2009-05-21 06:25:04 AM |
Link | Quote |
|
Originally posted by GoldyoshiEggJMP 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.
|
|
| Posted on 2009-05-21 06:29:57 AM |
Link | Quote |
|
Originally posted by AlcaroOriginally posted by GoldyoshiEggJMP 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 meJMP 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
|
| Last edited on 2009-05-21 06:30:14 AM by Superyoshi. |
|
| Posted on 2009-05-21 06:35:52 AM |
Link | Quote |
|
Originally posted by SuperyoshiJMP 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?
|
|
| Posted on 2009-05-21 06:37:37 AM |
Link | Quote |
|
|
i just want a block that makes mario a cape.also,wich one should i use?
|
|
| Posted on 2009-05-21 06:38:46 AM |
Link | Quote |
|
Gah T_T I write Return because I always do this in my blocks <-<
Originally posted by SuperyoshiJMP 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.
|
|
| Posted on 2009-05-21 06:39:10 AM |
Link | Quote |
|
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
|
|
| Posted on 2009-05-21 06:44:54 AM |
Link | Quote |
|
thanks to alcaro's code my game freezes T_T
EDIT:the same happens with SY's when on impact with it...
|
| Last edited on 2009-05-21 06:46:44 AM by GhostlyYoshiEgg. |
|
| Posted on 2009-05-21 06:47:05 AM |
Link | Quote |
|
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
|
|
| Posted on 2009-05-21 06:48:37 AM |
Link | Quote |
|
|
nope,still the same...
|
|
| Posted on 2009-05-22 01:34:18 AM |
Link | Quote |
|
|
Are you sure you're inserting the block properly? Those codes look fine to me..
|
|
| Posted on 2009-05-22 02:02:53 AM |
Link | Quote |
|
|
i do insert the blocks properly,but i got some different ones that boing made.and thanks for the help you all!
|
| Last edited on 2009-05-22 02:03:29 AM by GhostlyYoshiEgg. |
|
| Posted on 2009-05-22 06:32:49 AM |
Link | Quote |
|
|
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.
|
|
| Posted on 2009-11-16 08:24:55 PM |
Link | Quote |
|
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.
|
| Last edited on 2009-11-16 08:25:46 PM by NameUser. |
|
| Posted on 2009-11-16 08:35:23 PM |
Link | Quote |
|
Originally posted by SomeGuyOriginally 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
to decrease the value instead.
Third,
Originally posted by ErsanioI would like to mention this is a tutorial thread, not a help thread. Keep the questions in the other help sticky.
|
|
| Posted on 2009-11-17 07:33:37 AM |
Link | Quote |
|
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.
|
|
| Posted on 2009-12-13 01:49:26 PM |
Link | Quote |
|
THANKSS !
Finally i can learn this
|
|
| Posted on 2010-01-02 09:13:11 AM |
Link | Quote |
|
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:
CodeJMP 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.
|
| Last edited on 2010-01-02 10:54:07 AM by noobsmwhacker. |
|
| Posted on 2010-02-08 12:03:06 AM |
Link | Quote |
|
|
I was just wondering, what is the opcode NOP?
|
|
| Posted on 2010-02-08 12:12:52 AM |
Link | Quote |
|
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 codeLDA #$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.
|
|
| Posted on 2010-03-06 09:30:42 AM |
Link | Quote |
|
|
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?
|
|
|
|
|
|
|
Forum Index - SMW Hacking - General SMW Hacking Help - Tutorials - The basics of ASM |