Actions

SCHG How-to

Port the REV01 Background Effects

From Sonic Retro

(Original guide by jman2050)

Looking at the REV01 version of Sonic 1, I can see why it's Rev01. They pretty much completely overhauled the entire BG deformation part of the engine. The drawing system has been changed (and from what I've seen, more similar to the way Sonic 2 does things) and the deformation data for every level has been changed to fit this new code. Also, in every level besides SBZ2, it was used to enhance the deformation effects. To see the difference in your own Sonic 1 ROM hack, you'll have to do the following...

The Steps You Need

Step 1

First, we'll do the easiest change. Go to label Obj0A_WobbleData in Hivebrain's 2005 disassembly and replace the entire block with this:

Obj0A_WobbleData:
		dc.b 0, 0, 0, 0, 0, 0,	1, 1, 1, 1, 1, 2, 2, 2,	2, 2, 2
		dc.b 2,	3, 3, 3, 3, 3, 3, 3, 3,	3, 3, 3, 3, 3, 3, 4, 3
		dc.b 3,	3, 3, 3, 3, 3, 3, 3, 3,	3, 3, 3, 3, 2, 2, 2, 2
		dc.b 2,	2, 2, 1, 1, 1, 1, 1, 0,	0, 0, 0, 0, 0, -1, -1
		dc.b -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3
		dc.b -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4
		dc.b -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4
		dc.b -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2
		dc.b -2, -2, -2, -2, -1, -1, -1, -1, -1
		dc.b 0, 0, 0, 0, 0, 0,	1, 1, 1, 1, 1, 2, 2, 2,	2, 2, 2
		dc.b 2,	3, 3, 3, 3, 3, 3, 3, 3,	3, 3, 3, 3, 3, 3, 4, 3
		dc.b 3,	3, 3, 3, 3, 3, 3, 3, 3,	3, 3, 3, 3, 2, 2, 2, 2
		dc.b 2,	2, 2, 1, 1, 1, 1, 1, 0,	0, 0, 0, 0, 0, -1, -1
		dc.b -1, -1, -1, -2, -2, -2, -2, -2, -3, -3, -3, -3, -3
		dc.b -3, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4
		dc.b -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4
		dc.b -4, -4, -4, -4, -4, -3, -3, -3, -3, -3, -3, -3, -2
		dc.b -2, -2, -2, -2, -1, -1, -1, -1, -1

The programmers extended this array so it would also be usable by the deformation data even though it was designed to be used by the water bubbles.

Step 2

Next, we'll do the BGScroll data. Go to BGScroll_GHZ in the disassembly. Replace everything from there until the end of BGScroll_End with the following:

BgScroll_GHZ:				; XREF: BgScroll_Index
		clr.l	($FFFFF708).w
		clr.l	($FFFFF70C).w
		clr.l	($FFFFF714).w
		clr.l	($FFFFF71C).w
		lea	($FFFFA800).w,a2
		clr.l	(a2)+
		clr.l	(a2)+
		clr.l	(a2)+
		rts 
; ===========================================================================

BgScroll_LZ:				; XREF: BgScroll_Index
		asr.l	#1,d0
		move.w	d0,($FFFFF70C).w
		rts	
; ===========================================================================

BgScroll_MZ:				; XREF: BgScroll_Index
		rts	
; ===========================================================================

BgScroll_SLZ:				; XREF: BgScroll_Index
		asr.l	#1,d0
		addi.w	#$C0,d0
		move.w	d0,($FFFFF70C).w
		clr.l	($FFFFF708).w
		rts	
; ===========================================================================

BgScroll_SYZ:				; XREF: BgScroll_Index
		asl.l	#4,d0
		move.l	d0,d2
		asl.l	#1,d0
		add.l	d2,d0
		asr.l	#8,d0
		addq.w	#1,d0
		move.w	d0,($FFFFF70C).w
		clr.l	($FFFFF708).w
		rts	
; ===========================================================================

BgScroll_SBZ:				; XREF: BgScroll_Index
		andi.w	#$7F8,d0
		asr.w	#3,d0
		addq.w	#1,d0
		move.w	d0,($FFFFF70C).w
		rts	
; ===========================================================================

BgScroll_End:				; XREF: BgScroll_Index
		move.w	($FFFFF700).w,d0
		asr.w	#1,d0
		move.w	d0,($FFFFF708).w
		move.w	d0,($FFFFF710).w
		asr.w	#2,d0
		move.w	d0,d1
		add.w	d0,d0
		add.w	d1,d0
		move.w	d0,($FFFFF718).w
		clr.l	($FFFFF70C).w
		clr.l	($FFFFF714).w
		clr.l	($FFFFF71C).w
		lea	($FFFFA800).w,a2
		clr.l	(a2)+
		clr.l	(a2)+
		clr.l	(a2)+
		rts

The starting deformation data for every stage needed to be changed. To be precise, it prevents bugs that occur in the scrolling in SBZ and SYZ, and prevents a bug that causes GHZ's bg not to appear at all.

Step 3

Next, we'll do the deformation data itself. Go to Deform_GHZ, and replace everything from there until the end of Deform_SBZ, straight down (right before ScrollHoriz) with the following:

Deform_GHZ:
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#5,d4
		move.l	d4,d1
		asl.l	#1,d4
		add.l	d1,d4
		moveq	#0,d6
		bsr.w	ScrollBlock6
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#7,d4
		moveq	#0,d6
		bsr.w	ScrollBlock5
		lea	($FFFFCC00).w,a1
		move.w	($FFFFF704).w,d0
		andi.w	#$7FF,d0
		lsr.w	#5,d0
		neg.w	d0
		addi.w	#$20,d0	; ' '
		bpl.s	Deform_GHZ_1
		moveq	#0,d0

Deform_GHZ_1:				; XREF: Deform_GHZ
		move.w	d0,d4
		move.w	d0,($FFFFF618).w
		move.w	($FFFFF700).w,d0
		cmpi.b	#4,($FFFFF600).w
		bne.s	Deform_GHZ_2
		moveq	#0,d0

Deform_GHZ_2:				; XREF: Deform_GHZ
		neg.w	d0
		swap	d0
		lea	($FFFFA800).w,a2
		addi.l	#$10000,(a2)+
		addi.l	#$C000,(a2)+
		addi.l	#$8000,(a2)+
		move.w	($FFFFA800).w,d0
		add.w	($FFFFF718).w,d0
		neg.w	d0
		move.w	#$1F,d1
		sub.w	d4,d1
		bcs.s	Deform_GHZ_4

