Merci
Voici le source:
https://www.bento8.fr/wp-content/uploads/2021/02/Bento8-20210215.zipLe build se lance avec la classe : fr.bento8.to8.build.BuildDisk
et avec pour argument : ./Sonic2/config.properties
Il faut aussi les deux libs log4j-api-2.13.3.jar et log4j-core-2.13.3.jar
le fichier principal de conf contient les lignes suivantes:
Code:
# ******************************************************************************
# Configuration du BuildDisk
# ------------------------------------------------------------------------------
#
# ******************************************************************************
# Engine ASM source code
# ******************************************************************************
# Engine loader
engine.asm.boot=./Sonic2/Engine/Boot.asm
engine.asm.gameModeManager=./Sonic2/Engine/GameModeManager.asm
engine.asm.gameModeLoader=./Sonic2/Engine/GameModeLoader.asm
# Generated code includes
engine.asm.gen.includ.GLOBALS=Globals.asm
engine.asm.gen.includ.GMLOADER=GameModeLoader.asm
engine.asm.gen.includ.GMDATA=GameModeData.asm
# Engine includes
engine.asm.includ.CONSTANT=./Sonic2/Engine/Constants.asm
engine.asm.includ.EXOMIZER=./Sonic2/Engine/Exomizer.asm
# Game definition
# ******************************************************************************
gameModeBoot=TITLESCR
gameMode.TITLESCR=./Sonic2/GameMode/TITLESCR/TITLESCR.properties
# Build parameters
# ******************************************************************************
#
# builder.compilatedsprite.useCache:
# param: N: recompile, Y: utilise les fichiers ASM, BIN et lst déjà générés
#
# builder.compilatedsprite.maxTries
# param: nombre d'essais aléatoires pour les permutations de plus de 10 él.
# Rapide : 500000, Lent : 5000000
# ------------------------------------------------------------------------------
builder.c6809=./c6809.exe
builder.exobin=./exobin.exe
builder.debug=N
builder.logToConsole=Y
builder.diskName=./Sonic2/Disk/SONIC2
builder.generatedCode=./Sonic2/GeneratedCode
builder.to8.memoryExtension=Y
# TODO pour pouvoir utiliser le cache il faut sauver la taille data de chaque image
builder.compilatedSprite.useCache=N
builder.compilatedSprite.maxTries=500000
Le GameModeManager est chargé par le boot en page 4. Il contient l'ensemble des index de données disquette et leur destination en RAM pour chaque GameMode.
Il va occuper cette place en permanence pendant toute l'exécution du jeu.
Lorsque le GameModeManager est appelé (par exemple au boot), il écrit les données (toutes stockées en page 4) du GameModeLoader, de l'exomizer et des index du GameMode désiré en page 0a.
Le GameModeLoader est alors lancé depuis la page 0a :
- il charge en page 2 (zone cartouche) les données lues sur la disquette;
- les données sont décompressées par exomizer et copiées en zone données.
- on lance le moteur du game mode en 6100
Si on voit un jeu comme une "machine à état" un "GameMode" représente alors un "état"
Le Boot charge un game mode par défaut, ici TITLESCR (il n'y en n'a qu'un ;-))
Il y a encore du boulot sur le sujet : il faudrait pouvoir charger des ressources communes à plusieurs game mode (ex: les animations du personnage principal ne doivent pas être recargées à chaque niveau de jeu ...)
Définition d'un Game Mode (Ici TitleScreen) :
Code:
# ******************************************************************************
# Définition d'un mode de Jeu
# -----------------------------
# Un mode est un état du jeu qui nécessite un chargement disquette
# Un acte est un sous-état de mode qui ne nécessite pas d'accès disquette
#
# ******************************************************************************
engine.asm.mainEngine=./Sonic2/Engine/MainEngine.asm
# Generated code includes
engine.asm.gen.includ.PALETTE=Palette.asm
engine.asm.gen.includ.OBJINDEX=ObjectIndex.asm
engine.asm.gen.includ.LOADACT=LoadAct.asm
engine.asm.gen.includ.IMAGEIDX=ImageIndex.asm
engine.asm.gen.includ.ANIMSCPT=AnimationScript.asm
# Engine includes
engine.asm.includ.WAITVBL=./Sonic2/Engine/WaitVBL.asm
engine.asm.includ.UPDTPAL=./Sonic2/Engine/UpdatePalette.asm
engine.asm.includ.READJPDS=./Sonic2/Engine/ReadJoypads.asm
engine.asm.includ.RUNOBJTS=./Sonic2/Engine/RunObjects.asm
engine.asm.includ.ANIMSPR=./Sonic2/Engine/AnimateSprite.asm
engine.asm.includ.OBJMOVE=./Sonic2/Engine/ObjectMove.asm
engine.asm.includ.OBJLOAD=./Sonic2/Engine/SingleObjLoad.asm
engine.asm.includ.DELETOBJ=./Sonic2/Engine/DeleteObject.asm
engine.asm.includ.DISPLSPR=./Sonic2/Engine/DisplaySprite.asm
engine.asm.includ.MRKOBJGN=./Sonic2/Engine/MarkObjGone.asm
engine.asm.includ.CLEAROBJ=./Sonic2/Engine/ClearObj.asm
engine.asm.includ.CHECKSPR=./Sonic2/Engine/CheckSpritesRefresh.asm
engine.asm.includ.ERASESPR=./Sonic2/Engine/EraseSprites.asm
engine.asm.includ.UNSETDSP=./Sonic2/Engine/UnsetDisplayPriority.asm
engine.asm.includ.DRAWSPR=./Sonic2/Engine/DrawSprites.asm
engine.asm.includ.BGBALLOC=./Sonic2/Engine/BgBufferAlloc.asm
engine.asm.includ.BGBFREE=./Sonic2/Engine/BgBufferFree.asm
engine.asm.includ.CLRCARTM=./Sonic2/Engine/ClearCartMemory.asm
engine.asm.includ.CPYIMG=./Sonic2/Engine/CopyImageToCart.asm
# Objects
object.TitleScreen=./Sonic2/Objects/TitleScreen/TitleScreen.properties
#object.Sonic=./Sonic2/Objects/Sonic/Sonic.properties
# Acts definition
actBoot=intro
act.intro.palette=Pal_TitleScreen;./Sonic2/Objects/TitleScreen/Title_000.png
act.intro.screenBorder=3
act.intro.backgroundSolid=0
# act.intro.backgroundImage=./Sonic2/GameMode/TITLESCR/TitleScreen.png
# act.intro.objectPlacement=./Sonic2/GameMode/TITLESCR/ObjectPlacement.txt
On y retrouve :
- le moteur de Jeu (il peut donc être différent pour chaque niveau de jeu);
- les objets;
- la définition des données de l'act (a terme on pourra avoir plusieurs sous-niveaux ne nécessitant pas de rechargement de disquette, ou des rechargements partiels);
et enfin la définition des objets (un seul pour l'écran d'accueil, on utilise la notion de sous-type pour chaque sprite différent) :
Code:
# ******************************************************************************
# Définition d'un objet
# ---------------------
# Un objet est défini:
# - par un code de comportement
# - par un ensemble d'images converties en code (optionnel)
# - par un ensemble d'animations (optionnel)
#
# code:
# param1: code source du comportement de l'objet
#
# sprite:
# param1: image PNG de type couleurs indexées 8Bits, Index de palette : Transparence=0, couleurs=1-16
# la planche doit contenir une seule ligne de sprites, chaque sprite ayant la même largeur
# param2: inversion de l'image (N: Normal, X: Horizontal, Y: Vertical, XY: Horizontal et Vertical), valeurs séparée par des virgules, plusieurs valeurs possibles
# param3: type de sprite compilé (B: Dessin avec sauvegarde du fond, D: Dessin sans sauvegarde du fond), valeurs séparée par des virgules, plusieurs valeurs possibles
#
# animation:
# param1: durée en frame de chaque image de l'animation (0=1 frame, 1=2 frames, ...)
# param2: alias de la planche d'image
# ...
# param3: Action de fin (_resetAnim, _goBackNFrames, _goToAnimation, _nextRoutine, _resetAnimAndSubRoutine, _nextSubRoutine)
# param4: Optionnel: nombre de frames (si param3=_goBackNFrames) ou identifiant d'animation (si param3=_goToAnimation)
#
# ******************************************************************************
code=./Sonic2/Objects/TitleScreen/TitleScreen.asm
# Generated code includes
engine.asm.gen.includ.IMAGEIDX=ImageIndex.asm
engine.asm.gen.includ.ANIMSCPT=AnimationScript.asm
# Sprites
sprite.Img_sonic_1=./Sonic2/Objects/TitleScreen/Title_005.png;N;B
sprite.Img_sonic_2=./Sonic2/Objects/TitleScreen/Title_006.png;N;B
sprite.Img_sonic_3=./Sonic2/Objects/TitleScreen/Title_007.png;N;B
sprite.Img_sonic_4=./Sonic2/Objects/TitleScreen/Title_008.png;N;B
sprite.Img_sonic_5=./Sonic2/Objects/TitleScreen/Title_018.png;N;B
sprite.Img_sonicHand=./Sonic2/Objects/TitleScreen/Title_009.png;N;B
sprite.Img_star_1=./Sonic2/Objects/TitleScreen/Title_015.png;N;B
sprite.Img_star_2=./Sonic2/Objects/TitleScreen/Title_012.png;N;B
sprite.Img_star_3=./Sonic2/Objects/TitleScreen/Title_013.png;N;B
sprite.Img_star_4=./Sonic2/Objects/TitleScreen/Title_014.png;N;B
sprite.Img_tails_1=./Sonic2/Objects/TitleScreen/Title_000.png;N;B
sprite.Img_tails_2=./Sonic2/Objects/TitleScreen/Title_001.png;N;B
sprite.Img_tails_3=./Sonic2/Objects/TitleScreen/Title_002.png;N;B
sprite.Img_tails_4=./Sonic2/Objects/TitleScreen/Title_003.png;N;B
sprite.Img_tails_5=./Sonic2/Objects/TitleScreen/Title_004.png;N;B
sprite.Img_tailsHand=./Sonic2/Objects/TitleScreen/Title_019.png;N;B
# Animations
animation.Ani_sonic=1;Img_sonic_1;Img_sonic_2;Img_sonic_3;Img_sonic_4;_nextSubRoutine
animation.Ani_tails=1;Img_tails_1;Img_tails_2;Img_tails_3;Img_tails_4;Img_tails_5;_nextSubRoutine
animation.Ani_largeStar=1;Img_star_1;Img_star_2;Img_star_3;Img_star_2;Img_star_1;_nextSubRoutine
animation.Ani_smallStar=3;Img_star_2;Img_star_1;_resetAnim
Pour finir, le code pour cette intro est contenu dans TitleScreen.asm
Dont voici un extrait :
Code:
* ---------------------------------------------------------------------------
* Object Status Table index
* - objects with a dedicated adress (no dynamic allocation)
* ---------------------------------------------------------------------------
TitleScr_Object_RAM equ Object_RAM
Obj_Sonic equ Object_RAM
Obj_Tails equ Object_RAM+(object_size*1)
Obj_LargeStar equ Object_RAM+(object_size*2)
Obj_SmallStar equ Object_RAM+(object_size*3)
Obj_SonicHand equ Object_RAM+(object_size*4)
Obj_TailsHand equ Object_RAM+(object_size*5)
Obj_EmblemTop equ Object_RAM+(object_size*6)
Obj_PaletteHandler equ Object_RAM+(object_size*7)
Obj_PaletteHandler2 equ Object_RAM+(object_size*8)
Obj_PaletteHandler3 equ Object_RAM+(object_size*9)
TitleScr_Object_RAM_End equ Object_RAM+(object_size*10)
* ---------------------------------------------------------------------------
* Object Status Table offsets
* - two variables can share same space if used by two different subtypes
* - take care of words and bytes and space them accordingly
* ---------------------------------------------------------------------------
w_TitleScr_time_frame_count equ ext_variables
w_TitleScr_time_frame_countdown equ ext_variables+2
w_TitleScr_move_frame_count equ ext_variables+2
w_TitleScr_xy_data_index equ ext_variables+4
w_TitleScr_color_data_index equ ext_variables+4
b_TitleScr_final_state equ ext_variables+6
* ---------------------------------------------------------------------------
* Subtypes
* ---------------------------------------------------------------------------
Sub_Init equ 0
Sub_Sonic equ 2
Sub_Tails equ 4
Sub_EmblemTop equ 6
Sub_LargeStar equ 8
Sub_SonicHand equ 10
Sub_SmallStar equ 12
Sub_TailsHand equ 16
* ***************************************************************************
* TitleScreen
* ***************************************************************************
*; ----------------------------------------------------------------------------
*; Object 0E - Flashing stars from intro
*; ----------------------------------------------------------------------------
*; Sprite_12E18:
TitleScreen *Obj0E:
* moveq #0,d0
lda routine,u * move.b routine(a0),d0
leax <TitleScreen_Routines,pcr * move.w Obj0E_Index(pc,d0.w),d1
jmp [a,x] * jmp Obj0E_Index(pc,d1.w)
*; ===========================================================================
*; off_12E26: Obj0E_States:
TitleScreen_Routines *Obj0E_Index: offsetTable
fdb Init * offsetTableEntry.w Obj0E_Init ; 0
fdb Sonic * offsetTableEntry.w Obj0E_Sonic ; 2
fdb Tails * offsetTableEntry.w Obj0E_Tails ; 4
fdb EmblemTop * offsetTableEntry.w Obj0E_LogoTop ; 6
fdb LargeStar * offsetTableEntry.w Obj0E_LargeStar ; 8
fdb SonicHand * offsetTableEntry.w Obj0E_SonicHand ; $A
fdb SmallStar * offsetTableEntry.w Obj0E_SmallStar ; $C
fdb $0000 * offsetTableEntry.w Obj0E_SkyPiece ; $E
fdb TailsHand * offsetTableEntry.w Obj0E_TailsHand ; $10
*; ===========================================================================
*; loc_12E38:
Init *Obj0E_Init:
* vdp unused * addq.b #2,routine(a0) ; useless, because it's overwritten with the subtype below
* vdp unused * move.l #Obj0E_MapUnc_136A8,mappings(a0)
* vdp unused * move.w #make_art_tile(ArtTile_ArtNem_TitleSprites,0,0),art_tile(a0)
lda #4 * move.b #4,priority(a0)
sta priority,u
lda subtype,u * move.b subtype(a0),routine(a0)
sta routine,u
bra TitleScreen * bra.s Obj0E
*; ===========================================================================
* ---------------------------------------------------------------------------
* Sonic
* ---------------------------------------------------------------------------
*
Sonic *Obj0E_Sonic:
ldd w_TitleScr_time_frame_count,u
addd #1 * addq.w #1,objoff_34(a0)
std w_TitleScr_time_frame_count,u
cmpd #$120 * cmpi.w #$120,objoff_34(a0)
bhs Sonic_NotFinalState * bhs.s +
lbsr TitleScreen_SetFinalState
* bsr.w TitleScreen_SetFinalState
Sonic_NotFinalState *+
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <Sonic_Routines,pcr * move.w off_12E76(pc,d0.w),d1
jmp [a,x] * jmp off_12E76(pc,d1.w)
*; ===========================================================================
Sonic_Routines *off_12E76: offsetTable
fdb Sonic_Init * offsetTableEntry.w Obj0E_Sonic_Init ; 0
fdb Sonic_PaletteFade * offsetTableEntry.w loc_12EC2 ; 2
fdb Sonic_SetPal_TitleScreen * offsetTableEntry.w loc_12EE8 ; 4
fdb Sonic_Move * offsetTableEntry.w loc_12F18 ; 6
fdb TitleScreen_Animate * offsetTableEntry.w loc_12F52 ; 8
fdb Sonic_CreateHand * offsetTableEntry.w Obj0E_Sonic_LastFrame ; $A
fdb Sonic_CreateTails * offsetTableEntry.w loc_12F7C ; $C
fdb Sonic_FadeInBackground * offsetTableEntry.w loc_12F9A ; $E
fdb Sonic_CreateSmallStar * offsetTableEntry.w loc_12FD6 ; $10
fdb CyclingPal * offsetTableEntry.w loc_13014 ; $12
*; ===========================================================================
*; spawn more stars
Sonic_Init *Obj0E_Sonic_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_sonic_1
std mapping_frame,u * move.b #5,mapping_frame(a0)
ldd #Ani_sonic ; in original code, anim is an index in offset table (1 byte) that is implicitly initialized to 0
std anim,u ; so added init code to anim address here because it is not an index anymore
ldd #$7870
std xy_pixel,u * move.w #$110,x_pixel(a0)
* move.w #$E0,y_pixel(a0)
ldx #Obj_LargeStar * lea (IntroLargeStar).w,a1
lda #ObjID_TitleScreen
sta id,x * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro stars) at $FFFFB0C0
ldb #Sub_LargeStar
stb subtype,x * move.b #8,subtype(a1) ; large star
*ldx #Obj_EmblemTop * lea (IntroEmblemTop).w,a1
*sta id,x * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro stars) at $FFFFD140
*ldb #Sub_EmblemTop
*stb subtype,x * move.b #6,subtype(a1) ; logo top
* sound unused * moveq #SndID_Sparkle,d0
rts * jmpto (PlaySound).l, JmpTo4_PlaySound
*; ===========================================================================
*
Sonic_PaletteFade *loc_12EC2:
ldd w_TitleScr_time_frame_count,u
cmpd #$38 * cmpi.w #$38,objoff_34(a0)
bhs Sonic_PaletteFadeAfterWait * bhs.s +
rts * rts
*; ===========================================================================
Sonic_PaletteFadeAfterWait *+
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
*ldx #Obj_PaletteHandler3 * lea (TitleScreenPaletteChanger3).w,a1
*lda #ObjID_TtlScrPalChanger
*sta id,x * move.b #ObjID_TtlScrPalChanger,id(a1) ; load objC9 (palette change)
*clr subtype,x * move.b #0,subtype(a1)
* music unused (flag) * st.b objoff_30(a0)
* music unused * moveq #MusID_Title,d0 ; title music
rts * jmpto (PlayMusic).l, JmpTo4_PlayMusic
*; ===========================================================================
*
Sonic_SetPal_TitleScreen *loc_12EE8:
ldd w_TitleScr_time_frame_count,u
cmpd #$80 * cmpi.w #$80,objoff_34(a0)
bhs Sonic_SetPal_TitleScreenAfterWait * bhs.s +
rts * rts
*; ===========================================================================
Sonic_SetPal_TitleScreenAfterWait *+
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
*ldd #Pal_TitleScreen * lea (Pal_133EC).l,a1
*std Ptr_palette * lea (Normal_palette).w,a2
*
* not implemented * moveq #$F,d6
* switch pointer to *- move.w (a1)+,(a2)+
* fixed palette instead of copying data * dbf d6,-
*
*; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
*
*
* not implemented *sub_12F08:
* not implemented * lea (IntroSmallStar1).w,a1
* not implemented
* not implemented * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB180
* not implemented
* not implemented * move.b #$E,subtype(a1) ; piece of sky
rts * rts
*; End of function sub_12F08
*
*; ===========================================================================
*
Sonic_Move *loc_12F18:
ldx #Sonic_xy_data_end-Sonic_xy_data
stx dyn_01+2 * moveq #word_13046_end-word_13046+4,d2
leax Sonic_xy_data-2,pcr * lea (word_13046).l,a1
*
TitleScreen_MoveObjects *loc_12F20:
ldd w_TitleScr_move_frame_count,u * move.w objoff_2A(a0),d0
addd #1 * addq.w #1,d0
std w_TitleScr_move_frame_count,u * move.w d0,objoff_2A(a0)
andb #3 * one frame on four * andi.w #3,d0
bne MoveObjects_KeepPosition * bne.s +
ldd w_TitleScr_xy_data_index,u * move.w objoff_2C(a0),d1
addd #2 * addq.w #4,d1
dyn_01
cmpd #$0000 * cmp.w d2,d1
lbhs TitleScreen_NextSubRoutineAndDisplay
* bhs.w loc_1310A
std w_TitleScr_xy_data_index,u * move.w d1,objoff_2C(a0)
leax d,x * move.l -4(a1,d1.w),d0
ldd ,x * move.w d0,y_pixel(a0)
std xy_pixel,u
* swap d0
* move.w d0,x_pixel(a0)
MoveObjects_KeepPosition *+
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
TitleScreen_Animate *loc_12F52:
* no more offset table * lea (Ani_obj0E).l,a1
jsr AnimateSprite * bsr.w AnimateSprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
Sonic_CreateHand *Obj0E_Sonic_LastFrame:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_sonic_5
std mapping_frame,u * move.b #$12,mapping_frame(a0)
ldx #Obj_SonicHand * lea (IntroSonicHand).w,a1
lda #ObjID_TitleScreen
sta id,x * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB1C0
lda #Sub_SonicHand
sta subtype,x * move.b #$A,subtype(a1) ; Sonic's hand
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
Sonic_CreateTails *loc_12F7C:
ldd w_TitleScr_time_frame_count,u
cmpd #$C0 * cmpi.w #$C0,objoff_34(a0)
blo Sonic_CreateTails_BeforeWait * blo.s +
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldx #Obj_Tails * lea (IntroTails).w,a1
lda #ObjID_TitleScreen
sta id,x * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB080
lda #Sub_Tails
sta subtype,x * move.b #4,subtype(a1) ; Tails
Sonic_CreateTails_BeforeWait *+
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
Sonic_FadeInBackground *loc_12F9A:
ldd w_TitleScr_time_frame_count,u
cmpd #$120 * cmpi.w #$120,objoff_34(a0)
blo Sonic_FadeInBackground_NotYet * blo.s +
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #$0000
std w_TitleScr_xy_data_index,u * clr.w objoff_2C(a0)
ldd #$FF
std b_TitleScr_final_state,u * st objoff_2F(a0)
*ldd #White_palette * lea (Normal_palette_line3).w,a1
*std Ptr_palette * move.w #$EEE,d0
*
* not implemented * moveq #$F,d6
* switch pointer to *- move.w d0,(a1)+
* fixed palette instead of copying data * dbf d6,-
*
*ldx #Obj_PaletteHandler2 * lea (TitleScreenPaletteChanger2).w,a1
*lda #ObjID_TtlScrPalChanger
*sta id,x * move.b #ObjID_TtlScrPalChanger,id(a1) ; load objC9 (palette change handler) at $FFFFB240
*lda #2
*sta subtype,x * move.b #2,subtype(a1)
* not implemented * move.b #ObjID_TitleMenu,(TitleScreenMenu+id).w ; load Obj0F (title screen menu) at $FFFFB400
Sonic_FadeInBackground_NotYet *+
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
Sonic_CreateSmallStar *loc_12FD6:
* not implemented * btst #6,(Graphics_Flags).w ; is Megadrive PAL?
* not implemented * beq.s + ; if not, branch
ldd w_TitleScr_time_frame_count,u
cmpd #$190 * cmpi.w #$190,objoff_34(a0)
beq Sonic_CreateSmallStar_AfterWait * beq.s ++
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*+
* not implemented * cmpi.w #$1D0,objoff_34(a0)
* not implemented * beq.s +
* not implemented * bra.w DisplaySprite
*; ===========================================================================
Sonic_CreateSmallStar_AfterWait *+
ldx #Obj_SmallStar * lea (IntroSmallStar2).w,a1
lda #ObjID_TitleScreen
sta id,x * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB440
lda #Sub_SmallStar
sta subtype,x * move.b #$C,subtype(a1) ; small star
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
* not implemented * lea (IntroSmallStar1).w,a1
* not implemented * bsr.w DeleteObject2 ; delete object at $FFFFB180
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
CyclingPal *loc_13014:
*lda Vint_runcount+1 * move.b (Vint_runcount+3).w,d0
*anda #7 * every 8 frames * andi.b #7,d0
*bne CyclingPal_NotYet * bne.s ++
*ldx w_TitleScr_color_data_index,u * move.w objoff_2C(a0),d0
*leax 2,x * addq.w #2,d0
*cmpx #CyclingPal_TitleScreen_end-CyclingPal_TitleScreen
* cmpi.w #CyclingPal_TitleStar_End-CyclingPal_TitleStar,d0
*blo CyclingPal_Continue * blo.s +
*ldx #0 * moveq #0,d0
CyclingPal_Continue *+
*stx w_TitleScr_color_data_index,u * move.w d0,objoff_2C(a0)
*leax <CyclingPal_TitleScreen-2,pcr * move.w CyclingPal_TitleStar(pc,d0.w),(Normal_palette_line3+$A).w
*ldd ,x
*std Normal_palette+$E
CyclingPal_NotYet *+
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*; word_1303A:
CyclingPal_TitleScreen *CyclingPal_TitleStar:
* binclude "art/palettes/Title Star Cycle.bin"
*fdb $0F11 * ;$0E64
*fdb $0E31 * ;$0E86
*fdb $0F11 * ;$0E64
*fdb $0E63 * ;$0EA8
*fdb $0F11 * ;$0E64
*fdb $0E96 * ;$0ECA
CyclingPal_TitleScreen_end *CyclingPal_TitleStar_End
*
Sonic_xy_data *word_13046:
fcb $74,$60 * dc.w $108, $D0
fcb $70,$50 * dc.w $100, $C0 ; 2
fcb $6C,$40 * dc.w $F8, $B0 ; 4
fcb $6B,$36 * dc.w $F6, $A6 ; 6
fcb $6D,$2E * dc.w $FA, $9E ; 8
fcb $70,$2A * dc.w $100, $9A ; $A
fcb $72,$29 * dc.w $104, $99 ; $C
fcb $74,$28 * dc.w $108, $98 ; $E
Sonic_xy_data_end *word_13046_end
*; ===========================================================================
* ---------------------------------------------------------------------------
* Tails
* ---------------------------------------------------------------------------
*
Tails *Obj0E_Tails:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <Tails_Routines,pcr * move.w off_13074(pc,d0.w),d1
jmp [a,x] * jmp off_13074(pc,d1.w)
*; ===========================================================================
Tails_Routines *off_13074: offsetTable
fdb Tails_Init * offsetTableEntry.w Obj0E_Tails_Init ; 0
fdb Tails_Move * offsetTableEntry.w loc_13096 ; 2
fdb TitleScreen_Animate * offsetTableEntry.w loc_12F52 ; 4
fdb Tails_CreateHand * offsetTableEntry.w loc_130A2 ; 6
fdb Tails_DisplaySprite * offsetTableEntry.w BranchTo10_DisplaySprite ; 8
*; ===========================================================================
*
Tails_Init *Obj0E_Tails_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #$5C68
std xy_pixel,u * move.w #$D8,x_pixel(a0)
* move.w #$D8,y_pixel(a0)
ldd #Ani_tails
std anim,u * move.b #1,anim(a0)
ldd #Img_tails_1 ; in original code, mapping_frame is an index in offset table (1 byte) that is implicitly initialized to 0
std mapping_frame,u ; so added init code to mapping_frame address here because it is not an index anymore
rts * rts
*; ===========================================================================
*
Tails_Move *loc_13096:
ldx #Tails_xy_data_end-Tails_xy_data
stx dyn_01+2 * moveq #word_130B8_end-word_130B8+4,d2
leax <Tails_xy_data-2,pcr * lea (word_130B8).l,a1
lbra TitleScreen_MoveObjects * bra.w loc_12F20
*; ===========================================================================
*
Tails_CreateHand *loc_130A2:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldx #Obj_TailsHand * lea (IntroTailsHand).w,a1
lda #ObjID_TitleScreen * move.b #ObjID_IntroStars,id(a1) ; load obj0E (flashing intro star) at $FFFFB200
sta id,x
lda #Sub_TailsHand
sta subtype,x * move.b #$10,subtype(a1) ; Tails' hand
*
Tails_DisplaySprite *BranchTo10_DisplaySprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
Tails_xy_data *word_130B8:
fcb $5B,$58 * dc.w $D7,$C8
fcb $59,$48 * dc.w $D3,$B8 ; 2
fcb $57,$3C * dc.w $CE,$AC ; 4
fcb $56,$36 * dc.w $CC,$A6 ; 6
fcb $55,$32 * dc.w $CA,$A2 ; 8
fcb $54,$31 * dc.w $C9,$A1 ; $A
fcb $54,$30 * dc.w $C8,$A0 ; $C
Tails_xy_data_end *word_130B8_end
*; ===========================================================================
* ---------------------------------------------------------------------------
* EmblemTop
* ---------------------------------------------------------------------------
*
EmblemTop *Obj0E_LogoTop:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <EmblemTop_Routines,pcr * move.w off_130E2(pc,d0.w),d1
jmp [a,x] * jmp off_130E2(pc,d1.w)
*; ===========================================================================
EmblemTop_Routines *off_130E2: offsetTable
fdb EmblemTop_Init * offsetTableEntry.w Obj0E_LogoTop_Init ; 0
fdb EmblemTop_DisplaySprite * offsetTableEntry.w BranchTo11_DisplaySprite ; 2
*; ===========================================================================
*
EmblemTop_Init *Obj0E_LogoTop_Init:
* not implemented * move.b #$B,mapping_frame(a0)
* trademark logo for PAL * tst.b (Graphics_Flags).w
* game version * bmi.s +
* lda #Img_emblemFront * move.b #$A,mapping_frame(a0)
sta mapping_frame,u *+
lda #2
sta priority,u * move.b #2,priority(a0)
ldd #$8078
std xy_pixel,u * move.w #$120,x_pixel(a0)
* move.w #$E8,y_pixel(a0)
*
TitleScreen_NextSubRoutineAndDisplay *loc_1310A:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
*
EmblemTop_DisplaySprite *BranchTo11_DisplaySprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
* ---------------------------------------------------------------------------
* Sky Piece
* - use a VDP functionality that hide lines of lower priority
* sprites, when a higher priority sprite is at x=0 position
* ---------------------------------------------------------------------------
*
* not implemented *Obj0E_SkyPiece:
* not implemented * moveq #0,d0
* not implemented * move.b routine_secondary(a0),d0
* not implemented * move.w off_13120(pc,d0.w),d1
* not implemented * jmp off_13120(pc,d1.w)
* not implemented *; ===========================================================================
* not implemented *off_13120: offsetTable
* not implemented * offsetTableEntry.w Obj0E_SkyPiece_Init ; 0
* not implemented * offsetTableEntry.w BranchTo12_DisplaySprite ; 2
* not implemented *; ===========================================================================
* not implemented *
* not implemented *Obj0E_SkyPiece_Init:
* not implemented
* not implemented * addq.b #2,routine_secondary(a0)
* not implemented * move.w #make_art_tile(ArtTile_ArtKos_LevelArt,0,0),art_tile(a0)
* not implemented
* not implemented * move.b #$11,mapping_frame(a0)
* not implemented * move.b #2,priority(a0)
* not implemented * move.w #$100,x_pixel(a0)
* not implemented * move.w #$F0,y_pixel(a0)
* not implemented *
* not implemented *BranchTo12_DisplaySprite
* not implemented * bra.w DisplaySprite
* not implemented *; ===========================================================================
* ---------------------------------------------------------------------------
* Large Star
* ---------------------------------------------------------------------------
*
LargeStar *Obj0E_LargeStar:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <LargeStar_Routines,pcr * move.w off_13158(pc,d0.w),d1
jmp [a,x] * jmp off_13158(pc,d1.w)
*; ===========================================================================
LargeStar_Routines *off_13158: offsetTable
fdb LargeStar_Init * offsetTableEntry.w Obj0E_LargeStar_Init ; 0
fdb TitleScreen_Animate * offsetTableEntry.w loc_12F52 ; 2
fdb LargeStar_Wait * offsetTableEntry.w loc_13190 ; 4
fdb LargeStar_Move * offsetTableEntry.w loc_1319E ; 6
*; ===========================================================================
*
LargeStar_Init *Obj0E_LargeStar_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_star_2
std mapping_frame,u * move.b #$C,mapping_frame(a0)
* not implemented * ori.w #high_priority,art_tile(a0)
ldd #Ani_largeStar
std anim,u * move.b #2,anim(a0)
ldb #$02
stb priority,u * move.b #1,priority(a0)
ldd #$7038
std xy_pixel,u * move.w #$100,x_pixel(a0)
* move.w #$A8,y_pixel(a0)
ldd #4
std w_TitleScr_move_frame_count,u * move.w #4,objoff_2A(a0)
rts * rts
*; ===========================================================================
*
LargeStar_Wait *loc_13190:
ldd w_TitleScr_move_frame_count,u
subd #1 * subq.w #1,objoff_2A(a0)
std w_TitleScr_move_frame_count,u
bmi LargeStar_AfterWait * bmi.s +
rts * rts
*; ===========================================================================
LargeStar_AfterWait *+
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
rts * rts
*; ===========================================================================
*
LargeStar_Move *loc_1319E:
ldd #$0200
sta routine_secondary,u * move.b #2,routine_secondary(a0)
stb anim_frame,u * move.b #0,anim_frame(a0)
stb anim_frame_duration,u * move.b #0,anim_frame_duration(a0)
ldd #6
std w_TitleScr_move_frame_count,u * move.w #6,objoff_2A(a0)
ldd w_TitleScr_xy_data_index,u * move.w objoff_2C(a0),d0
addd #2 * addq.w #4,d0
cmpd #LargeStar_xy_data_end-LargeStar_xy_data
* cmpi.w #word_131DC_end-word_131DC+4,d0
blo LargeStar_MoveContinue
jmp DeleteObject * bhs.w DeleteObject
LargeStar_MoveContinue
std w_TitleScr_xy_data_index,u * move.w d0,objoff_2C(a0)
leax <LargeStar_xy_data-2,pcr
leax d,x * move.l word_131DC-4(pc,d0.w),d0
ldd ,x
std xy_pixel,u * move.w d0,y_pixel(a0)
* swap d0
* move.w d0,x_pixel(a0)
* sound unused * moveq #SndID_Sparkle,d0 ; play intro sparkle sound
rts * jmpto (PlaySound).l, JmpTo4_PlaySound
*; ===========================================================================
*; unknown
LargeStar_xy_data *word_131DC:
fcb $5D,$82 * dc.w $DA, $F2
fcb $A8,$88 * dc.w $170, $F8 ; 2
fcb $89,$C1 * dc.w $132,$131 ; 4
fcb $BF,$32 * dc.w $19E, $A2 ; 6
fcb $50,$73 * dc.w $C0, $E3 ; 8
fcb $B0,$70 * dc.w $180, $E0 ; $A
fcb $76,$CB * dc.w $10D,$13B ; $C
fcb $50,$3B * dc.w $C0, $AB ; $E
fcb $A2,$97 * dc.w $165, $107 ; $10
LargeStar_xy_data_end *word_131DC_end
*; ===========================================================================
* ---------------------------------------------------------------------------
* Sonic Hand
* ---------------------------------------------------------------------------
*
SonicHand *Obj0E_SonicHand:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <SonicHand_Routines,pcr * move.w off_1320E(pc,d0.w),d1
jmp [a,x] * jmp off_1320E(pc,d1.w)
*; ===========================================================================
SonicHand_Routines *off_1320E: offsetTable
fdb SonicHand_Init * offsetTableEntry.w Obj0E_SonicHand_Init ; 0
fdb SonicHand_Move * offsetTableEntry.w loc_13234 ; 2
fdb SonicHand_DisplaySprite * offsetTableEntry.w BranchTo13_DisplaySprite ; 4
*; ===========================================================================
*
SonicHand_Init *Obj0E_SonicHand_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_sonicHand
std mapping_frame,u * move.b #9,mapping_frame(a0)
lda #3
sta priority,u * move.b #3,priority(a0)
ldd #$924F
std xy_pixel,u * move.w #$145,x_pixel(a0)
* move.w #$BF,y_pixel(a0)
*
SonicHand_DisplaySprite *BranchTo13_DisplaySprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
SonicHand_Move *loc_13234:
ldx #SonicHand_xy_data_end-SonicHand_xy_data
stx dyn_01+2 * moveq #word_13240_end-word_13240+4,d2
leax <SonicHand_xy_data-2,pcr * lea (word_13240).l,a1
lbra TitleScreen_MoveObjects * bra.w loc_12F20
*; ===========================================================================
SonicHand_xy_data *word_13240:
fcb $91,$51 * dc.w $143, $C1
fcb $90,$52 * dc.w $140, $C2 ; 2
fcb $90,$51 * dc.w $141, $C1 ; 4
SonicHand_xy_data_end *word_13240_end
*; ===========================================================================
* ---------------------------------------------------------------------------
* Tails Hand
* ---------------------------------------------------------------------------
*
TailsHand *Obj0E_TailsHand:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <TailsHand_Routines,pcr * move.w off_1325A(pc,d0.w),d1
jmp [a,x] * jmp off_1325A(pc,d1.w)
*; ===========================================================================
TailsHand_Routines *off_1325A: offsetTable
fdb TailsHand_Init * offsetTableEntry.w Obj0E_TailsHand_Init ; 0
fdb TailsHand_Move * offsetTableEntry.w loc_13280 ; 2
fdb TailsHand_DisplaySprite * offsetTableEntry.w BranchTo14_DisplaySprite ; 4
*; ===========================================================================
*
TailsHand_Init *Obj0E_TailsHand_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_tailsHand
std mapping_frame,u * move.b #$13,mapping_frame(a0)
lda #3
sta priority,u * move.b #3,priority(a0)
ldd #$7765
std xy_pixel,u * move.w #$10F,x_pixel(a0)
* move.w #$D5,y_pixel(a0)
*
TailsHand_DisplaySprite *BranchTo14_DisplaySprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
TailsHand_Move *loc_13280:
ldx #TailsHand_xy_data_end-TailsHand_xy_data
stx dyn_01+2 * moveq #word_1328C_end-word_1328C+4,d2
leax <TailsHand_xy_data-2,pcr * lea (word_1328C).l,a1
lbra TitleScreen_MoveObjects * bra.w loc_12F20
*; ===========================================================================
TailsHand_xy_data *word_1328C:
fcb $76,$60 * dc.w $10C, $D0
fcb $76,$61 * dc.w $10D, $D1 ; 2
TailsHand_xy_data_end *word_1328C_end
*; ===========================================================================
* ---------------------------------------------------------------------------
* Small Star
* ---------------------------------------------------------------------------
*
SmallStar *Obj0E_SmallStar:
* moveq #0,d0
lda routine_secondary,u * move.b routine_secondary(a0),d0
leax <SmallStar_Routines,pcr * move.w off_132A2(pc,d0.w),d1
jmp [a,x] * jmp off_132A2(pc,d1.w)
*; ===========================================================================
SmallStar_Routines *off_132A2: offsetTable
fdb SmallStar_Init * offsetTableEntry.w Obj0E_SmallStar_Init ; 0
fdb SmallStar_Move * offsetTableEntry.w loc_132D2 ; 2
*; ===========================================================================
*
SmallStar_Init *Obj0E_SmallStar_Init:
inc routine_secondary,u
inc routine_secondary,u * addq.b #2,routine_secondary(a0)
ldd #Img_star_2
std mapping_frame,u * move.b #$C,mapping_frame(a0)
lda #5
sta priority,u * move.b #5,priority(a0)
ldd #$A810
std xy_pixel,u * move.w #$170,x_pixel(a0)
* move.w #$80,y_pixel(a0)
ldd #Ani_smallStar
std anim,u * move.b #3,anim(a0)
ldd #$71
std w_TitleScr_time_frame_countdown,u * move.w #$8C,objoff_2A(a0)
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================
*
SmallStar_Move *loc_132D2:
ldd w_TitleScr_time_frame_countdown,u
subd #1 * subq.w #1,objoff_2A(a0)
std w_TitleScr_time_frame_countdown,u
bpl SmallStar_MoveContinue
jmp DeleteObject * bmi.w DeleteObject
SmallStar_MoveContinue
dec x_pixel,u * subq.w #2,x_pixel(a0)
inc y_pixel,u * addq.w #1,y_pixel(a0)
* no more offset table * lea (Ani_obj0E).l,a1
jsr AnimateSprite * bsr.w AnimateSprite
jmp DisplaySprite * bra.w DisplaySprite
*; ===========================================================================