Banner
Views: 854,133,967
Time:
11 users online: Conal, CosmicTiff, Dan Drigues, Eduard, Green Jerry,  KevinM, panterajk2000, PuffleDreemurr, RanAS, Retr0_Dave, yogui - Guests: 43 - Bots: 72 Users: 47,131 (2,482 active)
Latest: drr
Tip: ExAnimation also works on sprites!Not logged in.
Code for Coin that Increases Time
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Code for Coin that Increases Time
Pages: « 1 »
Hi. Sorry for the n00bish question, what is the code for a block that acts like coin that increase time by 10 seconds? Thanks!
Includes checking the P-switch. No credit needed.

I also recommend learning some ASM. It's very fun when you can get it working. Sometimes I feel like a god controlling the game!

Code
print "Increases time by ten"

db $42

JMP Mario : JMP Mario : JMP Mario : JMP Return : JMP Return : JMP Return : JMP Return : JMP Mario : JMP Mario : JMP Mario

Mario:
	LDA $14AD	; \ Make sure P-switch isn't on
	BNE Return	; / 
	LDA $F32	; \ 
	CMP #$09	; | Make sure it's not 9 (this causes "A" to appear in the timer)
	BEQ Alt		; / 
	INC $F32	; \ Increment tens
	RTL		; / 
Alt:
	STZ $F32	; \ Same as above but increments hundreds and clears tens
	INC $F31	; | (may not seem logical, but it is)
	RTL		; / 
Return:
	RTL		; Now what could this do?




Edit: Don't spam these unless you want this to happen:


Another Edit: My code was terrible. I fixed it.
the people who watch hentai as an anime, and not just as a porn, are the superior race
Smw's timer is binary-coded decimal (each byte holds a digit)

To do that, check if the tens place is 9, then set it to zero, and increment the hundreds (but do not store yet), if the hundreds is 10, then set all digits to 9 (shows as 999), or even better, install a 16-bit timer, so that the values are not encoded (if you install the super status bar patch, then you NEED to edit it to make a 16-bit bit counter, it has its own timer since the smw status base/HUD has that code in the HUD routine).

--------------------
Give thanks to RPG hacker for working on Asar.
I already got it. Thanks, Techinus!
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - Code for Coin that Increases Time

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy