8031 CJNE Instruction

Can I do this: (8031 Assembly)

SWITCH EQU P3; Equate port 3 to SWITCH
.
.
.
CJNE RO, #SWITCH, LABEL

It is the #SWITCH part of the CJNE instruction I am not sure about, because I am comparing a register (R0) with a port (P3). Will this work, or am I limited to comparing a register with an immediate value such as #255.

Thanks

Joe

Comments

  • : Can I do this: (8031 Assembly)
    :
    : SWITCH EQU P3; Equate port 3 to SWITCH
    : .
    : .
    : .
    : CJNE RO, #SWITCH, LABEL
    :
    : It is the #SWITCH part of the CJNE instruction I am not sure about, because I am comparing a register (R0) with a port (P3). Will this work, or am I limited to comparing a register with an immediate value such as #255.
    :
    : Thanks
    :
    : Joe
    :
    :
    The correct form for direct addressing is:

    CJNE A,P3,LABEL

    but the compare value must be in the accumulator, not R0.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion