jpb - Boolean jump

jpc - Condition jump

Calling Format

jpc     status0, status1, mode, label

Operands

Name Description
status0 Value of status register 0 (the value is either 0 or 1).
status1 Value of status register 1 (the value is either 0 or 1).
mode Conditional mode (0: OR, 1: AND, 2: Only status register 0, 3: Only status register 1)
label Label name.

Overview

Causes control to jump conditionally based on the status register values.
The value specified by status0 (or status1) is tested for equality against the value of status register 0 (or 1). When mode is 0, the result is true when either status register 0 or status register 1 matches its respective operand.
When mode is 1, both status registers must match their respective operands.
When mode is 2, status register 0 must match status0.
When mode is 3, status register 1 must match status1.
When the specified condition is true, this instruction causes control to jump to the address of the specified label.
Unlike the call instruction, control does not return at a ret instruction. Also, you can specify labels for which ret instructions have not been set.

An error will result if you jump to an external location from within an if or loop block, or jump from an external location into an if or loop block.
An error also will result if you call this instruction immediately prior to an else, endif, endloop, or ret instruction.
Behavior is undefined if you jump to an external location from between the main and endmain labels, or from within subroutines.
In the same way, jumping to a ret instruction within a subroutine also results in undefined behavior.
Jumping to an else, endif, or endloop instruction has the same effect as jumping to the instruction immediately following that instruction.

Operation

switch ( mode )
{
    case 0 :
        if ( status0 == Status_register0 || status1 == Status_register1 )
            jump to label
        break;
    case 1 :
        if ( status0 == Status_register0 && status1 == Status_register1 )
            jump to label
        break;
    case 2 :
        if ( status0 == Status_register0 )
            jump to label
        break;
    case 3 :
        if ( status1 == Status_register1 )
            jump to label
        break;
}

Code Example

jpc     1, 1, 0, subfunction0  // Call subfunction0 if either status register 0 or status register 1 is 1

subfunction0:
..

Revision History

2011/12/20
Initial version.

CONFIDENTIAL