13 users online: anonimzwx, crocodileman94, Dolo,  Hooded Edge,  KungFuFurby, Lexzy24, Moltz, MrDeePay, Natsuz2, Nciktendo, RZRider,  xHF01x, YouFailMe - Guests: 111 - Bots: 191
Users: 62,817 (2,618 active)
Latest user: Kaputon

SMW Deadly Coins by ComradeKirby

File Name: SMW Deadly Coins
Submitted: by ComradeKirby
Authors: ComradeKirby
Type: Game Mode
Includes GFX: No
Includes Hijack: Yes
Featured: No
Description: Add a twist to your game of Super Mario World. Coins make you game over! Anything that increases your coin counter (while the timer is running) will deplete your lives and kill you off.

Special thanks to asquared31415 and Taffy on the SMWC discord for the help with the code and insertion.
Rejected due to limited usage and widespread lack of optimization.

Code being a little inefficient isn’t the end of the world, but this code is too bloated to let slide, especially for how small it is.

When operating on RAM addresses in the $7E region, it is unnecessary to include the $7E portion the vast majority of the time - STA $7E0F31 can be shortened to STA $0F31, STA $7E0F32 to STA $0F32, etc. (oddly, both forms are used for $0DBE). Furthermore, many of these addresses are being set to zero, for which there is an even quicker option in the STZ (store zero) opcode. Thus, LDA #$00 : STA $7E0F31 can be condensed all the way down to STZ $0F31.

Second, the free RAM address $18C5 is set and read, but doesn’t actually accomplish anything. What is the point of this address? It sets the player coin count equal to itself on level start, but since the address is itself cleared on level load, it’s always zero anyway.

Third, there is a label “GoBack:” which cannot be reached, so the STZ $0DBE beneath it does nothing but consume more space.

Fourth, SMW’s timer ticks down every 40 frames (28 in hex). The address $0F30 controls when the timer will tick down next - this code does not modify this address, which means the player will be killed on a delay of 0 - 40 frames upon collecting a coin, which is a bit awkward (but not a rejection-worthy oversight on its own).

Finally, the submission contains unneeded files inside the .zip. Please do not include a test .bps or a pre-filled list.txt file in your submissions. Since your readme only exists as a file checklist, that should probably go too unless you’ve something to add to it.

Side note - you checked “Includes Hijack” on your submission. This checkbox is for UberASM submissions that modify the ROM outside of usual scope of UberASM tool, such as those that require a helper patch to be applied with Asar, which your submission does not have. Just so that you’re aware for next time.

All in all, this entire code can be planed down to the following with no loss of function:


LDA $0DBF		; Check if player has coins
BEQ End			; If not, end without doing anything
STZ $0DBE		; If so, zero player life count
STZ $0F30		; Force timer to tick down immediately
STZ $0F31		; Zero timer, hundreds digit
STZ $0F32		; Zero timer, tens digit
LDA #$01		; \ 
STA $0F33		; / Set timer, ones digit to 1

RTL			; End

Alternatively, if you don’t care about the coin display reading zero, you can make the code even faster as follows:


LDA $0DBF		; Check if player has coins
BEQ End			; If not, end without doing anything
STZ $0DBF		; If so, zero coin count (necessary to prevent looping)
STZ $0DBE		; Zero player life count
JSL $00F606		; Call the “kill player” routine

RTL			; End

With all that said, I recommend against resubmitting this code even fixed up as above, as it’s quite narrow in scope. I’d personally rather see it submitted with more user options, or as an additional function to a very similar code we already host (with the authors’ permission, of course) - as it is, this specific trigger (collecting a coin) causing this specific result (instant GAME OVER) is pretty barebones.

(Also, I personally recommend getting in the habit of writing LDA and STA with two digits (LDA #$01 instead of LDA #$1) - there’s nothing strictly wrong with your way and it’s not a rejection reason, it just improves readability a bit.)

Tested with Lunar Magic 3.03, Snes9x 1.59.2, UberASM Tool 1.3.