Language…
18 users online:  AmperSam,  Anorakun, apache, Dennsen86, Heitor Porfirio, krizeth, mtheordinarygamer, Null42, OEO6, Rykon-V73,  Saphros, Sweetdude,  Telinc1,  Thomas, tOaO, underway, Yuvi, Zandro - Guests: 288 - Bots: 319
Users: 64,795 (2,373 active)
Latest user: mathew

Official Hex/ASM/Etc. Help Thread

  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 418
  • 419
  • 420
thanks again
i couldnt solve the inverting palette issue through coding.. but ive inverted it directly in lunar magic and worked as it should.
i meant like invert the colors on the gradient. so if its green to black, make it pink to white. inverting the bg colors works too but is obviously more annoying
Originally posted by Ladida
i meant like invert the colors on the gradient. so if its green to black, make it pink to white. inverting the bg colors works too but is obviously more annoying

Yes, i understood.. but could not make it work #tb{D'X}
Sorry to interrupt! I have two sprite-related questions, which hopefully should be quick.



What's the best way to make a sprite respawn after it's killed? What I'm currently doing is writing 0 to the table at $1938 if the sprite status is 0, but somehow that doesn't handle the case where you kill it with a spin jump. Is the sprite code never run when it's spin-killed?



Is there a code snippet that makes sprites stay on ledges? code library thread doesn't seem to have any. I copied this one from another sprite, but that stops it from walking down slopes too:

Code
	LDA $1588,x			; run the subroutine if the sprite is in the air...
	ORA $151C,x			; ...and not already turning
	BNE +
	LDA $157C,x
	EOR #$01
	STA $157C,x
	LDA #$01			; set that we're already turning
	STA $151C,x
+	LDA $1588,x			; if on the ground, reset the turn counter
	AND #$04
	BEQ +
	STZ $151C,x
	STZ $AA,x
+


 


 


Originally posted by WhiteYoshiEgg
What's the best way to make a sprite respawn after it's killed? What I'm currently doing is writing 0 to the table at $1938 if the sprite status is 0, but somehow that doesn't handle the case where you kill it with a spin jump. Is the sprite code never run when it's spin-killed?

I'm not quite sure what you're trying to do here. Are you checking the sprite status after calling the Mario-sprite interaction routine ($01A7DC) or something? Because that shouldn't really work since most causes of death will set a different sprite state than immediately 0 (specifically 2-4, plus 5 if you're also running object interaction somewhere). Your best bet would just be to immediately clear $1938 if the sprite status is less than 6 following that routine's call.

Originally posted by WhiteYoshiEgg
Is there a code snippet that makes sprites stay on ledges? code library thread doesn't seem to have any. I copied this one from another sprite, but that stops it from walking down slopes too:

Your code is partially correct, though you'll want an AND #$01 after loading $1588 to make sure the sprite is specifically off the ground. To handle the slope issue, you should change the way you set your sprite's "on ground" Y speed; rather than clearing the speed, you should assign a downwards value when the sprite is on a slope (SMW uses #$18). See the subroutine SMW uses at $019A04.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
I'm not quite sure what you're trying to do here. Are you checking the sprite status after calling the Mario-sprite interaction routine ($01A7DC) or something? Because that shouldn't really work since most causes of death will set a different sprite state than immediately 0 (specifically 2-4, plus 5 if you're also running object interaction somewhere). Your best bet would just be to immediately clear $1938 if the sprite status is less than 6 following that routine's call.

Yeah, in retrospect I don't know how that ended up working for non-spin kills. In the end I just stuck the code in uberASM instead (cycle through sprites, and if they're that sprite and status 0, then reset their entry in the respawn table). eh~

