Views: 721,789,342
22 users online: bandicoot, Big Brawler, chickaDEE Magazine, CosmicTiff, FailSandwich, Giftshaven, Gloomy, IRLjohn, o Ladida, o LadiesMan217, Luigixhero, MaxodeX, Mogu94, Mrmariobros222, NextTactics, Nowieso, Pinci, sss cs, The Hacking Yoshi, TheDivineLupine, Tobio, TonyP - Guests: 65 - Bots: 131Users: 37,678 (1,738 active)
Latest: TheDivineLupine
Tip: Try not to place secret exits at the very end of levels-- the player will basically have to go through the same level twice.Not logged in.
Details for Shared Subroutines v2.2
SMW Patches - Shared Subroutines v2.2
File Name: Shared Subroutines v2.2
Version History: View
Authors: imamelia
Tool: Asar
Requires Free Space: Yes
Bug Fix: No
Featured: Yes
Description: This patch inserts some commonly-used subroutines into your ROM so that you can just call them with a JSL instead of copy-pasting them, which saves a significant amount of ROM space.

Note that some subroutines cannot be converted to SA-1 since either the registers become inaccessible or that they rely on unsigned math operations.
Tags: needs remoderation, subroutine
Download: Download - 18.09 KiB
Actually, JSL read3(!DefineRoutine) to directly jump to a freespace code is a bad idea. Because the JSL now jumps directly to freespace instead a fixed location, anytime you make the subroutine code move, there is tendency that the destination address JSL jumps to could end up jumping to wrong address (which can crash the game) if the user didn't update the codes that uses the shared subroutine patch (sprites, outside patches, blocks, etc containing a JSL to a moving freespace block).

This happens on the second and later routine if any code/data's bytes before it changes.

Unless if you manually add subroutines in fixed locations in the ROM, and don't edit those codes at all.
Posted by: GreenHammerBro -
4.- A big improvement to this patch would be to just include the pointer to the routine (autoclean dl) instead of a JML. That way one could do JSL read3(!GetRand2) and he'd be directly taken to the routine. It's just a small byte and cycle save, yeah, but it's better than nothing.

you mean like this?:

autoclean dl Routine0
autoclean dl Routine1
autoclean dl Routine2

;in a seperate ASM file to use shared subroutine
LDA #$00
STA $19
JSL read3(!Routine1)

I don't think it's possible, since the address the JML jumps to cannot be transferred into a define, as asar would error out. Can you show me a working example? JML [$xxxxxx] does not exist.
Posted by: GreenHammerBro -
After trying to save my semester and other IRL stuff, I'm finally done moderating this. Has many minor issues, I honestly debated between removing this or not, but most of these are just small issues or nitpicks. Overall I don't see any purpose in this patch anymore, in the age of shared routines within GPS and PIXI/GIEPY, and the UberASM library. I don't think this has many use-cases left, but that's just my opinion.

I found some problems with the RATS tag. There are two issues in it:
1.- The if condition you made to check for banks outside the original game area is broken, because if you set your definition to a FastROM bank it'd still add the tag in the unexpanded area. Add an &$7F to the check to disregard for the high bit if the ROM isn't SA-1 (SA-1 uses banks $80+ for other things, as you'll see below).
2.- As you comment in it, it is size-1, however you aren't actually subtracting 1 from the RATS tag. Use:
  dw JMLListEnd-JMLListStart-1
  dw JMLListEnd-JMLListStart-1^$FFFF

to correct this issue.
I fixed these for you, but be more careful next time.

Some other things:
1.- Removed the SA-1 tag. Most of these aren't SA-1 compatible. Be it because of the registers, or because you decided to throw !F into most ROM mentions. This breaks in SA-1 ROMs. SA-1 uses the portion after $80 for other stuff, unlike a normal LoROM where it's just a mirror of the lower area. I didn't fix these.
2.- Additionally, making reads from tables FastROM doesn't make them faster.
3.- Not really an issue, but why do you define JMLListRatsTagSize twice? You only use it in SubroutineDefs.asm anyway. There's no need to repeat such define.
4.- A big improvement to this patch would be to just include the pointer to the routine (autoclean dl) instead of a JML. That way one could do JSL read3(!GetRand2) and he'd be directly taken to the routine. It's just a small byte and cycle save, yeah, but it's better than nothing.
5.- This patch has stuff all over the place! It's so annoying to configure. You can call it tidiness, but really it just makes finding stuff harder. Just stick to one defines file if it's really necessary, and put it within the main folder.
Posted by: o Erik -
WAIT - donít use this patch yet, Iíll update it later today. It has a fatel bug currently.

Edit: Patch updated.
Posted by: GreenHammerBro -
2.1 update: After learning from my enemy HP meter patch removal, it is necessary to have this protection since location-fixed codes aren't automatically have the rats tag inserted.
Posted by: GreenHammerBro -
Not sure how that applies to this patch.. But truthfully some one might better off porting them from the smb1 disassembly. Icemans's have alot of differences.
Posted by: zacmario -
Can you read this forum, uses the patch, and fix and update the platform sprites.

Can you use the SMB1 scale platforms to make act more better than the other games? Donít forget to fix it and add SA-1. The platforms needs that patch.
Posted by: CalHal -
Thanks for fixing, I have forgotten to switch that to asar.
Posted by: GreenHammerBro -
I know xkas patches are not SA-1.
Posted by: CalHal -
RPG Hacker
It's no xkas patch, it was just labeled incorrectly. Fixed it.
Posted by: o RPG Hacker -
We donít expect xkas patches. But I donít mind.
Posted by: CalHal -

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: 28


Follow Us On

  • Facebook
  • Twitter
  • YouTube


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