Guest User

Zelda 2 Redux - FDS Battle Theme in East Hyrule

a guest
Oct 28th, 2020
120
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //***********************************************************
  2. //  FDS Battle Theme in East Hyrule (by IcePenguin)
  3. //***********************************************************
  4.  
  5. bank 0;
  6. // Jump to change overworld music
  7. org $8891   // 0x008A1
  8.     jsr l_A8F0  // Originally LDA #$02, STA #$EB
  9.     nop
  10.  
  11. // Overworld music change routine by IcePenguin
  12. org $A8F0   // 0x02900
  13. l_A8F0:
  14.     lda.w $0707 // Load current world
  15.     sta.w $0702 // Store at $0702
  16.     lda.b #$02  // Load music entry $02
  17.     sta.b $EB   // Store in music address at RAM
  18.     rts
  19.  
  20.     fill $05,$FF
  21. l_A900:
  22.     ldx.w $0707 // Load current world
  23.     cpx.b #$00
  24.     bne world0  // BNE $07, Branch if not world $00
  25.     ldx.w $0706 // Load current region (East/West Hyrule)
  26.     cpx.b #$02  // Compare if its $02 (East Hyrule)
  27.     beq east    // BEQ $04
  28. world0:
  29.     sta.w $075F // Music to play address
  30.     rts
  31. east:
  32.     lda.b #$08  // Load music entry $08
  33.     sta.w $075F // Music to play address
  34.     rts
  35.  
  36. bank 6;
  37. // Music data modifications
  38. org $9489   // 0x19499
  39.     jsr l_9DC0
  40.     nop
  41.  
  42. org $9DC0   // 0x19DD0
  43. l_9DC0:
  44.     lda.b #$02
  45.     cmp.w $0706 // Compare if current region = $02
  46.     beq l_9DCC  // BEQ $05, Branch to $9DCC
  47.     lda.b #$04  // Load song $04
  48.     sta.b $EB   // Store to music address
  49.     rts
  50. l_9DCC:
  51.     lda.b #$08  // Load song $08
  52.     sta.b $EB   // Store to music address
  53.     lda.b #$00
  54.     sta.w $0702 // Store to $0702
  55.     rts
  56.  
  57. org $A000   // 0x1A010
  58. // Table for ?, Related to Music
  59.     db $08,$0A,$17,$1E,$1C,$2E,$2E,$2E
  60.     db $2F,$00,$35,$35,$3B,$41,$3B,$47
  61.     db $4D,$4D,$53,$59,$53,$5F,$00,$65
  62.     db $6B,$71,$77,$00,$7D,$00,$88,$88
  63.     db $8E,$8E,$88,$88,$8E,$8E,$94,$94
  64.     db $9A,$9A,$94,$94,$9A,$9A,$00
  65. // Intro - Part 1 (08 - 1F)
  66.     db $18      // Offset for Not-Lengths
  67.     dw $B073    // Pointer to Square 1
  68.     db $4B      // Offset for Square 2
  69.     db $27      // Offset for Triangle
  70.     db $68      // OFfset for Noise
  71. // Intro - Part 2 (0A - 25)
  72.     db $18
  73.     dw $B0EB
  74.     db $3C
  75.     db $1D
  76.     db $56
  77. // Header for ? (0C -> 2B)
  78.     db $18
  79.     dw $B148
  80.     db $16
  81.     db $0A
  82.     db $24
  83. // Header for ? (31)
  84.     db $18
  85.     dw $B173
  86.     db $1D
  87.     db $0D
  88.     db $28
  89. // Header for ? (37)
  90.     db $18
  91.     dw $B1A2
  92.     db $25
  93.     db $13
  94.     db $31
  95. // Header for ? (3D)
  96.     db $18
  97.     dw $B1DA
  98.     db $0F
  99.     db $08
  100.     db $1B
  101. // Header for ? (43)
  102.     db $18
  103.     dw $B1FC
  104.     db $19
  105.     db $0D
  106.     db $1D
  107. // Header for ? (49)
  108.     db $18
  109.     dw $B21D
  110.     db $1D
  111.     db $0D
  112.     db $21
  113. // Header for ? (4F)
  114.     db $18
  115.     dw $B242
  116.     db $0D
  117.     db $09
  118.     db $15
  119. // Header for ? (55)
  120.     db $08
  121.     dw $B25F
  122.     db $17
  123.     db $0C
  124.     db $2F
  125. // Header for ? (5B)
  126.     db $08
  127.     dw $B295
  128.     db $1A
  129.     db $0D
  130.     db $32
  131. // Header for ? (64)
  132.     db $08
  133.     dw $B2CE
  134.     db $31
  135.     db $19
  136.     db $51
  137. // Header for ? (6A)
  138.     db $08
  139.     dw $B326
  140.     db $3F
  141.     db $20
  142.     db $60
  143. // Header for ? (70)
  144.     db $18
  145.     dw $B3B1
  146.     db $11
  147.     db $09
  148.     db $00
  149.  
  150.     db $42,$A2,$0D,$09,$15,$10,$5F,$A2
  151.     db $07,$04,$00,$10,$6C,$A2,$07,$04
  152.     db $00,$10,$79,$A2,$0D,$07,$00,$10
  153.     db $8B,$A2,$0D,$07,$00,$10
  154.  
  155. org $A0A1   // 0x1A0B1
  156.     fillto $A24A,$FF
  157.  
  158. org $A25F   // 0x1A26F
  159.     db $1B,$19,$D6,$00,$11,$0F,$CC,$DA
  160.     db $9A,$DA,$9A,$9A,$9A,$21,$1F,$DC
  161.     db $00,$17,$15,$D2,$E0,$A0,$E0,$A0
  162.     db $A0,$A0,$9A,$A0,$A6,$EC,$A6,$E0
  163.     db $00,$94,$9A,$A0,$E6,$A0,$DA,$9A
  164.     db $DA,$E0,$9A,$E6,$98,$9E,$A4,$EA
  165.     db $A4,$DE,$00,$92,$98,$9E,$E4,$9E
  166.     db $D8,$98,$D8,$DE,$98,$E4,$AC,$A4
  167.     db $9A,$AE,$A4,$9E,$33,$43,$00
  168.  
  169. org $A2A6   // 0x1A2B6
  170.     fillto $A3B9,$FF
  171.  
  172. org $B072   // 0x1B082
  173.     db $00
  174. l_B073:
  175.     db $5B,$83,$83,$9B,$9B,$9B,$9B,$9B
  176.     db $83,$97,$DA,$83,$83,$9B,$9B,$9B
  177.     db $9B,$9B,$83,$97,$DA,$83,$83,$9B
  178.     db $9B,$9B,$9B,$9A,$10,$10,$90,$10
  179.     db $10,$90,$10,$10,$90,$90,$00,$4B
  180.     db $83,$83,$8B,$8B,$8B,$8B,$87,$83
  181.     db $87,$C6,$C2,$87,$87,$87,$89,$83
  182.     db $89,$C8,$83,$83,$89,$89,$89,$89
  183.     db $88,$04,$04,$84,$04,$04,$84,$04
  184.     db $04,$84,$84,$DA,$9B,$9B,$9B,$DA
  185.     db $9B,$9B,$9B,$D6,$97,$97,$97,$D6
  186.     db $97,$97,$97,$D2,$93,$93,$93,$D2
  187.     db $93,$93,$93,$D0,$D0,$D0,$94,$98
  188.     db $C8,$C8,$C8,$C8,$C8,$C8,$C8,$C8
  189.     db $C8,$C8,$C8,$C8,$C8,$C8,$C8,$C8
  190.  
  191. org $B0EB   // 0x1B0EB
  192. l_B0EB:
  193.     db $63,$42,$22,$A3,$A5,$A9,$6E,$1A
  194.     db $6C,$1A,$68,$1A,$64,$1A,$62,$1E
  195.     db $63,$B3,$B3,$B3,$E8,$B3,$B3,$B3
  196.     db $E8,$B3,$B3,$B3,$00,$D0,$95,$91
  197.     db $8F,$50,$10,$91,$95,$A3,$5A,$14
  198.     db $5A,$14,$5A,$14,$5A,$14,$50,$10
  199.     db $51,$A9,$A9,$A9,$E2,$A9,$A9,$A9
  200.     db $E2,$A9,$A9,$A9,$DA,$9B,$9B,$9B
  201.     db $E2,$DA,$E4,$E4,$E4,$E4,$DA,$9B
  202.     db $9B,$9B,$DA,$B9,$B9,$B9,$F2,$B9
  203.     db $B9,$B9,$F2,$B9,$B9,$B9,$C8,$89
  204.     db $89,$89,$C8,$C8,$00
  205. l_B148:     // 0x1B158
  206.     db $5F,$42,$22,$64,$2C,$FA,$F8,$F6
  207.     db $F2,$00,$CC,$91,$8D,$8B,$4C,$10
  208.     db $54,$24,$EC,$E8,$EC,$E2,$DE,$9F
  209.     db $9F,$9F,$DE,$DE,$9F,$9D,$9F,$E2
  210.     db $A5,$A3,$A5,$EC,$C8,$89,$89,$89
  211.     db $C8,$C8,$00
  212. l_B173:     // 0x1B183
  213.     db $6E,$2E,$EC,$42,$24,$A5,$A9,$AD
  214.     db $6C,$2C,$69,$C2,$00,$5E,$1E,$DA
  215.     db $42,$1A,$95,$9B,$A5,$62,$22,$22
  216.     db $20,$22,$24,$E2,$DA,$E4,$A5,$9B
  217.     db $A5,$EC,$E4,$5A,$1A,$E2,$E8,$DA
  218.     db $C8,$89,$89,$89,$C8,$C8,$00
  219. l_B1A2:     // 0x1B1B2
  220.     db $B1,$AD,$B1,$E8,$42,$1E,$9F,$9F
  221.     db $9F,$99,$95,$99,$D0,$42,$10,$91
  222.     db $91,$91,$00,$9F,$9F,$9F,$DE,$42
  223.     db $18,$99,$99,$99,$87,$87,$87,$C6
  224.     db $42,$06,$87,$87,$87,$D0,$99,$97
  225.     db $99,$DE,$E4,$E8,$A5,$A3,$A5,$D8
  226.     db $D0,$C8,$89,$89,$89,$C8,$C8,$00
  227. l_B1DA:     // 0x1B1EA
  228.     db $5B,$C2,$E4,$64,$24,$63,$C2,$00
  229.     db $4B,$C2,$D4,$54,$14,$51,$C2,$DA
  230.     db $9B,$9B,$9B,$DA,$DA,$DA,$9B,$9B
  231.     db $9B,$DA,$DA,$C8,$89,$89,$89,$C8
  232.     db $C8,$00
  233. l_B1FC:     // 0x1B20C
  234.     db $9F,$A5,$AD,$B3,$AD,$A5,$9F,$A5
  235.     db $AD,$B3,$AD,$A5,$00,$95,$9F,$A5
  236.     db $AD,$A5,$9F,$95,$9F,$A5,$AD,$A5
  237.     db $9F,$5F,$C2,$24,$6C,$49,$C0,$08
  238.     db $48
  239. l_B21D:     // 0x1B22D
  240.     db $B7,$B9,$B7,$B3,$B7,$B3,$B1,$B3
  241.     db $B1,$AD,$B1,$AD,$00,$24,$2C,$24
  242.     db $2C,$24,$2C,$24,$2C,$1E,$24,$1E
  243.     db $24,$1E,$24,$1E,$24,$5F,$C2,$24
  244.     db $6C,$49,$C0,$08,$48
  245. l_B242:     // 0x1B252
  246.     db $70,$32,$6C,$30,$68,$2C,$64,$28
  247.     db $00,$E8,$E4,$DE,$D8,$50,$18,$58
  248.     db $1E,$5E,$18,$64,$10,$48,$08,$48
  249.     db $08,$48,$08,$48,$08
  250. l_B25F:     // 0x1B26F
  251.     db $1F,$2D,$29,$25,$E2,$DA,$1F,$33
  252.     db $31,$29,$6D,$00,$15,$1F,$1F,$1F
  253.     db $D4,$D4,$15,$1F,$1F,$1F,$5F,$DE
  254.     db $AC,$DE,$AC,$9E,$AC,$DE,$AC,$DE
  255.     db $AC,$9E,$AC,$DE,$AC,$DE,$AC,$9E
  256.     db $AC,$DE,$AC,$DE,$AC,$9E,$AC,$C8
  257.     db $88,$C8,$88,$88,$88,$00
  258. l_B295:     // 0x1B2A5
  259.     db $1B,$29,$25,$63,$82,$DE,$1B,$2F
  260.     db $EC,$29,$25,$E2,$00,$11,$1B,$1B
  261.     db $5B,$82,$82,$D0,$11,$23,$E2,$23
  262.     db $1B,$9A,$DA,$A8,$DA,$A8,$9A,$A8
  263.     db $DA,$A8,$DA,$A8,$9A,$A8,$DA,$A8
  264.     db $DA,$A8,$9A,$A8,$DA,$A8,$DA,$A8
  265.     db $9A,$A8,$C8,$88,$C8,$88,$88,$88
  266.     db $00
  267. l_B2CE:     // 0x1B2DE
  268.     db $57,$C2,$DA,$1F,$23,$E4,$61,$C2
  269.     db $E4,$29,$2D,$EE,$2D,$63,$82,$C2
  270.     db $29,$2F,$2D,$63,$82,$C2,$33,$33
  271.     db $00,$4D,$C2,$D6,$17,$17,$DE,$57
  272.     db $C2,$D6,$21,$21,$E8,$23,$5D,$82
  273.     db $C2,$23,$29,$23,$5D,$82,$C2,$31
  274.     db $31,$D6,$9E,$25,$EE,$D6,$9E,$25
  275.     db $EE,$E0,$90,$17,$E0,$E0,$90,$17
  276.     db $E0,$D4,$9C,$23,$E8,$D4,$9C,$23
  277.     db $E8,$D4,$9C,$23,$E8,$D4,$9C,$23
  278.     db $E8,$C8,$88,$C8,$88,$88,$88,$00
  279. l_B326:     // 0x1B336
  280.     db $57,$C2,$DA,$1F,$23,$E4,$63,$C2
  281.     db $E4,$29,$2D,$EE,$EC,$A8,$EC,$A8
  282.     db $AC,$A8,$EC,$A8,$EC,$A8,$AC,$A8
  283.     db $B2,$F2,$F2,$F2,$B2,$6D,$43,$00
  284.     db $4D,$C2,$D6,$17,$17,$DE,$5B,$C2
  285.     db $DE,$23,$25,$E8,$DC,$9C,$DC,$9C
  286.     db $9C,$9C,$DC,$9C,$DC,$9C,$9C,$9C
  287.     db $A8,$E8,$E8,$E8,$A8,$5D,$43,$D6
  288.     db $9E,$25,$EE,$D6,$9E,$25,$EE,$DA
  289.     db $A2,$29,$F2,$DA,$A2,$29,$F2,$D4
  290.     db $9C,$23,$E8,$D4,$9C,$23,$E8,$94
  291.     db $D4,$D4,$D4,$94,$D4,$D4,$9C,$23
  292.     db $C8,$88,$C8,$88,$88,$88,$C8,$88
  293.     db $C8,$88,$88,$88,$C8,$88,$C8,$88
  294.     db $88,$88,$C8,$88,$C8,$88,$88,$88
  295.     db $C8,$88,$C8,$88,$88,$88,$C8,$88
  296.     db $C8,$88,$88,$88,$88,$C8,$C8,$C8
  297.     db $88,$49,$41
  298. l_B3B1:     // 0x1B3C1
  299.     db $AC,$A4,$9A,$AE,$A4,$9E,$33,$43
  300.     db $00,$A4,$9A,$94,$A4,$9E,$96,$2D
  301.     db $43,$B2,$AC,$A4,$B6,$AE,$A4,$3B
  302.     db $43,$08,$0A,$15,$15,$17,$19,$19
  303.     db $19,$1A,$00
  304.  
  305.  
  306. bank 7;
  307. // Move pointer to music data (and the data itself) 0x30 bytes below to avoid collide with Exp hacks
  308. org $C436   // 0x1C446
  309.     jsr l_A900  // Originally STA $075F
  310. // Related to the Battle Theme music
  311. org $CBAA   // 0x1CBBA
  312.     jsr l_FEAA  // Originally STA $0707
  313. org $CBC8   // 0x1CBD8
  314.     jsr l_FEB4  // Originally LDA #$04 (Load Battle theme)
  315.     nop     // Originally STA $075F (Music to play)
  316.     nop
  317.  
  318. // Routine for loading new battle theme into East Hyrule
  319. org $FEAA   // 0x1FEBA
  320. l_FEAA:
  321.     sta.w $0707 // Store current world
  322.     lda.w $0707 // Load current world
  323.     sta.w $0702 // Store ???
  324.     rts
  325. l_FEB4:
  326.     lda.b #$02  // Load $02 into accumulator
  327.     cmp.w $0706 // Compare if we are at East Hyrule
  328.     beq l_FEC1  // BEQ $06, Branch if at East Hyrule
  329.     lda.b #$04  // Load normal battle theme ($04)
  330.     sta.w $075F // Store into music address
  331.     rts
  332. l_FEC1:
  333.     lda.b #$08  // Load new battle theme ($08)
  334.     sta.w $075F // Store into music address
  335.     lda.b #$00  // Load $00 into accumulator
  336.     sta.w $0702 // Store ???
  337.     rts
  338.  
RAW Paste Data