Sonic and Sega Retro Message Board: Static Splash Screen Guide - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Page 1 of 1
    Locked
    Locked Forum

Static Splash Screen Guide

#1 User is offline Hitaxas 

Posted 31 October 2014 - 12:33 AM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1432
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
As of November 3rd, I have changed a lot of this guide to work with Retro Graphics Toolkit, which required a slight edit of the code.

Time for something I've been wanting to post up for a little while.

I recently sat down and thought to myself "Splash screens are neat and all. However most of them are rather lengthy in code and almost all come with something complete they can just slap in there and call it a day. Not all, but most I've seen."

From there I proceeded to write my own, using as few lines as I could.

So today (or tonight for me!) I figured I would release this code. Yes, the code is complete and could simply be slapped into a ROM. BUT there is a difference here, I will provide example files for the code and a compiled ROM for it as well. HOWEVER, this example is purely that. Replacing the art/mappings and palette for the screen will be necessary due to the disclaimer the screen has. =P
This screen is also static, and does not use any fancy effects or objects, that is up to whoever uses that to do on their own.

ALSO, this was made with Xenowhirl's 2007 disassembly of Sonic 2, and that is what this tutorial will cover. It should be fairly easy to port to any other version of Sonic 2 or Sonic 3 & Knuckles, if you know basic assembly. For a version that works with Hivebrain's 2005 disassembly of Sonic 1, click HERE!

But enough about that, lets get down to it!
For this example I will be replacing the SEGA screen, you do not need to implement it this way if you know how to correctly add screen modes and set the code to go the the correct one next.

First open S2.asm then search and locate the original sega screen at this label:
segascreen:
Once you have located this replace everything (including the original label) with this:

; ============================================================================================
; Sega Screen example - This code only works as a replacement for the SEGA screen
; For regular Splash screens, read the guide this code comes with!
; 2014, Hitaxas
; ============================================================================================
SegaScreen: ; Stop previous music, clear vram and screen to set up this new screen
    moveq  #$FD,d0                  ; set music ID to stop
    jsr    (PlayMusic).w            ; play music ID
    jsr    (Pal_FadeFrom).w         ; fade palette out
    move   #$2700,sr                ; disable interrupts
    move.w ($FFFFF60C).w,d0         ; load VDP register 81XX data
    andi.b #%10111111,d0            ; set display to "disable"
    move.w d0,(VDP_control_port).l  ; save to VDP
    jsr    (ClearPLC).w             ; clear pattern load cues
    jsr    (ClearScreen).w          ; clear VRAM planes, sprite buffer and scroll buffer
    lea    (Metablock_Table).l,a1   ; load dump location
    lea    (MAPS_SEGA).l,a0         ; load compressed mappings address
    move.w #320,d0                  ; prepare pattern index value to patch to mappings
    jsr    (EniDec).w               ; decompress and dump
    move.l #$60000003,d0            ; prepare VRAM write mode address (Plane B E000)
    moveq  #$28-$01,d1              ; set map box draw width
    moveq  #$1E-$01,d2              ; set map box draw height
    bsr.w  ShowVDPGraphics          ; flush mappings to VRAM
    lea    (VDP_control_port).l,a6  ; load VDP control port
    move.l #$68000000,(a6)          ; set VDP to VRAM write mode (Address 2800)
    lea    (ART_SEGA).l,a0          ; load compressed art address
    jsr    (NemDec).w               ; decompress and dump to VDP memory
    lea    (Pal_SEGANew).l,a0          ; load palette address
    lea    (Second_palette).w,a1    ; load palette buffer address
    moveq  #$F,d0                   ; set repeat times

SegaScreen_PalLoop:
    move.l (a0)+,(a1)+              ; copy colours to buffer
    move.l (a0)+,(a1)+              ; ''
    dbf    d0,SegaScreen_PalLoop    ; repeat until done
    move.w ($FFFFF60C).w,d0         ; load VDP register 81XX data
    ori.b  #%01000000,d0            ; set display to "enable"
    move.w d0,(a6)                  ; save to VDP
    jsr    Pal_FadeTo               ; fade palette in
    move.w #3*60,(Demo_Time_left).w ; set delay time (3 seconds on a 60hz system)

