Language…
13 users online:  Anorakun, Children's Digest 1950-2009, CircleFriendo, Daemontom, Dark Mario Bros, h.carrell, HeitorPorfirio2006, Koopster, MarioriaM, monkey03297, Morph Moth,  quietmason, SubconsciousEye - Guests: 99 - Bots: 286
Users: 55,719 (2,332 active)
Latest user: unccfan2001

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419
I am trying to make a sprite that stays in the air and releases a single fireball downward every few seconds. I managed to put together the graphics and such, but I can't figure out how to get it to spawn the fireballs. I had tried several attempts but I just can't get it to work at all. This is as far as I was able to get, help would be much appreciated.
Don't eat the sandwich
How can you make a constant in ASM? I want to declare a constant for a ram address so if I ever need to change it to another one, I only need to change it in one place, other than the fact that it make the code more readable.

(╯°□°)╯︵ ┻━┻
In that case, you want defines i.e. a have a "label" which is prefixed with a '!' and then a declaration. It looks like this:
Code
!Define = $00

The defines work then like placeholders in the code.
attempting to get this block to work:
Code
db $37
JMP Return : JMP On : JMP Return : JMP Return
JMP Return : JMP Return : JMP Return : JMP Return
JMP Return : JMP Return : JMP Return : JMP Return

On:
	LDA $14AF|!addr				; \ If the ON/OFF switch is ON...
	BNE Off				; /
	PHX					; \
	REP #$10				; |
	LDX #$006A				; | Change this block into Map16 tile #$006A.
	%change_map16()				; |
	SEP #$10				; |
	PLX					; /
Off:
	PHX					; \
	REP #$10				; |
	LDX #$016A				; | Change this block into Map16 tile #$016A.
	%change_map16()				; |
	SEP #$10				; |
	PLX					; /


Return:
	RTL
any help would be great it does nothing you can touch it but its invisible from bottom and sides and SOMETIMES when standing on it it will update to 016A
Every entry but the second one in your JMP table leads to "Return", so the block will only do something when you hit it from below.

You're probably expecting all blocks to change instantly and automatically when you hit an ON/OFF switch? That won't work, because blocks are only active when you touch them. You probably don't want to actually change the map16 tile - instead, try giving ti different behavior depending on the ON/OFF state, then handle the graphcis change with ExAnimation if needed.


 
Originally posted by WhiteYoshiEgg
Originally posted by Bene Hrethgir
if block states only update when touched then how to I change there passable/solid state as they would still need to be touched to update there status

Questions like this are better off being asked publically; it'd be great if you could take those to the forums instead.

Though while we're here: instead of changing the tile to a different one, make it behave like a different one. The code looks something like this:
Code
LDY #$00 ; first two digits: 00
LDA #$25 ; last two digits: 25
STA $1693 ; makes it act like tile 0025

In the Map16 editor you'll see that tile 25 (0025) is empty (passable), and tile 130 (0130) is solid.