Deform_GHZ_3:				; XREF: Deform_GHZ
		move.l	d0,(a1)+
		dbf	d1,Deform_GHZ_3

Deform_GHZ_4:				; XREF: Deform_GHZ
		move.w	($FFFFA804).w,d0
		add.w	($FFFFF718).w,d0
		neg.w	d0
		move.w	#$F,d1

Deform_GHZ_5:				; XREF: Deform_GHZ
		move.l	d0,(a1)+
		dbf	d1,Deform_GHZ_5
		move.w	($FFFFA808).w,d0
		add.w	($FFFFF718).w,d0
		neg.w	d0
		move.w	#$F,d1

Deform_GHZ_6:				; XREF: Deform_GHZ
		move.l	d0,(a1)+
		dbf	d1,Deform_GHZ_6
		move.w	#$2F,d1	; '/'
		move.w	($FFFFF718).w,d0
		neg.w	d0

Deform_GHZ_7:				; XREF: Deform_GHZ
		move.l	d0,(a1)+
		dbf	d1,Deform_GHZ_7
		move.w	#$27,d1	; '''
		move.w	($FFFFF710).w,d0
		neg.w	d0

Deform_GHZ_8:				; XREF: Deform_GHZ
		move.l	d0,(a1)+
		dbf	d1,Deform_GHZ_8
		move.w	($FFFFF710).w,d0
		move.w	($FFFFF700).w,d2
		sub.w	d0,d2
		ext.l	d2
		asl.l	#8,d2
		divs.w	#$68,d2	; 'h'
		ext.l	d2
		asl.l	#8,d2
		moveq	#0,d3
		move.w	d0,d3
		move.w	#$47,d1	; 'G'
		add.w	d4,d1

Deform_GHZ_9:				; XREF: Deform_GHZ
		move.w	d3,d0
		neg.w	d0
		move.l	d0,(a1)+
		swap	d3
		add.l	d2,d3
		swap	d3
		dbf	d1,Deform_GHZ_9
		rts	
; End of function Deform_GHZ


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


Deform_LZ:
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#7,d4
		move.w	($FFFFF73C).w,d5
		ext.l	d5
		asl.l	#7,d5
		bsr.w	ScrollBlock1
		move.w	($FFFFF70C).w,($FFFFF618).w
		lea	(LZ_Wave_Data).l,a3
		lea	(Obj0A_WobbleData).l,a2
		move.b	($FFFFF7D8).w,d2
		move.b	d2,d3
		addi.w	#$80,($FFFFF7D8).w ; '€'
		add.w	($FFFFF70C).w,d2
		andi.w	#$FF,d2
		add.w	($FFFFF704).w,d3
		andi.w	#$FF,d3
		lea	($FFFFCC00).w,a1
		move.w	#$DF,d1	; 'ß'
		move.w	($FFFFF700).w,d0
		neg.w	d0
		move.w	d0,d6
		swap	d0
		move.w	($FFFFF708).w,d0
		neg.w	d0
		move.w	($FFFFF646).w,d4
		move.w	($FFFFF704).w,d5

Deform_LZ_1:				; XREF: Deform_LZ
		cmp.w	d4,d5
		bge.s	Deform_LZ_2
		move.l	d0,(a1)+
		addq.w	#1,d5
		addq.b	#1,d2
		addq.b	#1,d3
		dbf	d1,Deform_LZ_1
		rts	
; ===========================================================================

Deform_LZ_2:				; XREF: Deform_LZ
		move.b	(a3,d3.w),d4
		ext.w	d4
		add.w	d6,d4
		move.w	d4,(a1)+
		move.b	(a2,d2.w),d4
		ext.w	d4
		add.w	d0,d4
		move.w	d4,(a1)+
		addq.b	#1,d2
		addq.b	#1,d3
		dbf	d1,Deform_LZ_2
		rts	
; End of function Deform_LZ

; ===========================================================================
LZ_Wave_Data:	dc.b   1,  1,  2,  2,  3,  3,  3,  3,  2,  2,  1,  1,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b $FF,$FF,$FE,$FE,$FD,$FD,$FD,$FD,$FE,$FE,$FF,$FF,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   1,  1,  2,  2,  3,  3,  3,  3,  2,  2,  1,  1,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
		dc.b   0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


Deform_MZ:
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#6,d4
		move.l	d4,d1
		asl.l	#1,d4
		add.l	d1,d4
		moveq	#2,d6
		bsr.w	ScrollBlock4
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#6,d4
		moveq	#6,d6
		bsr.w	ScrollBlock6
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#7,d4
		moveq	#4,d6
		bsr.w	ScrollBlock5
		move.w	#$200,d0
		move.w	($FFFFF704).w,d1
		subi.w	#$1C8,d1
		bcs.s	Deform_MZ_1
		move.w	d1,d2
		add.w	d1,d1
		add.w	d2,d1
		asr.w	#2,d1
		add.w	d1,d0

Deform_MZ_1:				; XREF: Deform_MZ
		move.w	d0,($FFFFF714).w
		move.w	d0,($FFFFF71C).w
		bsr.w	ScrollBlock3
		move.w	($FFFFF70C).w,($FFFFF618).w
		move.b	($FFFFF756).w,d0
		or.b	($FFFFF758).w,d0
		or.b	d0,($FFFFF75A).w
		clr.b	($FFFFF756).w
		clr.b	($FFFFF758).w
		lea	($FFFFA800).w,a1
		move.w	($FFFFF700).w,d2
		neg.w	d2
		move.w	d2,d0
		asr.w	#2,d0
		sub.w	d2,d0
		ext.l	d0
		asl.l	#3,d0
		divs.w	#5,d0
		ext.l	d0
		asl.l	#4,d0
		asl.l	#8,d0
		moveq	#0,d3
		move.w	d2,d3
		asr.w	#1,d3
		move.w	#4,d1

Deform_MZ_2:				; XREF: Deform_MZ
		move.w	d3,(a1)+
		swap	d3
		add.l	d0,d3
		swap	d3
		dbf	d1,Deform_MZ_2
		move.w	($FFFFF718).w,d0
		neg.w	d0
		move.w	#1,d1

Deform_MZ_3:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_MZ_3
		move.w	($FFFFF710).w,d0
		neg.w	d0
		move.w	#8,d1

Deform_MZ_4:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_MZ_4
		move.w	($FFFFF708).w,d0
		neg.w	d0
		move.w	#$F,d1

