’Cause all games were better on the GBC

You are not logged in.

#1 2012-12-14 16:55:07

Registered: 2010-10-16
Post 1,317/2,348

Map Music loading routine

Another neat found I did. Interesting parts of map music loading routine are located starting at $2D96 in rom.
And as usual, this is for Silver (and offsets are probably the same for Gold).

push hl
push bc
ld de, 0006
call 2CDD (load the map music byte in register c)
ld a, c
cp a, 64 (0x64 is the map music byte used for the "rocket base house" in Mahogany)
jr z, 2DC1 ("if = 0x64 0x2DC1")
bit 7, c
jr nz, 2DAD (= "if map music byte of this map is bigger than 0x80, jump to 2DAD")
ld e, c
ld d, 00 (transfer the map music byte of this map in de for later usage)
pop bc
pop hl

ld a, D572
bit 7, a (used the check whether bit 1600 from bittable 2 is set)
jr z, 2DCD
ld de, 0048 ("rocket hideout music")
jr 2DAA

ld de, 0026 ("Cherrygrove City music" (after being able to buy items in TR base in Mahogany))
jr 2DAA

ld a, D572
bit 0, a (used the check whether bit 1200 from bittable 2 is set)
jr z, 2DB9
ld de, 0056 ("radio tower take over music")
jr 2DAA

ld a, c
and a, 7F (store the parts, a and 7F share in common, in a)
ld e, a
ld d, 00 (transfer the new map music byte formed with and a, 7F instructions to de for later usage)
jr 2DAA

pop bc
pop hl

But what makes this info so useful is that all the latter code between 2DAD and 2DC0 could be moved to another rom bank with rst 8 function. This could serve for having plenty of different map music possiblities for as many maps as wanted to. As long as the code ends by returning to the original rom bank and has "jr 2DAA" in the end, everything should work out just fine.

Last edited by Miksy91 (2012-12-14 17:13:54)


#2 2012-12-14 18:19:03

Registered: 2012-04-09
Post 53/679

Re: Map Music loading routine

what's funny is the map music never got changed for the rocket house in crystal. music 100 is suicune's battle theme so if you ever tried to use it you would have gotten mahogany music


Board footer

Powered by FluxBB