Programming

Appendix A

Equals Flag

The Equals Flag is a temporary flag for all instructions except when comparison results are equal (=). It is set automatically by the system, and it will change. The Equals Flag can be turned OFF (ON) by an instruction after a previous instruction has turned it ON (OFF). The Equals Flag will turn ON, for example, when MOV or another move instruction moves 0000 hex as source data and will be OFF at all other times. Even if an instruc- tion turns the Equals Flag ON, the move instruction will execute immediately and the Equals Flag will turn ON or OFF depending on whether the source data for the move instruction is 0000 hex or not.

Carry Flag

The CY Flag is used in shift instructions, addition and subtraction instructions with carry input, and addition and subtraction instructions with borrows and carries. Note the following precautions.

1.The CY Flag can remain ON (OFF) because of execution results for a certain instruction and then be used in other instruction (an addition and subtraction instruction with carry or a shift instruction). Be sure to clear the Carry Flag when necessary.

2.The CY Flag can be turned ON (OFF) by the execution results for a certain instruction and be turned OFF (ON) by another instruction. Be sure the proper results are reflected in the Carry Flag when using it.

Less Than and Greater Than Flags

The < and > Flags are used in comparison instructions.

The < or > Flag can be turned OFF (ON) by another instruction even if it is turned ON (OFF) by execution results for a certain instruction.

Negative Flag

The N Flag is turned OFF when the leftmost bit of the instruction execution results word is “1” for certain instructions and it is turned OFF unconditionally for other instruction.

Specifying Operands for Multiple Words

An instruction will be executed as written even if an operand requiring multiple words is specified so that all of the words for the operand are not in the same area. In this case, words will be taken in order of the memory addresses. The Error Flag will not turn ON.

As an example, consider the results of executing a block transfer with XFER(070) if 20 words are specified for transfer beginning with W250. Here, the Work Area, which ends at W255, will be exceeded, but the instruction will be executed without turning ON the Error Flag. In the memory addresses, words reserved by the system come after the Work Area, and thus for the following instruction, W250 to W255 will be transferred to D00000 to D00005 and contents of the system-reserved words will be transferred to D00006 to D00019.

 

 

W250

XFER

 

 

to

 

 

&20

Number of words

W255

 

 

---------

 

 

W250

First source word

Reserved

 

 

by system

D00000

First destination word

 

 

 

 

D00000

Trans-

ferred. to

D00005 D00006

to D00019

285

Page 308
Image 308
Omron FQM1-MMP21, FQM1-CM001, FQM1-MMA21 Equals Flag, Carry Flag, Less Than and Greater Than Flags, Negative Flag