Deform_MZ_5:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_MZ_5
		lea	($FFFFA800).w,a2
		move.w	($FFFFF70C).w,d0
		subi.w	#$200,d0
		move.w	d0,d2
		cmpi.w	#$100,d0
		bcs.s	Deform_MZ_6
		move.w	#$100,d0

Deform_MZ_6:				; XREF: Deform_MZ
		andi.w	#$1F0,d0
		lsr.w	#3,d0
		lea	(a2,d0.w),a2
		bra.w	Deform_All
; ===========================================================================

Deform_SLZ:
		move.w	($FFFFF73C).w,d5
		ext.l	d5
		asl.l	#7,d5
		bsr.w	ScrollBlock2
		move.w	($FFFFF70C).w,($FFFFF618).w
		lea	($FFFFA800).w,a1
		move.w	($FFFFF700).w,d2
		neg.w	d2
		move.w	d2,d0
		asr.w	#3,d0
		sub.w	d2,d0
		ext.l	d0
		asl.l	#4,d0
		divs.w	#$1C,d0
		ext.l	d0
		asl.l	#4,d0
		asl.l	#8,d0
		moveq	#0,d3
		move.w	d2,d3
		move.w	#$1B,d1

Deform_SLZ_1:				; XREF: Deform_MZ
		move.w	d3,(a1)+
		swap	d3
		add.l	d0,d3
		swap	d3
		dbf	d1,Deform_SLZ_1
		move.w	d2,d0
		asr.w	#3,d0
		move.w	d0,d1
		asr.w	#1,d1
		add.w	d1,d0
		move.w	#4,d1

Deform_SLZ_2:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SLZ_2
		move.w	d2,d0
		asr.w	#2,d0
		move.w	#4,d1

Deform_SLZ_3:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SLZ_3
		move.w	d2,d0
		asr.w	#1,d0
		move.w	#$1D,d1

Deform_SLZ_4:				; XREF: Deform_MZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SLZ_4
		lea	($FFFFA800).w,a2
		move.w	($FFFFF70C).w,d0
		move.w	d0,d2
		subi.w	#$C0,d0	; 'À'
		andi.w	#$3F0,d0
		lsr.w	#3,d0
		lea	(a2,d0.w),a2

Deform_All:				; XREF: Deform_MZ, Deform_SYZ, ...
		lea	($FFFFCC00).w,a1
		move.w	#$E,d1
		move.w	($FFFFF700).w,d0
		neg.w	d0
		swap	d0
		andi.w	#$F,d2
		add.w	d2,d2
		move.w	(a2)+,d0
		jmp	Deform_All_2(pc,d2.w)
; End of function Deform_MZ

; ===========================================================================

Deform_All_1:				; XREF: Deform_All
		move.w	(a2)+,d0

Deform_All_2:
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		move.l	d0,(a1)+
		dbf	d1,Deform_All_1
		rts	

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


Deform_SYZ:
		move.w	($FFFFF73C).w,d5
		ext.l	d5
		asl.l	#4,d5
		move.l	d5,d1
		asl.l	#1,d5
		add.l	d1,d5
		bsr.w	ScrollBlock2
		move.w	($FFFFF70C).w,($FFFFF618).w
		lea	($FFFFA800).w,a1
		move.w	($FFFFF700).w,d2
		neg.w	d2
		move.w	d2,d0
		asr.w	#3,d0
		sub.w	d2,d0
		ext.l	d0
		asl.l	#3,d0
		divs.w	#8,d0
		ext.l	d0
		asl.l	#4,d0
		asl.l	#8,d0
		moveq	#0,d3
		move.w	d2,d3
		asr.w	#1,d3
		move.w	#7,d1

Deform_SYZ_1:				; XREF: Deform_SYZ
		move.w	d3,(a1)+
		swap	d3
		add.l	d0,d3
		swap	d3
		dbf	d1,Deform_SYZ_1
		move.w	d2,d0
		asr.w	#3,d0
		move.w	#4,d1

Deform_SYZ_2:				; XREF: Deform_SYZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SYZ_2
		move.w	d2,d0
		asr.w	#2,d0
		move.w	#5,d1

Deform_SYZ_3:				; XREF: Deform_SYZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SYZ_3
		move.w	d2,d0
		move.w	d2,d1
		asr.w	#1,d1
		sub.w	d1,d0
		ext.l	d0
		asl.l	#4,d0
		divs.w	#$E,d0
		ext.l	d0
		asl.l	#4,d0
		asl.l	#8,d0
		moveq	#0,d3
		move.w	d2,d3
		asr.w	#1,d3
		move.w	#$D,d1

Deform_SYZ_4:				; XREF: Deform_SYZ
		move.w	d3,(a1)+
		swap	d3
		add.l	d0,d3
		swap	d3
		dbf	d1,Deform_SYZ_4
		lea	($FFFFA800).w,a2
		move.w	($FFFFF70C).w,d0
		move.w	d0,d2
		andi.w	#$1F0,d0
		lsr.w	#3,d0
		lea	(a2,d0.w),a2
		bra.w	Deform_All
; End of function Deform_SYZ


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


Deform_SBZ:
		tst.b	($FFFFFE11).w
		bne.w	Deform_SBZ_Act2
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#7,d4
		moveq	#2,d6
		bsr.w	ScrollBlock4
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#6,d4
		moveq	#6,d6
		bsr.w	ScrollBlock6
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#5,d4
		move.l	d4,d1
		asl.l	#1,d4
		add.l	d1,d4
		moveq	#4,d6
		bsr.w	ScrollBlock5
		moveq	#0,d4
		move.w	($FFFFF73C).w,d5
		ext.l	d5
		asl.l	#5,d5
		bsr.w	ScrollBlock1_2
		move.w	($FFFFF70C).w,d0
		move.w	d0,($FFFFF714).w
		move.w	d0,($FFFFF71C).w
		move.w	d0,($FFFFF618).w
		move.b	($FFFFF756).w,d0
		or.b	($FFFFF75A).w,d0
		or.b	d0,($FFFFF758).w
		clr.b	($FFFFF756).w
		clr.b	($FFFFF75A).w
		lea	($FFFFA800).w,a1
		move.w	($FFFFF700).w,d2
		neg.w	d2
		asr.w	#2,d2
		move.w	d2,d0
		asr.w	#1,d0
		sub.w	d2,d0
		ext.l	d0
		asl.l	#3,d0
		divs.w	#4,d0
		ext.l	d0
		asl.l	#4,d0
		asl.l	#8,d0
		moveq	#0,d3
		move.w	d2,d3
		move.w	#3,d1

Deform_SBZ_1:				; XREF: Deform_SBZ
		move.w	d3,(a1)+
		swap	d3
		add.l	d0,d3
		swap	d3
		dbf	d1,Deform_SBZ_1
		move.w	($FFFFF718).w,d0
		neg.w	d0
		move.w	#9,d1

Deform_SBZ_2:				; XREF: Deform_SBZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SBZ_2
		move.w	($FFFFF710).w,d0
		neg.w	d0
		move.w	#6,d1

Deform_SBZ_3:				; XREF: Deform_SBZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SBZ_3
		move.w	($FFFFF708).w,d0
		neg.w	d0
		move.w	#$A,d1

Deform_SBZ_4:				; XREF: Deform_SBZ
		move.w	d0,(a1)+
		dbf	d1,Deform_SBZ_4
		lea	($FFFFA800).w,a2
		move.w	($FFFFF70C).w,d0
		move.w	d0,d2
		andi.w	#$1F0,d0
		lsr.w	#3,d0
		lea	(a2,d0.w),a2
		bra.w	Deform_All
; ===========================================================================

Deform_SBZ_Act2:			; XREF: Deform_SBZ
		move.w	($FFFFF73A).w,d4
		ext.l	d4
		asl.l	#6,d4
		move.w	($FFFFF73C).w,d5
		ext.l	d5
		asl.l	#5,d5
		bsr.w	ScrollBlock1
		move.w	($FFFFF70C).w,($FFFFF618).w
		lea	($FFFFCC00).w,a1
		move.w	#$DF,d1	; 'ß'
		move.w	($FFFFF700).w,d0
		neg.w	d0
		swap	d0
		move.w	($FFFFF708).w,d0
		neg.w	d0

Deform_SBZ_Act2_1:			; XREF: Deform_SBZ
		move.l	d0,(a1)+
		dbf	d1,Deform_SBZ_Act2_1
		rts	
; End of function Deform_SBZ

Step 4

The new Bg drawing system required a different method of scrolling the BGs themselves. Go to ScrollBlock1 and replace everything from there until the end of ScrollBlock4 with the following:

ScrollBlock1:				; XREF: Deform_LZ, Deform_SBZ
		move.l	($FFFFF708).w,d2
		move.l	d2,d0
		add.l	d4,d0
		move.l	d0,($FFFFF708).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF74C).w,d3
		eor.b	d3,d1
		bne.s	ScrollBlock1_2
		eori.b	#$10,($FFFFF74C).w
		sub.l	d2,d0
		bpl.s	ScrollBlock1_1
		bset	#2,($FFFFF756).w
		bra.s	ScrollBlock1_2
; ===========================================================================

ScrollBlock1_1:				; XREF: ScrollBlock1
		bset	#3,($FFFFF756).w

ScrollBlock1_2:				; XREF: ScrollBlock1, Deform_SBZ, ...
		move.l	($FFFFF70C).w,d3
		move.l	d3,d0
		add.l	d5,d0
		move.l	d0,($FFFFF70C).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF74D).w,d2
		eor.b	d2,d1
		bne.s	ScrollBlock1_End
		eori.b	#$10,($FFFFF74D).w
		sub.l	d3,d0
		bpl.s	ScrollBlock1_3
		bset	#0,($FFFFF756).w
		rts	
; ===========================================================================

ScrollBlock1_3:				; XREF: ScrollBlock1
		bset	#1,($FFFFF756).w

ScrollBlock1_End:			; XREF: ScrollBlock1
		rts	
; End of function ScrollBlock1


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


ScrollBlock2:				; XREF: Deform_MZ, Deform_SYZ
		move.l	($FFFFF70C).w,d3
		move.l	d3,d0
		add.l	d5,d0
		move.l	d0,($FFFFF70C).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF74D).w,d2
		eor.b	d2,d1
		bne.s	ScrollBlock2_End
		eori.b	#$10,($FFFFF74D).w
		sub.l	d3,d0
		bpl.s	ScrollBlock2_1
		bset	#4,($FFFFF756).w
		rts	
; ===========================================================================

ScrollBlock2_1:				; XREF: ScrollBlock2
		bset	#5,($FFFFF756).w

ScrollBlock2_End:			; XREF: ScrollBlock2
		rts	
; End of function ScrollBlock2


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


ScrollBlock3:				; XREF: Deform_MZ
		move.w	($FFFFF70C).w,d3
		move.w	d0,($FFFFF70C).w
		move.w	d0,d1
		andi.w	#$10,d1
		move.b	($FFFFF74D).w,d2
		eor.b	d2,d1
		bne.s	ScrollBlock3_End
		eori.b	#$10,($FFFFF74D).w
		sub.w	d3,d0
		bpl.s	ScrollBlock3_1
		bset	#0,($FFFFF756).w
		rts	
; ===========================================================================

ScrollBlock3_1:				; XREF: ScrollBlock3
		bset	#1,($FFFFF756).w

ScrollBlock3_End:			; XREF: ScrollBlock3
		rts	
; End of function ScrollBlock3


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


ScrollBlock4:				; XREF: Deform_MZ, Deform_SBZ
		move.l	($FFFFF708).w,d2
		move.l	d2,d0
		add.l	d4,d0
		move.l	d0,($FFFFF708).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF74C).w,d3
		eor.b	d3,d1
		bne.s	ScrollBlock4_End
		eori.b	#$10,($FFFFF74C).w
		sub.l	d2,d0
		bpl.s	ScrollBlock4_1
		bset	d6,($FFFFF756).w
		bra.s	ScrollBlock4_End
; ===========================================================================

ScrollBlock4_1:				; XREF: ScrollBlock4
		addq.b	#1,d6
		bset	d6,($FFFFF756).w

ScrollBlock4_End:			; XREF: ScrollBlock4
		rts	
; End of function ScrollBlock4


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


ScrollBlock5:				; XREF: Deform_GHZ, Deform_MZ, ...
		move.l	($FFFFF710).w,d2
		move.l	d2,d0
		add.l	d4,d0
		move.l	d0,($FFFFF710).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF74E).w,d3
		eor.b	d3,d1
		bne.s	ScrollBlock5_End
		eori.b	#$10,($FFFFF74E).w
		sub.l	d2,d0
		bpl.s	ScrollBlock5_1
		bset	d6,($FFFFF758).w
		bra.s	ScrollBlock5_End
; ===========================================================================

