Language…
5 users online: Majormachina, mikeeeeee83, Nitrocell Inc., playagmes169, RetroSamBam - Guests: 106 - Bots: 97
Users: 69,207 (2,358 active)
Latest user: lapakspin99

Posts by Von Fahrenheit

Von Fahrenheit's Profile → Posts

I am trying to make a generator that shows level message 1 if the extra bit is clear and level message 2 if the extra bit is set.
For some reason it always displays message 2. I have read through the code several times but can't find what I did wrong. The code is pretty short so I just pasted it in the post.
I saved some of the data to $58 since the RAM map said it was unused. I don't know if you're supposed to do that...

I'm also pretty new to ASM, so maybe I am missing something really basic...
Code
dcb "INIT"

	RTL


dcb "MAIN"

	LDA $7FAB10,x
	AND #$04		;Checks if the extra bit is set, determing weither message 1 or 2 should show
	BNE Message2

;Message1:

	LDA $58
	AND #$01		;Checks if message 1 has already been shown
	BNE MessageShown
	LDA #$01
	STA $1426		;Spawns a message box containing message 1
	LDA #$01
	TSB $58			;Sets bit 1, flagging that message 1 has already been shown
	RTL

Message2:

	LDA $58
	AND #$02		;Checks if message 2 has already been shown
	BNE MessageShown
	LDA #$02
	STA $1426		;Spawns a message box containing message 2
	LDA #$02
	TSB $58			;Sets bit 2, flagging that message 2 has already been shown
	RTL

MessageShown:

	RTL

allow shy guy emojis in post footers you cowards!
Originally posted by MarioE
Generators don't actually have an extra bit -- only regular custom sprites use them.


So I was missing something really simple... Thanks a lot, I was going crazy over this :D

allow shy guy emojis in post footers you cowards!
I'm trying to make a generator that subtracts 1 coin from Mario every x frames, and kill him when it reaches 0. I've been trying for some time now but can't get it to work.

This is my current code:
Code
	LDA 0DBF		;Loads coin counter
	BNE HasCoins
	JSL 00F606		;Kills Mario if he has 0 coins
	RTL

HasCoins:

	LDA $14
	CMP #$FA		;Branches every 250 frames (5sec)
	BEQ DecreaseCoins
	RTL

DecreaseCoins:

	DEC 0DBF		;Takes a coin
	RTL


I can't seem to find what's wrong. When testing the generator it does nothing. Doesn't subtract coins and doesn't kill Mario.

allow shy guy emojis in post footers you cowards!
Oh... I can't believe I even made a mistake like that...
Thanks for pointing it out :)

allow shy guy emojis in post footers you cowards!
So I've been trying to use the Storm Eagle theme from Mega Man X in one of my levels. I managed to insert the song into the ROM and have it play, but I want it to sound exactly like it does in Mega Man X (FYI I downloaded it from the music section here on smwcentral). The only song I've inserted before is Hot-Head Bop from DKC 2 (also from the music section on smwcentral) which used a sample bank and sounded just like it did in the original game.

