• Keine Ergebnisse gefunden

BOZ BDNZ

Im Dokument Ultimate THE (Seite 174-179)

Syntax

Description

4-26

The BDZ (branch decrementing if zero) and BDNZ (branch decrementing if not zero) instructions decrement a relatively addressed operand and then compare it to zero. BDZ decrements, then tests and transfers control if the resultant value is zero. BDNZ decrements, then tests and transfers control if the value is not zero.

BDZd,1 BDNZ d,l n numeric literal t tallies

the label (in the current frame) of the branch destination if the result of the test is true

If operand 1 is a tally or double tally, operand 2 may be a numeric literal (n); the literal assembles as the same symbol type as operand 1.

These instructions take the place of a DECrement followed by a conditional branch instruction, and are usually used in loop controls.

If only one operand is specified, the value at the effective address is decremented by one (1). If two operands are specified, the value at the effective address of operand 2 is subtracted from the value at the address of operand 1. Then the specified condition is tested and, if true, the branch is taken.

Assembly Manual 6973-1

MOV 100,CTRl Set loop counter for 100 iterations

REPEAT EQU * Start of loop

BDNZ CTRl,REPEAT

Note that the body of the loop executes at least once with this logic.

Compare this to the example shown for BDHZ.

BE BU

Syntax

Description

4-28

The BE (branch equal) instruction compares two relatively addressed operands or virtual addresses and branches to a local label if the operand values are equal. The BU (branch unequal) instruction compares and branches if the values are not equal.

BE d,d,1 BU d,d,1 n numeric literal t tally

the label (in the current frame) of the branch destination if the result of the test is true

If the operands are tally-types, they must be of the same length, that is, one byte (type H), two bytes (type T), four bytes (type D) or six bytes (type F).

If one operand is a tally or double tally, the other operand may be a literal (n); the literal assembles as the same symbol type as the relatively addressed operand.

BE and BU compare two values of the same length or symbol type and use the to determine program action. If a 1-byte or 6-byte literal or constant value needs to be compared, it must be defined as a symbol

Assembly Manual 6973-1

' .

1/'

,

"

.J

using an HTLY or DEFH directive (I-byte value), or an FfL Y or DEFF directive (6-byte value).

If the register fonnat is used, the virtual address in any storage register operands must be nonnalized prior to executing the BE/BU instruction;

see the FAR instruction for more infonnation.

For BE instructions, the fIrst referenced operand is compared to the second referenced operand, and if their arithmetic values are equal, then program control transfers to the specifIed local label. If the values are not equal, then execution continues with the next sequential instruction.

For BU instructions, the referenced operands are compared, and if the values are not equal, then program control transfers. If the values are equal, then execution continues with the next instruction.

Note: When testing registers, this test/or "equal or unequal" is the only option. There is no way to test which register is "less than" or "higher than" the other. When testing tally-type operands, however, alternative tests are possible; see the BH,

BHE, BL, and BLE instructions.

If a tally-type operand is to be compared with a literal or constant (n) value of zero, it is more effIcient and clearer to use another instruction that is designed for comparisons with zero (such as BZ, BNZ, or BHZ);

for example, use

BZ CTR1,QUIT

rather than

BE CTR1,O,QUIT

Note that half tally and triple tally symbols (types hand f) cannot be tested directly against a constant or literal (type n). There are two ways to handle this condition:

• Use an SRA instruction to set an address register to point to the h or f type symbol; for example:

SRA R15,H7 BCE R15,lO,OK

set R15 pointing to h symbol

4-30

• Define the constant or literal as a half tally or triple tally in the program; for example:

FLIT FTLY O,X'F23AB3FC' Define a constant of type F

BE FPO,FLIT,OK

BE R14,R15,LABLl BU R14,R15,LABLl BU SR5,R15,LABLl BE R15,SR5,LABLl BU DO,Dl,LABLl BE DO,Dl,LABLl BU FPO,FP1,LABLl BE FPO,FP1,LABLl BU H8,H9,LABLl BE H8,H9,LABLl BU TO,T4,LABLl BE TO,T4,LABLl LABLl EQU *

Assembly Manual 6973-1

\ .

" ... ,/-1

/ '

'~o;,~ "",I

/1'-~j

(

The BH (branch higher) instruction compares one specified tally-type operand against another and branches to a local label if the value of the first operand is greater than the second. BHE (branch higher/equal) compares and branches if the first value is greater than or equal to the second.

The BL (branch lower) instruction compares one specified operand against another and branches to a local label if the value of the first character is less than that of the second. BLE (branch lower/equal) compares and branches if the value is less than or equal to the second.

BH d,d,l BHE d,d,I BL d,d,l BLE d,d,I n numeric literal t tallies

the label (in the current frame) of the branch destination if the result of the test is true

The operands must be of the same length, that is, one byte (type H), two bytes (type T), four bytes (type D) or six bytes (type F).

If one operand is a tally or double tally, the other operand may be a literal (n); the literal assembles as the same symbol type as the relatively addressed operand.

These instructions compare two values of the same length or symbol type and use the results to determine program action.

Im Dokument Ultimate THE (Seite 174-179)