Originally posted by Thomas
Your code is partially correct, though you'll want an AND #$01 after loading $1588 to make sure the sprite is specifically off the ground. To handle the slope issue, you should change the way you set your sprite's "on ground" Y speed; rather than clearing the speed, you should assign a downwards value when the sprite is on a slope (SMW uses #$18). See the subroutine SMW uses at $019A04.

Oh hey, I didn't even notice the STZ $AA,x there - guess I didn't take as close a look at the code I copied as I should have. Replacing that with a copy of SMW's code, plus adding that AND #$01 at the top, did the trick. Thanks a bunch! #tb{:)}


 
It seems that trouble with the Metroid HP patch has reared its head for me again. When music is inserted via AddmusicK, getting hit will break the soundtrack's instruments, and even possibly cause a crash after losing a life. Is there anything that can be done about this, or is this particular patch just a wash? The alternative is to use the Player Health Meter, which looks to be just above my abilities but shouldn't break from AMK.


Other Submissions of mine!
Any way to remove reznors platforms after they are killed?

Im trying killing the sprite.
it kinda works, but whenever i kill the reznor in slot #07 all the other platforms stop rotating. Any way to avoid that?
Just a quick question.
Im trying to get a random number between 0 and 9. So im doing:
Code
JSL $01ACF9 
AND #$09


But for some reason it only give-me 0,1,8 or 9 as result.
What is going wrong?

Edit.. i think i kinda get it.. im masking only the bits 0000 1001
But how would i go about getting a random number between 0 and 9?
divide the output by 10, and use the remainder

Code
JSL $01ACF9
LDA $148D
STA $4204
LDA $148E
STA $4205
LDA #$0A
STA $4206
LDA ($00,s),y	;\
LDA ($00,s),y	;| waste time
NOP		;/
LDA $4216


edit: thats assuming 0-9 inclusive (aka 0 1 2 3 4 5 6 7 8 9)
Originally posted by Ladida
divide the output by 10, and use the remainder

Code
JSL $01ACF9
LDA $148D
STA $4204
LDA $148E
STA $4205
LDA #$0A
STA $4206
LDA ($00,s),y	;\
LDA ($00,s),y	;| waste time
NOP		;/
LDA $4216


edit: thats assuming 0-9 inclusive (aka 0 1 2 3 4 5 6 7 8 9)


Im trying to understand it, but whats 4204... 4216?
Ram map says its some decompressed gfx thing.. or you are using it as free ram?!
i said it on discord but theyre cpu regs

see regs.txt

$4204/5 is dividend (16bit)
$4206 is divisor
$4214/5 is quotient (16bit)
$4216/7 is remainder (16bit)

if youre using sa1 you prolly want to use the sa1 division regs which i dont know offhand so a kind sa1 friendly friend will maybe tell you what the regs for that are
Originally posted by Ladida
i said it on discord but theyre cpu regs

see regs.txt

$4204/5 is dividend (16bit)
$4206 is divisor
$4214/5 is quotient (16bit)
$4216/7 is remainder (16bit)

if youre using sa1 you prolly want to use the sa1 division regs which i dont know offhand so a kind sa1 friendly friend will maybe tell you what the regs for that are

Oh.. thank you.
This is a bit confusing to me, but is really fun try to learn
A division on SA-1 for that matter, is for example this code:
Code
JSL $01ACF9

LDA #$01				; \ Set Division Mode
STA $2250 				; /

REP #$20				; 16-bit Accum
LDA #$148D				; \ Set dividend
STA $2251				; /
LDA #$000A				; \ Set divisor
STA $2253				; /
 
NOP     				; \ ... Wait 5 cycles!
BRA $00 				; /

LDA $2308

For that matter, the quotient is stored at $2306 whereas the reminder at $2308 (note that both are 16-bit).

You also can take a look into the SA-1 readme which contains an instruction to do a multiplication.

Edit: Made some impovements.
Thank You MarioFanGamer
Im not using SA-1 right now, but its always good to know the difference. And of course, this could be useful someday for others.


So i have another dumb question.
Its possible to have a loop inside a loop?
Im trying to compare 24 numbers to see if theres any repetition. If one number is repeted i add 1 to the value and restart the loop..
Code
	
Edit:
This code was garbage.
Problem solved.			


I know as of now this would be an infinite loop...
So is possible to create this loop?
How can i compare x to y so it doesnt get stuck on a infinite loop?


The alternative you can consider is using scratch RAM ($00-$0F) to control the loops if you aren't using them for anything else. Then you can use X and Y safely if you want to change or compare them, for example.





Dream team (feed them, please):






GPS (Gopher Popcorn Stew) doesnt recognize the y register?
Originally posted by NaroGugul
GPS (Gopher Popcorn Stew) doesnt recognize the y register?


Define "recognize". GPS as in the program doesn't care about anything inside the blocks themselves.

The Y register does have a special meaning inside blocks though: It contains the highbyte of the act like setting. That however just means that you need to preserve Y or set it to whatever it needs to be before your block returns. Other than that you can use Y as freely as you want inside blocks.

Also for your x = y problem you could just set y to be x + 1. That way you never get x = y and don't need to specifically check for it. It also means that you don't compare values twice since x = 1, y = 5 is the same comparison as x = 5, y = 1
Originally posted by TheBiob
Originally posted by NaroGugul
GPS (Gopher Popcorn Stew) doesnt recognize the y register?


Define "recognize". GPS as in the program doesn't care about anything inside the blocks themselves.

The Y register does have a special meaning inside blocks though: It contains the highbyte of the act like setting. That however just means that you need to preserve Y or set it to whatever it needs to be before your block returns. Other than that you can use Y as freely as you want inside blocks.

Also for your x = y problem you could just set y to be x + 1. That way you never get x = y and don't need to specifically check for it. It also means that you don't compare values twice since x = 1, y = 5 is the same comparison as x = 5, y = 1


Ive asked because whenever i have "something,y" Gps returns me an error.
What opcode gives the error? It may be possible that that opcode just doesn't support ,y addressing.
  • Pages:
  • 1
  • 2
  • 3
  • 4
  • 5
  • 397
  • 398
  • 399
  • 400
  • 401
  • 402
  • 403
  • 404
  • 405
  • 406
  • 407
  • 418
  • 419
  • 420