Monitor error

Discussion in 'Discussion and Q&A Archive' started by JackyFarron, Jul 6, 2009.

Thread Status:
Not open for further replies.
  1. JackyFarron

    JackyFarron Ah, it suits you! Member

    Joined:
    Mar 19, 2009
    Messages:
    27
    Location:
    $10000
    I have created a monitor that is capable of substract 10 rings. I have tried to put in the ASM that when Sonic has 1-9 rings, substract these 1-9 rings and when Sonic has 0 rings, he lose a life.


    But instead of that, substract rings, going out a blot in the ring counter and, simultaneously, Sonic lose a life.


    What might it to do?


    This is everything what I have done:




    Obj2E_ChkMinus:


    cmpi.b #8,d0 ; does monitor contain 10 Minus rings?


    bne.w Obj2E_ChkEnd


    cmpi.w #10,($FFFFFE20).w ; check if you have 10 or more rings


    beq.s MinusEffect_More10rings


    cmpi.w #1,($FFFFFE20).w ; check if you have 1 rings


    beq.s MinusEffect_1ring


    cmpi.w #2,($FFFFFE20).w ; check if you have 2 rings


    beq.s MinusEffect_2ring


    cmpi.w #3,($FFFFFE20).w ; check if you have 3 rings


    beq.s MinusEffect_3ring


    cmpi.w #4,($FFFFFE20).w ; check if you have 4 rings


    beq.s MinusEffect_4ring


    cmpi.w #5,($FFFFFE20).w ; check if you have 5 rings


    beq.s MinusEffect_5ring


    cmpi.w #6,($FFFFFE20).w ; check if you have 6 rings


    beq.w MinusEffect_6ring


    cmpi.w #7,($FFFFFE20).w ; check if you have 7 rings


    beq.w MinusEffect_7ring


    cmpi.w #8,($FFFFFE20).w ; check if you have 8 rings


    beq.w MinusEffect_8ring


    cmpi.w #9,($FFFFFE20).w ; check if you have 9 rings


    beq.w MinusEffect_9ring


    cmpi.w #0,($FFFFFE20).w ; check if you have 0 rings


    beq.w MinusKill


    MinusEffect_More10rings:


    bcs.w Obj2E_MinusRingSFX


    subi.w #$A,($FFFFFE20).w ; substract 10 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_1ring:


    bcs.w Obj2E_MinusRingSFX


    subi.w #$1,($FFFFFE20).w ; substract 1 ring


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_2ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$2,($FFFFFE20).w ; substract 2 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_3ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$3,($FFFFFE20).w ; substract 3 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_4ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$4,($FFFFFE20).w ; substract 4 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_5ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$5,($FFFFFE20).w ; substract 5 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_6ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$6,($FFFFFE20).w ; substract 6 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_7ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$7,($FFFFFE20).w ; substract 7 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_8ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$8,($FFFFFE20).w ; substract 8 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusEffect_9ring:


    bcs.s Obj2E_MinusRingSFX


    subi.w #$9,($FFFFFE20).w ; substract 9 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    MinusKill:


    bcs.s Obj2E_MinusRingSFX


    lea ($FFFFD000).w,a0


    jsr KillSonic


    Obj2E_MinusRingSFX:


    move.w #$A6,d0


    jmp (PlaySound).l ; play Minus ring SFX



    Thanks for any help.
     
  2. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    First off, I reduced the code. Maybe you've never heard about ble and bge. Secondly, you made something wierd with the killing code... anyway, here is my version. I haven't tested it, but I think it'll work:



    Obj2E_ChkMinus:
    cmpi.b #8,d0 ; does monitor contain 10 Minus rings?


    bne.w Obj2E_ChkEnd


    cmpi.w #10,($FFFFFE20).w ; check if you have 10 or more rings


    bge.s MinusEffect_More10rings


    cmpi.w #9,($FFFFFE20).w ; check if you have 9 or less rings


    ble.s MinusEffect_9ring


    cmpi.w #0,($FFFFFE20).w ; check if you have 0 rings


    beq.s MinusKill


    MinusEffect_More10rings:


    subi.w #10,($FFFFFE20).w ; substract 10 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    bra.s MinusKill_Sound ; skip everything and play the sound


    MinusEffect_9ring:


    clr.w ($FFFFFE20).w ; remove all rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    bra.s MinusKill_Sound ; skip everything and play the sound


    MinusKill:


    jmp Obj36_Hurt ; hurt sonic with the spikes hurting code. Because he has no rings, he will die anyway


    MinusKill_Sound:


    move.w #$A6,d0


    jmp (PlaySound).l ; play Minus ring SFX
     
  3. JackyFarron

    JackyFarron Ah, it suits you! Member

    Joined:
    Mar 19, 2009
    Messages:
    27
    Location:
    $10000
    Cool idea. I was thinking in remove some code, but not a mode of replace with another thing.

    This is the first time I hear about ble and bge.

    Works, but partially. When Sonic has (insert number here) rings, 10 or less rings are substracted, but MinusKill doesn't work.


    Anyway, I'll give to you 1 point :)
     
  4. Selbi

    Selbi The Euphonic Mess Member

    Joined:
    Jul 20, 2008
    Messages:
    2,429
    Location:
    Northern Germany
    Woops, I've confused the order of the ring checks. The 0 rings check has to be at first:



    Obj2E_ChkMinus:
    cmpi.b #4,d0 ; does monitor contain 10 Minus rings?


    bne.w Obj2E_ChkEnd


    cmpi.w #0,($FFFFFE20).w ; check if you have 0 rings


    beq.s MinusKill


    cmpi.w #10,($FFFFFE20).w ; check if you have 10 or more rings


    bge.s MinusEffect_More10rings


    cmpi.w #9,($FFFFFE20).w ; check if you have 9 or less rings


    ble.s MinusEffect_9ring


    MinusEffect_More10rings:


    subi.w #10,($FFFFFE20).w ; substract 10 rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    bra.s MinusKill_Sound ; skip everything and play the sound


    MinusEffect_9ring:


    clr.w ($FFFFFE20).w ; remove all rings


    ori.b #1,($FFFFFE1D).w ; update the ring counter


    bra.s MinusKill_Sound ; skip everything and play the sound


    MinusKill:


    clr.w ($FFFFFE20).w ; remove all rings


    jmp Obj36_Hurt ; hurt sonic with the spikes hurting code. Because he has no rings, he will die anyway


    MinusKill_Sound:


    move.w #$A6,d0


    jmp (PlaySound).l ; play Minus ring SFX



    This should work now.
     
  5. JackyFarron

    JackyFarron Ah, it suits you! Member

    Joined:
    Mar 19, 2009
    Messages:
    27
    Location:
    $10000
    And definitively: Works!


    Thanks for the whole help, Selbi! :)
     
Thread Status:
Not open for further replies.