您的位置:首页 > 其它

Assembly之instruction之JC

2015-07-27 20:19 591 查看
JC    Jump if carry set
JHS    Jump if higher or same

Syntax   JC  label

      JHS  label

Operation

    If C = 1: PC + 2 × offset −> PC
    If C = 0: execute following instruction

Description

   The status register carry bit (C) is tested. If it is set, the 10-bit signed offset contained in the instruction LSBs is added to the program counter. If C is reset, the next instruction following the jump is executed. JC (jump if carry/higher or same) is used for the comparison of unsigned numbers (0 to 65536).

Status Bits

  Status bits are not affected.

Example

  The P1IN.1 signal is used to define or control the program flow.

BIT #01h,&P1IN   ; State of signal −> Carry
JC PROGA       ; If carry=1 then execute program routine A
......       ; Carry=0, execute program here


Example

   R5 is compared to 15. If the content is higher or the same, branch to LABEL.

CMP #15,R5
JHS LABEL     ; Jump is taken if R5 ≥ 15
......       ; Continue here if R5 < 15
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: