Advertisement
Telinc1

Bugged Block Code

May 26th, 2012
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. ;a regular coin
  2. ;by Iceguy
  3. ;to be used with BTSD
  4.  
  5. ;NOTE: YOU CAN REPLACE TILE 2B WITH THIS BLOCK, AND MAKE IT ACT LIKE TILE 25!
  6.  
  7.  
  8. !COIN_TO_GIVE = $05 ;# of coins to give (1)
  9. ;DO NOT ADD A STUPID VALUE LIKE 1321 OTHERWISE IT WILL NOT
  10. ;WORK!
  11.  
  12. !SOUND = $01 ;sound to play for a coin
  13. !PORT = $1DFC ;which port to play from
  14. !1_UP_SFX = $05 ;sound to play for the 1up (100 coins)
  15. !1_UP_PORT = $1DFC ;1up port
  16. !1_UP_COINS = $64 ;coins needed for a 1-up, and resetting the counter
  17. ;it's in hex (64 = 100 in dec)
  18. !1_UPS = $01 ;1ups to give when collecting 100 coins
  19.  
  20. db $42
  21. JMP Main : JMP Main : JMP Main : JMP return : JMP return : JMP return : JMP return
  22. JMP Main : JMP Main : JMP Main
  23.  
  24. MakeSolid:
  25. LDY #$01
  26. LDA #$30
  27. STA $1693
  28. RTL
  29.  
  30. Main:
  31. LDA $14AD
  32. BNE MakeSolid
  33. LDA #!SOUND
  34. STA !PORT ;play the sfx of a regular coin
  35. LDA #!COIN_TO_GIVE ;add coins
  36. STA $13CC
  37.  
  38. ;this is so that a glitter effect is played when collecting
  39. ;a coin
  40.  
  41. LDA $7F
  42. ORA $81
  43. BNE return
  44. LDY #$03
  45. LoopStart:
  46. LDA $17C0,Y
  47. BEQ CreateGlitter
  48. DEY
  49. BPL LoopStart
  50.  
  51. CreateGlitter:
  52. LDA #$05
  53. STA $17C0,Y
  54. LDA $9A
  55. AND #$F0
  56. STA $17C8,Y
  57. LDA $98
  58. AND #$F0
  59. STA $17C4,Y
  60. LDA $1933
  61. BEQ ADDR_00FD97
  62. LDA $9A
  63. SEC
  64. SBC $26
  65. AND #$F0
  66. STA $17C8,Y
  67. LDA $98
  68. SEC
  69. SBC $28
  70. AND #$F0
  71. STA $17C4,Y
  72. ADDR_00FD97:
  73. LDA #$10
  74. STA $17CC,Y
  75.  
  76. LDA $0DBF ;
  77. ;this is so that the counter does not display hex
  78. CMP #!1_UP_COINS ;and go to values above 99 (like A0, B5, I4 etc.)
  79. BEQ STZ_COIN
  80. BCS STZ_COIN
  81. BNE ERASE_COIN
  82.  
  83. STZ_COIN:
  84. LDA $0DBE
  85. CLC
  86. ADC #!1_UPS ;add 1-ups
  87. STA $0DBE
  88. LDA #!1_UP_SFX
  89. STA !1_UP_PORT
  90. STZ $0DBF ;completely erase coin counter
  91. PHY ;preserve map16 high
  92. LDA #$02 ;erase self
  93. STA $9C
  94. JSL $00BEB0 ;generate blank block
  95. PLY ;restore map16 high
  96. RTL
  97.  
  98. ERASE_COIN:
  99. PHY ;preserve map16 high
  100. LDA #$02 ;erase self
  101. STA $9C
  102. JSL $00BEB0 ;generate blank block
  103. PLY ;restore map16 high
  104. RTL
  105.  
  106. return:
  107. RTL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement