The Free Assets Thread

LuigiXHero

Member
Messages
5
Hello MDDC! So I decided to bring this thread over to make sharing stuff easier for now and to bring over some old stuff. Excited to see what gets made and get to play them.

So to start i'll share some of my stuff:

Sonic CD art test:
ROM
DISASM
Most of the Sonic CD levels ported directly to Sonic 1, only art and layouts though, supports incomplete US and JP soundtrack depending on region.

Sonic 1 Drop Edition:
ROM
DISASM
Yeah that one hack with the Drop Dash back when Mania was first announced.

Sonic 1 Legends:
ROM
DISASM
Another incomplete hack, has a shield and spike gimmick that isn't seen elsewhere.

Nineko SMPS Pack:
Download

Feel free to use these disasm for whatever, all I ask is that you give me credit somewhere and no sharing these disasm and saying they are yours.

Now open the floodgates!
 

Inferno

Blazing Creator
Member
Messages
19
Location
Sky Base Zone, South Island
S1D has code for a standalone FG object, in contrast to the pylon. I am happy to provide this, but you will have to adjust it yourself for mappings, art, etc. Made for Github disasm, should be easy enough to port to Hivebrain with enough knowledge. Should work in vanilla S1:
Code:
FGObject:
        moveq    #0,d0
        move.b    obRoutine(a0),d0
        move.w    FGObject_Index(pc,d0.w),d1
        jmp    FGObject_Index(pc,d1.w)
; ===========================================================================
FGObject_Index:    dc.w FGObject_Main-FGObject_Index
        dc.w FGObject_Display-FGObject_Index
; ===========================================================================

FGObject_Main:
        addq.b    #2,obRoutine(a0)
        move.l    #Map_FGObject,obMap(a0) ; Add mappings here!
        move.w    #$C000,obGfx(a0) ; Tweak this to change VRAM location tied to object!
        move.b    #$14,obRender(a0) ; This must always be at least $10! The $10 in this ensures it displays in front of all level art.
        move.b    #32,obActWid(a0)
        move.b  #$40,obHeight(a0)
        move.b    #0,obPriority(a0) ; This ensures it displays in front of almost ALL sprites.
        move.w    obX(a0), $30(a0) ; Move this here to ensure proper sprite deletion.

FGObject_Display:
    ;-- Thank you based pylon --
        move.w    $30(a0), d1 ; Store the original X position in d1....
        move.w  d1,d2 ; ... and make sure to allow us to readd it in d2 so we don't assume we are at X = 0.
        subi.w  #$A0,d1 ; Subtract A0 from d1.
        sub.w   (v_screenposx).w,d1 ; Subtract the current screen position from d1.
        asr.w    #1,d1 ; Divide d1 by 2. (Tweak this to get different scroll rates!)
        add.w    d2, d1 ; Add the base X position to our offset.
        move.w    d1, obX(a0) ; Here's our new X position!
      
    @displaydelete:
        jsr    DisplaySprite
        out_of_range    @delete,$30(a0)
        rts 
      
@delete:
        jmp DeleteObject
 

Brainulator9

Regular garden-variety member
Member
Messages
3
Location
United States
Is it okay to comment on or ask questions about particular code/assets that appear here? There are two things I've noticed with Inferno's code above that I want to ask about.
 
Messages
27
that enemy from metallic madness with a saw btw this is for sonic 3 can pretty much work on s2 or 1
Code:
Inital_X_BuzzSaw = $34
Some_BUZZ_Flag = $36
Obj_Buzz_Saw:


    ;    jsr    (Decide_Object_Spawn).l
        moveq    #0,d0
        move.b    routine(a0),d0
        move.w    off_20DF88(pc,d0.w),d0
        jsr    off_20DF88(pc,d0.w)
        jsr     (Add_SpriteToCollisionResponseList).l
        jsr    (DisplaySprite).l   ; why does sonic cd display it then removes it ?
        move.w    Inital_X_BuzzSaw(a0),d0
        jmp    (MarkObjGone2).l
; ---------------------------------------------------------------------------
off_20DF88:    dc.w Obj_BuzzSaw_Init-off_20DF88

        dc.w Obj_BuzzSaw_SetOnFloor-off_20DF88
        dc.w Obj_BuzzSaw_Main-off_20DF88
; ---------------------------------------------------------------------------

Obj_BuzzSaw_Init:
        move.w    x_pos(a0),Inital_X_BuzzSaw(a0)
        ;move.b    subtype(a0),secondary_subtype(a0)
        ori.b    #4,render_flags(a0)
        move.w    #$200,priority(a0)
        move.w    #$244E,art_tile(a0)
        move.l    #MainBody_Map,mappings(a0)
        move.b    #$18,width_pixels(a0)
        move.b    #$16,height_pixels(a0)
        move.b    #$E,y_radius(a0)
        move.b    #$2A,collision_flags(a0) ; '*' ; collision response
        move.l    #Object_RAM,objoff_30(a0)
        addq.b    #2,routine(a0)
        bchg    #0,status(a0)
        lea    (Load_BuzzSaw_assets).l,a1
                   jsr    (Load_PLC_Raw).l
        jsr    (SingleObjLoad2).l
        beq.s    loc_20DFDA
        jmp    (DeleteObject).l
; ---------------------------------------------------------------------------

loc_20DFDA:
        move.l    #Obj24_BuzzSaw,(a1)
        move.b    subtype(a0),subtype(a1)
        move.w    x_pos(a0),x_pos(a1)
        move.w    y_pos(a0),y_pos(a1)
        move.w    a0,parent(a1)


Obj_BuzzSaw_SetOnFloor:

        jsr    ObjectMoveAndFall
        jsr    ObjCheckFloorDist
        tst.w    d1
        bpl.s    return_20E034
        add.w    d1,y_pos(a0)
        addq.b    #2,routine(a0)

return_20E034:
        rts
; ---------------------------------------------------------------------------

Obj_BuzzSaw_Main:
        tst.b    render_flags(a0)
        bpl.s    loc_20E054    ; offscreen
        addq.w    #1,Some_BUZZ_Flag(a0)
        move.w    Some_BUZZ_Flag(a0),d0
        and.w    #$1F,d0
        bne.s    loc_20E054
        move.w    #$82,d0    ; 'ยฑ'
        jsr    (PlaySound).l


loc_20E054:

        move.l    objoff_30(a0),d0
        add.l    d0,x_pos(a0)    ; add velocity
        jsr    (ObjCheckFloorDist).l
        add.w    d1,y_pos(a0)    ; set on floor
        add.w    #-1,objoff_2E(a0)
        bpl.s    return_20E078
        move.w    #$199,objoff_2E(a0)
        neg.l    objoff_30(a0)

return_20E078:
        rts
Decide_Object_Spawn:
    ;    tst.b    ($FF156A).l  ; is it bad future ?
    ;    beq.s    return_20F2EA
    ;    cmp.b    #1,($FF152E).l   ; is it present ? these flags are for time
    ;    bne.s    loc_20F2BC
        tst.b    subtype(a0) ; is this a subtype
        beq.s    return_20F2EA

loc_20F2BC:
        move.w    x_pos(a0),d5
        move.w    y_pos(a0),d6
        jsr    (DeleteObject).l ; if x and y = 0 delete ?
        move.w    d5,x_pos(a0)
        move.w    d6,y_pos(a0)
        move.l    #DeleteObject,(a0)   ; load it as obj 18 aka exploasion
        tst.b    render_flags(a0)
        bpl.s    loc_20F2E8
        move.w    #$46,d0    ; 'ลพ'
        jsr    (PlaySound).l

loc_20F2E8:
        addq.l    #4,sp      ; dont run code after this

return_20F2EA:

        rts
Obj24_BuzzSaw:
        moveq    #0,d0
        move.b    routine(a0),d0
        move.w    off_20E09C(pc,d0.w),d0
        jsr    off_20E09C(pc,d0.w)
        jsr     (Add_SpriteToCollisionResponseList).l
        jmp    (DisplaySprite).l
; ---------------------------------------------------------------------------
off_20E09C:    dc.w Obj24_BuzzSaw_Init-off_20E09C

        dc.w Obj24_BuzzSaw_Main-off_20E09C
; ---------------------------------------------------------------------------

Obj24_BuzzSaw_Init:
        addq.b    #2,routine(a0)
        ori.b    #4,render_flags(a0)
        move.w    #$180,priority(a0)
        move.w    #$244E,art_tile(a0)
        move.l    #Main_Saw_Mapps,mappings(a0)
        move.b    #$C,width_pixels(a0)
        move.b    #$14,height_pixels(a0)
    ;    move.b    #$10,$16(a0)
        move.b    #$AB,collision_flags(a0)    ; collision hurts

Obj24_BuzzSaw_Main:
        move.w    parent(a0),a1
        btst    #0,status(a1)
        bne.s   +
        bset    #0,render_flags(a0)
        bset    #0,status(a0)
+
        cmpi.l    #Obj_Buzz_Saw,(a1) ; '$' ; delete if parent gone
        beq.s    loc_20E0E2
        jmp    (DeleteObject).l
; ---------------------------------------------------------------------------

loc_20E0E2:
        tst.b    subtype(a0)
        bne.s    loc_20E0FC
        add.w    #-1,objoff_2E(a0)
        bpl.s    loc_20E126
        move.w    #$3C,objoff_2E(a0) ; '<'
        eor.b    #1,anim(a0)

loc_20E0FC:
        move.w    #$FFE7,objoff_30(a0)
        move.w    #0,objoff_32(a0)
        tst.b    anim(a0)
        beq.s    loc_20E11A
        move.w    #$FFED,objoff_30(a0)
        move.w    #$FFF1,objoff_32(a0)

loc_20E11A:
        btst    #0,render_flags(a0)
        beq.s    loc_20E126
        neg.w    objoff_30(a0)

loc_20E126:
        move.w    x_pos(a1),d0
        move.w    y_pos(a1),d1
        add.w    objoff_30(a0),d0
        add.w    objoff_32(a0),d1
        move.w    d0,x_pos(a0)
        move.w    d1,y_pos(a0)
        lea    Anim_Obj_BuzzSaw(pc),a1
        jmp    (Animate_Sprite_s1).l
Anim_Obj_BuzzSaw:    dc.w First_Anim_Set-Anim_Obj_BuzzSaw

                     dc.w Sec_Set_BuzzSaw-Anim_Obj_BuzzSaw
First_Anim_Set:    dc.b   2,0,1,$FF

        even
Sec_Set_BuzzSaw:    dc.b   2,2,3,$FF
        even
MainBody_Map:
        dc.w SME_P1ymR_2-MainBody_Map
SME_P1ymR_2:    dc.b 0, 2
        dc.b $F0, $F, 0, 0, $FF, $E8
        dc.b $F0, 7, 0, $10, 0, 8
        even
Main_Saw_Mapps:
       include        "mappings/BuzzSaw_Item_Map.asm" ================================
===========>

SME_CxdTl:
        dc.w SME_CxdTl_8-SME_CxdTl, SME_CxdTl_16-SME_CxdTl
        dc.w SME_CxdTl_24-SME_CxdTl, SME_CxdTl_32-SME_CxdTl
SME_CxdTl_8:    dc.b 0, 2
        dc.b $F8, 9, 0, $24, $FF, $F8
        dc.b $F0, $B, 0, $18, $FF, $F4
SME_CxdTl_16:    dc.b 0, 2
        dc.b $F8, 9, 0, $24, $FF, $F8
        dc.b $EF, $B, $10, $18, $FF, $F4
SME_CxdTl_24:    dc.b 0, 2
        dc.b $FE, 6, 0, $2A, $FF, $FC
        dc.b $F0, $B, 0, $18, $FF, $F4
SME_CxdTl_32:    dc.b 0, 2
        dc.b $FE, 6, 0, $2A, $FF, $FC
        dc.b $EF, $B, $10, $18, $FF, $F4
        even
