callc - Condition call

callc - Condition call

Calling Format

callc   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

Calls a function conditionally based on the status register values.
The value specified by status0 (or status1) is tested for equality with 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 their respective arguments.
When mode is 1, both status registers must match their respective arguments.
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.
Once code has been executed up to the ret instruction following the label address, execution will return to the address immediately after this instruction. You cannot call a label unless a ret instruction has been set for it.

You can nest call instructions (call, callc, and callb) up to four times. Behavior is undefined if these are nested five or more times.
Behavior is also undefined when a nested call instruction is invoked immediately before a ret instruction.

Operation

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

Code Example

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

subfunction0:
..
ret

Revision History

2011/12/20
Initial version.

CONFIDENTIAL