Name: | Shared Subroutines v2.3 |
Author: | imamelia |
Added: | |
Version History: | View |
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: | lorom subroutine |
Comments: | 14 (jump to comments) |
Download
23.33 KiB | 331 downloads
Comments (14)
I experienced that subroutine isolation problem when developing the graphical bar tutorial for programming sprites.
This also enables global access to all ASM codes regardless to its type of tool. A custom subroutine useable by pixi and uberasm tool, for example.
-Print command to make Asar window now display the list memory usage and range. This is useful to tell if it overwrites other data.
-Several routines JSLs to a list, then back into the code, changed to just simply jump directly to the routine since it is unnecessary; because they are in the same ASM file, so labels are found within it.
Asar v1.71, Free Space Logger (checking for addresses), Snes9x v1.55
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.
you mean like this?:
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.
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:
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.
WAIT - don’t use this patch yet, I’ll update it later today. It has a fatel bug currently.Edit: Patch updated.
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.