vgmrips

The forum about vgm files
It is currently 2023-06-04, 15:44:15

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: 2022-10-14, 16:19:44 
Offline

Joined: 2022-10-14, 16:04:53
Posts: 3
When I put the rom in ValleyBell's SMPS2MIDI, I can convert every song except for the credits, but that's the only song I want out of it! trying to convert brings up a "Number of FM or PSG channels invalid!" error. is there any way that I can fix this?


Top
 Profile  
 
 Post subject:
PostPosted: 2022-10-15, 19:25:52 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 4511
Location: Germany
I moved the topic to the correct subforum (Ideas and WIPs -> Non-VGM Technical Discussion).

When loading the Sonic 3C ROM, smps2mid reports "Sonic 3 loaded" - which means it assumes vanilla Sonic 3. (or "Sonic 3A")
Apparently the song banks in Sonic 3C don't exactly match up with Sonic 3A, so it assumes that song 26 is stored in ROM bank 1B while it is actually stored in ROM bank 18.

Z80 base offset E33A, bank 1B (ROM area 0D8000..0DFFFF) results in ROM offset 0DE33A, which is what it displays in the list.
Z80 base offset E33A, bank 18 (ROM area 0C0000..0C7FFF) results in ROM offset 0C633A, which is where the song is really stored.
The bank list is stored in the ROM at offset 0E6B48 and in indicates that there are 3 songs stored in bank 18: songs 26, 2E and 30
(Note: The bank list stores only the last digit, so it contains 08..0B for banks 18..1B. The ROM offset of the bank is (bank * 8000h).)

You either have to manually reimport a part of the music pointer list with "Base Offset: 0C0000" or load the pre-ripped SMPS manually in smps2mid.


Top
 Profile  
 
 Post subject:
PostPosted: 2022-10-23, 2:22:21 
Offline

Joined: 2022-10-14, 16:04:53
Posts: 3
ValleyBell wrote:
...Z80 base offset E33A, bank 18 (ROM area 0C0000..0C7FFF) results in ROM offset 0C633A, which is where the song is really stored.
The bank list is stored in the ROM at offset 0E6B48 and in indicates that there are 3 songs stored in bank 18: songs 26, 2E and 30...
You... have to manually reimport a part of the music pointer list with "Base Offset: 0C0000"...

when I put in Z80 Mem Base E33A, Pointer List 0E6B48, Base Offset 0C0000 and click Add to List, nothing shows up.


Top
 Profile  
 
 Post subject:
PostPosted: 2022-12-03, 20:33:31 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 4511
Location: Germany
The "music bank list" (1 byte per song) is not the "music pointer list" (2 bytes per song). You confused both, so it can not work.


I will just quote part of a past IRC conversation and add in some information.

Quote:
(14:16:50) GamingGardevoir: I want to use smps2mid to convert the songs from the Sonic 3 November 1993 prototype
(14:16:57) ValleyBell: ah, okay

(14:20:00) ValleyBell: SMPS Type: Sonic 3K and later
(14:20:00) ValleyBell: Pointer List: 0x0E16A0
(14:20:00) ValleyBell: Base Offset: 0x0B0000
(14:20:15) ValleyBell: [Add to List]
(14:20:30) ValleyBell: This adds the first 6 songs to the list.
(14:20:45) ValleyBell: That is how many songs are stored in the first music bank.
(14:21:54) ValleyBell: You then need to increase the "Pointer List" value by (6*2) = 0C (0E16A0 + 0C = 0E16AC),
(14:21:54) ValleyBell: increase the "Base Offset" by adding 0x008000 [example: 0x0B0000 -> 0x0B8000 -> 0x0C0000 -> etc.]
(14:21:54) ValleyBell: and press the button again
[Then you repeat this more music banks. How much the "Pointer List" value has to be increased depends on the number of songs added.]
(14:22:34) ValleyBell: In case you want to know how many songs are in each bank, the Bank List is at ROM offset 0E08DD.
(14:23:58) ValleyBell: and the "Base Offset" for each song is calculated by taking the value fom the Bank List, adding 0x10 to it and multiplying the result by 0x8000.
(14:23:58) ValleyBell: e.g. for the first song: (0x06 + 0x10) = 0x16, 0x16 * 0x8000 = 0x0B0000

(14:39:20) ValleyBell: The value of the pointer list always has to be increased by ([number of songs added] * 2)
(14:39:38) ValleyBell: (6 songs in the first bank, I think it's more in the second bank)

(15:05:56) ValleyBell: the bank list is in the ROM at 0E08DD
(15:06:33) ValleyBell: and it goes from 06 (equals ROM bank 0B0000) to 0B (ROM bank 0D8000)

That above was for the Sonic 3 prototype 1993-11. For the Sonic 3C prototype 1994-05-17, the offsets are a bit different, but the same concepts apply.
  • Music Pointer List: 0E761A
  • Music Bank List: 0E6B48
  • First music bank: 0C8000 (value "09")
The music bank numbers are not monotonically increasing though and some songs (e.g. the credits theme) use different banks than you would get with the "normal" method.
Thus you have to add the entry for these songs separately.

What you have to do:
  1. figure out the song number
  2. calculate the correct location of the 2-byte music pointer: 0x0E761A + 2 * (songID-1) -> value for "Pointer List"
  3. calculate the correct location of the 1-byte music bank: 0x0E6B48 + 1 * (songID-1)
  4. read the byte there, then calculate: ([music bank] + 0x10) * 0x8000 -> value for "Base Offset"
  5. then press the "Add to List" button to add that song (and maybe additional garbage pointers) to the list


Top
 Profile  
 
 Post subject:
PostPosted: 2023-02-21, 4:15:43 
Offline

Joined: 2022-10-14, 16:04:53
Posts: 3
ValleyBell wrote:
What you have to do:
  1. figure out the song number
  2. calculate the correct location of the 2-byte music pointer: 0x0E761A + 2 * (songID-1) -> value for "Pointer List"
  3. calculate the correct location of the 1-byte music bank: 0x0E6B48 + 1 * (songID-1)
  4. read the byte there, then calculate: ([music bank] + 0x10) * 0x8000 -> value for "Base Offset"
  5. then press the "Add to List" button to add that song (and maybe additional garbage pointers) to the list

Apologies for being late to reply, college took my time from me, I found trouble on the last part.


Song Number $26
26-1=25

0E761A + 2*25 = 0E7664

0E6B48 + 1*25 = 0E6B6D

(0E6B6D+10) x 8000 = problem.

1E6B6D*8000=F35B68000. too long. (adding the 10 based on placement after 0x)
0E6B7D*8000= 735BE8000. still too long. (adding the 10 based on how I'd normally add 10)
Where did I do this math wrong?


Top
 Profile  
 
 Post subject:
PostPosted: 2023-02-21, 9:16:23 

Staff Staff
Programmers Programmers
Musicians Musicians
Contributors Contributors
Reverse engineers Reverse engineers
Offline
User avatar

Joined: 2011-12-01, 20:20:07
Posts: 4511
Location: Germany
You missed something in step 4.
The instruction is "read the byte there" (-> read the byte stored at ROM offset 0E6B6D). You used the offset itself (0E6B6D, you calculated that correctly) instead byte located there (08).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
[ Time : 0.028s | 13 Queries | GZIP : On ]