The thing now is that the MMX song didn't come with a sample bank, but it did come with an spc. I'm thinking I should be able to insert the spc-into a custom bank using sample tool (to make it sound like it did in MMX), but I don't understand how to do that. I read the sample tool tut but didn't quite understand it :(


In case you didn't understand from my post I have very little experience inserting music :p

allow shy guy emojis in post footers you cowards!
I'm working on a new sprite meant to be a mid boss of sorts. For testing purposes I use a clean ROM, empty level 105 and put the boss there. In the INIT routine I store $5E to $06F9 (empty RAM) and store #$01 to $5E (so the screen will stop moving at screen 00). However the screen stops only 8 tiles (half a screen) into screen 01.

Here's my code:

Code
	LDA #$09
	STA $63			;Sets boss HP to 9
	LDA $5E
	STA $06FB		;Preserves the original value of address $5E
	LDA BOSS_SCREEN
	STA $5E			;Locks the camera at the desired screen number
	RTL



EDIT:
I solved it. When I tried storing #$01 to $5E instead of BOSS_SCREEN (which was set to #$01) it worked. I don't know why, but, whatever, it works.

allow shy guy emojis in post footers you cowards!
I want to have a bunch of collectibles in my hack (think star coins in NSMB) but I can't seem to figure out how I would actually save it to SRAM. I searched the RAM map saw the description for the three bytes at $1F2B:
"Empty. Cleared at reset and titlescreen load. Unlike most empty addresses, this one is saved to and loaded from SRAM."
This doesn't seem to be quite what I'm looking for, however, as all I want is to save something other than cleared exits and player positions.

allow shy guy emojis in post footers you cowards!
So if I just store my data (I believe it will end up being about 10 bytes or something, so 1F2B won't quite cut it) to empty space like this:

Code
LDA #Whatever
STA $70035A

Will this work?

Edit: Will this still be there even if the player restarts the game?

allow shy guy emojis in post footers you cowards!
Ok, thanks a lot!

allow shy guy emojis in post footers you cowards!
I need to extend the save game routine to include a few bytes normally unused in SMW. I read the ROM map and found that the save game routine is located at 0D1C9 (ROM offset) though it is JSL'd through $009BC9. Now what I'm thinking is that I do the following:

1. I insert my extension to the routine at $158000 (freespace slogger gave me) with an assembler like Asar.
2. I use a hex editor to copy the first 4 bytes at 0D1C9 to the end of my extension at $158000 (before the RTS).
3. I overwrite the first 4 bytes at 0D1C9 with 22 00 08 51 (JSL $158000 in small endian (I think)).

There are two things I am wondering about this:
Is the freespace slogger gave me ($158000) the ROM offset or the SNES offset? Also would the save game routine include my extension (like I'm assuming it would) or can ASM only be stored to specific banks??

allow shy guy emojis in post footers you cowards!
Wow. I didn't think I was that much off track. Thanks for helping me out. Smwcentral is awesome!

allow shy guy emojis in post footers you cowards!
First I want to clarify that I do know MarioE made a patch that optimizes saving and stuff and that might just solve my problem. However this is my first hack which I am making primarily to learn, and when I decided to implement a collectible items mechanic (like the star coins from NSMB) that was the first time I had to actually patch the game's code (because I have to store it to SRAM and stuff).

Here is my code:

Code
header
lorom

!Freespace = $158000			;Point this to your goddam freespace before complaining

org $009BC9

	JSL STORESRAM			;Hijack save game routine
	NOP				;\Two NOPs to fill out empty space
	NOP				;/

org !Freespace

!Codelength = End-Code
db "STAR"
dw !Codelength-1
dw !Codelength-1^$FFFF
Code:

	STORESRAM:

		PHP				;Preserve processor flags
		SEP #$30			;A and index 8 bit
		LDA $010A			;Load save file
		ASL A				;\
		ASL A				; |Multiply by 8 since each file uses 8 bytes
		ASL A				;/
		TAX				;X now contains save file times 8 (0, 8 or 16)
		REP #$20			;A 16 bit
		LDA $06F9			;\
		STA $70035A,x			; |
		LDA $06FB			; |
		STA $70035C,x			; |Store Buffer in RAM to SRAM, offset by file
		LDA $06FD			; |
		STA $70035E,x			; |
		LDA $06FF			; |
		STA $700360,x			;/
		SEP #$20			;A 8 bit
		PLP				;Restore processor flags

		PHB				;\
		PHK				; |The code the JSL to STORESRAM overwrites
		PLB				; |
		LDX $010A			;/

		RTL				;End custom save routine

End:

What I wanted to happen was for the game to just store my buffer ($06F9) to SRAM when the player saves the game. What actually happens is that the game freezes (music keeps going tho) when the overworld loads.

EDIT: I thought the ROM might be corrupted so I tested with a fresh one. Same results.

allow shy guy emojis in post footers you cowards!
Awwww yeah! I tried your magic and find myself incredibly relieved to see the game not crashing anymore! Also, for future reference, how would I know I can't hijack with JSL?

allow shy guy emojis in post footers you cowards!
I have this grandscale master plan for my hack that it would be better off without Mario. Instead I would prefer a character with different (and simpler) physics, kind of like how X controls in Mega Man X (basically I want to remove the acceleration).

What I'm wondering is what would the best way of doing this be? I'm guessing it would be easier to hide Mario and have a custom sprite coded from scratch be the player, but how would I do this?

(sorry for kind of wall of text)

allow shy guy emojis in post footers you cowards!
I want to make a sprite that looks like Mario and so I would load the graphics from page 8. My question is how exactly do I do that? I know I can load from page 1-4 with the property byte, but how would I get the game to put a tile from page 8 on the screen?

allow shy guy emojis in post footers you cowards!
When I do that it uses Mario's current frame. Is there no way to make the sprite use Mario's graphics and still have it animate independently? Other than inserting custom GFX that is...


Thanks for the help btw.

allow shy guy emojis in post footers you cowards!
I guess I'll look into how DMA works and see if I can understand it. If not, I have some really innefficient usage of ROM ahead of me.

allow shy guy emojis in post footers you cowards!
Ooooh, that's exactly the kind of stuff I was looking for! Thanks a lot mate!

allow shy guy emojis in post footers you cowards!
I'm making a sprite and I want it to stop when it walks into a wall.

My code is:

Code
LDA $B6,x	;Load sprite X speed
BEQ RETURN	;If zero do nothing
LDA $B6,x	;Load sprite X speed
BPL POSXSPEED	;Branch if speed is positive
LDA $1588,x	;Load sprite collision byte (or whatever it's called)
AND #$02	;Check second bit (set if blocked from the left)
BEQ RETURN	;If sprite is not blocked do nothing
STZ $B6,x	;Set sprite X speed to zero
JSL $01802A	;Apply speed
RTS		;Return

POSXSPEED:

LDA $1588,x	;Load sprite collision majigger
AND #$01	;Check first bit (set if blocked from the right)
BEQ RETURN	;If sprite is not blocked do nothing
STZ $B6,x	;Set sprite X speed to zero
JSL $01802A	;Apply speed
RTS		;Return


The problem is that the sprite just goes right through everything. It doesn't even care. What do?


Edit: I fixed it by saving the sprite's X-position and restoring it at the end of the MAIN routine if it clipped with something. After that I set the speed to zero and now it works.

allow shy guy emojis in post footers you cowards!
I'm working on a fairly complex sprite that I want to have interaction with a lot of the vanilla sprites. I wrote a loop that is run every frame that checks for contact between my sprite (sprite A) and all other sprite's. I then index with the other sprite's number to see what interaction routine will be called (this is not as absurdly large a task as it sounds because a lot of sprites will use a default interaction).

At the end of the routine however, $00 is not equal to INTERACTION_TABLE indexed by sprite B's sprite number (at least it's not equal to what Lunar Magic says the sprite number is). I don't know if I've been at this thing for too damn long or I'm just really stupid.

I mean, sprite number does mean what sprite it is, right? For example a bullet bill has $9E,x = #$1C.

This is my code:

Code
GET_SPRITE_CLIPPING:

	TXY				;Store X to Y
	PHX				;Push X
	LDA #$FF			;\This starts the loop off at X=#$FF
	STA $1695			;/

LOOP	LDX $1695
LOOPX	INX				;Increment X (the first time this happens X is set to zero)

	TXA				;\
	CMP #$0C			; |Terminate loop if it has been run 12 times this frame
	BEQ RETURN_INT			;/

	TXA				;\
	CMP $15E9			; |Loop if sprite is trying to compare clipping values with itself
	BEQ LOOPX			;/

	JSL $03B6E5			;Get sprite B's clipping values (sprite B is whichever one being checked)

	STX $1695			;Store X value for sprite B
	TYX				;Restore X from Y
	JSL $03B69F			;Get sprite A's clipping values
	JSL $03B72B			;Check for contact (if they touch the carry flag will be set)
	BCC LOOP			;Loop if carry is clear

	LDX $1695			;Load sprite B's X value (sprite B is now confirmed to touch sprite A)
	LDA 9E,x			;Load sprite B's sprite number
	TAX				;Store sprite B's sprite number to X
	LDA INTERACTION_TABLE,x		;Load specific interaction value indexed by sprite number
	STA $00				;Store to scratch RAM

RETURN_INT

	PLX

	RTS


The table is 256 bytes long to work with any possible sprite number. I will shrink it when I find out how many sprite numbers are actually used.


Edit: I had simply been at it for too long. I missed the '$' in LDA $E9,x. Derp.

Sorry for wall of text.

allow shy guy emojis in post footers you cowards!