Basic Questions and Answers Thread

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

  1. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    $300? What? But how?

    How can i set $80 instead of $300? '-'
     
  2. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    The 'writeCRAM' macros, if you're using the Git disasm. The second value's meant to be $80.
     
  3. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Okay i have this in a clean GitHub disassembly:


    Code:
    ; ---------------------------------------------------------------------------
    ; DMA copy data from 68K (ROM/RAM) to the CRAM
    ; input: source, length, destination
    ; ---------------------------------------------------------------------------
    
    writeCRAM:    macro
            lea    (vdp_control_port).l,a5
            move.l    #$94000000+(((\2>>1)&$FF00)<<8)+$9300+((\2>>1)&$FF),(a5)
            move.l    #$96000000+(((\1>>1)&$FF00)<<8)+$9500+((\1>>1)&$FF),(a5)
            move.w    #$9700+((((\1>>1)&$FF0000)>>16)&$7F),(a5)
            move.w    #$C000+(\3&$3FFF),(a5)
            move.w    #$80+((\3&$C000)>>14),(v_vdp_buffer2).w
            move.w    (v_vdp_buffer2).w,(a5)
            endm
    And i have this in my Hivebrain 2005 disassembly:


    Code:
    CramWrtAddr  MACRO
            MOVE.L  #$C0000000|((\1&$3fff)<<16)|((\1>>14)&3),\2
            ENDM
    CalcVramWrtAddrCode MACRO
            move.w  \1,\2          ; Copy for lower 14 bits
            and.l   #$3fff,\2      ; mask
            lsl.l   #8,\2
            lsl.l   #8,\2          ; Shift up
            or.l    #$40000000,\2  ; Set bit that tells VDP it's a VRAM WRITE
            lsr.l   #8,\1
            lsr.l   #6,\1          ; Shift down 14 bits
            and.l   #$3,\1
            or.l    \1,\2          ; and combine
            ENDM
    I don't understand why there is so many differences.
     
  4. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    The reason that there's so many differences is because the macros you posted are for different purposes.
    The first is for setting up a DMA of the palette to CRAM, the other is for calculating a VDP command to manually write the palette to CRAM.
     
    TheInvisibleSun, Clownacy and FireRat like this.
  5. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    I am trying to make a new HUD, having it to read as simple text, taking from a combination of a tutorial here and parts of the level select code
    Code:
    New_Obj21: ;New_Obj21 will contain art_text
      moveq #0,d0
      move.b $24(a0),d0
      move.w New_Obj21_Index(pc,d0.w),d1
      jmp New_Obj21_Index(pc,d1.w)
    ; ===========================================================================
    New_Obj21_Index:
      dc.w New_Obj21_Main-Obj21_Index
      ;dc.w New_Obj21_Flash-Obj21_Index unsure if needed
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Subroutine to HUD text
    ; ---------------------------------------------------------------------------
    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    
    New_Obj21_Main:    ; XREF: LevelSelect
        ; XREF: TitleScreen
      lea (HUDText).l,a1
      lea ($C00000).l,a6
      move.l #$62100003,d4 ; screen position (text)
      move.w #$E680,d3 ; VRAM setting
      moveq #$14,d1  ; number of lines of text
    loc_Over9000:    ; XREF: LevSelTextLoad+26j
      move.l d4,4(a6)
      bsr.w HUD_ChgLine
      addi.l #$800000,d4
      dbf d1,loc_Over9000
      moveq #0,d0
      move.w ($FFFFFF82).w,d0
      move.w d0,d1
      move.l #$62100003,d4
      lsl.w #7,d0
      swap d0
      add.l d0,d4
      lea (HUDText).l,a1
      lsl.w #3,d1
      move.w d1,d0
      add.w d1,d1
      add.w d0,d1
      adda.w d1,a1
      move.w #$C680,d3
      move.l d4,4(a6)
      bsr.w HUD_ChgLine
      move.w #$E680,d3
      cmpi.w #$14,($FFFFFF82).w
      bne.s location_3550
      move.w #$C680,d3
    location_3550:
      move.l #$6C300003,($C00004).l ; screen position (sound test)
      move.w ($FFFFFF84).w,d0
      addi.w #$80,d0
      move.b d0,d2
      lsr.b #4,d0
      bsr.w HUD_ChgSnd
      move.b d2,d0
      bsr.w HUD_ChgSnd
      rts
    ; End of function LevSelTextLoad
    
    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    
    HUD_ChgSnd:    ; XREF: LevSelTextLoad
      andi.w #$F,d0
      cmpi.b #$A,d0
      bcs.s location_3580
      addi.b #4,d0
    location_3580:
      add.w d3,d0
      move.w d0,(a6)
      rts
    ; End of function LevSel_ChgSnd
    
    ; ||||||||||||||| S U B R O U T I N E |||||||||||||||||||||||||||||||||||||||
    
    HUD_ChgLine:    ; XREF: LevSelTextLoad
      moveq #$17,d2  ; number of characters per line
    location_3588:
      moveq #0,d0
      move.b (a1)+,d0
      bpl.s location_3598
      move.w #0,(a6)
      dbf d2,location_3588
      rts
    ; ===========================================================================
    location_3598:    ; XREF: LevSel_ChgLine0
            cmp.w    #$40, d0    ; Check for $40 (End of ASCII number area)
            blt.s        @noText    ; If this is not an ASCII text character, branch
            sub.w    #$3,d0        ; Subtract an extra 3 (Compensate for missing characters in the font)
        @noText:
            sub.w    #$30,d0        ; Subtract #$33 (Convert to S2 font from ASCII)
            add.w    d3,d0        ; combine char with VRAM setting
            move.w    d0,(a6)        ; send to VRAM
            dbf        d2,Location_3588
            rts   ; End of function LevSel_ChgLine
    ; ===========================================================================
    ; ---------------------------------------------------------------------------
    ; Level select menu text (Not yet edited)
    ; ---------------------------------------------------------------------------
    HUDText:   dc.b    "GREEN HILL ZONE  STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "LABYRINTH        STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "MARBLE ZONE      STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "STAR LIGHT ZONE  STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "SPRING YARD ZONE STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "SCRAP BRAIN ZONE STAGE 1"
            dc.b    "                 STAGE 2"
            dc.b    "                 STAGE 3"
            dc.b    "FINAL ZONE              "           
            dc.b    "SPECIAL STAGE           "         
            dc.b    "SOUND TEST              "
               even
    
    but i'm assuming that since Art_text is nowhere in this code, but is in title_clrpalette, since all I need is Art_Text to load, should I add jsr to where art_text loads in title_clrpalette, or copy paste that section alone somewhere?
     
  6. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France

    In fact, I don't remember having changed anything about it.
    I'm looking for $300, $80, find stuff on the internet, compare my Sonic1. asm with a clean file, thanks to Examdiff, I don't know how to fix this problem because I don't know anything about it.
    It's going to sound bloated what I'm going to ask, but can you tell me clearly where I should look, or what I need to fix it?

    I've never faced a problem like this before...

    As i understand, a normal Sonic game is using $20 bytes by palette lines in CRAM (so $80), but my hack just do it to $300 bytes?
    I don't know where to look anyway...
     
  7. AURORA☆FIELDS

    AURORA☆FIELDS so uh yes Exiled

    Joined:
    Oct 7, 2011
    Messages:
    759
    Ok, I am gonna try to answer your question, but without being able to see all the code specifically, and given you have custom macro, it might use different code, but, in Loc_B10 (in hive05, it might also be something like VBlank, Vint, etc.), you should scroll down and see some repeated patterns. Specifically, lines should either reference CRAM, or something that looks vaguely like this:
    Code:
            lea    ($C00004).l,a5
            move.l    #$94009340,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    The bit you are looking for, in this instance, is the 5th line from top, saying "$C000". This line will be right before the last 1 or 2 lines. If you see code that looks like the latter, post it here. Also, you might face code that looks something like:
    Code:
    writeCRAM    v_pal_dry,$80,0
    In this case, the $80 is length, and if its not $80, then this can cause an issue (Probably at the very least corrupts CRAM palette). If you can find neither, try to look for something related and maybe post it here, so we can examine it.

    I am guessing this can be incorrectly or unsafely done mass replace, which just so happens to have changed one of the values to different one, but we can never know until we see the code responsible.
     
  8. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Hello Natsumi, yes there is the same part of code:


    Code:
    lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    It's just different here "move.l #$94019380,(a5)", because it's an help from Markeyjester to add an extra tile to my sprites.

    But for this line: move.w #$80,($FFFFF640).w is the same everywhere in mi hack, so this is why i don't understand.
    Look at a big part of the codes:

    Code:
    loc_B10:                ; XREF: Vectors
            movem.l    d0-a6,-(sp)
            tst.b    ($FFFFF62A).w
            beq.s    VBla_00
            move.w    ($C00004).l,d0
            move.l    #$40000010,($C00004).l
            move.l    ($FFFFF616).w,($C00000).l
            btst    #6,($FFFFFFF8).w
            beq.s    loc_B42
            move.w    #$700,d0
    
    loc_B3E:
            dbf    d0,loc_B3E
    
    loc_B42:
            move.b    ($FFFFF62A).w,d0
            move.b    #0,($FFFFF62A).w
            move.w    #1,($FFFFF644).w
            andi.w    #$3E,d0
            move.w    VBla_Index(pc,d0.w),d0
            jsr    VBla_Index(pc,d0.w)
    
    loc_B5E:                ; XREF: VBla_00
            jsr    sub_71B4C
    
    loc_B64:                ; XREF: loc_D50
            addq.l    #1,($FFFFFE0C).w
            movem.l    (sp)+,d0-a6
            rte
    ; ===========================;VBLA_Index    ================================================
    VBla_Index:     dc.w VBla_00-VBla_Index, VBla_02-VBla_Index
            dc.w VBla_04-VBla_Index, VBla_06-VBla_Index
            dc.w VBla_08-VBla_Index, VBla_0A-VBla_Index
            dc.w VBla_0C-VBla_Index, VBla_0E-VBla_Index
            dc.w VBla_10-VBla_Index, VBla_12-VBla_Index
            dc.w VBla_14-VBla_Index, VBla_16-VBla_Index
            dc.w VBla_0C-VBla_Index
    ; ===========================================================================
    
    VBla_00:                ; XREF: loc_B10; VBla_Index
            cmpi.b    #$8C,($FFFFF600).w
            beq.s    loc_B9A
            cmpi.b    #$C,($FFFFF600).w
            bne.w    loc_B5E
    
    loc_B9A: ;@islevel
            ;cmpi.b #1,($FFFFFE10).w
            ;bne.w loc_B5E
            tst.b    (Water_flag).w
            beq.w    loc_B5E    ; if not, branch
            move.w    ($C00004).l,d0
            btst    #6,($FFFFFFF8).w
            beq.s    loc_BBA
            move.w    #$700,d0
    
    loc_BB6: ; @WaitPal
            dbf    d0,loc_BB6
    
    loc_BBA: ; @NotPal
            move.w    #1,($FFFFF644).w
            move.w    #$100,($A11100).l
    
    loc_BC8:
            btst    #0,($A11100).l
            bne.s    loc_BC8
            tst.b    ($FFFFF64E).w
            bne.s    loc_BFE
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            bra.s    loc_C22
    ; ===========================================================================
    
    loc_BFE:                ; XREF: loc_BC8
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    
    loc_C22:                ; XREF: loc_BC8
            move.w    ($FFFFF624).w,(a5)
            move.w    #0,($A11100).l
            bra.w    loc_B5E
    ; ===========================================================================
    
    VBla_02:                ; XREF: VBla_Index
            bsr.w    sub_106E
    
    VBla_14:                ; XREF: VBla_Index
            tst.w    ($FFFFF614).w
            beq.w    locret_C42
            subq.w    #1,($FFFFF614).w
    
    locret_C42:
            rts
    ; ===========================================================================
    
    VBla_04:                ; XREF: VBla_Index
            bsr.w    sub_106E
            jsr     sub_6886
            bsr.w    sub_1642
            tst.w    ($FFFFF614).w
            beq.w    locret_C5C
            subq.w    #1,($FFFFF614).w
    
    locret_C5C:
            rts
    ; ===========================================================================
    
    VBla_06:                ; XREF: VBla_Index
            bsr.w    sub_106E
            rts
    ; ===========================================================================
    
    VBla_10:                ; XREF: VBla_Index
            cmpi.b    #$10,($FFFFF600).w ; is    game mode = $10    (special stage)    ?
            beq.w    VBla_0A        ; if yes, branch
    
    VBla_08:                ; XREF: VBla_Index
            move.w    #$100,($A11100).l ; stop the Z80
    
    loc_C76:
            btst    #0,($A11100).l    ; has Z80 stopped?
            bne.s    loc_C76        ; if not, branch
            bsr.w    ReadJoypads
            tst.b    ($FFFFF64E).w
            bne.s    loc_CB0
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            bra.s    loc_CD4
    ; ===========================================================================
    
    loc_CB0:                ; XREF: loc_C76
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    
    loc_CD4:                ; XREF: loc_C76
            move.w    ($FFFFF624).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$940193C0,(a5)
            move.l    #$96E69500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7C00,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$94019340,(a5)
            move.l    #$96FC9500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7800,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            jsr    (ProcessDMAQueue).l
    
    loc_D50: ;@nochg
            ;move    #$83,($FFFFF640).w
            ;jsr    Process_DMA
            move.w    #0,($A11100).l
            movem.l    ($FFFFF700).w,d0-d7
            movem.l    d0-d7,($FFFFFF10).w
            movem.l    ($FFFFF754).w,d0-d1
            movem.l    d0-d1,($FFFFFF30).w
            cmpi.b    #$60,($FFFFF625).w
            bcc.s    Demo_Time
            move.b    #1,($FFFFF64F).w
            addq.l    #4,sp
            bra.w    loc_B64 ; VBLA_Exit
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    run a demo for an amount of time
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    Demo_Time:                ; XREF: loc_D50; PalToCRAM
            jsr     LoadTilesAsYouMove
            jsr    AniArt_Load
            jsr    HudUpdate
            bra.w    sub_165E
            tst.w    ($FFFFF614).w    ; is there time    left on    the demo?
            beq.w    Demo_TimeEnd    ; if not, branch
            subq.w    #1,($FFFFF614).w ; subtract 1 from time    left
    
    Demo_TimeEnd:
            rts
    ; End of function Demo_Time
    
    ; ===========================================================================
    
    VBla_0A:                ; XREF: VBla_Index
            move.w    #$100,($A11100).l ; stop the Z80
    
    loc_DAE:
            btst    #0,($A11100).l    ; has Z80 stopped?
            bne.s    loc_DAE        ; if not, branch
            bsr.w    ReadJoypads
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$94019340,(a5)
            move.l    #$96FC9500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7800,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$940193C0,(a5)
            move.l    #$96E69500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7C00,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            move.w    #0,($A11100).l
            jsr     PalCycle_SS
            jsr    (ProcessDMAQueue).l
    
    loc_E64: ; @nochg
            tst.w    ($FFFFF614).w ; v_demolength
            beq.w    locret_E70 ; @end
            subq.w    #1,($FFFFF614).w
    
    locret_E70: ;@end
            rts
    ; ===========================================================================
    
    VBla_0C:                ; XREF: VBla_Index
            move.w    #$100,($A11100).l ; stop the Z80
    
    loc_E7A:
            btst    #0,($A11100).l    ; has Z80 stopped?
            bne.s    loc_E7A        ; if not, branch
            bsr.w    ReadJoypads
            tst.b    ($FFFFF64E).w
            bne.s    loc_EB4
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            bra.s    loc_ED8
    ; ===========================================================================
    
    loc_EB4:                ; XREF: loc_E7A
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    
    loc_ED8:                ; XREF: loc_E7A
            move.w    ($FFFFF624).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$940193C0,(a5)
            move.l    #$96E69500,(a5)
    
    loc_EEE:
            move.w    #$977F,(a5)
            move.w    #$7C00,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$94019340,(a5)
            move.l    #$96FC9500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7800,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            jsr    (ProcessDMAQueue).l
    
    loc_F54:
            move.w    #0,($A11100).l    ; start    the Z80
            movem.l    ($FFFFF700).w,d0-d7
            movem.l    d0-d7,($FFFFFF10).w
            movem.l    ($FFFFF754).w,d0-d1
            movem.l    d0-d1,($FFFFFF30).w
            jsr     LoadTilesAsYouMove
            jsr    AniArt_Load
            jsr    HudUpdate
            bsr.w    sub_1642
            rts
    ; ===========================================================================
    
    VBla_0E:                ; XREF: VBla_Index
            bsr.w    sub_106E
            addq.b    #1,($FFFFF628).w
            move.b    #$E,($FFFFF62A).w
            rts
    ; ===========================================================================
    
    VBla_12:                ; XREF: VBla_Index
            bsr.w    sub_106E
            move.w    ($FFFFF624).w,(a5)
            bra.w    sub_1642
    ; ===========================================================================
    
    VBla_16:                ; XREF: VBla_Index
            move.w    #$100,($A11100).l ; stop the Z80
    
    loc_FAE:
            btst    #0,($A11100).l    ; has Z80 stopped?
            bne.s    loc_FAE        ; if not, branch
            bsr.w    ReadJoypads
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$94019340,(a5)
            move.l    #$96FC9500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7800,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$940193C0,(a5)
            move.l    #$96E69500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7C00,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            move.w    #0,($A11100).l    ; start    the Z80
            jsr    (ProcessDMAQueue).l
    
    loc_1060: ;VBla_16
            tst.w    ($FFFFF614).w
            beq.w    locret_106C
            subq.w    #1,($FFFFF614).w
    
    locret_106C:
            rts
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    sub_106E:                ; XREF: VBla_02; et al
            move.w    #$100,($A11100).l ; stop the Z80
    
    loc_1076:
            btst    #0,($A11100).l    ; has Z80 stopped?
            bne.s    loc_1076    ; if not, branch
            bsr.w    ReadJoypads
            tst.b    ($FFFFF64E).w
            bne.s    loc_10B0
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9580,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            bra.s    loc_10D4
    ; ===========================================================================
    
    loc_10B0:                ; XREF: sub_106E
            lea    ($C00004).l,a5
            move.l    #$94019380,(a5)
            move.l    #$96FD9540,(a5)
            move.w    #$977F,(a5)
            move.w    #$C000,(a5)
            move.w    #$80,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
    
    loc_10D4:                ; XREF: sub_106E
            lea    ($C00004).l,a5
            move.l    #$94019340,(a5)
            move.l    #$96FC9500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7800,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            lea    ($C00004).l,a5
            move.l    #$940193C0,(a5)
            move.l    #$96E69500,(a5)
            move.w    #$977F,(a5)
            move.w    #$7C00,(a5)
            move.w    #$83,($FFFFF640).w
            move.w    ($FFFFF640).w,(a5)
            move.w    #0,($A11100).l    ; start    the Z80
            rts
    ; End of function sub_106E
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    move pallets from the RAM to CRAM
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    PalToCRAM:
            move    #$2700,sr
            tst.w    ($FFFFF644).w
            beq.s    locret_119C
            move.w    #0,($FFFFF644).w
            movem.l    a0-a1,-(sp)
            lea    ($C00000).l,a1
            lea    ($FFFFFA80).w,a0 ; load    pallet from RAM
            move.l    #$C0000000,4(a1) ; set VDP to CRAM write
            move.l    (a0)+,(a1)    ; move pallet to CRAM
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.l    (a0)+,(a1)
            move.w    #$8ADF,4(a1)
            movem.l    (sp)+,a0-a1
            tst.b    ($FFFFF64F).w
            bne.s    loc_119E
    
    locret_119C:
            rte
    ; ===========================================================================
    
    loc_119E:                ; XREF: PalToCRAM
            clr.b    ($FFFFF64F).w
            movem.l    d0-a6,-(sp)
            bsr.w    Demo_Time
            jsr    sub_71B4C
            movem.l    (sp)+,d0-a6
            rte
    ; End of function PalToCRAM
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    initialise joypads
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    JoypadInit:                ; XREF: GameClrRAM
            move.w    #$100,($A11100).l ; stop the Z80
    
    Joypad_WaitZ80:
            btst    #0,($A11100).l    ; has the Z80 stopped?
            bne.s    Joypad_WaitZ80    ; if not, branch
            moveq    #$40,d0
            move.b    d0,($A10009).l    ; init port 1 (joypad 1)
            move.b    d0,($A1000B).l    ; init port 2 (joypad 2)
            move.b    d0,($A1000D).l    ; init port 3 (extra)
            move.w    #0,($A11100).l    ; start    the Z80
            rts
    ; End of function JoypadInit
    
    ; ---------------------------------------------------------------------------
    ; Subroutine to    read joypad input, and send it to the RAM
    ; ---------------------------------------------------------------------------
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    ReadJoypads:
            lea    ($FFFFF604).w,a0 ; address where joypad    states are written
            lea    ($A10003).l,a1    ; first    joypad port
            bsr.s    Joypad_Read    ; do the first joypad
            addq.w    #2,a1        ; do the second    joypad
    
    Joypad_Read:
            move.b    #0,(a1)
            nop
            nop
            move.b    (a1),d0
            lsl.b    #2,d0
            andi.b    #$C0,d0
            move.b    #$40,(a1)
            nop
            nop
            move.b    (a1),d1
            andi.b    #$3F,d1
            or.b    d1,d0
            not.b    d0
            move.b    (a0),d1
            eor.b    d0,d1
            move.b    d0,(a0)+
            and.b    d0,d1
            move.b    d1,(a0)+
            rts
    ; End of function ReadJoypads
    
    
    ; ||||||||||||||| S U B    R O U T    I N E |||||||||||||||||||||||||||||||||||||||
    
    
    VDPSetupGame:                ; XREF: GameClrRAM; ChecksumError
            lea    ($C00004).l,a0
            lea    ($C00000).l,a1
            lea    (VDPSetupArray).l,a2
            moveq    #$12,d7
    
    VDP_Loop:
            move.w    (a2)+,(a0)
            dbf    d7,VDP_Loop    ; set the VDP registers
    
            move.w    (VDPSetupArray+2).l,d0
            move.w    d0,($FFFFF60C).w
            move.w    #$8ADF,($FFFFF624).w
            moveq    #0,d0
            move.l    #$C0000000,($C00004).l ; set VDP to CRAM write
            move.w    #$3F,d7
    
    VDP_ClrCRAM:
            move.w    d0,(a1)
            dbf    d7,VDP_ClrCRAM    ; clear    the CRAM
    
            clr.l    ($FFFFF616).w
            clr.l    ($FFFFF61A).w
            move.l    d1,-(sp)
            lea    ($C00004).l,a5
            move.w    #$8F01,(a5)
            move.l    #$94FF93FF,(a5)
            move.w    #$9780,(a5)
            move.l    #$40000080,(a5)
            move.w    #0,($C00000).l    ; clear    the screen
    
    loc_128E:
            move.w    (a5),d1
            btst    #1,d1
            bne.s    loc_128E
    
            move.w    #$8F02,(a5)
            move.l    (sp)+,d1
            rts
    ; End of function VDPSetupGame
    
    ; ===========================================================================
    VDPSetupArray:    dc.w $8004, $8134, $8230, $8328    ; XREF: VDPSetupGame
            dc.w $8407, $857C, $8600, $8700
            dc.w $8800, $8900, $8A00, $8B00
            dc.w $8C81, $8D3F, $8E00, $8F02
            dc.w $9001, $9100, $9200


    Sorry for the big spoiler but i don't know what to show exactly, but as you can see, i don't see any problem..
     
  9. warr1or2

    warr1or2 I AM CLG Member

    Joined:
    Apr 7, 2008
    Messages:
    416
    Location:
    Town Creek, AL
    it ain't against site rules to create a forum for updates of a hack, no release, as long as I have pictures and video?
     
  10. Lord_Claudius

    Lord_Claudius Newcomer Trialist

    Joined:
    Oct 26, 2017
    Messages:
    1
    Location:
    America
    Does anyone know of a mod for the steam version of SA2B that replaces dark chao walker with big the cat in eggman's walker from the dreamcast version? Many thanks.
     
  11. Clownacy

    Clownacy Retired Staff lolololo Member

    Joined:
    Aug 15, 2014
    Messages:
    1,016
    I think that question's more suited for the Suggestions & Feedback subforum, rather than this one. Regardless, if this thread's allowed to exist, I think you have nothing to worry about.
     
  12. Soldaten

    Soldaten The Coilgun Root Admin

    Joined:
    Mar 10, 2016
    Messages:
    267
    All the hacks that are posted on this site work in this manner? You've been here since 2008, don't know how this is a question...

    EDIT- Slight ninja by Clowny.
     
  13. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    922
    That's not possible currently. The best I can give you is replacing Mech Eggman with Big.
     
  14. LazloPsylus

    LazloPsylus The Railgun Member

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    Looking at the DMA code you just showed us, there's a pretty notable issue present here. However, I'd rather show you what the code actually does so that it's clear what the issue is...

    Code:
            lea         ($C00004).l,a5          ; Load VDP control register into a5
            move.l      #$94019380,(a5)         ; Set DMA length to $180
            move.l      #$96FD9540,(a5)         ; Set lower 16 bits of source to $FD40
            move.w      #$977F,(a5)             ; Set upper 8 bits of source to $7F
                                                ; Result: $7FFD40 * 2 = $FFFA80
            move.w      #$C000,(a5)             ; Write first part of destination
            move.w      #$80,($FFFFF640).w      ; Set up the second part
            move.w      ($FFFFF640).w,(a5)      ; Write second part
                                                ; Result: 011, CRAM
                                                ; Location: $0000
    
    So, with all that annotation, it should be pretty clear what's wrong. You're writing a DMA that's six times the size of the CRAM. You're writing garbage data over your palettes. Kega very likely does not allow overwriting like that to the CRAM, preventing the behavior from showing itself in that emulator. If CRAM is handled properly, though, such as hardware or in an emulator that handles it as expected, well, you've seen the result.

    The modification you've made here is not loading extra tiles, it's dumping way too much data to CRAM. That $94019380 needs to be reverted to $94009340 so that the CRAM DMA correctly is restricted to the CRAM size.

    ~E~: Oops, calculation's slightly off. Corrected the DMA length.
     
    Last edited: Nov 22, 2017
  15. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
  16. LazloPsylus

    LazloPsylus The Railgun Member

    Joined:
    Nov 25, 2009
    Messages:
    Location:
    Academy City
    No problem. One of the most important things about this hobby is understanding what's going on behind the scenes. Just copying and pasting without understanding can lead to issues later on. In this case, you seem to have not fully understood Markey's instructions, and applied the DMA queue expansion to a routine responsible for writing to the CRAM, which has nothing to do with tiles. Now that you understand how the DMA works a bit more, you won't repeat that, eh?
     
    Ashuro likes this.
  17. Ziro_

    Ziro_ Mentally Skewed Member

    Joined:
    Aug 1, 2016
    Messages:
    59
    Location:
    What are you a cop
    How can I move the camera horizontally. I have tried messing with ScrollHoriz2 and couldn't get any results that were not the camera freaking out.
     
  18. Ashuro

    Ashuro Anti-Cosmic Metal Of Death Member

    Joined:
    Sep 27, 2014
    Messages:
    550
    Location:
    France
    Sure. thank you very much x)
     
  19. Pacca

    Pacca Having an online identity crisis since 2019 Member

    Joined:
    Jul 5, 2014
    Messages:
    1,175
    Location:
    Limbo
    I decided to try and use some music from the Simon Wai Prototype with the Clone Driver v2, so I grabbed the SuperEgg disassembly from the Disassemblies page on Sonic Retro. Based on a comment by Clownacy in this basic Q&A page, I was under the impression that SMPS2ASM would easily convert the Sonic 2 Beta music into ASM form. However, this outputted a blank skeleton file with no actual music data, with duplicate labels as well, so I couldn't even attempt to compile it.

    I tried to just convert final Sonic 2 music as well; taking the raw file from the disassembly (which I believe is Saxman compressed) understandably gave an error and spit out gibberish. After uncompressing it, it had no error, but still spat out a useless file with no music data. Here is the command I'm using:
    Code:
    smps2asm.exe -v 2 "SimonWaiHPZ.bin" "songbeta.asm" HiddenPalace_SimonWai
    smps2asm.exe -v 2 "MCZ_2p.bin" "song2.asm" HiddenPalace_Final
    smps2asm.exe -v 2 "MCZ_2p_decompressed.bin" "song2_decomp.asm" HiddenPalace_Final
    and here are the output files for the beta and the uncompressed Sonic 2 final music.

    Am I doing something wrong? I've never had to convert Sonic 2 music before. Maybe I'm using an old version? I don't remember where I got this copy of SMPS2ASM, all I know is that it converts Sonic 1 music just fine :confused:
     
  20. ProjectFM

    ProjectFM Optimistic and self-dependent Member

    Joined:
    Oct 4, 2014
    Messages:
    912
    Location:
    Orono, Maine
    You should try using Music Pointer Fixer to port it to Sonic 1 or 3's format and go from there.