Users browsing this thread: 1 Guest(s)
Breath of Fire SPC and BRR info

#1
Posts: 3,298
Threads: 248
Thanks Received: 539
Thanks Given: 178
Joined: Oct 2011
Reputation: 54
Status
Faith
I started playing with BoF to find songs and BRR samples data. All writes to SPC-700 ($2140 to $2143) is done in the same routine below. I found song data pointers and what I think is BRR related pointers (2 groups) but it's hard to tell after this what is going on. It reminds me of SoE structure a bit.This is enough for today.

Edit: I played more with this and updated notes but it's the best I can do without debugging when a song is loaded, debugger will be for another day..

Download:
.zip  bof-notes.zip (3.21 KB, 2 downloads)


SPC routine
Code:
05/5CBE: A2 0F 00       LDX #$000F
05/5CC1: BF CD DC 8A    LDA $8ADCCD,x
05/5CC5: 9F F0 FF 7E    STA $7EFFF0,x
05/5CC9: CA             DEX
05/5CCA: 10 F5          BPL $5CC1
05/5CCC: 60             RTS

some table
05/5CDD:
49 4E
49 54
4F 4B
21 21
00 00
00 00
00 10
10 00

05/5CDD: AF F9 FF 7E    LDA $7EFFF9
05/5CE1: D0 18          BNE $5CFB
05/5CE3: A9 00          LDA #$00        (load from 08/8000 pointer region, i.e. offset 08/80DE)
05/5CE5: A0 F9 00       LDY #$00F9
05/5CE8: 20 FC DC       JSR $DCFC       (05/5CFC)
05/5CEB: A9 01          LDA #$01        (load from 08/8003 pointer region, i.e. offset 08/8B35)
05/5CED: A0 F9 00       LDY #$00F9
05/5CF0: 20 FC DC       JSR $DCFC       (05/5CFC)
05/5CF3: A9 02          LDA #$02        (load from 08/8006 pointer region, i.e. offset 08/9CEE)
05/5CF5: A0 F9 00       LDY #$00F9
05/5CF8: 20 FC DC       JSR $DCFC       (05/5CFC)
05/5CFB: 60             RTS

05/5CFC: 08             PHP
05/5CFD: 84 02          STY $02
05/5CFF: C2 30          REP #$30
05/5D01: 29 FF 00       AND #$00FF
05/5D04: C9 10 00       CMP #$0010      (if A below $10, so either #$00, #$01 or #$02, load data from first 3 pointers)
                                       (if A equal or is higher than $10, load a song pointer, first being at 08/8033)
05/5D07: 90 01          BCC $5D0A      
05/5D09: 1A             INC
05/5D0A: 85 00          STA $00
05/5D0C: 0A             ASL
05/5D0D: 65 00          ADC $00         (A * 3)
05/5D0F: AA             TAX
05/5D10: BF 00 80 91    LDA $918000,x   (get first two bytes of pointer)
05/5D14: 29 FF 7F       AND #$7FFF      (remove $8000 from pointer if necessary, e.g. $80DE -> $00DE)
05/5D17: A8             TAY
05/5D18: A9 00 80       LDA #$8000
05/5D1B: 85 10          STA $10
05/5D1D: E2 20          SEP #$20        (8-bit accumulator)
05/5D1F: BF 02 80 91    LDA $918002,x   (get last byte of pointer)
05/5D23: 09 80          ORA #$80        (add $80 to bank number if necessary, e.g. $11 -> $91)
05/5D25: 85 12          STA $12
05/5D27: 8A             TXA
05/5D28: F0 0E          BEQ $5D38       (branch if we are dealing with first pointer at 08/8000)
05/5D2A: AF FB FF 7E    LDA $7EFFFB
05/5D2E: CD 42 21       CMP $2142
05/5D31: D0 FB          BNE $5D2E
05/5D33: A5 02          LDA $02
05/5D35: 8D 40 21       STA $2140       (done only if we are not dealing with first pointer)
05/5D38: C2 20          REP #$20        (16-bit accumulator)
05/5D3A: A9 AA BB       LDA #$BBAA
05/5D3D: CD 40 21       CMP $2140
05/5D40: D0 FB          BNE $5D3D
05/5D42: E2 20          SEP #$20        (8-bit accumulator)
05/5D44: A9 CC          LDA #$CC
05/5D46: 80 34          BRA $5D7C

05/5D48: B7 10          LDA [$10],y
05/5D4A: C8             INY
05/5D4B: 10 05          BPL $5D52
05/5D4D: A0 00 00       LDY #$0000
05/5D50: E6 12          INC $12
05/5D52: EB             XBA
05/5D53: A9 00          LDA #$00
05/5D55: 80 12          BRA $5D69