mappings are s3k mappings the art link https://cdn.discordapp.com/attachments/662660553704996874/910593298832425041/BuzzSaw_Art.bin
 

Attachments

  • e45bcb61151b5c0e7975ad7489c00102.gif
    e45bcb61151b5c0e7975ad7489c00102.gif
    1.5 MB · Views: 0
Last edited:

Brainulator9

Regular garden-variety member
Member
Messages
3
Location
United States
Feel free.

I know how the code works, so I'll answer.
It's about this part:
Code:
    @displaydelete:
        jsr    DisplaySprite
        out_of_range    @delete,$30(a0)
        rts
  
@delete:
        jmp DeleteObject
  • Since the code is close enough, it would make sense to make the out_of_range use a short branch to @delete (the system defaults to word-sized).
  • This object (and the Metallic Madness badnik posted in the last post) have this bug that isn't immediately visible, but should be looked out for and was apparently one that was being worked on being fixed along Sonic 1 and 2's development cycles: various objects tend to queue themselves for displaying... only to be later deleted before it can display. The exact effect depends on how the game handles mappings and object loading, but the mappings pointer will be blanked, so sprites will be drawn with the idea that the object's mappings are at the start of the ROM... with, at worst, fatal results. There's a guide for fixing it in Sonic 1 which I would link to, but Sonic Retro's down as I type this. EDIT: here's the link.
I guess with both said, it would be better, I think, to do this instead:
Code:
    @displaydelete:
        out_of_range.s  @delete,$30(a0)
        jmp DisplaySprite
  
@delete:
        jmp DeleteObject
 
Last edited:
Messages
27
It's about this part:

  • Since the code is close enough, it would make sense to make the out_of_range use a short branch to @delete (the system defaults to word-sized).
  • This object (and the Metallic Madness badnik posted in the last post) have this bug that isn't immediately visible, but should be looked out for and was apparently one that was being worked on being fixed along Sonic 1 and 2's development cycles: various objects tend to queue themselves for displaying... only to be later deleted before it can display. The exact effect depends on how the game handles mappings and object loading, but the mappings pointer will be blanked, so sprites will be drawn with the idea that the object's mappings are at the start of the ROM... with, at worst, fatal results. There's a guide for fixing it in Sonic 1 which I would link to, but Sonic Retro's down as I type this. EDIT: here's the link.
I guess with both said, it would be better, I think, to do this instead:
Code:
    @displaydelete:
        out_of_range.s  @delete,$30(a0)
        jmp DisplaySprite
 
@delete:
        jmp DeleteObject
whats wrong with the mmz badnick ?
 
Messages
27
Putting DisplaySprite before a check for deletion can break horrifically depending on mappings format.
iirc sonic 2 and 1 format checks if the object mappings are 0 if it is 0 it doesnt render sprites and uhh im using s3k mapping format also
Code:
moveq    #0,d0
        move.b    routine(a0),d0
        move.w    off_20DF88(pc,d0.w),d0
        jsr    off_20DF88(pc,d0.w)
this runs before the displaying routine is reached so that means the mappings do get set before displaying
 

DeltaWooloo

ใ‚ทใƒฃใƒƒใƒˆใƒ€ใ‚ฆใƒณใ—ใพใ™๏ผ
Member
Messages
41
Location
England, United Kingdom
Time to share some big ass thing for the first time in this community.

The Another South Island Adventure disassembly is now public. Please click me to download!

Please check the read me text file in the disassembly before continuing~
 
Last edited:
Messages
27
well well its the time of the year when i decide to give one of my badniks codes away (you still have to credit sadly lol)
Code:
;----------------------------------------------------
; Object 4E - Aligator badnik from HPZ
;----------------------------------------------------

