Intranet Catprocess
  1. news...
  2. about Blackvoxel
  3. download
  4. manual
  5. videos
  6. about us
  1. Bxx - Conditionnal jumps

    Affected Flags
    C V N Z
     
       

    bxx : branch if xx condition is meet

    Conditional jump instructions change the processor execution flow when conditions are meet. The conditions depends on the status flags which reflects the result of the last instruction affecting flags. So, the conditional instructions will react depending on the result of the last instruction. All these branch instructions uses relative jump coded in 16 bits format. So, these can be used to jump to a location from -32768 to +32767 from the instruction located after the jump instruction. The relative jump mean your code can be relocated without problems. Use jmp if you want to jump to a more distant destination.

    Forms and variants 

    Form Effect
    beq #label
    Branch if equal(z=1)
    bne #label
    Branch if not equal (z=0)
    bcc #label
    Branch if carry clear (c=0)
    bcs #label Branch if carry set (c=1)
    bvc #label Branch if overflow clear (v=0)
    bvs #label Branch if overflow set (v=0)
    bpl #label Branch if negative clear(n=1)
    bmi #label
    Branch if negative set (n=0)
    bhi #label
    Branch if higher (C=1, Z=0)
    bhs #label
    Branch if higher or same (C=1, same as bcs)
    bls #label
    Branch if lower or same (C=0 && Z=1)
    blo #label
    Branch if lower ( c=0, same as bcc )
    bhi.s #label
    Signed Branch if higher ( z=0 && n==v)
    bhs.s #label
    Signed Branch if higher or same (n==v)
    bls.s #label
    Signed Branch if lower or same (z==1 && n!=v)
    blo.s #label
    Signed Branch if lower (n!=v)
    bso #label Branch if shift overflow (c!=n)
    bra #label Branch in all cases

    Instruction encoding

    S = Number of the register containing shift count
    D = Shifted register number
    Instruction Op
    Code
    Cycles Encoding
    beq #16BitsSignedValue 1C 8 00011100 IIIIIIII IIIIIIII
    bne #16BitsSignedValue 1D 8 00011101 IIIIIIII IIIIIIII
    bcc #16BitsSignedValue 5E 8 01011110 IIIIIIII IIIIIIII
    bcs #16BitsSignedValue 5F 8 01011111 IIIIIIII IIIIIIII
    bvc #16BitsSignedValue 5C 8 01011100 IIIIIIII IIIIIIII
    bvs #16BitsSignedValue 5D 8 01011101 IIIIIIII IIIIIIII
    bmi #16BitsSignedValue 1F 8 00011111 IIIIIIII IIIIIIII
    bpl #16BitsSignedValue 1E 8 00011110 IIIIIIII IIIIIIII
    bhi #16BitsSignedValue 9C 8 10011100 IIIIIIII IIIIIIII
    bhs #16BitsSignedValue 9D 8 10011101 IIIIIIII IIIIIIII
    bls #16BitsSignedValue 9E 8 10011110 IIIIIIII IIIIIIII
    blo #16BitsSignedValue 9F 8 10011111 IIIIIIII IIIIIIII
    bhi.s #16BitsSignedValue DC 8 11011100 IIIIIIII IIIIIIII
    bhs.s #16BitsSignedValue DD 8 11011101 IIIIIIII IIIIIIII
    bls.s #16BitsSignedValue DE 8 11011110 IIIIIIII IIIIIIII
    blo.s #16BitsSignedValue DF 8 11011111 IIIIIIII IIIIIIII
    bso #16BitsSignedValue 20 8 00100000 IIIIIIII IIIIIIII
    bra #16BitsSignedValue 60 8 01100000 IIIIIIII IIIIIIII

    Code Examples

     

    // Example : Todo...

     
  2. Google+