Language…
19 users online: AmazingChest,  AmperSam,  Anorakun, apache,  Eden_, elegist, Fozymandias, GRIMMKIN, Heitor Porfirio, NTI Productions, Null42, OEO6, Rykon-V73,  Telinc1,  Thomas, tOaO, Tulip Time Scholarship Games, underway,  yoshi3706 - Guests: 293 - Bots: 443
Users: 64,795 (2,373 active)
Latest user: mathew

ASM for Beginners: Basic, Basic Codes in 20 minutes

Thank you so much, Maxx. I'm making a hack where you play as Yoshi. I originally was just going to use altered graphics, but now I'll hack it so you actually play as him. Amazing tutorial.
I'm attempting to make my first branching coded block, but I'm stuck. I want to make a code after the branch, so that it hurts the Mario when he doesn't meet the requirements. What code would I use after it?
BEQ Label ; Branch if met
JSL $F5B7 ; Hurt Mario
RTS
Label:
...
RTS

or

BNE Label ; Branch if not met
...
RTS
Label:
JSL $F5B7
RTS

World Community Grid: Thread | Team
 
This is nice, it seems easy to use, I guess I'll make better levels now I know this.

Thanks for the tutorial.
Maxx:

I DO really owe you one man, thanks to this, I can Finnally insert LevelASM.

Again, thanks.
Hello There


I have a problem. D:

I'm trying to make mario enter the level with a fireflower, but I also want collecting 10 coins to give him a cape. Here's the code i'm using:

LDA $7E0DBF; This is the code for the cape.
CMP #$0A
BEQ equal
RTS
equal:
LDA #$02
STA $7E0019
LDA #$03; This is where the code for the FireFlower starts.
STA $7E0019

Exactly like that (No semi-colons). Can somebody tell me what I did wrong?

Who knows when I'll have
something to put here.


Credits go to Counterfeit for the bitchin' post layout.

Originally posted by Rabees
I have a problem. D:

I'm trying to make mario enter the level with a fireflower, but I also want collecting 10 coins to give him a cape. Here's the code i'm using:

LDA $7E0DBF; This is the code for the cape.
CMP #$0A
BEQ equal
RTS
equal:
LDA #$02
STA $7E0019
LDA #$03; This is where the code for the FireFlower starts.
STA $7E0019

Exactly like that (No semi-colons). Can somebody tell me what I did wrong?


What does happen, the game freezes? Or it don`t appear like you want?

Maxx (or however), I`m trying to use the Ground Pound that is in Patches section, But when I start the level, the music continues but the screen`s black, What do I do wrong?

Hello There


Originally posted by Teff007
Originally posted by Rabees
I have a problem. D:

I'm trying to make mario enter the level with a fireflower, but I also want collecting 10 coins to give him a cape. Here's the code i'm using:

LDA $7E0DBF; This is the code for the cape.
CMP #$0A
BEQ equal
RTS
equal:
LDA #$02
STA $7E0019
LDA #$03; This is where the code for the FireFlower starts.
STA $7E0019

Exactly like that (No semi-colons). Can somebody tell me what I did wrong?


What does happen, the game freezes? Or it don`t appear like you want?

Maxx (or however), I`m trying to use the Ground Pound that is in Patches section, But when I start the level, the music continues but the screen`s black, What do I do wrong?


The game doesn't freeze, the fireflower asm just doesn't work. No fireflower. :\

EDIT: I'm getting a fireflower after 10 coins now? And no cape? WHAT'S GOING ON HERE!?


Who knows when I'll have
something to put here.


Credits go to Counterfeit for the bitchin' post layout.

Rabees, try this code:

LDA #$03 ; Load fire flower.
STA #19 ; Store to Mario's power-up.
LDA $7E0DBF ; Load coin total.
CMP #$0A ; Has he got 10 coins?
BCS Greater ; Branch if equal or greater.
RTL ; End code.
Greater:
LDA #$02 ; Load cape.
STA $19 ; Store to Mario's power-up.
RTL ; End code.

Edit: Fixed the code. Thank you Ultimaximus, I didn't see the pound sign.
Originally posted by Master S
STA #7E0019 ; Store to Mario's power-up.

This is storing to a number itself, not an address. It should be $7E0019. Of course, since the address is under $7E1FFF, it can be shortened to $0019, and since that starts with 00 which is assumed, it can be shortened further to STA $19.

Originally posted by Master S
LDA £7E0DBF ; Load coin total.

XD You need the American dollar ($) sign. It's "$" not because it's the monetary unit, but because it's right after "#" on a typical (American) keyboard (hence "%" being used for binary).

Oh, and instead of CMP #$0A to compare to 10 coins, since coins are in decimal, you can use CMP #10. #value is decimal, #$value is hex.

World Community Grid: Thread | Team
 


What just happened?
Boredman, I can't help you if you don't post the code you used. :S
Sorry Maxx, here. I was doing some HDMA, copied a code basically.
Code
level1: 
	LVL1BLUE: 
	db $4F,$99
 	db $08,$9A
 	db $08,$9B
 	db $08,$9D
 	db $08,$9E
 	db $08,$9F
 	db $00
That's not how HDMA works. What you're using here is only the color table, but the way you're using it, xkas interprets it as (invalid) code, causing the game to crash. You have to use Kaijyuu's code (from the D) section of his HDMA guide) and replace the color table with yours.


 
Also, when I'm trying to get the climbing frame thing, it does nothing. Here is my code:
Code
level2:
	LDA $7E0075
	CMP #$01 
	BEQ equal
	RTS
	equal:
	LDA #$0A
	STA $7E0DBF
Now I can learn ASM! At first I saw it and said "This is just a bunch of random numbers with dollar signs in front!" But now, it makes sense why.

Thanks, Maxx!
Your layout has been removed.
Asm will be in my next rom thx!!
There was once a man... he grew seeds in his attic but since the light came from behind him the seeds grew up his nose. -Dylan Moran
Originally posted by boredman
Also, when I'm trying to get the climbing frame thing, it does nothing. Here is my code:
Code
level2:
	LDA $7E0075
	CMP #$01 
	BEQ equal
	RTS
	equal:
	LDA #$0A
	STA $7E0DBF

Code
$7E:0075	1 byte	Flag	"Mario is in water" flag


Change the code to this and it should work (haven't tested it):
Code
level2:
	LDA $74
	CMP #$01 
	BEQ equal
	RTS
	equal:
	LDA $0DBF
	CLC
	ADC $0A
	STA $0DBF
	RTS


Hacks I Support:


Code
level2:
	LDA $74
        BNE water
	RTS
	water:
	LDA #$0A
	STA $0DBF
	RTS

Double fixed.
Thank you very much Maxx! Very helpful!