Language…
9 users online: Batata Douce, DanMario24YT, ForthRightMC, Isikoro, kurtistrydiz, mathew, MegacesarCG, monkey03297, TheOrangeToad - Guests: 292 - Bots: 370
Users: 64,795 (2,378 active)
Latest user: mathew

ASM

Hey guys, I want to start learning ASM, and the best way to do so would be to do it myself. Putting things in the request section takes a long time (sometimes with no reply) and probably won't be exactly how you want it. So I thought I'd start off with a simple(I think) block. If any of you can tell me exactly what part of the code does what. This way, I have some knowledge of how ASM works, and I won't just be staring at a bunch of numbers.

So, to the point, what would the code be for a block that you could have any setting of in map16, turn into the one after words, when the on off switch is pressed.

For example: say you made tile # 200 a note block, and tile # 201 a cement block. I Would need code, to make a block, that you can insert in tile #200, so that when the ON/OFF block is ON, it acts like whatever is set in tile 200 in map 16(graphics and all) and when it is off, it changes to tile 201 (graphics and all).

Any help will be apprieciated. Anyone who is a big help will be in my credits.
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

If you want the "act like" setting to change, then write low byte (00 in 200) to $1693 and high byte (2 in 200) to Y register. Since you want to use ON/OFF switch you can use ExAnimation instread of having the change graphics routine inside the block.
I've never actually used ASM before, so Everything needs to be explained.

From what I understand in you post, I can't have a block that changes to the next block in Map sixteen, and not just the "acts like" part. Oh well, it'll take longer to customize, but it'll still work.
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

No, you actually can do that, but it would just require some harder ASM (it can be found here). For the act likes it'd be like:
Code
;This will make block act like tile 130
LDA #$30    ;Load #$30 into A...
STA $1693   ;... and store it to $1693
LDY #$01    ;Load #$01 to Y register

If you want to check for ON/OFF flag use CMP and BEQ/BNE (read some good tutorial to figure out what this is).
First, do the On/Off ExAnimation and add this code in your block

LDA $14AF
BNE Off
LDA #$30 ;Load #$30 into A...
STA $1693 ;... and store it to $1693
LDY #$01 ;Load #$01 to Y register
RTS
Off:
RTS

Make it act like 25. This block will be solid if On/Off is On

LDA $14AF
BEQ On
LDA #$30 ;Load #$30 into A...
STA $1693 ;... and store it to $1693
LDY #$01 ;Load #$01 to Y register
RTS
On:
RTS


Make it act like 25. This block will be solid if On/Off is Off
Thanks, I'll try it out. Could you explian what the values ($FA 14)things are, I check the ROM map but I can't seem to find them. If I know this, I should be able to figure it out.
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

That's because you should look in the RAM map for it. It's ON/OFF switch flag which is $00 when on and $01 (or any higher value) when off.
if you're going to insert it like that in a ASM File, you must put the JMP Tables at the top.

db $42
;^ This is needed for the last 3 JMP's

JMP Mario : JMP Mario : JMP Mario : JMP Return : JMP Return : JMP Return : JMP Return
JMP Mario : JMP Mario : JMP Mario

Mario:
Return:
RTL


You would put the code under the "Mario:" label. and you have to replace the RTS's with a RTL
I change my layout every 4-5 months
Originally posted by undefinied3
First, do the On/Off ExAnimation and add this code in your block

LDA $14AF
BNE Off
LDA #$30 ;Load #$30 into A...
STA $1693 ;... and store it to $1693
LDY #$01 ;Load #$01 to Y register
RTS
Off:
RTS

Make it act like 25. This block will be solid if On/Off is On

LDA $14AF
BEQ On
LDA #$30 ;Load #$30 into A...
STA $1693 ;... and store it to $1693
LDY #$01 ;Load #$01 to Y register
RTS
On:
RTS


Make it act like 25. This block will be solid if On/Off is Off

I couldn't find #$30 or #01. Are they just amounts?
And I don't know what it eans in the RAM adress for $1693.
And ramp, could you show me the entire code please? And what does the code at the top do?

Thanks!
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

#$30/#$01 are the values it's loading into the Accumalator and storing it into $1693 which is the RAM Address.

Originally posted by HalfMaster1
And ramp, could you show me the entire code please? And what does the code at the top do?

Sure.

db $42

JMP Mario : JMP Mario : JMP Mario : JMP Return : JMP Return : JMP Return : JMP Return
JMP Mario : JMP Mario : JMP Mario

Mario:
LDA $14AF
BNE Return
LDA #$30
STA $1693
LDY #$01
Return:
RTL


(Change BNE Return to BEQ Return if you want it to be solid when the On/Off Switch is Off) The Code at the top basically Loads $14AF (On/Off Flag) and Compares whether or not it's 0. in this cause, it would Branch only of the value is not 0. (BNE means Branch Not Equal. BEQ means B EQual)

I would suggest reading some tutorials like this one which i read from and i know how to do alot of blocks. now i just need to get into making Custom Sprites (advanced ones that is)
I change my layout every 4-5 months
You said you don't know anything on ASM, right? So I suggest that you read these tutorials, they are pretty helpful and made by the best in the business.
Schwa's, probably the best, and a really really basic one by Maxx. Oh and here is the ASM workshop summary by Roy.
So, if I wanted to make a block that you could only go through when you were invincible, then I'd change $14AF to whatever the RAM adress.

By the way, what RAM adress would that be, I can't seem to find it?

Okay then. How would you have a block that, say get's smashed when hit with something, like a shell, or a fire ball.

@ ramp: Your tut won't open on my computer. I don't really know why.

@ Lynnes: Thanks for the links.
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

It'd be $1490 (star timer), 00 when no power, FF-01 (decreasing) when you have some.

Here is shatter code for blocks. If you want block to break when hit by fireball do it like this:
Code
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall

MarioFireBall:
LDA #$02 ; Replace block with blank tile
STA $9C
JSL $00BEB0

PHB
LDA #$02
PHA
PLB
LDA #$00 ;set to 0 for normal explosion, 1 for rainbow (throw blocks)
JSR $028663 ;breaking effect
PLB
MarioAbove:
MarioBelow:
MarioSide:
SpriteV:
SpriteH:
MarioCape:
	RTL

Originally posted by Mindless
It'd be $1490 (star timer), 00 when no power, FF-01 (decreasing) when you have some.

Here is shatter code for blocks. If you want block to break when hit by fireball do it like this:
Code
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall

MarioFireBall:
LDA #$02 ; Replace block with blank tile
STA $9C
JSL $00BEB0

PHB
LDA #$02
PHA
PLB
LDA #$00 ;set to 0 for normal explosion, 1 for rainbow (throw blocks)
JSR $028663 ;breaking effect
PLB
MarioAbove:
MarioBelow:
MarioSide:
SpriteV:
SpriteH:
MarioCape:
	RTL



Okay, one more question. Is SpriteV and SpriteH when it get's his by a shell, or a throw block?
Will do custom overworlds. Just PM me.

Level Completion:



Over world completion:

SpriteV would mean if ANY sprite touches it on the top/bottom. SpriteH would be the same thing but on the sides. it would be best to use the Sprite Shatter Block and edit it so that it compares if '$14C8,x' is '#$0A'
I change my layout every 4-5 months