Views: 772,494,537
10 users online:  1UPdudes, 7 Up, Infinity, Linen, Marcozzo Daro, Necro_Mantis, placeholdertest,  Tahixham, TheInsanity115, toad64 - Guests: 26 - Bots: 166Users: 40,571 (1,857 active)
Latest: Linen
Tip: Do not put an excessive number of lives in a level; they should have a value to them.Not logged in.
H:None BG Scroll Reset Patch by Tattletale, edit1754
Forum Index - Valley of Bowser - Moderation Questions - Patches - H:None BG Scroll Reset Patch by Tattletale, edit1754
Pages: « 1 »
File Name: H:None BG Scroll Reset Patch
Submitted: by Tattletale
Obsoletes: H:None BG Scroll Reset Patch
Authors: Tattletale, edit1754
Tool: Asar
Requires Free Space: Yes
Bug Fix: Yes
Featured: No
Description: fixes the glitch in which the BG's X-position isn't reset when the player exits from a level with H:Variable into a level with H:None

Fixed a bug where this patch wouldn't consider the fact that AXY were in 16bit mode.
Converted to asar format.
This is a very good catch and while the conversion to Asar and the bug fix are very appreciated, I think it could have been pulled off better from an optimization standpoint. Instead of taking advantage of the 16-bit mode around the hijack, you've just added to the patch code to make it work, which results in rather bloated code.

Analyzing the code, we see that the patch places a subroutine jump at $0580CD. The patch code enters 16-bit mode and returns to $0580D1, which immediately enters 8-bit mode - if you look at the surrounding code, you'll see that 16-bit mode is only used to decrement to $47 and $4B. This is not the only waste; you could easily leverage the 16-bit accumulator in the patch code to zero out $1E and $1466 in two instructions instead of four, which would save both time and space. Of course, you need to do an 8-bit load beforehand, but you can use the X register for that instead (it's overwritten at $0580DD, so you don't have to worry about clobbering it).

To sum up, you can change the REP at $0580CB so it only sets A to 16-bit, then change the JSL hijack to a JML hijack, which would allow you to return directly to $0580D3. In the patch code, you should keep in mind that the size of X/Y isn't guaranteed because of the preceding subroutine calls, so you should account for that either by forcing X/Y to be 8-bit or by analyzing the subroutines and checking if they return with 8-bit X/Y. You can probably think of different functionally equivalent combinations; feel free to experiment and see which one is the cleanest.
Pages: « 1 »
Forum Index - Valley of Bowser - Moderation Questions - Patches - H:None BG Scroll Reset Patch by Tattletale, edit1754

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

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

Total queries: 9


Follow Us On

  • YouTube
  • Twitch
  • Twitter


  • Talkhaus
  • SMBX Community
  • GTx0
  • Super Luigi Bros
  • MFGG
  • Gaming Reinvented