ScrollBlock5_1:				; XREF: ScrollBlock5
		addq.b	#1,d6
		bset	d6,($FFFFF758).w

ScrollBlock5_End:			; XREF: ScrollBlock5
		rts	
; End of function ScrollBlock5


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


ScrollBlock6:				; XREF: Deform_GHZ, Deform_MZ, ...
		move.l	($FFFFF718).w,d2
		move.l	d2,d0
		add.l	d4,d0
		move.l	d0,($FFFFF718).w
		move.l	d0,d1
		swap	d1
		andi.w	#$10,d1
		move.b	($FFFFF750).w,d3
		eor.b	d3,d1
		bne.s	ScrollBlock6_End
		eori.b	#$10,($FFFFF750).w
		sub.l	d2,d0
		bpl.s	ScrollBlock6_1
		bset	d6,($FFFFF75A).w
		bra.s	ScrollBlock6_End
; ===========================================================================

ScrollBlock6_1:				; XREF: ScrollBlock6
		addq.b	#1,d6
		bset	d6,($FFFFF75A).w

ScrollBlock6_End:			; XREF: ScrollBlock6
		rts	
; End of function ScrollBlock6

Don't worry that there are six BGScroll functions now, that's taken cared of.

Step 5

Finally, the biggest part: the BG drawing code. Go to sub_6886 and replace everything from there until the end of LoadTilesFromStart2 (that's a VERY long way, up until MainLoadBlockLoad) with the following:

sub_6886:		
		lea	($C00004).l,a5
		lea	($C00000).l,a6
		lea	($FFFFF756).w,a2
		lea	($FFFFF708).w,a3
		lea	($FFFFA440).w,a4
		move.w	#$6000,d2
		bsr.w	sub_6D0A
		lea	($FFFFF758).w,a2
		lea	($FFFFF710).w,a3
		bra.w	sub_6DA6
; End of function sub_6886

; ---------------------------------------------------------------------------
; Subroutine to	display	correct	tiles as you move
; ---------------------------------------------------------------------------

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


LoadTilesAsYouMove:			; XREF: Demo_Time
		lea	($C00004).l,a5
		lea	($C00000).l,a6
		lea	($FFFFFF32).w,a2
		lea	($FFFFFF18).w,a3
		lea	($FFFFA440).w,a4
		move.w	#$6000,d2
		bsr.w	sub_6D0A
		lea	($FFFFFF34).w,a2
		lea	($FFFFFF20).w,a3
		bsr.w	sub_6DA6
		lea	($FFFFFF36).w,a2
		lea	($FFFFFF28).w,a3
		bsr.w	sub_6EA4
		lea	($FFFFFF30).w,a2
		lea	($FFFFFF10).w,a3
		lea	($FFFFA400).w,a4
		move.w	#$4000,d2
		tst.b	($FFFFF745).w
		beq.s	Draw_FG
		move.b	#0,($FFFFF745).w	;Reset the redraw flag
		moveq	#-$10,d4			;Go to top line oflevel data relative camera position
		moveq	#$F,d6				;

Draw_All:
		movem.l	d4-d6,-(sp)			; This whole routine basically redraws the whole
		moveq	#-$10,d5			; area instead of merely a line of tiles
		move.w	d4,d1
		bsr.w	Calc_VRAM_Pos
		move.w	d1,d4
		moveq	#-$10,d5
		bsr.w	DrawTiles_LR
		movem.l	(sp)+,d4-d6
		addi.w	#$10,d4
		dbf	d6,Draw_All
		rts	

Draw_FG:
		tst.b	(a2)
		beq.s	locret_6D08
		bclr	#0,(a2)
		beq.s	loc_6CBE
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	DrawTiles_LR

loc_6CBE:
		bclr	#1,(a2)
		beq.s	loc_6CD8
		move.w	#$E0,d4	; 'à'
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$E0,d4	; 'à'
		moveq	#-$10,d5
		bsr.w	DrawTiles_LR

loc_6CD8:
		bclr	#2,(a2)
		beq.s	loc_6CEE
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	DrawTiles_TB

loc_6CEE:
		bclr	#3,(a2)
		beq.s	locret_6D08
		moveq	#-$10,d4
		move.w	#$140,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		move.w	#$140,d5
		bsr.w	DrawTiles_TB

locret_6D08:
		rts	

; End of function LoadTilesAsYouMove


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_6D0A:
		tst.b	(a2)
		beq.w	locret_6DA4
		bclr	#0,(a2)
		beq.s	loc_6D26
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	DrawTiles_LR

loc_6D26:
		bclr	#1,(a2)
		beq.s	loc_6D40
		move.w	#$E0,d4	; 'à'
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$E0,d4	; 'à'
		moveq	#-$10,d5
		bsr.w	DrawTiles_LR

loc_6D40:
		bclr	#2,(a2)
		beq.s	loc_6D56
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		moveq	#-$10,d5
		bsr.w	DrawTiles_TB

loc_6D56:
		bclr	#3,(a2)
		beq.s	loc_6D70
		moveq	#-$10,d4
		move.w	#$140,d5
		bsr.w	Calc_VRAM_Pos
		moveq	#-$10,d4
		move.w	#$140,d5
		bsr.w	DrawTiles_TB

loc_6D70:
		bclr	#4,(a2)
		beq.s	loc_6D88
		moveq	#-$10,d4
		moveq	#0,d5
		bsr.w	loc_7176
		moveq	#-$10,d4
		moveq	#0,d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR3

loc_6D88:
		bclr	#5,(a2)
		beq.s	locret_6DA4
		move.w	#$E0,d4	; 'à'
		moveq	#0,d5
		bsr.w	loc_7176
		move.w	#$E0,d4	; 'à'
		moveq	#0,d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR3

locret_6DA4:
		rts	
; End of function sub_6D0A


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_6DA6:
		tst.b	(a2)
		beq.w	locret_6DF2
		cmpi.b	#5,($FFFFFE10).w
		beq.w	loc_6E16
		bclr	#0,(a2)
		beq.s	loc_6DD2
		move.w	#$70,d4	; 'p'
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$70,d4	; 'p'
		moveq	#-$10,d5
		moveq	#2,d6
		bsr.w	DrawTiles_TB2

loc_6DD2:
		bclr	#1,(a2)
		beq.s	locret_6DF2
		move.w	#$70,d4	; 'p'
		move.w	#$140,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$70,d4	; 'p'
		move.w	#$140,d5
		moveq	#2,d6
		bsr.w	DrawTiles_TB2

locret_6DF2:
		rts	
; ===========================================================================
unk_6DF4:	dc.b   0 ;	 
unk_6DF5:	dc.b   0 ;	 
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   0 ;  
; ===========================================================================

loc_6E16:
		moveq	#-$10,d4
		bclr	#0,(a2)
		bne.s	loc_6E28
		bclr	#1,(a2)
		beq.s	loc_6E72
		move.w	#$E0,d4	; 'à'

loc_6E28:
		lea	(unk_6DF5).l,a0
		move.w	($FFFFF70C).w,d0
		add.w	d4,d0
		andi.w	#$1F0,d0
		lsr.w	#4,d0
		move.b	(a0,d0.w),d0
		lea	(unk_6FE4).l,a3
		movea.w	(a3,d0.w),a3
		beq.s	loc_6E5E
		moveq	#-$10,d5
		movem.l	d4-d5,-(sp)
		bsr.w	Calc_VRAM_Pos
		movem.l	(sp)+,d4-d5
		bsr.w	DrawTiles_LR
		bra.s	loc_6E72
; ===========================================================================

loc_6E5E:
		moveq	#0,d5
		movem.l	d4-d5,-(sp)
		bsr.w	loc_7176
		movem.l	(sp)+,d4-d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR3

loc_6E72:
		tst.b	(a2)
		bne.s	loc_6E78
		rts	
; ===========================================================================

loc_6E78:
		moveq	#-$10,d4
		moveq	#-$10,d5
		move.b	(a2),d0
		andi.b	#-$58,d0
		beq.s	loc_6E8C
		lsr.b	#1,d0
		move.b	d0,(a2)
		move.w	#$140,d5

loc_6E8C:
		lea	(unk_6DF4).l,a0
		move.w	($FFFFF70C).w,d0
		andi.w	#$1F0,d0
		lsr.w	#4,d0
		lea	(a0,d0.w),a0
		bra.w	loc_6FEC
; End of function sub_6DA6


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_6EA4:
		tst.b	(a2)
		beq.w	locret_6EF0
		cmpi.b	#2,($FFFFFE10).w
		beq.w	loc_6F54
		bclr	#0,(a2)
		beq.s	loc_6ED0_2
		move.w	#$40,d4	; '@'
		moveq	#-$10,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$40,d4	; '@'
		moveq	#-$10,d5
		moveq	#2,d6
		bsr.w	DrawTiles_TB2

loc_6ED0_2:
		bclr	#1,(a2)
		beq.s	locret_6EF0
		move.w	#$40,d4	; '@'
		move.w	#$140,d5
		bsr.w	Calc_VRAM_Pos
		move.w	#$40,d4	; '@'
		move.w	#$140,d5
		moveq	#2,d6
		bsr.w	DrawTiles_TB2

locret_6EF0:
		rts	
; ===========================================================================
unk_6EF2:	dc.b   0 ;	 
unk_6EF3:	dc.b   0 ;	 
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   2 ;  
		dc.b   0 ;  
; ===========================================================================

loc_6F54:
		moveq	#-$10,d4
		bclr	#0,(a2)
		bne.s	loc_6F66
		bclr	#1,(a2)
		beq.s	loc_6FAE
		move.w	#$E0,d4	; 'à'

loc_6F66:
		lea	(unk_6EF3).l,a0
		move.w	($FFFFF70C).w,d0
		subi.w	#$200,d0
		add.w	d4,d0
		andi.w	#$7F0,d0
		lsr.w	#4,d0
		move.b	(a0,d0.w),d0
		movea.w	unk_6FE4(pc,d0.w),a3
		beq.s	loc_6F9A
		moveq	#-$10,d5
		movem.l	d4-d5,-(sp)
		bsr.w	Calc_VRAM_Pos
		movem.l	(sp)+,d4-d5
		bsr.w	DrawTiles_LR
		bra.s	loc_6FAE
; ===========================================================================

loc_6F9A:
		moveq	#0,d5
		movem.l	d4-d5,-(sp)
		bsr.w	loc_7176
		movem.l	(sp)+,d4-d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR3

loc_6FAE:
		tst.b	(a2)
		bne.s	loc_6FB4
		rts	
; ===========================================================================

loc_6FB4:
		moveq	#-$10,d4
		moveq	#-$10,d5
		move.b	(a2),d0
		andi.b	#-$58,d0
		beq.s	loc_6FC8
		lsr.b	#1,d0
		move.b	d0,(a2)
		move.w	#$140,d5

loc_6FC8:
		lea	(unk_6EF2).l,a0
		move.w	($FFFFF70C).w,d0
		subi.w	#$200,d0
		andi.w	#$7F0,d0
		lsr.w	#4,d0
		lea	(a0,d0.w),a0
		bra.w	loc_6FEC
; ===========================================================================
unk_6FE4:	dc.b $FF ;  
		dc.b $18 ;  
		dc.b $FF ;  
		dc.b $18 ;  
		dc.b $FF ;  
		dc.b $20 ;  
		dc.b $FF ;  
		dc.b $28 ; (
; ===========================================================================

loc_6FEC:
		moveq	#$F,d6
		move.l	#$800000,d7

loc_6FF4:
		moveq	#0,d0
		move.b	(a0)+,d0
		btst	d0,(a2)
		beq.s	loc_701C
		movea.w	unk_6FE4(pc,d0.w),a3
		movem.l	d4-d5/a0,-(sp)
		movem.l	d4-d5,-(sp)
		bsr.w	sub_712A
		movem.l	(sp)+,d4-d5
		bsr.w	Calc_VRAM_Pos
		bsr.w	sub_70AC
		movem.l	(sp)+,d4-d5/a0

loc_701C:
		addi.w	#$10,d4
		dbf	d6,loc_6FF4
		clr.b	(a2)
		rts	
; End of function sub_6EA4


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DrawTiles_LR:
		moveq	#$15,d6
; End of function DrawTiles_LR


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DrawTiles_LR2:
		move.l	#$800000,d7
		move.l	d0,d1

loc_7032:
		movem.l	d4-d5,-(sp)
		bsr.w	sub_712A
		move.l	d1,d0
		bsr.w	sub_70AC
		addq.b	#4,d1
		andi.b	#$7F,d1	; '?'
		movem.l	(sp)+,d4-d5
		addi.w	#$10,d5
		dbf	d6,loc_7032
		rts	
; End of function DrawTiles_LR2


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DrawTiles_LR3:
		move.l	#$800000,d7
		move.l	d0,d1

loc_705C:
		movem.l	d4-d5,-(sp)
		bsr.w	loc_712C
		move.l	d1,d0
		bsr.w	sub_70AC
		addq.b	#4,d1
		andi.b	#$7F,d1	; '?'
		movem.l	(sp)+,d4-d5
		addi.w	#$10,d5
		dbf	d6,loc_705C
		rts	
; End of function DrawTiles_LR3


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DrawTiles_TB:
		moveq	#$F,d6
; End of function DrawTiles_TB


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


DrawTiles_TB2:
		move.l	#$800000,d7
		move.l	d0,d1

loc_7088:
		movem.l	d4-d5,-(sp)
		bsr.w	sub_712A
		move.l	d1,d0
		bsr.w	sub_70AC
		addi.w	#$100,d1
		andi.w	#$FFF,d1
		movem.l	(sp)+,d4-d5
		addi.w	#$10,d4
		dbf	d6,loc_7088
		rts	
; End of function DrawTiles_TB2


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_70AC:
		or.w	d2,d0
		swap	d0
		btst	#4,(a0)
		bne.s	loc_70E8
		btst	#3,(a0)
		bne.s	loc_70C8
		move.l	d0,(a5)
		move.l	(a1)+,(a6)
		add.l	d7,d0
		move.l	d0,(a5)
		move.l	(a1)+,(a6)
		rts	
; ===========================================================================

loc_70C8:
		move.l	d0,(a5)
		move.l	(a1)+,d4
		eori.l	#$8000800,d4
		swap	d4
		move.l	d4,(a6)
		add.l	d7,d0
		move.l	d0,(a5)
		move.l	(a1)+,d4
		eori.l	#$8000800,d4
		swap	d4
		move.l	d4,(a6)
		rts	
; ===========================================================================

loc_70E8:
		btst	#3,(a0)
		bne.s	loc_710A
		move.l	d0,(a5)
		move.l	(a1)+,d5
		move.l	(a1)+,d4
		eori.l	#$10001000,d4
		move.l	d4,(a6)
		add.l	d7,d0
		move.l	d0,(a5)
		eori.l	#$10001000,d5
		move.l	d5,(a6)
		rts	
; ===========================================================================

loc_710A:
		move.l	d0,(a5)
		move.l	(a1)+,d5
		move.l	(a1)+,d4
		eori.l	#$18001800,d4
		swap	d4
		move.l	d4,(a6)
		add.l	d7,d0
		move.l	d0,(a5)
		eori.l	#$18001800,d5
		swap	d5
		move.l	d5,(a6)
		rts	
; End of function sub_70AC


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_712A:
		add.w	(a3),d5

loc_712C:
		add.w	4(a3),d4
		lea	($FFFFB000).w,a1
		move.w	d4,d3
		lsr.w	#1,d3
		andi.w	#$380,d3
		lsr.w	#3,d5
		move.w	d5,d0
		lsr.w	#5,d0
		andi.w	#$7F,d0	; '?'
		add.w	d3,d0
		moveq	#-1,d3
		move.b	(a4,d0.w),d3
		beq.s	locret_7172
		subq.b	#1,d3
		andi.w	#$7F,d3	; '?'
		ror.w	#7,d3
		add.w	d4,d4
		andi.w	#$1E0,d4
		andi.w	#$1E,d5
		add.w	d4,d3
		add.w	d5,d3
		movea.l	d3,a0
		move.w	(a0),d3
		andi.w	#$3FF,d3
		lsl.w	#3,d3
		adda.w	d3,a1

locret_7172:
		rts	
; End of function sub_712A


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


Calc_VRAM_Pos:
		add.w	(a3),d5

loc_7176:
		add.w	4(a3),d4
		andi.w	#$F0,d4	; 'ð'
		andi.w	#$1F0,d5
		lsl.w	#4,d4
		lsr.w	#2,d5
		add.w	d5,d4
		moveq	#3,d0
		swap	d0
		move.w	d4,d0
		rts	
; End of function Calc_VRAM_Pos

; ===========================================================================
		add.w	4(a3),d4
		add.w	(a3),d5
		andi.w	#$F0,d4	; 'ð'
		andi.w	#$1F0,d5
		lsl.w	#4,d4
		lsr.w	#2,d5
		add.w	d5,d4
		moveq	#2,d0
		swap	d0
		move.w	d4,d0
		rts	

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


LoadTilesFromStart:
		lea	($C00004).l,a5
		lea	($C00000).l,a6
		lea	($FFFFF700).w,a3
		lea	($FFFFA400).w,a4
		move.w	#$4000,d2
		bsr.s	LoadTilesFromStart2
		lea	($FFFFF708).w,a3
		lea	($FFFFA440).w,a4
		move.w	#$6000,d2
		tst.b	($FFFFFE10).w
		beq.w	loc_7220
		cmpi.b	#2,($FFFFFE10).w
		beq.w	loc_725A
		cmpi.w	#$500,($FFFFFE10).w
		beq.w	loc_7288
		cmpi.b	#6,($FFFFFE10).w
		beq.w	loc_7220
; End of function LoadTilesFromStart


; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


LoadTilesFromStart2:
		moveq	#-$10,d4
		moveq	#$F,d6

loc_71FC:
		movem.l	d4-d6,-(sp)
		moveq	#0,d5
		move.w	d4,d1
		bsr.w	Calc_VRAM_Pos
		move.w	d1,d4
		moveq	#0,d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR2
		movem.l	(sp)+,d4-d6
		addi.w	#$10,d4
		dbf	d6,loc_71FC
		rts	
; End of function LoadTilesFromStart2

; ===========================================================================

loc_7220:
		moveq	#0,d4
		moveq	#$F,d6

loc_7224:
		movem.l	d4-d6,-(sp)
		lea	(unk_724A).l,a0
		move.w	($FFFFF70C).w,d0
		add.w	d4,d0
		andi.w	#$F0,d0	; 'ð'
		bsr.w	sub_72BA
		movem.l	(sp)+,d4-d6
		addi.w	#$10,d4
		dbf	d6,loc_7224
		rts	
; ===========================================================================
unk_724A:	dc.b   0 ;	 
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   6 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   4 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
		dc.b   0 ;  
; ===========================================================================

loc_725A:
		moveq	#-$10,d4
		moveq	#$F,d6

loc_725E:
		movem.l	d4-d6,-(sp)
		lea	(unk_6EF3).l,a0
		move.w	($FFFFF70C).w,d0
		subi.w	#$200,d0
		add.w	d4,d0
		andi.w	#$7F0,d0
		bsr.w	sub_72BA
		movem.l	(sp)+,d4-d6
		addi.w	#$10,d4
		dbf	d6,loc_725E
		rts	
; ===========================================================================

loc_7288:
		moveq	#-$10,d4
		moveq	#$F,d6

loc_728C:
		movem.l	d4-d6,-(sp)
		lea	(unk_6DF5).l,a0
		move.w	($FFFFF70C).w,d0
		add.w	d4,d0
		andi.w	#$1F0,d0
		bsr.w	sub_72BA
		movem.l	(sp)+,d4-d6
		addi.w	#$10,d4
		dbf	d6,loc_728C
		rts	
; ===========================================================================
unk_72B2:	dc.b $F7 ; ÷
		dc.b   8 ;  
		dc.b $F7 ; ÷
		dc.b   8 ;  
		dc.b $F7 ; ÷
		dc.b $10 ;  
		dc.b $F7 ; ÷
		dc.b $18 ;  

; ||||||||||||||| S U B	R O U T	I N E |||||||||||||||||||||||||||||||||||||||


sub_72BA:
		lsr.w	#4,d0
		move.b	(a0,d0.w),d0
		movea.w	unk_72B2(pc,d0.w),a3
		beq.s	loc_72DA
		moveq	#-$10,d5
		movem.l	d4-d5,-(sp)
		bsr.w	Calc_VRAM_Pos
		movem.l	(sp)+,d4-d5
		bsr.w	DrawTiles_LR
		bra.s	locret_72EE
; ===========================================================================

loc_72DA:
		moveq	#0,d5
		movem.l	d4-d5,-(sp)
		bsr.w	loc_7176
		movem.l	(sp)+,d4-d5
		moveq	#$1F,d6
		bsr.w	DrawTiles_LR3

locret_72EE:
		rts	
; End of function sub_72BA

Step 6

Assuming you haven't changed the backgrounds of your levels, compile it and give it a go!

Credits

  • Hivebrain - for attempting this first
  • Tweaker - for his assistance when I had some issues to resolve.

Extra step

If you get errors upon compiling, you'll need to follow this extra step.

Fixing the errors

Alright, so after you've followed the main guide, you'll need to go here in your disasm:

Obj89:					; XREF: Obj_Index
		moveq	#0,d0
		move.b	$24(a0),d0
		move.w	Obj89_Index(pc,d0.w),d1
		jmp	Obj89_Index(pc,d1.w)
; ===========================================================================
Obj89_Index:	dc.w Obj89_Main-Obj89_Index
		dc.w Obj89_Move-Obj89_Index
		dc.w Obj89_GotoCredits-Obj89_Index
; ===========================================================================

Obj89_Main:				; XREF: Obj89_Index
		addq.b	#2,$24(a0)
		move.w	#-$20,8(a0)	; object starts	outside	the level boundary
		move.w	#$D8,$A(a0)
		move.l	#Map_obj89,4(a0)
		move.w	#$5C5,2(a0)
		move.b	#0,1(a0)
		move.b	#0,$18(a0)

Obj89_Move:				; XREF: Obj89_Index
		cmpi.w	#$C0,8(a0)	; has object reached $C0?
		beq.s	Obj89_Delay	; if yes, branch
		addi.w	#$10,8(a0)	; move object to the right
		bra.w	DisplaySprite
; ===========================================================================

Obj89_Delay:				; XREF: Obj89_Move
		addq.b	#2,$24(a0)
		move.w	#120,$30(a0)	; set duration for delay (2 seconds)

Obj89_GotoCredits:			; XREF: Obj89_Index
		subq.w	#1,$30(a0)	; subtract 1 from duration
		bpl.s	Obj89_Display
		move.b	#$1C,($FFFFF600).w ; exit to credits

Obj89_Display:
		bra.w	DisplaySprite

You should see this line occurring twice:

           bra.w   DisplaySprite

This is the problem. The code you just installed for the better background effects is bigger than the original code, and those lines that I mentioned have a specific branch range. Since some code has shifted, it is now out of range, causing the error. So let's change this code to something a bit more, shall I say, pliable. So, replace those two lines with this:

           jmp	DisplaySprite

That simple "jmp" command should do the trick.

And that's it! The errors should be gone! (If you still get errors, leave a message on this guide's talk page explaining how it all happens and I'll try to create a fix for it.) Have fun, and enjoy the Rev01 background effects!

(Oh, and you can still use this fix without following the actual guide, as it still works, and should make your life easier in case something else happens like the error I just explained above.)

SCHG How-To Guide: Sonic the Hedgehog (16-bit)
Fixing Bugs
Fix Demo Playback | Fix a Race Condition with Pattern Load Cues | Fix the SEGA Sound | Display the Press Start Button Text | Fix the Level Select Menu | Fix the Hidden Points Bug | Fix Accidental Deletion of Scattered Rings | Fix Ring Timers | Fix the Walk-Jump Bug | Correct Drowning Bugs | Fix the Death Boundary Bug | Fix the Camera Follow Bug | Fix Song Restoration Bugs | Fix the HUD Blinking | Fix the Level Select Graphics Bug
Changing Design Choices
Change Spike Behavior | Fix Special Stage Jumping Physics | Improve the Fade In\Fade Out Progression Routines | Fix Scattered Rings' Underwater Physics | Remove the Speed Cap | Port the REV01 Background Effects | Port Sonic 2's Level Art Loader | Retain Rings Between Acts | Add Sonic 2 (Simon Wai Prototype) Level Select | Improve ObjectMove Subroutines
Adding Features
Add Spin Dash ( Part 1 / Part 2 / Part 3 / Part 4 ) | Add Eggman Monitor
Sound Features
Expand Music Index From $94 to $9F | Extend Music Slots | Play Different Songs Per Act | Expand Music Index to Start at $00 | Port Sonic 2 Final Sound Driver | Port Sonic 3's Sound Driver
Extending the Game
Load Chunks From ROM | Add Extra Characters | Make an Alternative Title Screen | Use Dynamic Tilesets | Make GHZ Load Alternate Art | Add a New Zone | Set Up the Goggle Monitor | Add New Moves | Add a Dynamic Collision System | Dynamic Special Stage Walls System | Extend Sprite Mappings and Art Limit | Enigma Credits
Miscellaneous
Convert the Hivebrain 2005 Disassembly to ASM68K
Split Disassembly Guides
Set Up a Split Disassembly | Basic Level Editing | Basic Art Editing | Basic ASM Editing (Spin Dash)