We've just updated MediaWiki and its underlying software. If anything doesn't look or work quite right, please mention it to us. --RanAS
Useful Code Snippets: Difference between revisions
From SnesLab
Vitor Vilela (talk | contribs) (Split by category) |
Vitor Vilela (talk | contribs) (Add GPS/BTSD block template) |
||
Line 28: | Line 28: | ||
EOR #$FFFF | EOR #$FFFF | ||
INC | INC | ||
</pre> | |||
=== SMW Hacking === | |||
==== Custom block template ==== | |||
by [[User:Alcaro|Alcaro]] | |||
<pre> | |||
db $42 ; or db $37 | |||
JMP MarioBelow : JMP MarioAbove : JMP MarioSide | |||
JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball | |||
JMP TopCorner : JMP BodyInside : JMP HeadInside | |||
; JMP WallFeet : JMP WallBody ; if using db $37 | |||
MarioBelow: | |||
MarioAbove: | |||
MarioSide: | |||
TopCorner: | |||
BodyInside: | |||
HeadInside: | |||
WallFeet: | |||
WallBody: | |||
SpriteV: | |||
SpriteH: | |||
MarioCape: | |||
MarioFireball: | |||
RTL | |||
</pre> | </pre> | ||
Revision as of 01:20, 26 July 2019
Useful code snippets for the 65c816 ASM and general SNES hardware.
65c816 S-CPU
General
Wait for H-Blank
- BIT $4212 BVS - - BIT $4212 BVC -
Inverse the accumulator (8-bit)
EOR #$FF INC
Inverse the accumulator (16-bit)
EOR #$FFFF INC
SMW Hacking
Custom block template
by Alcaro
db $42 ; or db $37 JMP MarioBelow : JMP MarioAbove : JMP MarioSide JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireball JMP TopCorner : JMP BodyInside : JMP HeadInside ; JMP WallFeet : JMP WallBody ; if using db $37 MarioBelow: MarioAbove: MarioSide: TopCorner: BodyInside: HeadInside: WallFeet: WallBody: SpriteV: SpriteH: MarioCape: MarioFireball: RTL
65c816 SA-1 CPU
General
Unsigned 16 bit x 16 bit = 32 bit multiplication
by Akaginite
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; 16bit * 16bit Multiplication SA-1 version ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Parameters ; $00-$01 : Multiplicand ; $02-$03 : Multiplier ; Return values ; $04-$07 : Product ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MathMul16_16: STZ $2250 REP #$20 LDA $00 STA $2251 ASL A LDA $02 STA $2253 BCS + LDA.w #$0000 + BIT $02 BPL + CLC ADC $00 + CLC ADC $2308 STA $06 LDA $2306 STA $04 SEP #$20 RTS