Language…
9 users online: 1mslakingoff, Isikoro, MarioAndLuigi404, Pawnshow, Saela, Shiki_Makiro, TheNewGuy531268, tOaO,  xHF01x - Guests: 103 - Bots: 94
Users: 70,494 (2,449 active)
Latest user: ODX25

ON/OFF Slippery Activation v2.0

UberASM Repository → ON/OFF Slippery Activation v2.0

Submission Details

Name: ON/OFF Slippery Activation v2.0
Author: Nitrocell Inc.
Added:
Version History: View
Type: Level
Includes GFX: No
Includes Hijack: No
Featured: No
Description: When you hit ON/OFF switch, or change it no matter how, if that's ON, it will turn slippery mode ON, else, slippery will be disabled. By default, it will set ON/OFF status to OFF, and thus, slippery will be disabled.

Update:
In new version you can set if slippery will be activated on ON or OFF and you can force ON/OFF to change onload opposite to slippery specification. For more info, see readme.
Tags: lorom on-off sa-1 slippery
Comments: 3 (jump to comments)
Rating:
0.0 (0 ratings)
No rating
Download 1.40 KiB | 174 downloads

Screenshots

Comments (3)

 Erik Link
Tested with:
- UberASM Tool v2.0
- UberASM Tool v2.1 (under moderation)
- SA-1 v1.40
- Lunar Magic 3.51
- snes9x 1.62.3

I mean, it works as intended, and the update does its job. I found no bugs. This is why I am approving this.
But for such a simple resource, I have a laundry list of complaints. At the end of the day, I thought it would be exaggerated to reject this over such minutia (especially because I found no gameplay issues) but I still think you should address this in another, future update.
  • I have two issues with the code in the load label.
    • The label was still included even if !init_slippery is zero or less. I changed that on the submission.
    • It's redundant to check if the switch is ON. Just store the state of the switch directly, you save the cycles of the comparison as well as some bytes. Consider
      Code
      if !init_slippery > 0
      load:
          if !slippery_activation < 1
              ; Slippery when OFF, so set the switch ON
              STZ $14AF|!addr
          else
              ; Slippery when ON, so set the switch OFF
              LDA #$01
              STA $14AF|!addr
          endif
          RTL
      endif
      as the cleaner way to do this.
  • There really is no need to abuse the size indicators to Asar, the assembler will tell the correct address size in all these loads and stores. I got rid of all those .b and .w indicators. You can do so too, unless there's a section which Asar's parser has trouble identifying the size of.
  • The code's features could benefit from being an UAT extra byte instead of defines so the user can avoid inserting multiple copies of the code with differing values. You could use only one extra byte, with a flag of type ------IS, where I=1 corresponds to !init_slippery > 0, and S=1 corresponds to !slippery_activation < 1. After all, the readme mentions this requires UAT 2.0, but none of the features introduced with said version are used...
  • Finally, and admittedly this is a bit esoteric and may not work in custom ON/OFF modifying resources (it will definitely work in the vanilla game though). The main code doesn't really need branching and can be simplified by taking advantage of what is stored to the ON/OFF flag.
    Code
    ; The logic: $14AF contains 00 if the ON/OFF switch is ON, 01 if OFF.
    ; After a DEC, A now contains FF if the switch is ON, 00 if OFF
    ; We can store this directly to the slippery flag if we want slipperiness when
    ; the switch is ON, *or* invert the result with an xor for the OFF case.
    main:
        LDA $14AF|!addr
        DEC
        if !slippery_activation < 1
            EOR #$FF
        endif
        STA $86
        RTL
    Admittedly, the cycle count loses in the worst case (but 4 bytes are still saved ¯\_(ツ)_/¯) but I think it's more elegant. Again though, I can excuse the branching, because after all, while the vanilla game always has this flag as a binary value, you never know with vanilla resources.

Also minor, but try and record better quality gifs next time. Mesen can help with that, with its integrated video recorder which outputs gifs.
Nitrocell Inc. Author Link
!init_slippery is something I planned to remove but hell I forgot due to rushing. Also, EOR is something that went onto my mind but just decided to make some simpler logic the very beginners can understand (until next update). Thank you, Erik
Burning Loaf From older version: ON/OFF Slippery Activation Link
Tested with:
* Lunar Magic 3.33
* SA-1 Pack 1.40
* Mesen-S 0.4.0
* UberASM Tool 1.5

Works as it should. But there are some slight redundancies in the code, such as the checks and defines for SA-1 (which UberASM Tool already provides by default), how both [DEC : STA $86] and [LDA #$00 : STA $86] could be [STZ $86], and how [CMP #$00 : BNE +] could be just [BNE +]