Basic Questions and Answers Thread

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

  1. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    Yeah, you're trying to use the data registers without actually putting the correct data into them beforehand.
     
  2. Ziro_

    Ziro_ Mentally Skewed Member

    Joined:
    Aug 1, 2016
    Messages:
    59
    Location:
    What are you a cop
    I could of swear put this {move.b ($FFFFF604).w,d2; input to d2}. Thanks that one went over my head.
     
  3. GenesisDoes

    GenesisDoes Wizard of the Sonic Member

    Joined:
    Jan 2, 2016
    Messages:
    134
    Location:
    Pittsburgh, PA
    Is there any way to extend a LEA opcode to point to entries in an array of data bigger than a longword (.l)? I've noticed that as my objpos files grow >~38kb, objpos files near the end of the array either begin not loading in the levels or the game starts executing arbitrary lines of code.

    ObjPos Loading routine in Sonic 1:

    Code:
    ;!@ Warning! This Objpos loading routine pefroms a VERY long jump to to the ObjPos table at ObjPos_Index
    ;Levels begin to not load objpos (and do other weird things such as run arbitrary code)
    ;when the the total size of the objpos files is ~=38kb
    
    OPL_Main:                ; XREF: OPL_Index
            addq.b    #4,(v_opl_routine).w    ; increase OPL routine counter
            move.w    (v_zone).w,d0
            lsl.b    #6,d0
            lsr.w    #4,d0
            lea    (ObjPos_Index).l,a0
            movea.l    a0,a1
            adda.w    (a0,d0.w),a0
            move.l    a0,(v_opl_data).w
            move.l    a0,(v_opl_data+4).w
            move.l    a0,v_objstart
    ;        adda.w    2(a1,d0.w),a1
    ;        move.l    a1,($FFFFF778).w
    ;        move.l    a1,($FFFFF77C).w
            moveq    #0,d0
            lea    v_objstate,a2
            move.l    #(($1000)/4)-1,d1
    @loop:        move.l    d0,(a2)+
            dbf    d1,@loop
            lea    v_objstate,a2
    
    ;=============
    
    ObjPos_Index:
            dc.w ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index
            dc.w ObjPos_GHZ2-ObjPos_Index, ObjPos_Null-ObjPos_Index
            dc.w ObjPos_GHZ3-ObjPos_Index, ObjPos_Null-ObjPos_Index
            dc.w ObjPos_GHZ1-ObjPos_Index, ObjPos_Null-ObjPos_Index
    ;etc
     
  4. AURORA☆FIELDS

    AURORA☆FIELDS the cute one here Member

    Joined:
    Oct 7, 2011
    Messages:
    711
    Location:
    Nathan's arms <3
    uhhhh, see that dc.w ObjPos_GHZ1-ObjPos_Index; it can only get range of so much before you can't address it anymore. You can try to put the objpos files above ObjPos_Index, or change these from dc.w ObjPos_GHZ1-ObjPos_Index to dc.l ObjPos_GHZ1, and change the code to suit this change.
     
    MainMemory likes this.
  5. FireRat

    FireRat Well-Known Member Exiled

    Joined:
    Oct 31, 2009
    Messages:
    544
    Quick question: Is there any known consensus regarding whether can real-hardware z80 access 68k RAM, yes or no?
     
  6. Clownacy

    Clownacy Well-Known Member Staff

    Joined:
    Aug 15, 2014
    Messages:
    888
    My understanding is it can write to 68k RAM, but not read.
     
    vladikcomper and FireRat like this.
  7. B. Comet

    B. Comet Is fun still infinite? Member

    Joined:
    Aug 19, 2016
    Messages:
    83
    Location:
    South America Zone
    Is there a way to make the levels of Sonic 1 longer?
     
  8. Lordsble

    Lordsble Newcomer Trialist

    Joined:
    Oct 30, 2016
    Messages:
    5
    Every time I add a new piece of code into my sonic.asm and build it, the rom always goes away. I can't be that I'm putting in the code wrong, because I made sure it was for the Git disassembly. Maybe it's because my sonic.asm is too big?
     
  9. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    Check out your errors.txt, you've probably either introduced a branch out of range error or made a typo
     
  10. Lordsble

    Lordsble Newcomer Trialist

    Joined:
    Oct 30, 2016
    Messages:
    5
    Your right, but how do you fix a branch out of range?
     
  11. Clownacy

    Clownacy Well-Known Member Staff

    Joined:
    Aug 15, 2014
    Messages:
    888
  12. Lordsble

    Lordsble Newcomer Trialist

    Joined:
    Oct 30, 2016
    Messages:
    5
  13. D.A. Garden

    D.A. Garden & Knuckles Retired Staff

    Joined:
    Aug 6, 2009
    Messages:
    514
    Location:
    England
    So, this is a different set of circumstances I find myself in. I have 2 questions regarding the green glass pillar/piston (Object 30) of Marble Zone:

    1) How would I change the priority of it so that it goes behind the high-priority level tiles? I've done this before, but I can't remember how. It's not too difficult either, if I remember correctly.
    2) Would it be possible to change the height of subtype 04 (The one triggered by a Switch [Object 32]) by 16 pixels? I don't want to touch anything else, such as the distance it moves or whatever; just the object's size.
     
  14. FireRat

    FireRat Well-Known Member Exiled

    Joined:
    Oct 31, 2009
    Messages:
    544
    Depending of your disassembly, you should have either:
    Code:
    move.w    #$C38E,obGfx(aX)
    move.w    #$C38E,2(aX)
    Substract $8000 to it:
    - If level tiles are set to "Low plane", all kind of sprites will be drawn over
    - If level tiles are all set to "High plane", and all the sprites too, all sprites will be drawn over
    - If some level tiles are set to High plane, only sprites marked to "Low plane" will be drawn over these,
    - The seventh (7th) bit of 2(aX) toggles whether the sprite should be drawn on High or Low plane (it inverts the setting from mappings file though).
    The idea here is to unset the 7th bit.

    Now, for changing the solidification's collision radius, it's different than editing the width/height from the table in TouchResponse/ReactToItem. The check is made from the object itself instead, by calling SolidObject routine, which accepts an input like this:

    Code:
    ; input:
    ;    d1 = width
    ;    d2 = height / 2 (when jumping)
    ;    d3 = height / 2 (when walking)
    ;    d4 = x-axis position
    
    Note: Most of the time, d3 equals to d2 + 1

    Just change the width and height according to your subtype just before the call, a possibility can be like this:

    Code:
            move.w    #$2B,d1        ; use normal settings
            move.w    #$38,d2
            move.w    #$39,d3
            cmpi.b    #4,$28(a0)    ; obSubtype
            bne.s    @0        ; if not subtype 04, branch
            move.w    #$YY,d1        ; ...and use different settings
            move.w    #$YY,d2
            move.w    #$YY,d3
    @0:        move.w    8(a0),d4    ; obX
            bra.w    SolidObject
    
    
     
    Last edited: Nov 3, 2016
  15. D.A. Garden

    D.A. Garden & Knuckles Retired Staff

    Joined:
    Aug 6, 2009
    Messages:
    514
    Location:
    England
    Thanks, FireRat. Along with editing the mappings to fit the smaller size, this almost works as intended. I did forget about the 'reflection' object that loads on top, though. I'm trying to get it to move a smaller distance (8 pixels less both up and down respectively) if it's subtype 4. Unfortunately, I don't fully understand how it's loaded or how its movement is set. Once I have that finished though, the object will work as I want it to.
     
    Last edited: Nov 4, 2016
  16. B. Comet

    B. Comet Is fun still infinite? Member

    Joined:
    Aug 19, 2016
    Messages:
    83
    Location:
    South America Zone
    The Movable Block from Marble Zone stopped working on the lava.

    [​IMG]--[​IMG]

    I really don't understand why. How I can fix this?
     
  17. MainMemory

    MainMemory Well-Known Member Member

    Joined:
    Mar 29, 2011
    Messages:
    877
    Did you even place a lava marker object there?
     
  18. Clownacy

    Clownacy Well-Known Member Staff

    Joined:
    Aug 15, 2014
    Messages:
    888
    I ran into a similar problem a few weeks ago. Look for the references to ObjFloorDist in the block's object. After them, you'll see instructions like these:

    Code:
           move.w   (a1),d0
           andi.w   #$3FF,d0
           cmpi.w   #$16A,d0
    What this is doing is checking the ID of the current block the object has landed on. I can tell from your custom background that you've likely rearranged your blocks, meaning the ID has changed. Check the blocks in that chunk, and see what it's changed to.
     
    B. Comet likes this.
  19. B. Comet

    B. Comet Is fun still infinite? Member

    Joined:
    Aug 19, 2016
    Messages:
    83
    Location:
    South America Zone
    How I can make this thing here to work properly?
    [​IMG]

    When I use the object, I always get a Illegal Instrucion saying "zero divide".
     
    A-S-H likes this.
  20. Misinko

    Misinko YOU FOOLS! YOU MESSED WITH THE NATURAL ORDER! Staff

    Joined:
    Apr 30, 2013
    Messages:
    695
    Location:
    Ohio