Language…
13 users online: bradcomp, Domokun007, drkrdnk, Fozymandias, hhuxy, mathie, playagmes169,  Segment1Zone2, SirMystic, steelsburg,  Telinc1, tOaO, zAce08xZ - Guests: 294 - Bots: 367
Users: 64,795 (2,375 active)
Latest user: mathew

Uberasm: Using multiple patches for the same level.

So just recently, I learned about how to insert HDMA as a asm patch rather than a sprite file. That also means whatever level I want to apply any hdma patch in has to not be used. Is there a way I can use two patches in the same level? (for example, an HDMA patch and a layer 3 translucent patch)

LINKS -> YouTube - Discord - Twitter

You just have to combine the two into one .asm file. I'm not sure there's any other way.


Other solution: use the library folder.

Just stick the ASM codes you want in there. Then, make a new ASM file in the Level folder, and write it like this:

Code
init:
	JSL codeA_init
	JSL codeB_init
	; ...
	RTL

main:
	JSL codeA_main
	JSL codeB_main
	; ...
	RTL

...where codeA/codeB/etc. are the names of the ASM files you put in the library folder.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
So I tried to insert it like this
Code
init:
	JSL HDMA-SunsetSky1.asm
	JSL autowalking.asm.asm
	RTL

main:
	JSL HDMA-SunsetSky1.asm.asm
	JSL autowalking.asm.asm
	RTL

This is wrong for sure because UberASM shows it as an error. Did I put it in right?

LINKS -> YouTube - Discord - Twitter



Don't include the .asm, and you should still have the _init and _main.

Basically, if your file tree is set up like this:
Code
uberasm/
 ├── level/
 |    └── LevelCode.asm
 └── library/
      ├── HDMASunsetSky1.asm
      └── autowalking.asm

Then you write LevelCode.asm like this:

Code
init:
	JSL HDMASunsetSky1_init
	JSL autowalking_init
	RTL

main:
	JSL HDMASunsetSky1_main
	JSL autowalking_main
	RTL

If either of these don't actually have an "init" section, though, then remove the call to that (so if "autowalking.asm" doesn't have an init section, remove the "JSL autowalking_init" line).
(same idea in cases where they don't actually have a "main", although these two files sound like they should)

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Also remove the "-" in "HDMA-SunsetSky.asm" and all label references to it or it'll just throw invalid label name errors at you.

So just
Code
init:
	JSL HDMASunsetSky1_init
	JSL autowalking_init
	RTL

main:
	JSL HDMASunsetSky1_main
	JSL autowalking_main
	RTL

but replace the name of the file itself as well.

Quote
(same idea in cases where they don't actually have a "main", although these two files sound like they should)

Unless it's parallax or otherwise animated HDMA it usually just has an init part.
Huh. Well once again, thank you people for helping me solve another problem. Do expect me to come with more problems though because I'm an asm dummy. #smw{@_@}

LINKS -> YouTube - Discord - Twitter

Originally posted by Thomas
Other solution: use the library folder.

Just stick the ASM codes you want in there. Then, make a new ASM file in the Level folder, and write it like this:

Code
init:
	JSL codeA_init
	JSL codeB_init
	; ...
	RTL

main:
	JSL codeA_main
	JSL codeB_main
	; ...
	RTL

...where codeA/codeB/etc. are the names of the ASM files you put in the library folder.
Code
init:
	JSL reloadRoom_init
	JSL Lightning2_init
	RTL

main:
	JSL reloadRoom1_main
	JSL Lightning21_main

	RTL



I would like to have its 2 code for level 105 but it doesn't work because file list I can only put 1 code how can I do it?
here is my list.txt

Code
; Level list. Valid values: 000-1FF.
level:
105             Lightning2.asm             
106             reloadRoom.asm                   
I have been putting some thought on this lately... I think adding some simple support for UberASM Tool doing that automatically for you would be much better. I have addressed it here and if someone would like to suggest an approach for the tool automatically doing it I would appreciate it! :D

But basically for now what you will need to do @yygdrasil is putting both Lightning2.asm and reloadRoom.asm on the library folder and save that code you have posted as "lighting_and_reloadroom.asm" and then add just that ASM file.
GitHub - Twitter - YouTube - SnesLab Discord
Wow It worked! Thanks Thomas!
Originally posted by Thomas
Don't include the .asm, and you should still have the _init and _main.

Basically, if your file tree is set up like this:
Code
uberasm/
 ├── level/
 |    └── LevelCode.asm
 └── library/
      ├── HDMASunsetSky1.asm
      └── autowalking.asm

Then you write LevelCode.asm like this:

Code
init:
	JSL HDMASunsetSky1_init
	JSL autowalking_init
	RTL

main:
	JSL HDMASunsetSky1_main
	JSL autowalking_main
	RTL

If either of these don't actually have an "init" section, though, then remove the call to that (so if "autowalking.asm" doesn't have an init section, remove the "JSL autowalking_init" line).
(same idea in cases where they don't actually have a "main", although these two files sound like they should)


Sorry to bump this crazy old post. But that solution doesnt seem to work for me. Uber keeps saying there is no init found in either of my asm files. But they both do contain an init and main section. Does you or anyone know what the reason could be for it not finding the init section and throwing this error ?


Generally, it's recommended to make a new thread rather than bumping old threads (mainly if you aren't the OP of the thread), or use the general help threads here or here instead.

Anyway, though, assuming you're using the HorzWrap.asm file from this, that one actually doesn't have an init section, so you should remove the call to it. The FreeVerticalScroll.asm file meanwhile actually doesn't have an init section despite what you're seeing in the file, at least not at the time it's actually being assembled. Just above the init line, you'll notice there's an if statement which checks whether the "!NoHorizScroll" define is non-zero. If it is zero, during assembly that code will actually get skipped over (so no init label after all), and checking the define just above it shows that it is indeed set to 0.


As a side note, it's worth noting that the newest version of UberASM Tool (v2.0, current awaiting moderation here) bypasses this issue entirely as it does in fact allow inserting multiple codes to a level right out of the box, no need to do this trick with the library. If you're still in the early stages with your hack, it may be worth trying that one out.

Professional frame-by-frame time wizard. YouTube - Twitter - SMW Glitch List - SMW Randomizer
Originally posted by Thomas
Generally, it's recommended to make a new thread rather than bumping old threads (mainly if you aren't the OP of the thread), or use the general help threads here or here instead.

Anyway, though, assuming you're using the HorzWrap.asm file from this, that one actually doesn't have an init section, so you should remove the call to it. The FreeVerticalScroll.asm file meanwhile actually doesn't have an init section despite what you're seeing in the file, at least not at the time it's actually being assembled. Just above the init line, you'll notice there's an if statement which checks whether the "!NoHorizScroll" define is non-zero. If it is zero, during assembly that code will actually get skipped over (so no init label after all), and checking the define just above it shows that it is indeed set to 0.


As a side note, it's worth noting that the newest version of UberASM Tool (v2.0, current awaiting moderation here) bypasses this issue entirely as it does in fact allow inserting multiple codes to a level right out of the box, no need to do this trick with the library. If you're still in the early stages with your hack, it may be worth trying that one out.


Oh i will follow the newer version then, that would make it easier.

Ahhh, ok. I thought that even though there is a if not check it stil try to initialize the code in memory. But just not execute it. Thats a rookie mistake, my bad..