Sega_MainLoop:
    move.b #$02,(Delay_Time).w      ; set V-blank routine to run
    jsr    (DelayProgram).w         ; wait for V-blank (decreases "Demo_Time_left")
    tst.b  ($FFFFF605).w            ; has player 1 pressed start button?
    bmi.s  sega_GotoTitle           ; if so, branch
    tst.w  (Demo_Time_left).w       ; has the delay time finished?
    bne.s  Sega_MainLoop            ; if not, branch

sega_GotoTitle:
    move.b #$04,(Game_Mode).w       ; set the screen mode to Title Screen
    rts                             ; return


This is already completely written for this purpose. All that is left is to binclude the files I have provided here

Put these files in a folder in the root of you hack with the name NEWSEGASCREEN

To get these files to load into the game go to the bottom of your S2.ASM and just before the ; end of 'ROM' add these lines:

ART_SEGA:		binclude	"NEWSEGASCREEN/SEGAARTNEM.bin"
			even
 
MAPS_SEGA:		binclude	"NEWSEGASCREEN/SEGAMAPSE.bin"
			even

Pal_SEGANew:		binclude	"NEWSEGASCREEN/SEGAPAL.bin"
			even

Now save the asm file and build your ROM, everything should be in working order.

You will be greeted with a screen that looks almost like this:

Posted Image

However you will notice a slight difference with which you want to change. You will notice it if you've followed through with this guide.

If you would like to download an already compiled ROM with this screen in it and see what it would look like when you implement it on your own click HERE

From here it is up to you to change the art/mappings/palette. I suggest using a combination of Retro Graphics toolkit and Photoshop to do this, if you know how to use those programs. I will not be walking you through how to do this here.

If you are looking to use this code as a splash screen rather than a replacement for the SEGA screen, you need to make a few changes.

However, since I am too lazy right now, here is the complete code that allows for splash screens AFTER the SEGA screen:

 ; ============================================================================================
; Sega Screen example
; This version is for splash screens that load AFTER the SEGA screen
; For A version that replaces the SEGA screen, read the guide this code came from!
; 2014, Hitaxas
; ============================================================================================
SegaScreen2:
        move.b  #$FD,d0                         ; set music ID to "stop music"
        jsr     PlayMusic                       ; play ID
        jsr     (Pal_FadeFrom).w                ; fade palettes out
        jsr     (ClearScreen).w                 ; clear the plane mappings
        dmaFillVRAM 0,$0000,$10000              ; fill entire VRAM with 0 | macro used in S2 disassemblies
        ; load art, mappings and the palette
        lea     (Metablock_Table).l,a1          ; load dump location
        lea     (MAPS_SEGA).l,a0                ; load background mappings
	move.w #320,d0                          ; offset the tilemap by n amount of tiles
	bsr.w	EniDec
	lea	(Metablock_Table).l,a1
	move.l	#$60000002,d0
	moveq	#39,d1
	moveq	#30,d2
        bsr.w   ShowVDPGraphics3                ; flush mappings to VRAM
        move.l  #$68000000,(VDP_control_port).l ; set vdp loc
        lea     (ART_SEGA).l,a0                 ; load background art
        jsr     NemDec                          ; run NemDec to decompress art for display
	lea	(Pal_SEGANEW).l,a0                 ; load this palette
	lea	(Second_palette).l,a1           ; set as line 2
	move.w	#$F,d0

SegaScreen_PalLoop2:
	move.l	(a0)+,(a1)+			; copy colours to buffer
	move.l	(a0)+,(a1)+			; ''
	dbf	d0,SegaScreen_PalLoop2		; repeat until done
	jsr	Pal_FadeTo			; fade palette in
        move.w	#3*60,(Demo_Time_left).w	; set delay time (3 seconds on a 60hz system)

Sega_MainLoop2:
        move.b	#$02,(Delay_Time).w		; set V-blank routine to run
	jsr	(DelayProgram).w		; wait for V-blank (decreases "Demo_Time_left")
	tst.b	($FFFFF605).w			; has player 1 pressed start button?
	bmi.s	sega_GotoTitle2			; if so, branch
	tst.w	(Demo_Time_left).w		; has the delay time finished?
	bne.s	Sega_MainLoop2			; if not, branch

sega_GotoTitle2:
	move.b	#$04,(Game_Mode).w		; set the screen mode to Title Screen
	rts					; return


In my test this will allow the screen to show up correctly after the stock SEGA screen.
This post has been edited by Hitaxas: 05 November 2014 - 11:49 PM

#2 User is offline SupaNeo 

Posted 31 October 2014 - 02:23 AM

  • Posts: 11
  • Joined: 06-July 12
  • Gender:Male
  • Location:Great Britain
  • Project:LSL Scripting
Looks good! The logo reminds me of the Sonic 4 promotional trailers. Possible bug though. I tried your compiled room and noticed the splash screen becomes garbled after the demo has finished. Results differ depending on the demo.

#3 User is offline Hitaxas 

Posted 31 October 2014 - 04:02 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1432
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Updated the original post with the cleaned up code Markey provided, and a fix at the bottom of the post for those looking to use this for a splash screen that follows after the stock SEGA screen.

Edit: I have changed the original post, along with the example picture and the files to work with Retro Graphics toolkit. That is what I will be personally using from now on, as it does a much better job at converting images for use with the Genesis.
This post has been edited by Hitaxas: 03 November 2014 - 11:15 PM

#4 User is offline Hitaxas 

Posted 05 November 2014 - 11:47 PM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1432
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Bumping this topic to let people that may be interested that this code has been ported over for use with Hivebrain's 2005 disassembly of Sonic 1 thanks to ProjectFM over at SSRG:

For SEGA screen replacement:
; ============================================================================================
; Sega Screen example - This code only works as a replacement for the SEGA screen
; For regular Splash screens, read the guide this code comes with!
; 2014, Hitaxas
; Ported to Sonic 1 2005 Hivebrain Thanks to ProjectFM
; ============================================================================================
SegaScreen: ; Stop previous music, clear vram and screen to set up this new screen
    move.b  #$E4,d0                 ; set music ID to stop
    jsr    PlaySound_Special.w      ; play music ID
    jsr    Pal_FadeFrom.w           ; fade palette out
    move   #$2700,sr                ; disable interrupts
    move.w ($FFFFF60C).w,d0         ; load VDP register 81XX data
    andi.b #%10111111,d0            ; set display to "disable"
    move.w d0,($FFC00004).l         ; save to VDP
    jsr    ClearPLC.w               ; clear pattern load cues
    jsr    ClearScreen.w            ; clear VRAM planes, sprite buffer and scroll buffer
    lea    ($FF0000).l,a1           ; load dump location
    lea    MAPS_SEGA.l,a0           ; load compressed mappings address
    move.w #320,d0                  ; prepare pattern index value to patch to mappings
    jsr    EniDec.w                 ; decompress and dump
    move.l #$60000003,d0            ; prepare VRAM write mode address (Plane B E000)
    moveq  #$28-$01,d1              ; set map box draw width
    moveq  #$1E-$01,d2              ; set map box draw height
    bsr.w  ShowVDPGraphics          ; flush mappings to VRAM
    lea    ($FFC00004).l,a6         ; load VDP control port
    move.l #$68000000,(a6)          ; set VDP to VRAM write mode (Address 2800)
    lea    ART_SEGA.l,a0            ; load compressed art address
    jsr    NemDec.w                 ; decompress and dump to VDP memory
    lea    Pal_SEGANew.l,a0         ; load palette address
    lea    ($FFFFFB80).w,a1         ; load palette buffer address
    moveq  #$F,d0                   ; set repeat times

SegaScreen_PalLoop:
    move.l (a0)+,(a1)+              ; copy colours to buffer
    move.l (a0)+,(a1)+              ; ''
    dbf    d0,SegaScreen_PalLoop    ; repeat until done
    move.w ($FFFFF60C).w,d0         ; load VDP register 81XX data
    ori.b  #%01000000,d0            ; set display to "enable"
    move.w d0,(a6)                  ; save to VDP
    jsr    Pal_FadeTo               ; fade palette in
    move.w #3*60,($FFFFF614).w      ; set delay time (3 seconds on a 60hz system)

Sega_MainLoop:
    move.b #2,($FFFFF62A).w         ; set V-blank routine to run
    jsr    DelayProgram.w           ; wait for V-blank (decreases "Demo_Time_left")
    tst.b  ($FFFFF605).w            ; has player 1 pressed start button?
    bmi.s  sega_GotoTitle           ; if so, branch
    tst.w  ($FFFFF614).w            ; has the delay time finished?
    bne.s  Sega_MainLoop            ; if not, branch

sega_GotoTitle:
    move.b #$04,($FFFFF600).w       ; set the screen mode to Title Screen
    rts                             ; return	
; ===========================================================================


For a splash screen that follows after the SEGA screen:
; ============================================================================================
; Sega Screen example
; This version is for splash screens that load AFTER the SEGA screen
; For A version that replaces the SEGA screen, read the guide this code came from!
; 2014, Hitaxas
; Ported to Sonic 1 Hivebrain 2005 Thanks to ProjectFM
; ============================================================================================
SegaScreen2:
	move.b  #$E4,d0				; set music ID to "stop music"
	jsr     Playsound_Special.w		; play ID
	jsr     Pal_FadeFrom.w			; fade palettes out
	jsr     ClearScreen.w			; clear the plane mappings
	; load art, mappings and the palette
	lea     ($FF0000).l,a1			; load dump location
	lea     MAPS_SEGA.l,a0			; load compressed mappings address
	move.w  #320,d0				; prepare pattern index value to patch to mappings
	jsr     EniDec.w			; decompress and dump
	lea     ($FF0000).l,a1
	move.l	#$60000003,d0
	moveq	#39,d1
	moveq	#30,d2
	bsr.w   ShowVDPGraphics			; flush mappings to VRAM
	move.l  #$68000000,($FFC00004).l	; set vdp loc
	lea     ART_SEGA.l,a0			; load background art
	jsr     NemDec				; run NemDec to decompress art for display
	lea	Pal_SEGANew.l,a0		; load this palette
	lea	($FFFFFB80).l,a1		; set as line 2
	move.w	#$F,d0

SegaScreen_PalLoop2:
	move.l	(a0)+,(a1)+			; copy colours to buffer
	move.l	(a0)+,(a1)+			; ''
	dbf	d0,SegaScreen_PalLoop2		; repeat until done
	jsr	Pal_FadeTo			; fade palette in
	move.w	#3*60,($FFFFF614).w		; set delay time (3 seconds on a 60hz system)

Sega_MainLoop2:
	move.b	#2,($FFFFF62A).w		; set V-blank routine to run
	jsr	DelayProgram.w			; wait for V-blank (decreases "Demo_Time_left")
	tst.b	($FFFFF605).w			; has player 1 pressed start button?
	bmi.s	sega_GotoTitle2			; if so, branch
	tst.w	($FFFFF614).w			; has the delay time finished?
	bne.s	Sega_MainLoop2			; if not, branch

sega_GotoTitle2:
	move.b	#$04,($FFFFF600).w		; set the screen mode to Title Screen
	rts						; return


If you use both, you will need to replace this part of the code in the routine that replaces the SEGA screen:
sega_GotoTitle:
    move.b #$04,($FFFFF600).w       ; set the screen mode to Title Screen
    rts                             ; return


with this:
Sega_GotoTitle:
		bsr.w	SegaScreen2 ; go to next screen
		rts

This post has been edited by Hitaxas: 06 November 2014 - 08:53 PM

Page 1 of 1
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users