05/5D57: EB             XBA
05/5D58: B7 10          LDA [$10],y
05/5D5A: C8             INY
05/5D5B: 10 05          BPL $5D62
05/5D5D: A0 00 00       LDY #$0000
05/5D60: E6 12          INC $12
05/5D62: EB             XBA
05/5D63: CD 40 21       CMP $2140
05/5D66: D0 FB          BNE $5D63
05/5D68: 1A             INC
05/5D69: C2 20          REP #$20
05/5D6B: 8D 40 21       STA $2140
05/5D6E: E2 20          SEP #$20
05/5D70: CA             DEX
05/5D71: D0 E4          BNE $5D57
05/5D73: CD 40 21       CMP $2140
05/5D76: D0 FB          BNE $5D73
05/5D78: 69 03          ADC #$03
05/5D7A: F0 FC          BEQ $5D78

05/5D7C: 48             PHA             (from 05/5D46)
05/5D7D: B7 10          LDA [$10],y     (load first byte of block size, e.g. byte at 91/80DE = 08/80DE)
05/5D7F: EB             XBA             (swap, e.g. 0004 -> 0400)
05/5D80: C8             INY             (point to 2nd byte of block size)
05/5D81: 10 05          BPL $5D88       (branch if Y <= $7FFF)
05/5D83: A0 00 00       LDY #$0000
05/5D86: E6 12          INC $12         (if Y == $8000, set to $0000 and switch to next bank)  
05/5D88: B7 10          LDA [$10],y     (load second byte of block size, e.g. byte at 91/80DF = 08/80DF)
05/5D8A: EB             XBA             (swap, e.g. 04AA -> AA04)
05/5D8B: AA             TAX             (set block size as counter)
05/5D8C: C8             INY
05/5D8D: 10 05          BPL $5D94       (branch if Y <= $7FFF)
05/5D8F: A0 00 00       LDY #$0000
05/5D92: E6 12          INC $12         (if Y == $8000, set to $0000 and switch to next bank)
05/5D94: B7 10          LDA [$10],y     (load 1st byte of data block or song, e.g. byte at 91/80E0 = 08/80E0)
05/5D96: EB             XBA            
05/5D97: C8             INY
05/5D98: 10 05          BPL $5D9F       (branch if Y <= $7FFF)
05/5D9A: A0 00 00       LDY #$0000
05/5D9D: E6 12          INC $12         (if Y == $8000, set to $0000 and switch to next bank)
05/5D9F: B7 10          LDA [$10],y     (load 2nd byte of data block or song, e.g. byte at 91/80E1 = 08/80E1)
05/5DA1: 8D 43 21       STA $2143
05/5DA4: C8             INY
05/5DA5: 10 05          BPL $5DAC       (branch if Y <= $7FFF)
05/5DA7: A0 00 00       LDY #$0000
05/5DAA: E6 12          INC $12         (if Y == $8000, set to $0000 and switch to next bank)
05/5DAC: EB             XBA
05/5DAD: 8D 42 21       STA $2142      
05/5DB0: E0 01 00       CPX #$0001      
05/5DB3: A9 00          LDA #$00
05/5DB5: 2A             ROL
05/5DB6: 8D 41 21       STA $2141       (example of 08/80E0: 0D10 -> 0D00 -> 0D01)
05/5DB9: 69 7F          ADC #$7F        (example: 0D01 -> 0D80)
05/5DBB: 68             PLA            
05/5DBC: 8D 40 21       STA $2140
05/5DBF: CD 40 21       CMP $2140
05/5DC2: D0 FB          BNE $5DBF
05/5DC4: 70 82          BVS $5D48
05/5DC6: E2 30          SEP #$30
05/5DC8: A9 01          LDA #$01
05/5DCA: 8F FB FF 7E    STA $7EFFFB
05/5DCE: A2 3F          LDX #$3F
05/5DD0: 9E C0 03       STZ $03C0,x
05/5DD3: CA             DEX
05/5DD4: 10 FA          BPL $5DD0
05/5DD6: 9C B6 00       STZ $00B6
05/5DD9: 9C B5 00       STZ $00B5
05/5DDC: 28             PLP
05/5DDD: 60             RTS


Notes
Code:
088000-$088008
DE 80 11    (pointer to $0880DE)
35 8B 11    (pointer to $088B35)
EE 9C 11    (pointer to $089CEE)

088009-088032
all bytes at 00 (padding)