If you have any further questions you should ask them in the thread you originally posted in (or make a new one if you think it's important enough). That way, more people can answer.


so that just makes it act like 025 regardless of on/off switch theres obviously a simple solution im missing here
It's failing for two reasons:
  1. You're using the same acts like setting for both cases. No wonder why the block works.
  2. But even if you change it, remember that the "Off" code still gets executed when the switch is off. Put a RTL in front of Off: so not more unnecessary code is executed.
thank you, another question i am using GHB Disable scorehttps://www.smwcentral.net/?p=section&a=details&id=20270 and would like to put the player's p speed there instead can anyone point me to where there is an example of such?
So I'm playing around with the Passable Ledge and I'm trying to make it so as well as going down when pressing down, you go up when pressing up.
I have both pieces of code working (I can either have a block making you go down, which is the downloadable one, or a block making you go up), but I don't know how to make a block combining both.

I tried to combine it like that
Code
db $42
JMP Return : JMP PressUpDown : JMP Return : JMP Return : JMP Return : JMP Return : JMP Return : JMP PressUpDown : JMP Return : JMP Return

PressUpDown:
	LDA $72
	BNE Return	;if in the air, return

	LDA $16
	AND #$08
	BEQ Return	; If the player isn't tapping up, return
	
	LDA $96		; Move the player up 32 pixels
	CLC
	SBC #$20
	STA $96
	LDA $97
	SBC #$00
	STA $97
	

	LDA $16
	AND #$04
	BEQ Return	; If the player isn't tapping down, return
	
	LDA $96		; Move the player down 8 pixels
	CLC
	ADC #$08
	STA $96
	LDA $97
	ADC #$00
	STA $97	

Return:
	RTL		; Return

But I can't go down. It works while going up, but not down. Mario just ducks. I don't really know why.
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World
VLDC12 - 72HoKaizo#1
It's because your code essentially says "if the player isn't pressing UP, do nothing". When you're pressing down, you're not pressing up, so the block does nothing.

Instead of branching to Return when the first check fails, branch to the second check - that is, change the first BEQ Return to BEQ CheckDown, then add a CheckDown: label before the second LDA $16.


 
Originally posted by WhiteYoshiEgg
It's because your code essentially says "if the player isn't pressing UP, do nothing". When you're pressing down, you're not pressing up, so the block does nothing.

Instead of branching to Return when the first check fails, branch to the second check - that is, change the first BEQ Return to BEQ CheckDown, then add a CheckDown: label before the second LDA $16.

That makes a lot of sense! It's working now, thanks!
Super Mario Pants World
Luigi's Lost Levels
New Super Mario Pants World
VLDC12 - 72HoKaizo#1
Hey guys, im working on a super mario galaxy style hack and i need a way of making levels inaccesable until your exit count reaches a certain number. The game is open world and at the beginning you can play 4 levels that all have 3 exits each. when you get 8 exits (stars) total, you can enter the castle of that world. that idea continues through each world. Does anyone know how i can make that happen? I know basically nothing about asm.
I recently created a block with Blockreator that is like lava (cuz the lava Map16 is buggy and is like water) and this block kills sprites.To not kill the lava bubble,i did this:
Code
SpriteV:
	LDA !9E,x				; \ If the sprite's type is not equal to 33...
	CMP #$21				; |
	BEQ Label_0000			        ; /
	LDA #$05				; \
	STA !14C8,X				; | Kill the sprite as if by lava.
	LDA #$40				; |
	STA !1558,x				; /
Label_0000:					; > --------
	LDA !9E,x				; \ If the sprite's type is equal to 33...
	CMP #$21				; |
	BNE Label_0001				; /
Label_0001:					; > --------
RTL

SpriteH:
	LDA !9E,x				; \ If the sprite's type is not equal to 33...
	CMP #$21				; |
	BEQ Label_0002 		                ; /
	LDA #$05				; \
	STA !14C8,X				; | Kill the sprite as if by lava.
	LDA #$40				; |
	STA !1558,x				; /
Label_0002:					; > --------
	LDA !9E,x				; \ If the sprite's type is equal to 33...
	CMP #$21				; |
	BNE Label_0003				; /
Label_0003:					; > --------
RTL

But the lava bubble still dies.
I have put to Act like 0,the animated water,but it still dies.
Thinking about what patcher to use.
You already have a thread with that exact same question. Be patient. Reposting it here won't make more people see it, surprisingly.


So I use the 3-digit patch (Minimalist Status Bar) with the shop blocks included but when I hit the 1-up shop block it cause the icon at the bottom to have a letter d which is actually used in the title screen. Pressing select just show the 1-up as normal but is there a way to change the tilemap for the 1-up icon (D)


Also it this the right thread to post this?
Userbar made by Green Jerry




Noob Question but I see a lot of "!" and "+" in Custom Sprite code. What do they mean?
A ! usually marks a "define" which is pretty much just a compile-time variable. In sprite code you will often see stuff like !1544,x which are defines PIXI adds for you. This one would contain $1544 on non-sa-1 roms and the sa-1 equivalent if your rom is sa-1. They're used for hybrid code that can work on both sa-1 and non-sa-1 roms.

---
A + is just a quick nameless label that you can use. If you use them Asar will try and find the next occurrence of "+"

Code
LDA $9D
BNE + ; this jumps to the first +
NOP #2
+
LDA !C2,x
BEQ + ; this jumps to the second +
STZ $00
+


There's also - which does the same thing but looks in the other direction, instead of forward it'll look backwards for the last occurrence of "-"
Is the ",x" also used to make codes work with SA-1?
No, ,x is not part of the define, it is something called indexing and it is part of the ASM code that gets assembled (unlike defines). So for instance, if !C2 = $C2, that line will get assembled as LDA $C2,x.
What that does in-game is to load into the accumulator whatever is in the RAM address $C2+x (so $C3 if the x register holds $01, and so forth). It is useful to load values from a table and is heavily used by sprites, which use tables indexed by the current sprite number for absolutely everything.
Sorry for triple posting but I'm trying to write a simple code but I'm stuck. Just to try and make something simple, I wanted to make a sprite that acted like a platform and moved up and down.

I think I got the moving up part right but I don't know how I can get it to move down after reaching a certain height and vice versa.


Here the code:
Code
JSR Graphics     ;Load Graphics

       LDA #$00
       %SubOffScreen()
       JSL $01801A|!BankB	;updates sprite y position
       JSL $018022|!BankB	;updates sprite x position

       LDA $14C8,x		; Only run when sprite is living
       CMP #$08
       BNE return
 

       LDA $AA,X ;Load Y Speed
       DEC $AA,x ; Decrease it to make it Rise
       CMP #$3F  ; if/when it reaches this speed 
       BCS GoinDown ; then the code jumps to this subroutine
             
GoinDown:
LDA $AA,x
INC $AA,x 
CMP #$3F

JSL $01B44F|!BankB	; make the sprite solid
	
return:
       RTS


Also, are my notes interpreting the coding correctly?
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 406
  • 407
  • 408
  • 409
  • 410
  • 411
  • 412
  • 413
  • 414
  • 415
  • 416
  • 417
  • 418
  • 419