checkpoint monitor

Discussion in 'Discussion and Q&A Archive' started by liamsonichacker, Jul 6, 2010.

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

    liamsonichacker Mad Level Skillz ;) Member

    Joined:
    May 29, 2009
    Messages:
    50
    Location:
    Leicester, UK
    I am trying to make a monitor that acts like a checkpoint, but when I do so, all it does it take my rings, any help here, this is my code, I am very new to this so yes I aint exactly smart with asm.



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    jmp Cont_GotoLevel ; start from monitor


    jmp (playsound).l



    thanks for your help in advance.
     
    Last edited by a moderator: Jul 6, 2010
  2. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    "Good evening ladies and gentlemen to another night of the "Jester Show", tonight my guests are beq, bne, blt, ble, bgt and bge."


    I would suggest you search google for an MC68000 programmers manual, it's very helpful to have one around if you get stuck in a situation like this one. Try some of the below...


    beq (branch if equal)


    If 07 is in d0, it will branch, if it is not 07, it will not branch and will continue as normal.




    cmp.b #$07,d0 ; is 07 in d0?


    beq.s Cont_GotoLevel ; if so, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    bne (branch if not equal)


    If 07 is NOT in d0, it will branch, if it is infact 07, it will not branch.




    cmp.b #$07,d0 ; is 07 in d0?


    bne.s Cont_GotoLevel ; if not, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    blt (branch if lower than)


    If d0 is lower than 07 (if it's 06 or 05, etc), it will branch, if it is 07 or higher, it will not branch.




    cmp.b #$07,d0 ; is there a value lower than 07 in d0?


    blt.s Cont_GotoLevel ; if so, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    ble (branch if lower or equal to)


    If d0 is 07 or lower, it will branch, if it is higher that 07 (i.e. 08, 09, etc), it will not branch.




    cmp.b #$07,d0 ; is there a value 07 or lower in d0?


    ble.s Cont_GotoLevel ; if so, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    bgt (branch if greater than)


    If d0 is higher than 07 (i.e. 08, 09, etc), it will branch, if it is 07 or lower, it will not branch.




    cmp.b #$07,d0 ; is there a value higher than 07 in d0?


    bgt.s Cont_GotoLevel ; if so, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    bge (branch if greater or equal to)


    If d0 is 07 or higher, then it will branch, if it is lower than 07 (06, 05, 04, etc), it will not branch.




    cmp.b #$07,d0 ; is there a value 07 or higher in d0?


    bge.s Cont_GotoLevel ; if so, branch to "Cont_GotoLevel"


    ; otherwise, continue down



    "...and that's all we got time for folks, next week we'll be meeting bpl, bmi, bcc and bcs, goodnight everyone!"
     
    Last edited by a moderator: Jul 6, 2010
  3. DanielHall

    DanielHall Well-Known Member Member

    Joined:
    Jan 18, 2010
    Messages:
    860
    Location:
    North Wales
    I've bumped into instances like this though:



    cmpi.w 1F,$1C (d0) ; is blah blah blah
    beq.s HellNaw ; if not, branch



    So, just be careful. :\
     
  4. IWasAPerson

    IWasAPerson Part Of This Complete Breakfast Member

    Joined:
    Aug 18, 2008
    Messages:
    22
    I hope the Jester Show becomes a regular segment. Seriously. Just throwing it out there, though...


    That being said, the Helpful Links sticky actually has a 68k programmer's manual, as well as the actual Motorola 68k documentation. You should really read these so you don't have to ask these questions.


    Also, I doubt that the second part of your code is useful. I don't know the surrounding code, but I am not so sure it matters.



    Obj2E_ChkS:
    cmpi.b #7,d0 ; does monitor contain 'S'


    jmp Cont_GotoLevel ; start from monitor


    jmp (playsound).l



    Where you have the jump to playsound, it won't do anything because (assuming you fix your Cont_GotoLevel branch), you have not specified a sound in d0 and sound #7 will be played, meaning nothing will be played. You'll want to specify a sound in d0 (by moving a sound number to d0) if you want one played.


    Dandaman, the reason for the opposite branch that you're talking about is usually used for the tst function, most often with RAM flags. It is also used for when something is tested for being equal to 0 and has to do with flags usually. Here's an example:



    tst.b ($FFFFFFFB).w ; Is the character move flag on?
    beq.s DoStuff ; if not, branch



    Obviously I'm just using that RAM address as an example, but the tst function checks to see if something is equal to the value 0. I've seen instances of it being used on values not equal to 0, the branch works because the flag is not on and is equal to 0. It is really awkward to explain, but I hope I made some sense.
     
Thread Status:
Not open for further replies.