Obj4E:
        move.l    #ObjAligator_Map,mappings(a0)
            move.w  #$2421,art_tile(a0)
        ori.b    #4,render_flags(a0)
        move.b    #$A,collision_flags(a0)
        move.w    #$200,priority(a0)
        move.b    #$10,width_pixels(a0)
        move.b    #$F,y_radius(a0)
        move.b    #8,x_radius(a0)
        clr.b    objoff_2F(a0)
        bsr.w    j_ObjectMoveAndFall_4
        jsr    ObjCheckFloorDist
        tst.w    d1
        bpl.s    locret_17238
        add.w    d1,y_pos(a0)
        move.w    #0,y_vel(a0)
        tst.l   mappings(a0); is mappings set right ?
        beq.s   Obj4E     ; if not loop
        move.l    #Obj4E_Main,(a0) ; go to next routine


locret_17238:
        rts
;==============================================================================

Obj4E_Main:
        moveq    #0,d0
        move.b    routine_secondary(a0),d0
        move.w    Obj4E_SubIndex(pc,d0.w),d1
        jsr    Obj4E_SubIndex(pc,d1.w)
AligatorRefreshAnim:
        lea    (Ani_Obj4E).l,a1
        move.l  #Ani_Obj4E,objoff_30(a0)
        bsr.w    j_AnimateSprite_7
        jsr    (Add_SpriteToCollisionResponseList).l
        bra.w    loc_174B8
; ==============================================================================
Obj4E_SubIndex:    dc.w loc_1725A-Obj4E_SubIndex

        dc.w loc_1727E-Obj4E_SubIndex
; ===============================================================================

loc_1725A:


        subq.w    #1,objoff_34(a0)
        bpl.s    locret_1727C
        addq.b    #2,routine_secondary(a0)
        move.w    #$FF40,x_vel(a0)
        move.b    #0,anim(a0)
        bchg    #0,status(a0)
        bne.s    locret_1727C
        neg.w    x_vel(a0)

locret_1727C:

        rts
; =============================================================================

loc_1727E:
        bsr.w    GetPlayerLocations_Aligator
        moveq   #0,d0
        move.b  objoff_2F(a0),d0  ; get our status routine
        move.l  AligatorFallingRoutines(pc,d0),a2
        jmp     (a2)  ; jmp to floors routines
DoOrignalCode:
        bsr.w    j_ObjectMove_6
        jsr    ObjCheckFloorDist
AligatorCheckCollsionSides:
        cmpi.w    #$FFF8,d1
        blt.s    loc_1729E
        cmpi.w    #$C,d1
        bge.s    loc_1729E
        add.w    d1,y_pos(a0)
        rts
AligatorMidAir:
                bsr.w    j_ObjectMoveAndFall_4
        jsr    ObjCheckFloorDist
        tst.w    d1
        bpl.w    locret_17238
        clr.b   objoff_2F(a0)  ; clear our status to on floor
                bra.w   AligatorCheckCollsionSides
AligatorFallingRoutines:
        dc.l  DoOrignalCode
        dc.l  AligatorMidAir
; =============================================================================

loc_1729E:

        subq.b    #2,routine_secondary(a0)
        move.w    #$3B,objoff_34(a0)
        tst.b   objoff_2F(a0) ; is object returing from dashing code ?
        beq.s   +   ; if not do og code
        neg.w    x_vel(a0) ; negate locations
        move.b    #1,anim(a0)
        rts
+
        move.w    #0,x_vel(a0)
        move.b    #1,anim(a0)
        rts

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


GetPlayerLocations_Aligator:
        move.w    x_pos(a0),d0
        sub.w    (Player_1+x_pos).w,d0
        bmi.s    loc_172D0
        cmpi.w    #$40,d0    ; is player 40 pixels away
        bgt.s    loc_172E6
        btst    #0,status(a0)
        beq.s    loc_172DE
        rts
; ============================================================================

loc_172D0:
        cmpi.w    #$FFC0,d0
        blt.s    loc_172E6
        btst    #0,status(a0)
        beq.s    loc_172E6

loc_172DE:
        move.b    #2,anim(a0)
        move.l  #AligatorCharge,(a0)
        move.b  #$4,objoff_2F(a0) ; change our status to falling
        rts
;============================================================================

