IPB

Welcome Guest ( Log In | Register )


 

Recent Changes | Random | Help | Special Pages | Upload
home | info | forums | svn | irc | podcast | about

SCHG How-to:Extend the level index past $10 in Sonic 2

From Sonic Retro

WARNING: Unless you are working with Xenowhirl's 2007 Sonic 2 disassembly, I strongly recommend you port the Sonic 1 sound driver first before proceeding. A lot of major data shifting will occur in this tutorial and it will make the rom size a lot bigger than it was before. This will break the sonic2 or even sonic2 beta sound driver, thus so you definitely want the sonic 1 sound driver due to the fact that it can take the shifting and still work properly. However, if you are using Xenowhirl's 2007 Sonic 2 disassembly, it is not necessary to port any other sound driver, since that uses disassembled Z80 code which automatically references the correct locations and can thus work properly even if there are massive location shifts.

You probably noticed that all the indexes in the game stop at $10 and when you try to extend it, by extending the MLLB, you get weird glitches or even crashes, that is because you haven't extended all the indexes that need to be extended.

Contents

Extending the Titlecard index

first we will look at the data that defines the titlecard layout:

 
; word_13CD4:
Obj34_TitleCardData:
	dc.b    8,    0, $80, $1B
	dc.w $240, $120, $B8
 
	dc.b   $A,  $11, $40, $1C
	dc.w  $28, $148, $D0
 
	dc.b   $C,  $12, $18, $1C
	dc.w  $68, $188, $D0
 
	dc.b    2,    0,   0,   0
	dc.w    0,    0,   0
 
	dc.b    4,  $15, $48,   8
	dc.w $2A8, $168,$120
 
	dc.b    6,  $16,   8, $15
	dc.w  $80,  $F0, $F0
 

we want to change it to:

 
; word_13CD4:
Obj34_TitleCardData:
	dc.b    8,    0, $80, $1B;  Index 0 is the start of Zone names
	dc.w $240, $120, $B8
 
	dc.b   $A,  $21, $40, $1C;  Use index $21 to load the "ZONE" string
	dc.w  $28, $148, $D0
 
	dc.b   $C,  $22, $28, $1C;  Use index $22 as the index for act 1, $23 for act 2, $24 for act 3
	dc.w  $68, $188, $D0
 
	dc.b    2,    0,   0,   0;  I have no idea what this is.
	dc.w    0,    0,   0
 
	dc.b    4,  $25, $48,   8;  Use index $25 for "SONIC THE HEDGEHOG" string
	dc.w $2A8, $168,$120
 
	dc.b    6,  $26,   8, $15;  Use index $26 for red panel edge
	dc.w  $80,  $F0, $F0
 

then we look for:

 
loc_13DEE:
	jsr	sub_13D10(pc)
	move.b	(Current_Zone).w,d0
	cmpi.b	#$10,d0
	beq.s	BranchTo9_DeleteObject
	cmpi.b	#6,d0
	beq.s	BranchTo9_DeleteObject
	cmpi.b	#$E,d0
	beq.s	BranchTo9_DeleteObject
	move.b	(Current_Act).w,d1
	addi.b	#$12,d1
	cmpi.b	#5,d0
	bne.s	loc_13E18
	moveq	#$14,d1
 

and change it to:

 
loc_13DEE:
	jsr	sub_13D10(pc)
	move.b	(Current_Zone).w,d0
	cmpi.b	#$10,d0
	beq.s	BranchTo9_DeleteObject; do not load act number if sky chase zone
	cmpi.b	#6,d0
	beq.s	BranchTo9_DeleteObject; do not load act number if wing fortress zone
	cmpi.b	#$E,d0
	beq.s	BranchTo9_DeleteObject; do not load act number if death egg zone
	move.b	(Current_Act).w,d1
	addi.b	#$22,d1; reference to act 1 mappings for normal zones as well as $04 (MTZ 1 - 2)
	cmpi.b	#5,d0
	bne.s	loc_13E18
	moveq	#$24,d1; reference to act 3 mappings for $05 (MTZ 3 - 4) to load the "3" artwork reguardless of which act is really loaded.
 

That change allows us to make room for our extra 16 levels.

Next we locate:

 
; loc_157D2:
LoadTitleCard:
	bsr.s	LoadTitleCard0
	moveq	#0,d0
	move.b	(Current_Zone).w,d0
	move.b	byte_15820(pc,d0.w),d0
	lea	word_15832(pc),a0
	lea	(a0,d0.w),a0
	move.l	#$7BC00002,d0
 

and replace it with:

 
; loc_157D2:
LoadTitleCard:
	bsr.s	LoadTitleCard0
	moveq	#0,d0
	move.b	(Current_Zone).w,d0
	add.w	d0,d0
	move.w	Off_FontIndexes(pc,d0.w),d0
	lea	Off_FontIndexes(pc,d0.w),a0
	move.l	#$7BC00002,d0
 

Next we locate:

 
; unknown
byte_15820:
	dc.b   0,  0,  0,  0,$10,$10,$98,$20,$2C,  0,$3C,$46,$58,$68,$A8,$7A
	dc.b $8A,  0	; 16
; unknown
word_15832:
	dc.w $2A06,$3804,    4,$2604, $C04,$1804,$1C02,$FFFF
	dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04,$FFFF; 8
	dc.w $1804,$1C02,$2604,$4004,$3004,$FFFF,$1804,$1C02; 16
	dc.w  $C04,$3004,    4,$2604, $804,$FFFF,$1C02,$2604; 24
	dc.w  $804,    4,$FFFF,$2A06,$5604,$3C04,$4004,$1C02; 32
	dc.w  $804,    4,$4804,$FFFF, $804,    4,$3C04,$1C02; 40
	dc.w $1404,$1804,$4004,$FFFF, $804,$1804,$2A06,$1C02; 48
	dc.w	 4,$2604,$3004,$4004,$FFFF,    4,$3404,$4404; 56
	dc.w $4004,$1C02, $804,$3804,$FFFF,$3C04,$2204,$5604; 64
	dc.w  $804,$1804,    4,$FFFF,$4C06,$1C02,$1404,$1004; 72
	dc.w $3804,$4004,$3C04,$FFFF, $C04,    4,$4004,$1804; 80
	dc.w $1404,$FFFF	; 88
 

and replace it with:

; offset index to loaded artwork index for titlecards
Off_FontIndexes:
	dc.w	FontIndex_EHZ-Off_FontIndexes
	dc.w	FontIndex_LZ-Off_FontIndexes
	dc.w	FontIndex_WZ-Off_FontIndexes
	dc.w	FontIndex_DHZ-Off_FontIndexes
	dc.w	FontIndex_MTZ-Off_FontIndexes
	dc.w	FontIndex_MTZ-Off_FontIndexes
	dc.w	FontIndex_WFZ-Off_FontIndexes
	dc.w	FontIndex_HTZ-Off_FontIndexes
	dc.w	FontIndex_HPZ-Off_FontIndexes
	dc.w	FontIndex_GCZ-Off_FontIndexes
	dc.w	FontIndex_OOZ-Off_FontIndexes
	dc.w	FontIndex_MCZ-Off_FontIndexes
	dc.w	FontIndex_CNZ-Off_FontIndexes
	dc.w	FontIndex_CPZ-Off_FontIndexes
	dc.w	FontIndex_DEZ-Off_FontIndexes
	dc.w	FontIndex_ARZ-Off_FontIndexes
	dc.w	FontIndex_SCZ-Off_FontIndexes
	dc.w	FontIndex_Lev11-Off_FontIndexes
	dc.w	FontIndex_Lev12-Off_FontIndexes
	dc.w	FontIndex_Lev13-Off_FontIndexes
	dc.w	FontIndex_Lev14-Off_FontIndexes
	dc.w	FontIndex_Lev15-Off_FontIndexes
	dc.w	FontIndex_Lev16-Off_FontIndexes
	dc.w	FontIndex_Lev17-Off_FontIndexes
	dc.w	FontIndex_Lev18-Off_FontIndexes
	dc.w	FontIndex_Lev19-Off_FontIndexes
	dc.w	FontIndex_Lev1A-Off_FontIndexes
	dc.w	FontIndex_Lev1B-Off_FontIndexes
	dc.w	FontIndex_Lev1C-Off_FontIndexes
	dc.w	FontIndex_Lev1D-Off_FontIndexes
	dc.w	FontIndex_Lev1E-Off_FontIndexes
	dc.w	FontIndex_Lev1F-Off_FontIndexes
	dc.w	FontIndex_Lev20-Off_FontIndexes
 
; Letters displayed on EHZ titlecard
FontIndex_EHZ:
	dc.w $2A06,$3804,    4,$2604, $C04,$1804,$1C02,$FFFF
 
; Letters displayed on LZ titlecard
FontIndex_LZ:
	dc.w $2604,    4, $404,$3804,$1C02,$4004,$1804,$FFFF
 
; Letters displayed on WZ titlecard
FontIndex_WZ:
	dc.w $4C06, $C04,$FFFF
 
; Letters displayed on DHZ titlecard
FontIndex_DHZ:
	dc.w  $C04,$4404,$3C04,$4004,$1804,$1C02,$2604,$FFFF
 
; Letters displayed on MTZ titlecard
FontIndex_MTZ:
	dc.w $2A06,$4004,$3804,$3004,$2604,$1C02,$3C04,$FFFF
 
; Letters displayed on WFZ titlecard
FontIndex_WFZ:
	dc.w $4C06,$1C02,$1404,$1004,$3804,$4004,$3C04,$FFFF
 
; Letters displayed on HTZ titlecard
FontIndex_HTZ:
	dc.w $1804,$1C02,$2604,$4004,$3004,$FFFF
 
; Letters displayed on HPZ titlecard
FontIndex_HPZ:
	dc.w $1804,$1C02, $C04,$3004,    4,$2604, $804,$FFFF
 
; Letters displayed on GCZ titlecard
FontIndex_GCZ:
	dc.w $1404, $804,$1C02, $C04,$4004,$5604,$FFFF
 
; Letters displayed on OOZ titlecard
FontIndex_OOZ:
	dc.w $1C02,$2604, $804,    4,$FFFF
 
; Letters displayed on MCZ titlecard
FontIndex_MCZ:
	dc.w $2A06,$5604,$3C04,$4004,$1C02, $804,    4,$4804
	dc.w $FFFF
 
; Letters displayed on CNZ titlecard
FontIndex_CNZ:
	dc.w  $804,    4,$3C04,$1C02,$1404,$1804,$4004,$FFFF
 
; Letters displayed on CPZ titlecard
FontIndex_CPZ:
	dc.w  $804,$1804,$2A06,$1C02,    4,$2604,$3004,$4004
	dc.w $FFFF
 
; Letters displayed on DEZ titlecard
FontIndex_DEZ:
	dc.w  $C04,    4,$4004,$1804,$1404,$FFFF
 
; Letters displayed on ARZ titlecard
FontIndex_ARZ:
	dc.w     4,$3404,$4404,$4004,$1C02, $804,$3804,$FFFF
 
; Letters displayed on SCZ titlecard
FontIndex_SCZ:
	dc.w $3C04,$2204,$5604, $804,$1804,    4,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev11:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev12:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev13:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev14:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev15:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev16:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev17:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev18:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev19:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1A:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1B:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1C:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1D:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1E:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev1F:
	dc.w $4606,$2604,$4804,$FFFF
 
; Letters displayed on New Level  titlecard
FontIndex_Lev20:
	dc.w $4606,$2604,$4804,$FFFF
 

The original 8-bit proprietary offset index just won't cut it for the scope of this tutorial, so we replaced it with a much friendlier 16-bit relative offset index. also, we changed the order of the text artwork loading data to something much easier to manage, and added not only the ESE names for the empty levels that were already there, and you may choose to change again later, but also the slots for the new levels too. (they will read "NEW LEVEL ZONE" until you give the levels names and change the data here and mappings for those level titlecards.

You will find a link to the archive with the extra data files (sprite 34 mappings included) at the end of the tutorial.

Extending the cycling palette information

Now we want to locate:

 
; off_19F4:
PalCycle:
	dc.w PalCycle_EHZ - PalCycle	; 0
	dc.w PalCycle_Null - PalCycle	; 1
	dc.w PalCycle_Level2 - PalCycle	; 2
	dc.w PalCycle_Null - PalCycle	; 3
	dc.w PalCycle_MTZ - PalCycle	; 4
	dc.w PalCycle_MTZ - PalCycle	; 5
	dc.w PalCycle_WFZ - PalCycle	; 6
	dc.w PalCycle_HTZ - PalCycle	; 7
	dc.w PalCycle_HPZ - PalCycle	; 8
	dc.w PalCycle_Null - PalCycle	; 9
	dc.w PalCycle_OOZ - PalCycle	; 10
	dc.w PalCycle_MCZ - PalCycle	; 11
	dc.w PalCycle_CNZ - PalCycle	; 12
	dc.w PalCycle_CPZ - PalCycle	; 13
	dc.w PalCycle_CPZ - PalCycle	; 14
	dc.w PalCycle_ARZ - PalCycle	; 15
	dc.w PalCycle_WFZ - PalCycle	; 16
 

and replace it with:

 
; off_19F4:
PalCycle:
	dc.w PalCycle_EHZ - PalCycle	; 00
	dc.w PalCycle_Null - PalCycle	; 01
	dc.w PalCycle_Level2 - PalCycle	; 02
	dc.w PalCycle_Null - PalCycle	; 03
	dc.w PalCycle_MTZ - PalCycle	; 04
	dc.w PalCycle_MTZ - PalCycle	; 05
	dc.w PalCycle_WFZ - PalCycle	; 06
	dc.w PalCycle_HTZ - PalCycle	; 07
	dc.w PalCycle_HPZ - PalCycle	; 08
	dc.w PalCycle_Null - PalCycle	; 09
	dc.w PalCycle_OOZ - PalCycle	; 0A
	dc.w PalCycle_MCZ - PalCycle	; 0B
	dc.w PalCycle_CNZ - PalCycle	; 0C
	dc.w PalCycle_CPZ - PalCycle	; 0D
	dc.w PalCycle_CPZ - PalCycle	; 0E
	dc.w PalCycle_ARZ - PalCycle	; 0F
	dc.w PalCycle_WFZ - PalCycle	; 10
	dc.w PalCycle_Null - PalCycle	; 11
	dc.w PalCycle_Null - PalCycle	; 12
	dc.w PalCycle_Null - PalCycle	; 13
	dc.w PalCycle_Null - PalCycle	; 14
	dc.w PalCycle_Null - PalCycle	; 15
	dc.w PalCycle_Null - PalCycle	; 16
	dc.w PalCycle_Null - PalCycle	; 17
	dc.w PalCycle_Null - PalCycle	; 18
	dc.w PalCycle_Null - PalCycle	; 19
	dc.w PalCycle_Null - PalCycle	; 1A
	dc.w PalCycle_Null - PalCycle	; 1B
	dc.w PalCycle_Null - PalCycle	; 1C
	dc.w PalCycle_Null - PalCycle	; 1D
	dc.w PalCycle_Null - PalCycle	; 1E
	dc.w PalCycle_Null - PalCycle	; 1F
	dc.w PalCycle_Null - PalCycle	; 20
 

That inserts empty slots for the cycling palettes of out new levels.

Extending the static palette list

Next we locate:

 
PalPointers:
	palptr Pal_SEGA,  Normal_palette, $1F
	palptr Pal_Title, Normal_palette_line2, 7
	palptr Pal_UNK1,  Normal_palette, $1F
	palptr Pal_BGND,  Normal_palette, $F
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_WZ,    Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_MTZ,   Normal_palette_line2, $17
	palptr Pal_MTZ,   Normal_palette_line2, $17
	palptr Pal_WFZ,   Normal_palette_line2, $17
	palptr Pal_HTZ,   Normal_palette_line2, $17
	palptr Pal_HPZ,   Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_OOZ,   Normal_palette_line2, $17
	palptr Pal_MCZ,   Normal_palette_line2, $17
	palptr Pal_CNZ,   Normal_palette_line2, $17
	palptr Pal_CPZ,   Normal_palette_line2, $17
	palptr Pal_DEZ,   Normal_palette_line2, $17
	palptr Pal_ARZ,   Normal_palette_line2, $17
	palptr Pal_SCZ,   Normal_palette_line2, $17
	palptr Pal_HPZ_U, Normal_palette, $1F
	palptr Pal_CPZ_U, Normal_palette, $1F
	palptr Pal_ARZ_U, Normal_palette, $1F
	palptr Pal_SS,    Normal_palette, $17
	palptr Pal_UNK2,  Normal_palette_line2, 7
	palptr Pal_UNK3,  Normal_palette_line2, 7
	palptr Pal_SS1,   Normal_palette_line4, 7
	palptr Pal_SS2,   Normal_palette_line4, 7
	palptr Pal_SS3,   Normal_palette_line4, 7
	palptr Pal_SS4,   Normal_palette_line4, 7
	palptr Pal_SS5,   Normal_palette_line4, 7
	palptr Pal_SS6,   Normal_palette_line4, 7
	palptr Pal_SS7,   Normal_palette_line4, 7
	palptr Pal_UNK4,  Normal_palette_line4, 7
	palptr Pal_UNK5,  Normal_palette_line4, 7
	palptr Pal_UNK6,  Normal_palette_line4, 7
	palptr Pal_OOZ_B, Normal_palette_line2, 7
	palptr Pal_Menu,  Normal_palette, $1F
	palptr Pal_UNK7,  Normal_palette, $1F
 
; ----------------------------------------------------------------------------
Pal_SEGA:  BINCLUDE "art/palettes/Sega screen.bin" ; SEGA screen palette (Sonic and initial background)
Pal_Title: BINCLUDE "art/palettes/Title screen.bin" ; Title screen Palette
Pal_UNK1:  BINCLUDE "art/palettes/Unknown 1.bin" ; Unknown palette 1 (leftover S1 level select palette?)
Pal_BGND:  BINCLUDE "art/palettes/SonicAndTails.bin" ; "Sonic and Miles" background palette (also usually the primary palette line)
Pal_EHZ:   BINCLUDE "art/palettes/EHZ.bin" ; Emerald Hill Zone palette
Pal_WZ:    BINCLUDE "art/palettes/Wood Zone.bin" ; Wood Zone palette
Pal_MTZ:   BINCLUDE "art/palettes/MTZ.bin" ; Metropolis Zone palette
Pal_WFZ:   BINCLUDE "art/palettes/WFZ.bin" ; Wing Fortress Zone palette
Pal_HTZ:   BINCLUDE "art/palettes/HTZ.bin" ; Hill Top Zone palette
Pal_HPZ:   BINCLUDE "art/palettes/HPZ.bin" ; Hidden Palace Zone palette
Pal_HPZ_U: BINCLUDE "art/palettes/HPZ underwater.bin" ; Hidden Palace Zone underwater palette
Pal_OOZ:   BINCLUDE "art/palettes/OOZ.bin" ; Oil Ocean Zone palette
Pal_MCZ:   BINCLUDE "art/palettes/MCZ.bin" ; Mystic Cave Zone palette
Pal_CNZ:   BINCLUDE "art/palettes/CNZ.bin" ; Casino Night Zone palette
Pal_CPZ:   BINCLUDE "art/palettes/CPZ.bin" ; Chemical Plant Zone palette
Pal_CPZ_U: BINCLUDE "art/palettes/CPZ underwater.bin" ; Chemical Plant Zone underwater palette
Pal_DEZ:   BINCLUDE "art/palettes/DEZ.bin" ; Death Egg Zone palette
Pal_ARZ:   BINCLUDE "art/palettes/ARZ.bin" ; Aquatic Ruin Zone palette
Pal_ARZ_U: BINCLUDE "art/palettes/ARZ underwater.bin" ; Aquatic Ruin Zone underwater palette
Pal_SCZ:   BINCLUDE "art/palettes/SCZ.bin" ; Sky Chase Zone palette
Pal_UNK2:  BINCLUDE "art/palettes/Unknown 2.bin" ; Unknown palette 2
Pal_UNK3:  BINCLUDE "art/palettes/Unknown 3.bin" ; Unknown palette 3
Pal_OOZ_B: BINCLUDE "art/palettes/OOZ Boss.bin" ; Oil Ocean Zone boss palette
Pal_Menu:  BINCLUDE "art/palettes/Menu.bin" ; Menu palette
Pal_SS:    BINCLUDE "art/palettes/Special Stage Main.bin" ; Special Stage palette
Pal_SS1:   BINCLUDE "art/palettes/Special Stage 1.bin" ; Special Stage 1 palette
Pal_SS2:   BINCLUDE "art/palettes/Special Stage 2.bin" ; Special Stage 2 palette
Pal_SS3:   BINCLUDE "art/palettes/Special Stage 3.bin" ; Special Stage 3 palette
Pal_SS4:   BINCLUDE "art/palettes/Special Stage 4.bin" ; Special Stage 4 palette
Pal_SS5:   BINCLUDE "art/palettes/Special Stage 5.bin" ; Special Stage 5 palette
Pal_SS6:   BINCLUDE "art/palettes/Special Stage 6.bin" ; Special Stage 6 palette
Pal_SS7:   BINCLUDE "art/palettes/Special Stage 7.bin" ; Special Stage 7 palette
Pal_UNK4:  BINCLUDE "art/palettes/Special Stage 1 2p.bin" ; Special Stage 1 2p palette
Pal_UNK5:  BINCLUDE "art/palettes/Special Stage 2 2p.bin" ; Special Stage 2 2p palette
Pal_UNK6:  BINCLUDE "art/palettes/Special Stage 3 2p.bin" ; Special Stage 3 2p palette
Pal_UNK7:  BINCLUDE "art/palettes/Special Stage Results Screen.bin" ; Special Stage Results Screen palette
 

