Actions

SCHG How-to

Difference between revisions of "Extend the level index past $10 in Sonic 2"

From Sonic Retro

Line 10: Line 10:
  
 
==Extending the Titlecard index==
 
==Extending the Titlecard index==
First we find:
 
  
<asm>
+
==Extending the Palette Cycle information==
Obj34_TitleCardData:
 
dc.b    8,    0, $80, $1B
 
dc.w $240, $120, $B8
 
  
dc.b  $A,  $11, $40, $1C
+
==Extending the static palette list==
dc.w  $28, $148, $D0
 
  
dc.b  $C,  $12, $18, $1C
+
==Extending Zone Procedures and Scripts==
dc.w  $68, $188, $D0
 
  
dc.b    2,    0,  0,  0
+
==Extending Animated Pattern Mappings==
dc.w    0,    0,  0
 
  
dc.b    4,  $15, $48,  8
+
==Extending the 1 Player and 2 Player music playlists==
dc.w $2A8, $168,$120
 
  
dc.b    6,  $16,  8, $15
+
==Branch fixes==
dc.w  $80,  $F0, $F0
 
</asm>
 
  
and change it to:
+
==Fixing Addressing==
<asm>
 
Obj34_TitleCardData:
 
dc.b    8,    0, $80, $1B ; this is the zone string start index and  placement
 
dc.w $240, $120, $B8
 
  
dc.b  $A, $21, $40, $1C ; "ZONE" string index number and placement
+
==Extending the demo list==
dc.w  $28, $148, $D0
 
  
dc.b  $C,  $22, $18, $1C ; act number start index and placement
+
==Extending the Collision index==
dc.w  $68, $188, $D0
 
  
dc.b    2,    0,  0,  0 ; this part of the titlecard is totally unknown, colored backdrop possibly
+
==Extending Rings Index==
dc.w    0,    0,  0
 
  
dc.b    4,  $25, $48,  8 ; red strip edge index and placement
+
==Extending the object index==
dc.w $2A8, $168,$120
 
  
dc.b    6,  $26,  8, $15 ; red "Sonic The Hedgehog" string and placement
+
==Extending tiles and patterns index==
dc.w  $80,  $F0, $F0
 
</asm>
 
  
next, find:
+
==Extending level and tile layout indexes==
<asm>
 
    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
 
</asm>
 
  
and change it to:
+
==Extending the definition of act 2 (setting up our new levels so that they can have bosses in other words)==
<asm>
 
    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    #$22,d1                  ; Act number mappings (Act 1)
 
    cmpi.b    #5,d0
 
    bne.s    loc_13E18
 
    moveq    #$24,d1                  ; Act number mappings (Act 3).  Used for drawing MTZ (0x05) titlecard only
 
