;Prevents falling through floor when a downward wind pushes ;you downward !Freeram_NewSpd = $60 ;>4 bytes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;SA1 detector: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; if read1($00FFD5) == $23 !SA1 = 1 sa1rom else !SA1 = 0 endif ; Example usage if !SA1 ; SA-1 base addresses ;Give thanks to absentCrowned for this: ;http://www.smwcentral.net/?p=viewthread&t=71953 !Base1 = $3000 ;>$0000-$00FF -> $3000-$30FF !Base2 = $6000 ;>$0100-$0FFF -> $6100-$6FFF and $1000-$1FFF -> $7000-$7FFF else ; Non SA-1 base addresses !Base1 = $0000 !Base2 = $0000 endif ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Hijack(s) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; org $00EE85 autoclean JML RelativeYSpdL1 freecode ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;Main code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; RelativeYSpdL1: PHB PHK PLB LDX #$02 JSL CalculateXNetVelocity LDA $0A PLB BPL .SolidTop .PassableBelow JML $00EE89 .SolidTop JML $00EE8F CalculateXNetVelocity: ;>This was needed to prevent wall clipping death ;Input: ;X=#$00 = x speed ;X=#$02 = y speed ;output: ;$00 = 16-bit x speed ;$02 = 16-bit y speed ;$04 = 16-bit new x speed ;$06 = 16-bit new y speed ;$08 = relative x speed with Layer1 ;$0A = relative y speed with Layer1 ;This was needed so when mario stops being pushed, ;he'll have momentum from it. .ConvertMarioSpd16Bit LDA $7B,x JSR Convert16Bit LDA $7B,x REP #$20 STA $00,x ;>Player speed $00 and $02 SEP #$20 .ConvertNewSpd16Bit LDA !Freeram_NewSpd,x JSR Convert16Bit LDA !Freeram_NewSpd,x REP #$20 STA $04,x ;>Push speed $04 and $06 .CalculateNetVel CLC ADC $00,x STA $08,x ;>Speed relative to Layer1 $08 and $0A SEP #$20 RTS Convert16Bit: ;Input: A (8-bit) = the signed value ;Output: A (Load it as 8-bit before REP #$20) = the equivalent signed ;value (#$00XX or #$FFXX) ;Note: will not work if value is #$00XX where XX is 80 to FF or #$FFXX ;where XX is #$00 to #$7F BMI .Negative .Positive LDA #$00 BRA .SetHighByte .Negative LDA #$FF .SetHighByte XBA RTS