and replace it with:

 
PalPointers:
	palptr Pal_SEGA,  Normal_palette, $1F
	palptr Pal_Title, Normal_palette_line2, 7
	palptr Pal_UNK1,  Normal_palette, $1F
	palptr Pal_BGND,  Normal_palette, $F
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_WZ,    Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_MTZ,   Normal_palette_line2, $17
	palptr Pal_MTZ,   Normal_palette_line2, $17
	palptr Pal_WFZ,   Normal_palette_line2, $17
	palptr Pal_HTZ,   Normal_palette_line2, $17
	palptr Pal_HPZ,   Normal_palette_line2, $17
	palptr Pal_EHZ,   Normal_palette_line2, $17
	palptr Pal_OOZ,   Normal_palette_line2, $17
	palptr Pal_MCZ,   Normal_palette_line2, $17
	palptr Pal_CNZ,   Normal_palette_line2, $17
	palptr Pal_CPZ,   Normal_palette_line2, $17
	palptr Pal_DEZ,   Normal_palette_line2, $17
	palptr Pal_ARZ,   Normal_palette_line2, $17
	palptr Pal_SCZ,   Normal_palette_line2, $17
	palptr Pal_HPZ_U, Normal_palette, $1F
	palptr Pal_CPZ_U, Normal_palette, $1F
	palptr Pal_ARZ_U, Normal_palette, $1F
	palptr Pal_SS,    Normal_palette, $17
	palptr Pal_UNK2,  Normal_palette_line2, 7
	palptr Pal_UNK3,  Normal_palette_line2, 7
	palptr Pal_SS1,   Normal_palette_line4, 7
	palptr Pal_SS2,   Normal_palette_line4, 7
	palptr Pal_SS3,   Normal_palette_line4, 7
	palptr Pal_SS4,   Normal_palette_line4, 7
	palptr Pal_SS5,   Normal_palette_line4, 7
	palptr Pal_SS6,   Normal_palette_line4, 7
	palptr Pal_SS7,   Normal_palette_line4, 7
	palptr Pal_UNK4,  Normal_palette_line4, 7
	palptr Pal_UNK5,  Normal_palette_line4, 7
	palptr Pal_UNK6,  Normal_palette_line4, 7
	palptr Pal_OOZ_B, Normal_palette_line2, 7
	palptr Pal_Menu,  Normal_palette, $1F
	palptr Pal_UNK7,  Normal_palette, $1F
	palptr Pal_Lev11,   Normal_palette_line2, $17
	palptr Pal_Lev12,   Normal_palette_line2, $17
	palptr Pal_Lev13,   Normal_palette_line2, $17
	palptr Pal_Lev14,   Normal_palette_line2, $17
	palptr Pal_Lev15,   Normal_palette_line2, $17
	palptr Pal_Lev16,   Normal_palette_line2, $17
	palptr Pal_Lev17,   Normal_palette_line2, $17
	palptr Pal_Lev18,   Normal_palette_line2, $17
	palptr Pal_Lev19,   Normal_palette_line2, $17
	palptr Pal_Lev1A,   Normal_palette_line2, $17
	palptr Pal_Lev1B,   Normal_palette_line2, $17
	palptr Pal_Lev1C,   Normal_palette_line2, $17
	palptr Pal_Lev1D,   Normal_palette_line2, $17
	palptr Pal_Lev1E,   Normal_palette_line2, $17
	palptr Pal_Lev1F,   Normal_palette_line2, $17
	palptr Pal_Lev20,   Normal_palette_line2, $17
 
; ----------------------------------------------------------------------------
Pal_SEGA:  BINCLUDE "art/palettes/Sega screen.bin" ; SEGA screen palette (Sonic and initial background)
Pal_Title: BINCLUDE "art/palettes/Title screen.bin" ; Title screen Palette
Pal_UNK1:  BINCLUDE "art/palettes/Unknown 1.bin" ; Unknown palette 1 (leftover S1 level select palette?)
Pal_BGND:  BINCLUDE "art/palettes/SonicAndTails.bin" ; "Sonic and Miles" background palette (also usually the primary palette line)
Pal_EHZ:   BINCLUDE "art/palettes/EHZ.bin" ; Emerald Hill Zone palette
Pal_WZ:    BINCLUDE "art/palettes/Wood Zone.bin" ; Wood Zone palette
Pal_MTZ:   BINCLUDE "art/palettes/MTZ.bin" ; Metropolis Zone palette
Pal_WFZ:   BINCLUDE "art/palettes/WFZ.bin" ; Wing Fortress Zone palette
Pal_HTZ:   BINCLUDE "art/palettes/HTZ.bin" ; Hill Top Zone palette
Pal_HPZ:   BINCLUDE "art/palettes/HPZ.bin" ; Hidden Palace Zone palette
Pal_HPZ_U: BINCLUDE "art/palettes/HPZ underwater.bin" ; Hidden Palace Zone underwater palette
Pal_OOZ:   BINCLUDE "art/palettes/OOZ.bin" ; Oil Ocean Zone palette
Pal_MCZ:   BINCLUDE "art/palettes/MCZ.bin" ; Mystic Cave Zone palette
Pal_CNZ:   BINCLUDE "art/palettes/CNZ.bin" ; Casino Night Zone palette
Pal_CPZ:   BINCLUDE "art/palettes/CPZ.bin" ; Chemical Plant Zone palette
Pal_CPZ_U: BINCLUDE "art/palettes/CPZ underwater.bin" ; Chemical Plant Zone underwater palette
Pal_DEZ:   BINCLUDE "art/palettes/DEZ.bin" ; Death Egg Zone palette
Pal_ARZ:   BINCLUDE "art/palettes/ARZ.bin" ; Aquatic Ruin Zone palette
Pal_ARZ_U: BINCLUDE "art/palettes/ARZ underwater.bin" ; Aquatic Ruin Zone underwater palette
Pal_SCZ:   BINCLUDE "art/palettes/SCZ.bin" ; Sky Chase Zone palette
Pal_Lev11:   BINCLUDE "art/palettes/Lev11.bin" ; New Level palette
Pal_Lev12:   BINCLUDE "art/palettes/Lev12.bin" ; New Level palette
Pal_Lev13:   BINCLUDE "art/palettes/Lev13.bin" ; New Level palette
Pal_Lev14:   BINCLUDE "art/palettes/Lev14.bin" ; New Level palette
Pal_Lev15:   BINCLUDE "art/palettes/Lev15.bin" ; New Level palette
Pal_Lev16:   BINCLUDE "art/palettes/Lev16.bin" ; New Level palette
Pal_Lev17:   BINCLUDE "art/palettes/Lev17.bin" ; New Level palette
Pal_Lev18:   BINCLUDE "art/palettes/Lev18.bin" ; New Level palette
Pal_Lev19:   BINCLUDE "art/palettes/Lev19.bin" ; New Level palette
Pal_Lev1A:   BINCLUDE "art/palettes/Lev1A.bin" ; New Level palette
Pal_Lev1B:   BINCLUDE "art/palettes/Lev1B.bin" ; New Level palette
Pal_Lev1C:   BINCLUDE "art/palettes/Lev1C.bin" ; New Level palette
Pal_Lev1D:   BINCLUDE "art/palettes/Lev1D.bin" ; New Level palette
Pal_Lev1E:   BINCLUDE "art/palettes/Lev1E.bin" ; New Level palette
Pal_Lev1F:   BINCLUDE "art/palettes/Lev1F.bin" ; New Level palette
Pal_Lev20:   BINCLUDE "art/palettes/Lev20.bin" ; New Level palette
Pal_UNK2:  BINCLUDE "art/palettes/Unknown 2.bin" ; Unknown palette 2
Pal_UNK3:  BINCLUDE "art/palettes/Unknown 3.bin" ; Unknown palette 3
Pal_OOZ_B: BINCLUDE "art/palettes/OOZ Boss.bin" ; Oil Ocean Zone boss palette
Pal_Menu:  BINCLUDE "art/palettes/Menu.bin" ; Menu palette
Pal_SS:    BINCLUDE "art/palettes/Special Stage Main.bin" ; Special Stage palette
Pal_SS1:   BINCLUDE "art/palettes/Special Stage 1.bin" ; Special Stage 1 palette
Pal_SS2:   BINCLUDE "art/palettes/Special Stage 2.bin" ; Special Stage 2 palette
Pal_SS3:   BINCLUDE "art/palettes/Special Stage 3.bin" ; Special Stage 3 palette
Pal_SS4:   BINCLUDE "art/palettes/Special Stage 4.bin" ; Special Stage 4 palette
Pal_SS5:   BINCLUDE "art/palettes/Special Stage 5.bin" ; Special Stage 5 palette
Pal_SS6:   BINCLUDE "art/palettes/Special Stage 6.bin" ; Special Stage 6 palette
Pal_SS7:   BINCLUDE "art/palettes/Special Stage 7.bin" ; Special Stage 7 palette
Pal_UNK4:  BINCLUDE "art/palettes/Special Stage 1 2p.bin" ; Special Stage 1 2p palette
Pal_UNK5:  BINCLUDE "art/palettes/Special Stage 2 2p.bin" ; Special Stage 2 2p palette
Pal_UNK6:  BINCLUDE "art/palettes/Special Stage 3 2p.bin" ; Special Stage 3 2p palette
Pal_UNK7:  BINCLUDE "art/palettes/Special Stage Results Screen.bin" ; Special Stage Results Screen palette
 

That inserts our new palettes, which we will be using when we start on the main level load block.


Extending the 1 Player and 2 Player music playlists

next we find:

 
; loc_40AE:
Level_GetBgm:
	tst.w	(Demo_mode_flag).w
	bmi.s	loc_4114
	moveq	#0,d0
	move.b	(Current_Zone).w,d0
	lea	MusicList(pc),a1
	tst.w	(Two_player_mode).w
	beq.s	Level_PlayBgm
	lea	MusicList2(pc),a1
 

and replace it with:

 
; loc_40AE:
Level_GetBgm:
	tst.w	(Demo_mode_flag).w
	bmi.s	loc_4114
	moveq	#0,d0
	move.b	(Current_Zone).w,d0
	lea	MusicList(pc),a1
	tst.w	(Two_player_mode).w
	beq.s	Level_PlayBgm
	jsr	Level_2PlayerBGMList
 


now we want to find:

 
;----------------------------------------------------------------------------
; 1P Music Playlist
;----------------------------------------------------------------------------
; byte_3EA0:
MusicList:
	dc.b   2+$80	; 0 ; EHZ
	dc.b   2+$80	; 1
	dc.b   5+$80	; 2
	dc.b   4+$80	; 3
	dc.b   5+$80	; 4 ; MTZ1,2
	dc.b   5+$80	; 5 ; MTZ3
	dc.b  $F+$80	; 6 ; WFZ
	dc.b   6+$80	; 7 ; HTZ
	dc.b $10+$80	; 8
	dc.b  $D+$80	; 9
	dc.b   4+$80	; 10 ; OOZ
	dc.b  $B+$80	; 11 ; MCZ
	dc.b  $9+$80	; 12 ; CNZ
	dc.b  $E+$80	; 13 ; CPZ
	dc.b  $A+$80	; 14 ; DEZ
	dc.b   7+$80	; 15 ; ARZ
	dc.b  $D+$80	; 16 ; SCZ
	dc.b   0	; 17
;----------------------------------------------------------------------------
; 2P Music Playlist
;----------------------------------------------------------------------------
; byte_3EB2:
MusicList2:
	dc.b  $C+$80	; 0  ; EHZ 2P
	dc.b   2+$80	; 1
	dc.b   5+$80	; 2
	dc.b   4+$80	; 3
	dc.b   5+$80	; 4
	dc.b   5+$80	; 5
	dc.b  $F+$80	; 6
	dc.b   6+$80	; 7
	dc.b $10+$80	; 8
	dc.b  $D+$80	; 9
	dc.b   4+$80	; 10
	dc.b   3+$80	; 11 ; MCZ 2P
	dc.b   8+$80	; 12 ; CNZ 2P
	dc.b  $E+$80	; 13
	dc.b  $A+$80	; 14
	dc.b   7+$80	; 15
	dc.b  $D+$80	; 16
	dc.b   0	; 17
 

and replace it with:

 
;----------------------------------------------------------------------------
; 2P Music Playlist
;----------------------------------------------------------------------------
; byte_3EB2:
MusicList2:
	dc.b  $C+$80	; 00  ; EHZ 2P
	dc.b   2+$80	; 01
	dc.b   5+$80	; 02
	dc.b   4+$80	; 03
	dc.b   5+$80	; 04
	dc.b   5+$80	; 05
	dc.b  $F+$80	; 06
	dc.b   6+$80	; 07
	dc.b $10+$80	; 08
	dc.b  $D+$80	; 09
	dc.b   4+$80	; 0A
	dc.b   3+$80	; 0B ; MCZ 2P
	dc.b   8+$80	; 0C ; CNZ 2P
	dc.b  $E+