088033-0880DD (song pointers, 57 entries)
49 D2 12 (point to 095249)
FB D6 12 (point to 0956FB)
E5 DC 12 (point to 095CE5)
DB E5 12
69 EA 12
45 EF 12
C3 F3 12
B9 FA 12
B7 FD 12
01 80 13
75 88 13
AF 8C 13
E7 93 13
FD 95 13
E9 99 13
C7 9A 13
2F A2 13
F7 A6 13
DF AA 13
97 AE 13
0F B2 13
63 B4 13
4D B6 13
F1 B9 13
51 BB 13
E7 BC 13
2D C3 13
CD C9 13
D7 CC 13
DD D5 13
1D D9 13
61 DB 13
11 E2 13
37 E2 13
A1 E3 13
59 EB 13
25 F1 13
27 FA 13
ED 80 14
D9 81 14
A5 82 14
99 87 14
93 8E 14
23 97 14
C5 9C 14
75 A3 14
95 A3 14
69 A6 14
EB AA 14
3F B1 14
83 B2 14
57 B6 14
23 B7 14
17 C0 14
37 C0 14
14 D2 14
B1 D7 14

095243-095248       (???)
FF 00 00 00 00 FF

095249-09524A
AA 04               (block size of 04AA + 2 09524B-0956F6)
...

0956F7-0956FA       (song 01 header? or song 00 tail?)
00 00 00 00

0956FB-095CDE       (song 01 data?)
E2 05               (block size of 05E2 + 2)
...

0880DE-0880DF
10 00               (block size of 0010 + 2 -> 0880E0-0880F1)

0880E0-0880F1
10 0D
50 50
00 00
E0 04
00 00
3C 3C
DE 22
E0 04
30 00

0880F2-0880F3
3A 0A               (block size of 0A3A + 2 -> 0880F4-088B2F)

0880F4-088B2F       (???)
C0 02
20 CD
etc..
BE 10

088B30-088B34       (???)
00 00 C0 02 FF

088B35-088B36      
B0 11               (block size of 11B0 + 2 -> 088B37-089CE8)

088B37-089CE8       (???)
20 16
etc..
FF FF

089CE9-089CED       (???)
00 00 00 00 FF  

089CEE-089CEF  
5C 00               (block size of 005C + 2 -> 089CF0-089D4D)          

089CF0-089D4D       (???)      
00 28
E6 28 (E6)
1C 29 (106)
2E 29 (12)
49 29 (1B)
C5 2E (57C)
E0 2E (1B)
04 2F (24)
04 2F (0)
89 34 (585)
89 34 (0)
F7 38 (46E)
64 3B
F0 45
50 52
58 62
35 7F
BF 85
43 89
94 89
EA 8A
37 95
F5 97
46 98
B4 A5
EA A5
96 B1
E1 B7
E1 B7
6B BE
86 BE
AA BE
C5 BE
E9 BE
04 BF
C6 C0
C6 C0
A8 C3
4C C8
92 CD
AD CD
D1 CD
60 D5
9B D6
93 D8
0A DD
25 DD

089D4E-089D4F      
8A 00               (block size of 008A + 2 -> 089D50-089DDB)

089D50-089DDB
5C 28               (2800 + 005C = 285C)

Format: AA BB CC DD EE FF
AA: sample ID?
BB CC: ADSR data?
DD: ???
EE FF: Looping data, loop at EEFF bytes of sample?

00 FF E0 B8 02 00
01 FF F3 B8 07 C0
02 FF E0 B8 04 00
03 FF E0 B8 07 A8
04 FF E0 B8 07 A8
05 FF E0 B8 03 00
06 FF E0 B8 04 80
07 FF ED B8 04 80
08 FF E0 B8 09 00
09 FF E0 B8 02 40
0A FF ED B8 09 00
0B FF F0 B8 06 00
0C FF EF B8 11 E0
0D FF E0 B8 07 A8
0E FF E0 B8 04 00
0F FF E0 B8 04 00
10 FF E0 B8 02 80
11 FF E0 B8 07 A8
12 FF E0 B8 01 80
13 FF EE B8 04 00
14 FF F2 B8 23 00
15 FF F1 B8 02 10
16 FF F0 B8 04 00

64 B4           (block size of all samples?)
E6 28           (285C + 008A = 28E6)

089DE0-? BRR samples start!
089DE0-089DE8   sample (0009 bytes, 01 block) empty?
089DE9-089E27   sample (003F bytes, 07 blocks)
089E28-08A3BE   sample (0591 bytes, 9F blocks)
08A3FE-
08A989-
08ADF1-
08BAEA-
08D752-
08FAB9-
08FE8E-
090A31-
090D40-
091AE4-
092CDB-
0933E3-
0935C0-
0938A2-
0942CB-
094B95-
etc..
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite