Very interesting, I'm excited to see someone looking into it.
As said, different enemies would give different effects, but the same specific enemy would in most cases give the same specific effect. My wild guess would be it involves something with the values of what screen you're on. In the same rooms, I could get each enemy to give the same result each time, and the longer, scrolling rooms are where multiple effects can happen. Similarly, I haven't found any cases where this glitch can be triggered in rooms near the beginning of the level, perhaps when the address is 00?
I'm also assuming based on that piece of code that there's no other way to trigger the glitch other than having no weapons, which is also good information.
Would this mean that there are a total of 256 possible effects from this glitch? 9 would be from weapons under normal circumstances, and I would guess the majority of the rest would cause odd effects.
Perhaps it would also be possible to skip the other 7 Robot Masters by refilling their energies. I'm guessing that the game just checks what weapons have ammo for determining which you should have, and has some other flag for empty weapons.
I'm assuming a lot here since I don't have the assembly code handy, but I think a lot of it could turn out correct.
Edit: I was messing around with this some more and managed to get a
softlock on the password screen. When I initially experimented with the glitch, I did notice getting multiple passwords for the same settings, but didn't think much of it. It's likely that the game gets stuck when it fails creating a password, which could actually hinder a lot of the possibilities.
I believe that I got this from playing out Wind Man's stage as seen in my TAS, dying, and then killing the second panda robot twice for two small energy capsules.