Advertisement
cryptonberry5

amaraticando

Sep 21st, 2018
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.73 KB | None | 0 0
  1. Each sprite, including both kongs, has a table with 94 bytes to store some informations. Diddy's offset starts at byte $0DE2. Dixie at byte 0xE40 and the other sprites after her. When we refer to $06,X and X is the offset of a sprite, we are talking about its horizontal speed, for example. The absolute address within the WRAM is X + $06 in this case, but it's better to use the relative address.
  2.  
  3. For both Kongs, $48 is an address that is set to zero every time they are shot from a common barrel and to 1 in a bonus barrel. If the Kong are in the rotating state (shot from barrel or from animal barrel) and this value is nonzero, the game thinks the current room is over and sends the Kongs out. If the are in the main room of the level, they go to the overworld.
  4.  
  5. For many sprites (I didn't check all), $48 has a different purpose. It seems to me it's the horizontal speed of oscillation and this is copied from address $26. For most sprites (inclusing the kongs), $26 is the maximum speed allowed right now.
  6.  
  7. The Kutlass can be in many states. Double-bytes $2D (main pointer/status) and $1D (2nd status?) are what matter. The only known status the causes the glitch is when the main status is 6 (just after raising the sword) and the 2nd must be nonzero. The former always happens, but the later requires getting hurt after waiting some time after the attack.
  8.  
  9. -Amaraticando
  10.  
  11.  
  12. Also from Amaraticando, in discord:
  13.  
  14. 6:49 PM] Amaraticando 🗭🍄: I made some trace logging about the kutlass glitch... and I believe the reason is just a confusion between the X and Y registers. One was supposed to be the other.
  15. [8:00 PM] Arnethegreat: lol is that why
  16. [8:00 PM] Arnethegreat: that's pretty funny, could the kutlass set that value for any other sprite too?
  17. [8:15 PM] Amaraticando 🗭🍄: i don't think so, just for the kongs
  18. [8:18 PM] Amaraticando 🗭🍄:
  19. b3c4e1 lda $0048,y [b30e2a] A:7c73 X:0f5a Y:0de2 S:01fc D:0000 DB:b3 nvmxdIzC V: 10 H:1112
  20. b3c4e4 bne $c4ec [b3c4ec] A:0000 X:0f5a Y:0de2 S:01fc D:0000 DB:b3 nvmxdIZC V: 10 H:1182
  21. b3c4e6 lda $0026,y [b30e08] A:0000 X:0f5a Y:0de2 S:01fc D:0000 DB:b3 nvmxdIZC V: 10 H:1194
  22. b3c4e9 sta $0048,y [b30e2a] A:0360 X:0f5a Y:0de2 S:01fc D:0000 DB:b3 nvmxdIzC V: 10 H:1234
  23. later...
  24. bef850 lda $0026,y [b30f80] A:14d0 X:0002 Y:0f5a S:01f5 D:0000 DB:b3 nvmxdIzC V: 14 H: 292
  25. bef853 eor #$ffff A:fec0 X:0002 Y:0f5a S:01f5 D:0000 DB:b3 NvmxdIzC V: 14 H: 332
  26. bef856 inc A:013f X:0002 Y:0f5a S:01f5 D:0000 DB:b3 nvmxdIzC V: 14 H: 350
  27. bef857 sta $0026,y [b30f80] A:0140 X:0002 Y:0f5a S:01f5 D:0000 DB:b3 nvmxdIzC V: 14 H: 362
  28. bef85a sta $0048,y [b30fa2] A:0140 X:0002 Y:0f5a S:01f5 D:0000 DB:b3 nvmxdIzC V: 14 H: 402
  29.  
  30. Where $0f5a is the sprite offset and $0de2 is for diddy.(edited)
  31. [8:21 PM] Amaraticando 🗭🍄: diddy+48 is normally set when he's thrown from a barrel or Cat O' 9 Tails, having value 0 to continue normally and 1 for bonus.
  32.  
  33.  
  34. SIMPLE EXPLANATION FROM AMARATICANDO:
  35.  
  36. [9:48 AM] Amaraticando: Diddy and Dixie have an address (let's call it $48) that is usually 0, but is set to 1 when they are shot from a barrel that goes to another room/bonus. If that address is set to another value after the player is able to go left/right while spinning, the game ends the level.
  37.  
  38. [9:50 AM] Amaraticando: Each sprite has its table within memory. For normal sprites, $48 means another thing, usually related to the speed while oscillating from one side to the other. $26 is the maximum speed this sprite can get right now.
  39. So, the game copies $26 into $48. But due to an oversight, they do it with the wrong register (X and Y registers). So they set $48 for the kong, instead of the sprite.
  40.  
  41. [9:51 AM] Amaraticando: Even so, later on the code, they do the correct thing for the sprite.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement