Users browsing this thread: 1 Guest(s)
Random battle theme

#41
Posts: 3,614
Threads: 264
Thanks Received: 664
Thanks Given: 270
Joined: Oct 2011
Reputation: 60
Status
Faith
yeah you need to write your table entries as "db $56" instead of "56". Also you might want to change the two ".exit" to "exit" but those error might be cause by previous ones I'm not sure.



  Find
Quote  

#42
Posts: 226
Threads: 16
Thanks Received: 10
Thanks Given: 35
Joined: Dec 2017
Reputation: 2
Status
None
(12-14-2018, 03:16 PM)madsiur Wrote: yeah you need to write your table entries as "db $56" instead of "56". Also you might want to change the two ".exit" to "exit" but those error might be cause by previous ones I'm not sure.

Ok, if I change the code to the following there are no more compile errors, but now the music is just the default in-game for the 3 backgrounds I changed:

Code:
hirom
header

org $C2BDB7
JSR free_space
NOP

org $C264C9          ; change to free space
free_space:
TDC
LDA $C2BF3B,X        ; load formation song
CMP #$24             ; check if battle song
BNE exit            ; branch if not
LDA $11E2            ; load battle background byte
AND #$3F             ; isolate battle background
REP #$20
TAX                  ; set BG as index
SEP #$20
LDA table,X          ; load BG song ID
exit:
RTS

; your $37 song IDs
; this table can be anywhere in the ROM:
org $F15550 ;(uncomment and change to move table elsewhere)
table:
db $56    ; W O B Grass
db $57    ; WOR Forest
db $66    ; W O B Desert
db $00    ; song ID for 4th background
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
db $00
  Find
Quote  

#43
Posts: 3,614
Threads: 264
Thanks Received: 664
Thanks Given: 270
Joined: Oct 2011
Reputation: 60
Status
Faith
I dunno, remove the TDC and try "LDA $00, XBA" after the "BNE exit". If it still fail, set a breakpoint at your new code with bsnes+ and post the debugger trace.



  Find
Quote  

#44
Posts: 226
Threads: 16
Thanks Received: 10
Thanks Given: 35
Joined: Dec 2017
Reputation: 2
Status
None
(12-14-2018, 04:53 PM)madsiur Wrote: I dunno, remove the TDC and try "LDA $00, XBA" after the "BNE exit". If it still  fail, set a breakpoint at your new code with bsnes+ and post the debugger trace.

UGH, it was a lousy header issue.  I had forgotten that I removed the header to check for free space for the table, and didn't add it back.  Everything works fine so far, although I noticed any track set to 00 will play no music at all as opposed to the default music, so I'm guessing I should just replace all the 00's with 24 if I want the default to play with any background I don't modify.  Was this intentional?
  Find
Quote  

#45
Posts: 3,614
Threads: 264
Thanks Received: 664
Thanks Given: 270
Joined: Oct 2011
Reputation: 60
Status
Faith
Yes the $00 were just placeholders.



  Find
Quote  

#46
Posts: 226
Threads: 16
Thanks Received: 10
Thanks Given: 35
Joined: Dec 2017
Reputation: 2
Status
None
(12-14-2018, 08:10 PM)madsiur Wrote: Yes the $00 were just placeholders.

Hello 

Thanks!
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite