smw credits glitch strategy documentation

Masterjun Jul 29th, 2014 46,560 Never
  1. As usual, chuck glitch makes the code jump to
  2. $014A13
  3. which is open bus so it executes the last value on data bus which is 0x01 (the bank from the jump that just occured) or as an instruction
  5. ORA ($01,x)
  7. and since the chuck spawns in slot #9, X is also 0x09 meaning we have to look at the address in $0A (1+9=A)
  8. ORA ($0A)
  9. which is set by the xposition of the lowest sprite ID that is still existent + 2.
  10. this sprite is the pswitch in slot #7 that is at xposition 3250 or 0x0CB2 which makes $0A hold 0x0CB4 so
  11. ORA $0CB4
  12. now $0CB4 holds some decompressed graphics value for tiles so it's always the same value in that level, which is 0xFC so data bus is now 0xFC which means the next instruction is
  14. JSR (addr,X)
  16. usually addr would be $FCFC because of open bus, but the SNES does stuff in a different order when dealing with jumps
  17. 1. the low byte of the new address is read -> data bus is still 0xFC -> addr is $xxFC
  18. 2. the high byte of the old address is pushed to stack -> data bus turns to 0x4A (because $4A17)
  19. 3. the low byte of the old address is pushed to stack -> data bus turns to 0x17 (because $4A17)
  20. 4. the high byte of the new address is read -> data bus is now 0x17 -> addr is $17FC
  21. since X is still 0x09 the resulting address is 17FC+9=1805
  22. JSR ($1805)
  23. $1805 is inside the yposition (low byte) table for minor extended sprites (dust clouds, coin sparkles, etc)
  24. so 2 ypositions have to be set up to get E4 00 forming an address of $00E4 (the 0xE4 can also be a bit lower, but then it will run over code that could ruin the setup)
  25. JSR $00E4
  26. $00E4 is the xposition (low byte) table of normal sprites where you can write code by despawning (destroying) sprites in different slots and then making sure no other sprite spawns in that slot
  27. so say you destroy sprites in slot #1 and #2 at xposition 0x68, #3 in 0x4A, #4 in 0x92, #5 in 0x75 and #6 in 0x60 which forms the code
  29. PLA : PLA : LSR A : STA ($75) : RTS
  31. PLA : PLA
  32. that effectively gets rid of the wrong stack address (we don't want to return to open bus) and because of $4A17 that was on the stack, A is now 0x4A
  33. LSR A
  34. shifts A one bit to the right, meaning the same as dividing by 2 so A is now 0x25
  35. STA ($75)
  36. $75 is 0x01 when in water and 0x00 when not, $76 is 0x01 when facing right and 0x00 when left so facing right makes that a
  37. STA $0100
  38. $0100 is the game mode and is set to 0x25 which is the ending with the enemies
  39. RTS
  40. returns to the place that would have been normally executed if Yoshi had eaten a usual powerup
  42. Game Mode changed -> Enemies show
  43. THE END
  44. ----------------------------------------------------------------
  45. Simple isn't it?
  46. Just set up the pswitch in slot #7 at a pixel perfect xposition.
  47. Then manipulate two minor extended sprite ypositions.
  48. Additionally write code with 6 xpositions of sprites, pixel perfect of course.
  49. Finally just do the chuck glitch while facing right.
  51. (oh and of course always keep track of the sprite slots and don't you dare overwrite one of the values because you accidentally spawned a sprite or collected a coin)
RAW Paste Data