loc_172E6:

        move.b    #0,anim(a0)
        rts

StoredXVelAligator = y_vel   ; getting away with 2 bytes
AligatorCharge:
             move.w  x_vel(a0),d0
             move.w  d0,StoredXVelAligator(a0)
             clr.w   x_vel(a0)
             bsr.w   AligatorRefreshAnim
             move.l  #AliGatorPlaySound,(a0)
             move.w    x_vel(a0),d0
              jmp        Do_xmove
AliGatorPlaySound:
         cmpi.b  #$8,objoff_45(a0)
         bhs.s   AligatorMoveToPlayer
         subq.b  #1,objoff_44(a0)
         bpl.w   AligatorRefreshAnim
         move.b  #$10,objoff_44(a0)
         addq.b  #1,objoff_45(a0)
         bsr.w   AligatorRefreshAnim
         move.w    #SndID_SpindashRev,d0
         jmp    (PlaySound).l
AligatorMoveToPlayer:
             move.w  StoredXVelAligator(a0),d0 ; get old x vel
             move.w  d0,d1
             move.w  d1,d2   ; save value
             add.w   d0,d0      ; multyply it by 2
             add.w   d0,d0     ; multyply that again by 2
             add.w  d0,d1      ; add d0 to d1
             add.w   d1,d0  ; add d1 to d0
             moveq   #0,d1    ;clear d1
             sub.w   d2,d0   ; subtract og value
             moveq   #0,d2    ;clear d2
             move.w  d0,x_vel(a0) ; get the result to x vel
             move.w  #$20,objoff_44(a0)   ; set timer
             move.l  #AligatorCheckTime,(a0)
             bsr.w   AligatorRefreshAnim
             move.w    x_vel(a0),d0
             jmp        Do_xmove
AligatorCheckTime:
              subq.w    #1,objoff_44(a0)
              bpl.w     +
              move.l    #Obj4E_Main,(a0)
              clr.w     StoredXVelAligator(a0)
              clr.b     routine_secondary(a0)
              move.b  #$4,objoff_2F(a0) ; change our status to falling
+

            ;  move.w    x_vel(a0),d0
           ;   jsr        Do_xmove
              jsr    ObjectMoveAndFall
              jsr    ObjCheckFloorDist
              tst.w    d1
                bpl.w    AligatorRefreshAnim
             add.w    d1,y_pos(a0)
             bsr.w    MakeTrailsAligator
              bra.w   AligatorRefreshAnim

MakeTrailsAligator:
                subq.b  #1,objoff_37(a0)
                bpl.w   +
                move.b  #$F,objoff_37(a0)
              jsr    SingleObjLoad
        bne.s    +
-
        move.l    mappings(a0),mappings(a1)
        tst.l   mappings(a1) ; did the child copy the mappings
        beq.s   -     ; if not loop
        move.w    art_tile(a0),art_tile(a1)

        move.l    #ObjMakeTrails,(a1)
        move.w    x_pos(a0),x_pos(a1)
        move.w    y_pos(a0),y_pos(a1)
        move.w  a0,parent3(a1)
+
        rts

; ===========================================================================
Ani_Obj4E:    dc.w byte_172F4-Ani_Obj4E ; DATA XREF: ROM:00017248o
                    ; ROM:Ani_Obj4Eo ...
        dc.w byte_172FC-Ani_Obj4E
        dc.w byte_172FF-Ani_Obj4E
byte_172F4:    dc.b   3,  0,  4,  2,  3,  1,  5,$FF; 0    ; DATA XREF: ROM:Ani_Obj4Eo
byte_172FC:    dc.b  $F,  0,$FF    ; 0 ; DATA XREF: ROM:000172F0o
byte_172FF:    dc.b   3,  6, $A,  8,  9,  7, $B,$FF,  0; 0 ; DATA XREF: ROM:000172F2o
                even
ObjAligator_Map:
                include  "mappings/AligatorMap.asm"
sadly you will be the one making your own afterimages code :L and getting maps and stuff Happy XMAS :)
 
Top