Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. bluBird

    bluBird Game Developer Member

    Joined:
    May 19, 2015
    Messages:
    32
    Location:
    Michigan
    Hey, this is kinda unrelated, but is there a genesis soundfont that I can download somewhere? I need some better instruments for my music for my hack. Also, how do I use the PCM tracks in XM3SMPS/oerg? I'm still learning...
     
  2. JoenickROS

    JoenickROS ROS (bug fixing in progress) Member

    Joined:
    Feb 5, 2012
    Messages:
    929
    You could always VGM log songs from other games and extract the voices through mid2SMPS or make your own through mid2SMPSs YM2612 instrument editor.
     
  3. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    And hmm...

    Why in Pattern Load Cues.asm, the LZ water surface art is stored à $6000:

    Code:
    dc.l Nem_Water        ; water    surface
            dc.w $6000
    And in Sonic1.asm, the vram adress is:

    Code:
    move.l    #Map_obj1B,4(a0)
            move.w    #$C300,2(a0)
    ?

    Because i want to know the vram adress of the lz water to change it. I want to move the lz water surface to the vram adress used by the shield and invincibility art.
     
  4. Painto

    Painto Arthurus Paintus Erinaceus Member

    Joined:
    Mar 24, 2014
    Messages:
    321
    Location:
    Lublin, Poland
    $6000 divided by $20 is $300. The $CXXX comes from foreground flag (bit 15 - $8000) and palette line 2 (bit 14 - $4000) being set.
     
    Last edited: Aug 20, 2016
  5. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    So if i want to put A820 instead of 6000, the result is: C541? :eek:
     
  6. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    That is correct.

    Actually it's palette line 2, since bit 13 is cleared (For bits 14 and 13: 00 = line 0, 01 = line 1, 10 = line 2, 11 = line 3). Also, FYI, bit 12 handles vertical flipping and bit 11 handles horizontal flipping.
     
  7. Painto

    Painto Arthurus Paintus Erinaceus Member

    Joined:
    Mar 24, 2014
    Messages:
    321
    Location:
    Lublin, Poland
    Ah, my bad. Sometimes I mix up decimal with hex so I counted the lines from 1 rather than 0 :V Ofc I meant line 2.
     
  8. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Thank you, guys!
     
  9. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    SORRY, i know that i can't double post:

    What "staFacing" means in GitHub? I want to translate it to Hivebrain.
     
  10. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    I would imagine it stands for status - facing. It is the direction Sonic faces, bit 0 of $22.

    Of course, reading the source code and Retro Wiki could have answered this, too...
     
  11. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Thanks, it's because i want to make Shield art use DPLC, and in the code i have find in Sonic Retro, there is:

    @shift:
    sub.w d1,8(a0)
    btst #staFacing,d0
    beq.s @noshift
    add.w d1,d1
    add.w d1,8(a0)
    ;=================================

    Also, it's not working with SonMapEd, but how can i create a DPLC.asm for an object?
    I have loaded the uncompressed shield art, mappings, and when i want to save the PLC, SonMapEd don't want. :eek:
     
  12. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    hey, I got a question, lately I was trying to make the special stage ring in sonic 1 behave more like sonic 3 where you can put it anywhere in the stage and it will work and possibly bring you back to the point where you entered it. now I know that the second step is probably the harder thing to do but for now I want to focus on at least making sure the ring will work with having to finish the act. first of all I am using the Hivebrain 2005 Dis and from what I understand the line " move.b #$10,($FFFFF600).w" is what sets the game mode to special stage , so I though if i'll put it somewhere in "Obj4A" (Special Stage Ring Object) it would make the ring put me in the special stage. the thing is, I am not that experienced with ASM and I am not sure where to put the line in. I tried multiple places in Obj4A and the results are always the same. I wonder ,do I have the right idea here or do I need to do something different? if I am in the right direction, I would appreciate if you would tell me where I should put the line?
     
  13. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    First of all, I recommend that you try learning more ASM and finding out what's going on in the code you're editing before you do something as advanced as making the special stage rings work the same as in Sonic 3. Once you get a better understanding of the code you're editing, then figuring out how to make your code work the way you want it to should be much easier to figure out.

    Second, Obj4A is unused and so modifying it will do nothing (notice how it says it's from the beta?).

    Third, you're actually on the right track for how the ring sends you to the special stage, you were just in the wrong location. The best place to put that in in the code for object 7C, the flash after you enter the ring. There, the last thing it does before it disappears is delete Sonic's object in Obj7C_End. This is the best place for the game mode to be set to the special stage. While's you're at it, if you haven't already, you should remove the code that Sonic 1 uses for sending you to the special stage at Obj3A_ChkSS because it's unnecessary now.
     
  14. Baraksha

    Baraksha Well-Known Member Member

    Joined:
    Dec 23, 2015
    Messages:
    99
    thank you very much for your response. I had a feeling that I might be on the wrong object. I actually did notice the beta thing. but i for some reason dis not question it. i should have realised it before. also I am trying to learn about ASM as possible right now, I read MarkeyJester's website and a guide on Sonic Retro. do you recommended anywhere else?
     
    breakthetargets likes this.
  15. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Hi everybody, it's been a while! lol
    Before reading, take a look at it:
    Code:
    ; ---------------------------------------------------------------------------
    ; Level    order array
    ; ---------------------------------------------------------------------------
    LevelOrder:   
            dc.w    green_hill_act_2    ; GHZ1
            dc.w    green_hill_act_3    ; GHZ2
            dc.w    marble_act_1        ; GHZ3
            dc.w    lvlord_sega        ; GHZ4
           
            dc.w    labyrinth_act_2        ; LZ1
            dc.w    labyrinth_act_3        ; LZ2
            dc.w    star_light_act_1    ; LZ3
            dc.w    final_zone        ; LZ4 (SBZ3)
           
            dc.w    marble_act_2        ; MZ1
            dc.w    marble_act_3        ; MZ2
            dc.w    spring_yard_act_1    ; MZ3
            dc.w    lvlord_sega        ; MZ4
           
            dc.w    star_light_act_2    ; SLZ1
            dc.w    star_light_act_3    ; SLZ2
            dc.w    scrap_brain_act_1    ; SLZ3
            dc.w    lvlord_sega        ; SLZ4
           
            dc.w    spring_yard_act_2    ; SYZ1
            dc.w    spring_yard_act_3    ; SYZ2
            dc.w    frozen_island_act_1        ; FIZ1
            dc.w    lvlord_sega        ; SYZ4
           
            dc.w    scrap_brain_act_2    ; SBZ1
            dc.w    scrap_brain_act_3    ; SBZ2
            dc.w    lvlord_sega        ; SBZ3 (FZ)
            dc.w    lvlord_sega        ; SBZ4
           
            dc.w    frozen_island_act_2    ; FIZ2
            dc.w    frozen_island_act_3    ; FIZ3
            dc.w    labyrinth_act_1     ; SBZ3
            dc.w    lvlord_sega        ; FIZ4
            even
    I play Spring Yard Zone act 3, beat the boss, and then, the game start my new zone act 1.
    I play the level normally, and there is the result screen.
    And when the game branch to my new level act 2: ILLEGAL INSTRUCTION, AGAIN!
    Sans titre.png
    I don't really understand how the handler works, so i don't know how to resolve my problem.
    Why?
     
  16. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    It seems that in DynScrResizeLoad it was trying to load an incorrect location in Resize_Index which led to it branch to a weird spot (in this case, Obj7F_loop). Look through Resize_Index to make sure each branch is correct and that every level in your hack has a spot on the table. When dealing with indexes like this, I've made the mistake of forgetting to put in a comma.
     
  17. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Code:
    Resize_Index:    dc.w Resize_GHZ-Resize_Index, Resize_LZ-Resize_Index
            dc.w Resize_MZ-Resize_Index, Resize_SLZ-Resize_Index
            dc.w Resize_SYZ-Resize_Index, Resize_SBZ-Resize_Index
            dc.w Resize_Ending-Resize_Index, Resize_FIZ-Resize_Index
    Every levels has a spot! :eek:

    Code:
    ; ---------------------------------------------------------------------------
    ; Frozen Island Zone dynamic screen resizing
    ; ---------------------------------------------------------------------------
    
    Resize_FIZ:                ; XREF: Resize_Index
            moveq    #0,d0
            move.b    ($FFFFFE11).w,d0
            add.w    d0,d0
            move.w    Resize_FIZx(pc,d0.w),d0
            jmp        Resize_FIZx(pc,d0.w)
    ; ===========================================================================
    Resize_FIZx:    dc.w Resize_FIZ1-Resize_FIZx
            dc.w Resize_FIZ2-Resize_FIZx
            dc.w Resize_FIZ3-Resize_FIZx
    ; ===========================================================================
    
    Resize_FIZ1:
            move.w    #$300,($FFFFF726).w ; set lower y-boundary
            move.w    #$300,($FFFFF72E).w ; set lower y-boundary    ;Mercury High Speed Camera Fix
            cmpi.w    #$1780,($FFFFF700).w ; has the camera reached $1780 on x-axis?
            bcs.s    locret2_6E08    ; if not, branch
            move.w    #$400,($FFFFF726).w ; set lower y-boundary
            move.w    #$400,($FFFFF72E).w ; set lower y-boundary    ;Mercury High Speed Camera Fix
    
    locret2_6E08:
            rts   
    ; ===========================================================================
    
    Resize_FIZ2:
    ;        move.w    #$300,($FFFFF726).w
    ;        cmpi.w    #$ED0,($FFFFF700).w
    ;        bcs.s    locret2_6E3A
    ;        move.w    #$200,($FFFFF726).w
    ;        cmpi.w    #$1600,($FFFFF700).w
    ;        bcs.s    locret2_6E3A
    ;        move.w    #$400,($FFFFF726).w
    ;        cmpi.w    #$1D60,($FFFFF700).w
    ;        bcs.s    locret2_6E3A
    ;        move.w    #$300,($FFFFF726).w
    ;
    ;locret2_6E3A:
            rts   
    ; ===========================================================================
    
    Resize_FIZ3:
            moveq    #0,d0
            move.b    ($FFFFF742).w,d0
            move.w    off2_6E4A(pc,d0.w),d0
            jmp    off2_6E4A(pc,d0.w)
    ; ===========================================================================
    off2_6E4A:    dc.w Resize_FIZ3main-off2_6E4A
            dc.w Resize_FIZ3boss-off2_6E4A
            dc.w Resize_FIZ3end-off2_6E4A
    ; ===========================================================================
    
    Resize_FIZ3main:
            move.w    #$300,($FFFFF726).w
            cmpi.w    #$380,($FFFFF700).w
            bcs.s    locret2_6E96
            move.w    #$310,($FFFFF726).w
            cmpi.w    #$960,($FFFFF700).w
            bcs.s    locret2_6E96
            cmpi.w    #$280,($FFFFF704).w
            bcs.s    loc2_6E98
            move.w    #$400,($FFFFF726).w
            cmpi.w    #$1380,($FFFFF700).w
            bcc.s    loc2_6E8E
            move.w    #$4C0,($FFFFF726).w
            move.w    #$4C0,($FFFFF72E).w
    
    loc2_6E8E:
            cmpi.w    #$1700,($FFFFF700).w
            bcc.s    loc2_6E98
    
    locret2_6E96:
            rts   
    ; ===========================================================================
    
    loc2_6E98:
            move.w    #$300,($FFFFF726).w
            addq.b    #2,($FFFFF742).w
            rts   
    ; ===========================================================================
    
    Resize_FIZ3boss:
            cmpi.w    #$960,($FFFFF700).w
            bcc.s    loc2_6EB0
            subq.b    #2,($FFFFF742).w
    
    loc2_6EB0:
            cmpi.w    #$2960,($FFFFF700).w
            bcs.s    locret2_6EE8
            bsr.w    SingleObjLoad
            bne.s    loc2_6ED0
            move.b    #$3D,0(a1)    ; load GHZ boss    object
            move.w    #$2A60,8(a1)
            move.w    #$280,$C(a1)
    
    loc2_6ED0:
            move.w    #$8C,d0
            jsr        PlaySound    ; play boss music
            move.b    #1,($FFFFF7AA).w ; lock    screen
            addq.b    #2,($FFFFF742).w
            moveq    #$11,d0
            jmp     LoadPLC        ; load boss patterns
    ; ===========================================================================
    
    locret2_6EE8:
            rts   
    ; ===========================================================================
    
    Resize_FIZ3end:
            move.w    ($FFFFF700).w,($FFFFF728).w
            rts    

    And here is my Obj7F_Loop code:
    Code:
    Obj7F_Loop:
            move.b    #$7F,0(a1)
            move.w    (a2)+,8(a1)    ; set x-position
            move.w    #$F0,$A(a1)    ; set y-position
            lea    ($FFFFFE58).w,a3 ; check which emeralds    you have
            move.b    (a3,d2.w),d3
            move.b    d3,$1A(a1)
            move.b    d3,$1C(a1)
            addq.b    #1,d2
            addq.b    #2,$24(a1)
            move.l    #Map_obj7F,4(a1)
            move.w    #$8541,2(a1)
            move.b    #0,1(a1)
            lea    $40(a1),a1    ; next object
            dbf    d1,Obj7F_Loop    ; loop for d1 number of    emeralds
    As you can see, nothing was wrong..?
     
  18. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    If you don't know what the debugger does, then read its thread. You can't expect us to do all the debugging for you. As the thread clearly states, it examines the stack to determine what called the problematic code: in this case, it was dynscrresizeload. As ProjectFM pointed out, this resulted in data near obj7f_loop being called for some reason, causing the crash. So, look at dynscrresizeload, and make sure it supports the new zone. Whenever you get a crash like this, search the code whose label is printed.

    EDIT: It doesn't matter what obj7f_loop looks like: it shouldn't have been called in the first place.
     
  19. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    I'm probably the guy who ask the most questions here, and i know and i know that is boring for you (and me).
    I'm sorry, i have obviously read the debugger's thread at least 3 times, and i have don't really understand how to: understand how the debugger work, but i know, soon i will!

    So, in Resize_Index, i have the FIZ entry, but how can i load the entry in dynscrresizeload?
    ASM is more difficult for me than other guys, (because my english sucks, first)...
    "d0", "a0", pc, d1 ect....

    I don't even know what they do in the routine.
    It's the first time i add a NEW ZONE in a hack, then ther emust be a first time for everything.
    The tutorial from Sonic Retro is not so complete, otherwise i would have not asked all these questions for two days, sorry.. :(
     
  20. Soldaten

    Soldaten The Coilgun Root Admin

    Joined:
    Mar 10, 2016
    Messages:
    267
    ASM is its own language. Those register names are not a part of the English language so being bad at English isn't an excuse.
     
    Pacca, Painto, ArcaniaCQ and 2 others like this.