</asm>
 
  
Now we have the offset data of where to load the mappings for the titlecards shifted so that we can now start working on updating the mappings and not have that strange "ZONE ZONE" bug that [[GARY 'M 9]] left behind and I intended to correct.
+
==Extend Level Size Array==
  
Next, another thing I wanted to see others correct.  this time, I will explain why I changed byte_15820 into a 16-bit relative offset index as opposed to it staying as a byte-by-byte relative offset that does not point correctly, and to appropriately handle the string data in word_15832, as well as allow that string data to be properly represented.  This time I will make it even clearer too.
+
==Extending the Start Location Index==
  
Next off, in this part of the hack the first thing before converting to a better manageable datatype, we want to replace the byte_15820 handler with a better one.
+
==Notes==
 
 
look for:
 
<asm>
 
; 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
 
</asm>
 
 
 
and we want to replace it with:
 
<asm>
 
; loc_157D2:
 
LoadTitleCard:
 
bsr.s LoadTitleCard0
 
moveq #0,d0
 
move.b (Current_Zone).w,d0
 
add.w d0,d0
 
move.w Off_Titlecardtext(pc,d0.w),d0
 
lea Off_Titlecardtext(pc,d0.w),a0
 
move.l #$7BC00002,d0
 
</asm>
 
 
 
That takes care of the loader, now time to update the string data.
 
 
 
find:
 
<asm>
 
; 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
 
</asm>
 
 
 
and replace it with:
 
<asm>
 
;byte_15820
 
Off_Titlecardtext:
 
dc.w  Text_EHZ-Off_Titlecardtext ; EHZ Titlecard 00
 
dc.w  Text_LZ-Off_Titlecardtext  ;  LZ Titlecard 01
 
dc.w  Text_WZ-Off_Titlecardtext  ;  WZ Titlecard 02
 
dc.w  Text_DHZ-Off_Titlecardtext ; DHZ Titlecard 03
 
dc.w  Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 04
 
dc.w  Text_MTZ-Off_Titlecardtext ; MTZ Titlecard 05
 
dc.w  Text_WFZ-Off_Titlecardtext ; WFZ Titlecard 06
 
dc.w  Text_HTZ-Off_Titlecardtext ; HTZ Titlecard 07
 
dc.w  Text_HPZ-Off_Titlecardtext ; HPZ Titlecard 08
 
dc.w  Text_GCZ-Off_Titlecardtext ; GCZ Titlecard 09
 
dc.w  Text_OOZ-Off_Titlecardtext ; OOZ Titlecard 0A
 
dc.w  Text_MCZ-Off_Titlecardtext ; MCZ Titlecard 0B
 
dc.w  Text_CNZ-Off_Titlecardtext ; CNZ Titlecard 0C
 
dc.w  Text_CPZ-Off_Titlecardtext ; CPZ Titlecard 0D
 
dc.w  Text_DEZ-Off_Titlecardtext ; DEZ Titlecard 0E
 
dc.w  Text_ARZ-Off_Titlecardtext ; ARZ Titlecard 0F
 
dc.w  Text_SCZ-Off_Titlecardtext ; SCZ Titlecard 10
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 11
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 12
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 13
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 14
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 15
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 16
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 17
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 18
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 19
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1A
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1B
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1C
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1D
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1E
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 1F
 
dc.w  Text_NZ-Off_Titlecardtext  ;  NZ Titlecard 20
 
 
 
;word_15832
 
Text_EHZ: dc.b $2A,$38,$00,$26,$0C,$18,$1C ; 'MRALDHI'
 
  dc.w $FFFF ; '<EOF>'
 
Text_LZ:  dc.b $26,$00,$04,$56,$38,$1C,$40,$18 ; 'LABYRITH'
 
  dc.w $FFFF ; '<EOF>'
 
Text_WZ:  dc.b $4C,$0C ; 'WD'
 
  dc.w $FFFF ; '<EOF>'
 
Text_DHZ: dc.b $0C,$44,$3C,$40,$18,$1C,$26 ; 'DUSTHIL'
 
  dc.w $FFFF ; '<EOF>'
 
Text_MTZ: dc.b $2A,$40,$38,$30,$26,$1C,$3C ; 'MTRPLIS'
 
  dc.w $FFFF ; '<EOF>'
 
Text_WFZ: dc.b $4C,$1C,$14,$10,$38,$40,$3C ; 'WIGFRTS'
 
  dc.w $FFFF ; '<EOF>'
 
Text_HTZ: dc.b $18,$1C,$26,$40,$30 ; 'HILTP'
 
  dc.w $FFFF ; '<EOF>'
 
Text_HPZ: dc.b $18,$1C,$0C,$30,$00,$26,$08 ; 'HIDPALCE'
 
  dc.w $FFFF ; '<EOF>'
 
Text_GCZ: dc.b $14,$08,$1C,$0C,$40,$56 ; 'GCIDTY'
 
  dc.w $FFFF ; '<EOF>'
 
Text_OOZ: dc.b $1C,$26,$08,$00 ; 'ILCAN'
 
  dc.w $FFFF ; '<EOF>'
 
Text_MCZ: dc.b $2A,$56,$3C,$40,$1C,$08,$00,$48 ; 'MYSTICAV'
 
  dc.w $FFFF ; '<EOF>'
 
Text_CNZ: dc.b $08,$00,$3C,$1C,$14,$18,$40 ; 'CASIGHT'
 
  dc.w $FFFF ; '<EOF>'
 
Text_CPZ: dc.b $08,$18,$2A,$1C,$00,$26,$30,$40 ; 'CHMICALPT'
 
  dc.w $FFFF ; '<EOF>'
 
Text_DEZ: dc.b $0C,$00,$40,$18,$14 ; 'DATHG'
 
  dc.w $FFFF ; '<EOF>'
 
Text_ARZ: dc.b $00,$34,$44,$40,$1C,$08,$38 ; 'AQUTICR'
 
  dc.w $FFFF ; '<EOF>'
 
Text_SCZ: dc.b $3C,$22,$56,$08,$18,$00,$3C ; 'SKYCHAS'
 
  dc.w $FFFF ; '<EOF>'
 
Text_NZ:  dc.b $4C ; 'W'
 
  dc.w $FFFF ; '<EOF>'
 
</asm>
 
 
 
This extends the title card index to $20, adds titlecards for Wood Zone, Labyrinth Zone, Dust Hill Zone, Genocide City Zone, and an empty New Zone titlecard for every single level above SCZ, compacts the titlecard text data for all titlecards, and makes it more easier to manage.  you will be wondering probably what to do with the mappings.  Well that is what is next.
 
 
 
find:
 
<asm>
 
; -------------------------------------------------------------------------------
 
; sprite mappings
 
; -------------------------------------------------------------------------------
 
Obj34_MapUnc_147BA: BINCLUDE "mappings/sprite/obj34.bin"
 
; -------------------------------------------------------------------------------
 
</asm>
 
 
 
and replace it with:
 
<asm>
 
; -------------------------------------------------------------------------------
 
; sprite mappings
 
; -------------------------------------------------------------------------------
 
Obj34_MapUnc_147BA: dc.w Titlecard_EHZ-Obj34_MapUnc_147BA ; EHZ 00
 
    dc.w Titlecard_LZ-Obj34_MapUnc_147BA  ; LZ  01
 
    dc.w Titlecard_WZ-Obj34_MapUnc_147BA  ; WZ  02
 
    dc.w Titlecard_DHZ-Obj34_MapUnc_147BA ; DHZ 03
 
    dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 04
 
    dc.w Titlecard_MTZ-Obj34_MapUnc_147BA ; MTZ 05
 
    dc.w Titlecard_WFZ-Obj34_MapUnc_147BA ; WFZ 06
 
    dc.w Titlecard_HTZ-Obj34_MapUnc_147BA ; HTZ 07
 
    dc.w Titlecard_HPZ-Obj34_MapUnc_147BA ; HPZ 08
 
    dc.w Titlecard_GCZ-Obj34_MapUnc_147BA ; GCZ 09
 
    dc.w Titlecard_OOZ-Obj34_MapUnc_147BA ; OOZ 0A
 
    dc.w Titlecard_MCZ-Obj34_MapUnc_147BA ; MCZ 0B
 
    dc.w Titlecard_CNZ-Obj34_MapUnc_147BA ; CNZ 0C
 
    dc.w Titlecard_CPZ-Obj34_MapUnc_147BA ; CPZ 0D
 
    dc.w Titlecard_DEZ-Obj34_MapUnc_147BA ; DEZ 0E
 
    dc.w Titlecard_ARZ-Obj34_MapUnc_147BA ; ARZ 0F
 
    dc.w Titlecard_SCZ-Obj34_MapUnc_147BA ; SCZ 10
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  11
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  12
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  13
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  14
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  15
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  16
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  17
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  18
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  19
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1A
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1B
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1C
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1D
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1E
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  1F
 
    dc.w Titlecard_NZ-Obj34_MapUnc_147BA  ; NZ  20
 
    dc.w T_ZONE-Obj34_MapUnc_147BA        ; "ZONE"
 
    dc.w T_ACT1-Obj34_MapUnc_147BA        ; "1"
 
    dc.w T_ACT2-Obj34_MapUnc_147BA        ; "2"
 
    dc.w T_ACT3-Obj34_MapUnc_147BA        ; "3"
 
    dc.w T_STH-Obj34_MapUnc_147BA        ; "SONIC THE HEDGEHOG"
 
    dc.w T_STRIPEDGE-Obj34_MapUnc_147BA  ; ">"
 
 
 
Titlecard_EHZ:     dc.w $b ; number of letters
 
    dc.w $0005, $8580, $82C0, $FFC0 ;E
 
    dc.w $0009, $85DE, $82EF, $FFD0 ;M
 
    dc.w $0005, $8580, $82C0, $FFE8 ;E
 
    dc.w $0005, $85E4, $82F2, $FFF8 ;R
 
    dc.w $0005, $85E8, $82F4, $0008 ;A
 
    dc.w $0005, $85EC, $82F6, $0018 ;L
 
    dc.w $0005, $85F0, $82F8, $0028 ;D
 
 
 
    dc.w $0005, $85F4, $82FA, $0048 ;H
 
    dc.w $0001, $85F8, $82F2, $0058 ;I
 
    dc.w $0005, $85EC, $82F6, $0060 ;L
 
    dc.w $0005, $85EC, $82F6, $0070 ;L
 
 
 
Titlecard_LZ:     dc.w $9 ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFE8 ;L
 
    dc.w $0005, $85E2, $82F1, $FFF8 ;A
 
    dc.w $0005, $85E6, $82F3, $0008 ;B
 
    dc.w $0005, $85EA, $82F5, $0018 ;Y
 
    dc.w $0005, $85EE, $82F7, $0028 ;R
 
    dc.w $0001, $85F2, $82F9, $0038 ;I
 
    dc.w $0005, $8584, $82C2, $0040 ;N
 
    dc.w $0005, $85F4, $82FA, $0050 ;T
 
    dc.w $0005, $85F8, $82FC, $0060 ;H
 
 
 
Titlecard_WZ:     dc.w $4 ; number of letters
 
    dc.w $0009, $85DE, $82EF, $0008 ;W
 
    dc.w $0005, $8588, $82C4, $0010 ;O
 
    dc.w $0005, $8588, $82C4, $0020 ;O
 
    dc.w $0005, $85E4, $82F2, $0030 ;D
 
 
 
 
 
Titlecard_DHZ:     dc.w $8 ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFE8 ;D
 
    dc.w $0005, $85E2, $82F1, $FFF8 ;U
 
    dc.w $0005, $85E6, $82F3, $0008 ;S
 
    dc.w $0005, $85EA, $82F5, $0018 ;T
 
 
 
    dc.w $0005, $85EE, $82F7, $0038 ;H
 
    dc.w $0001, $85F2, $82F9, $0048 ;I
 
    dc.w $0005, $85F4, $82FA, $0050 ;L
 
    dc.w $0005, $85F4, $82FA, $0060 ;L
 
 
 
Titlecard_MTZ:     dc.w $a ; number of letters
 
    dc.w $0009, $85DE, $82EF, $FFE8 ;M
 
    dc.w $0005, $8580, $82C0, $FFF8 ;E
 
    dc.w $0005, $85E4, $82F2, $0008 ;T
 
    dc.w $0005, $85E8, $82F4, $0018 ;R
 
    dc.w $0005, $8588, $82C4, $0028 ;O
 
    dc.w $0005, $85EC, $82F6, $0038 ;P
 
    dc.w $0005, $8588, $82C4, $0048 ;O
 
    dc.w $0005, $85F0, $82F8, $0058 ;L
 
    dc.w $0001, $85F4, $82FA, $0068 ;I
 
    dc.w $0005, $85F6, $82FB, $0070 ;S
 
 
 
Titlecard_WFZ:     dc.w $c ; number of letters
 
    dc.w $0009, $85DE, $82EF, $FFB0 ;W
 
    dc.w $0001, $85E4, $82F2, $FFC8 ;I
 
    dc.w $0005, $8584, $82C2, $FFD0 ;N
 
    dc.w $0005, $85E6, $82F3, $FFE0 ;G
 
 
 
    dc.w $0005, $85EA, $82F5, $0000 ;F
 
    dc.w $0005, $8588, $82C4, $0010 ;O
 
    dc.w $0005, $85EE, $82F7, $0020 ;R
 
    dc.w $0005, $85F2, $82F9, $0030 ;T
 
    dc.w $0005, $85EE, $82F7, $0040 ;R
 
    dc.w $0005, $8580, $82C0, $0050 ;E
 
    dc.w $0005, $85F6, $82FB, $0060 ;S
 
    dc.w $0005, $85F6, $82FB, $0070 ;S
 
 
 
Titlecard_HTZ:     dc.w $7 ; number of letters
 
    dc.w $0005, $85DE, $82EF, $0008 ;H
 
    dc.w $0001, $85E2, $82F1, $0018 ;I
 
    dc.w $0005, $85E4, $82F2, $0020 ;L
 
    dc.w $0005, $85E4, $82F2, $0030 ;L
 
 
 
    dc.w $0005, $85E8, $82F4, $0050 ;T
 
    dc.w $0005, $8588, $82C4, $0060 ;O
 
    dc.w $0005, $85EC, $82F6, $0070 ;P
 
 
 
Titlecard_HPZ:     dc.w $c ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFB8 ;H
 
    dc.w $0001, $85E2, $82F1, $FFC8 ;I
 
    dc.w $0005, $85E4, $82F2, $FFD0 ;D
 
    dc.w $0005, $85E4, $82F2, $FFE0 ;D
 
    dc.w $0005, $8580, $82C0, $FFF0 ;E
 
    dc.w $0005, $8584, $82C4, $0000 ;N
 
 
 
    dc.w $0005, $85E8, $82F4, $0020 ;P
 
    dc.w $0005, $85EC, $82F6, $0030 ;A
 
    dc.w $0005, $85F0, $82F8, $0040 ;L
 
    dc.w $0005, $85EC, $82F6, $0050 ;A
 
    dc.w $0005, $85F4, $82FA, $0060 ;C
 
    dc.w $0005, $8580, $82C0, $0070 ;E
 
 
 
Titlecard_GCZ:     dc.w $c ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFB8 ;G
 
    dc.w $0005, $8580, $82C0, $FFC8 ;E
 
    dc.w $0005, $8584, $82C2, $FFD8 ;N
 
    dc.w $0005, $8588, $82C4, $FFE8 ;O
 
    dc.w $0005, $85E2, $82F1, $FFF8 ;C
 
    dc.w $0001, $85E6, $82F3, $0008 ;I
 
    dc.w $0005, $85E8, $82F4, $0010 ;D
 
    dc.w $0005, $8580, $82C0, $0020 ;E
 
 
 
    dc.w $0005, $85E2, $82F1, $0040 ;C
 
    dc.w $0001, $85E6, $82F3, $0050 ;I
 
    dc.w $0005, $85EC, $82F6, $0058 ;T
 
    dc.w $0005, $85F0, $82F8, $0068 ;Y
 
 
 
Titlecard_OOZ:     dc.w $8 ; number of letters
 
    dc.w $0005, $8588, $82C4, $FFF8 ;O
 
    dc.w $0001, $85DE, $82EF, $0008 ;I
 
    dc.w $0005, $85E0, $82F0, $0010 ;L
 
 
 
    dc.w $0005, $8588, $82C4, $0030 ;O
 
    dc.w $0005, $85E4, $82F2, $0040 ;C
 
    dc.w $0005, $8580, $82C0, $0050 ;E
 
    dc.w $0005, $85E8, $82F4, $0060 ;A
 
    dc.w $0005, $8584, $82C2, $0070 ;N
 
 
 
Titlecard_MCZ:     dc.w $a ; number of letters
 
    dc.w $0009, $85DE, $82EF, $FFD0 ;M
 
    dc.w $0005, $85E4, $82F2, $FFE8 ;Y
 
    dc.w $0005, $85E8, $82F4, $FFF8 ;S
 
    dc.w $0005, $85EC, $82F6, $0008 ;T
 
    dc.w $0001, $85F0, $82F8, $0018 ;I
 
    dc.w $0005, $85F2, $82F9, $0020 ;C
 
 
 
    dc.w $0005, $85F2, $82F9, $0040 ;C
 
    dc.w $0005, $85F6, $82FB, $0050 ;A
 
    dc.w $0005, $85FA, $82FD, $0060 ;V
 
    dc.w $0005, $8580, $82C0, $0070 ;E
 
 
 
Titlecard_CNZ:     dc.w $b ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFD0 ;C
 
    dc.w $0005, $85E2, $82F1, $FFE0 ;A
 
    dc.w $0005, $85E6, $82F3, $FFF0 ;S
 
    dc.w $0001, $85EA, $82F5, $0000 ;I
 
    dc.w $0005, $8584, $82C2, $0008 ;N
 
    dc.w $0005, $8588, $82C4, $0018 ;O
 
 
 
    dc.w $0005, $8584, $82C2, $0038 ;N
 
    dc.w $0001, $85EA, $82F5, $0048 ;I
 
    dc.w $0005, $85EC, $82F6, $0050 ;G
 
    dc.w $0005, $85F0, $82F8, $0060 ;H
 
    dc.w $0005, $85F4, $82FA, $0070 ;T
 
 
 
Titlecard_CPZ:     dc.w $d ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFA0 ;C
 
    dc.w $0005, $85E2, $82F1, $FFB0 ;H
 
    dc.w $0005, $8580, $82C0, $FFC0 ;E
 
    dc.w $0009, $85E6, $82F3, $FFD0 ;M
 
    dc.w $0001, $85EC, $82F6, $FFE8 ;I
 
    dc.w $0005, $85DE, $82EF, $FFF0 ;C
 
    dc.w $0005, $85EE, $82F7, $0000 ;A
 
    dc.w $0005, $85F2, $82F9, $0010 ;L
 
 
 
    dc.w $0005, $85F6, $82FB, $0030 ;P
 
    dc.w $0005, $85F2, $82F9, $0040 ;L
 
    dc.w $0005, $85EE, $82F7, $0050 ;A
 
    dc.w $0005, $8584, $82C2, $0060 ;N
 
    dc.w $0005, $85FA, $82FD, $0070 ;T
 
 
 
Titlecard_DEZ:     dc.w $8 ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFF0 ;D
 
    dc.w $0005, $8580, $82C0, $0000 ;E
 
    dc.w $0005, $85E2, $82F1, $0010 ;A
 
    dc.w $0005, $85E6, $82F3, $0020 ;T
 
    dc.w $0005, $85EA, $82F5, $0030 ;H
 
 
 
    dc.w $0005, $8580, $82C0, $0050 ;E
 
    dc.w $0005, $85EE, $82F7, $0060 ;G
 
    dc.w $0005, $85EE, $82F7, $0070 ;G
 
 
 
Titlecard_ARZ:     dc.w $c ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFD0 ;A
 
    dc.w $0005, $85E2, $82F1, $FFE0 ;Q
 
    dc.w $0005, $85E6, $82F3, $FFF0 ;U
 
    dc.w $0005, $85DE, $82EF, $0000 ;A
 
    dc.w $0005, $85EA, $82F5, $0010 ;T
 
    dc.w $0001, $85EE, $82F7, $0020 ;I
 
    dc.w $0005, $85F0, $82F8, $0028 ;C
 
 
 
    dc.w $0005, $85F4, $82FA, $0048 ;R
 
    dc.w $0005, $85E6, $82F3, $0058 ;U
 
    dc.w $0001, $85EE, $82F7, $0068 ;I
 
    dc.w $0005, $8584, $82C2, $0070 ;N
 
 
 
Titlecard_SCZ:     dc.w $8 ; number of letters
 
    dc.w $0005, $85DE, $82EF, $FFF0 ;S
 
    dc.w $0005, $85E2, $82F1, $0000 ;K
 
    dc.w $0005, $85E6, $82F3, $0010 ;Y
 
 
 
    dc.w $0005, $85EA, $82F5, $0030 ;C
 
    dc.w $0005, $85EE, $82F7, $0040 ;H
 
    dc.w $0005, $85F2, $82F7, $0050 ;A
 
    dc.w $0005, $85DE, $82EF, $0060 ;S
 
    dc.w $0005, $8580, $82C0, $0070 ;E
 
 
 
Titlecard_NZ:     dc.w $3 ; number of letters
 
    dc.w $0005, $8584, $82C2, $0048 ;N
 
    dc.w $0005, $8580, $82C0, $0058 ;E
 
    dc.w $0009, $85DE, $82EF, $0068 ;W
 
 
 
T_ZONE:     dc.w $4 ; number of letters
 
    dc.w $0005, $858C, $82C6, $0000 ;Z
 
    dc.w $0005, $8588, $82C4, $0010 ;O
 
    dc.w $0005, $8584, $82C2, $0020 ;N
 
    dc.w $0005, $8580, $82C0, $0030 ;E
 
 
 
 
 
T_ACT1:             dc.w $1 ; number of letters
 
    dc.w $0007, $A590, $A2C8, $0000 ;1
 
 
 
T_ACT2:     dc.w $1 ; number of letters
 
    dc.w $000B, $A598, $A2CC, $0000 ;2
 
 
 
T_ACT3:     dc.w $1 ; number of letters
 
    dc.w $000B, $A5A4, $A2D2, $0000 ;3
 
 
 
T_STH:          dc.w $5 ; number of letters
 
    dc.w $000D, $85B0, $82DE, $FFB8 ;SONI
 
    dc.w $000D, $85B8, $82DC, $FFD8 ;C TH
 
    dc.w $000D, $85C0, $82E0, $FFF8 ;E HE
 
    dc.w $000D, $85C8, $82E4, $0018 ;DGEH
 
    dc.w $0005, $85D0, $82E8, $0038 ;OG
 
 
 
T_STRIPEDGE:     dc.w $7 ; number of letters
 
    dc.w $9003, $85D4, $82EA, $0000 ;>
 
    dc.w $B003, $85D4, $82EA, $0000 ;>
 
    dc.w $D003, $85D4, $82EA, $0000 ;>
 
    dc.w $F003, $85D4, $82EA, $0000 ;>
 
    dc.w $1003, $85D4, $82EA, $0000 ;>
 
    dc.w $3003, $85D4, $82EA, $0000 ;>
 
    dc.w $5003, $85D4, $82EA, $0000 ;>
 
 
 
; -------------------------------------------------------------------------------
 
</asm>
 

Revision as of 06:47, 23 December 2010

(Split Trial: due to an unfortunate edit, I'm now trying to split this page to point some fixes - silent.creature)

(Original guide by kram, current revision that fixes major bugs and extends properly by GARY 'M 9)

(Updated again by kram, adding back custom titlecard mappings howto, due to guide being unfinished, thus finally fixing the "ZONE ZONE" bug. Replace all the empty levels with your new ones.)

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.

Extending the Titlecard index

Extending the Palette Cycle information

Extending the static palette list

Extending Zone Procedures and Scripts

Extending Animated Pattern Mappings

Extending the 1 Player and 2 Player music playlists

Branch fixes

Fixing Addressing

Extending the demo list

Extending the Collision index

Extending Rings Index

Extending the object index

Extending tiles and patterns index

Extending level and tile layout indexes

Extending the definition of act 2 (setting up our new levels so that they can have bosses in other words)

Extend Level Size Array

Extending the Start Location Index

Notes