This code will allow you to use screen exits to replicate the gimmick found in Chocolate Island 2 in the original Super Mario World, where the number of coins and Yoshi coins you collect and the value of the timer change which sublevels you get sent to.
Fixed ChocoIsland2CheckCoins2 and ChocoIsland2CheckCoins4 where a # was redundant, removed SA-1 checks for ChocoIsland2CheckTimerX (SA-1 multiplication only works on SA-1 but UberASM runs on SNES) and added lorom and sa-1 tags.
A pretty useful UberASM code given how limited Chocolate Island 2's gimmick is. Unlike most other codes here, which can be inserted directly or as a library, this one is a collection of so it belonds to the level file. In addition, you want to enter four digits to the level destination since the codes don't check.
There also is a limitation in you can only collect up to 30 (in decimal) coins as the code is tied to the green star block counter (but so is the vanilla CI2 code). To get more coins, you need a custom coin system.
A bit more complicated but still nice to know is that you not only can specify the level but also set the exit to be a secondary exit. To do so, just add $0200 to the level number. For the midway entrance (regular exit) or a water level (secondary exit), simply add $0800 to the level number. If you want to use the extended secondary exits (i.e. a secondary exit with a value larger than 0x200), you have to divide the secondary by 0x200 and enter that as the leftmost digits (e.g. to get secondary exit $0420, you want to enter $2220 and for $1337, you want $9337).
The only nitpick in the code is how you used indexing to get the screen number while you simply could have set the screen number in the macro directly. Likewise, you could have fixed the size in case someone enters the wrong amount of digits and then wonder why the code crash.