Branch

From Intellivision Wiki
Revision as of 23:27, 11 January 2005 by Pingaso (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Instruction NameBranch
MnemonicsB/BC/BOV/BPL
BEQ/BLT/BLE/BUSC
NOPP/BNC/BNOV/BMI
BNEQ/BGE/BGT/BESC
BEXT
CP1610 Clock Cycles7 or 9
InterruptibleYes
Opcode Range$0200-$023F

Similar to the Jump family of instructions, Branch is also an entire family of instructions that are represented as any of several different possible mnemonics, depending on the flags indicated in the opcode. The opcode format breaks down as follows.

   Format - Decle #1
   0000:0010:00de:nccc  0000:00aa
where:
d indicates the direction of the branch such that: d == 0 indicates to branch in the forward direction d == 1 indicates to branch in the reverse direction
e indicates to branch on an external condition such that if e == 0, then: nccc == 0000 branch unconditionally (B) nccc == 0001 branch if Carry Flag is set (BC) nccc == 0010 branch if Overflow Flag is set (BOV) nccc == 0011 branch if Sign Flag is clear (BPL) nccc == 0100 branch if Zero Flag is set (BEQ or BZ) nccc == 0101 branch if Sign Flag != Overflow Flag (BLT) nccc == 0110 branch if either Zero Flag is set or if Sign Flag != Overflow Flag (BLE) nccc == 0111 branch if Sign Flag != Carry Flag (BUSC) nccc == 1000 do not branch unconditionally (NOPP) nccc == 1001 do not branch if Carry Flag is set (BNC) nccc == 1010 do not branch if Overflow Flag is set (BNOV) nccc == 1011 do not branch if Sign Flag is clear (BMI) nccc == 1100 do not branch if Zero Flag is set (BNEQ or BNZ) nccc == 1101 do not branch if Sign Flag != Overflow Flag (BGE) nccc == 1110 do not branch if either Zero Flag is set or if Sign Flag != Overflow Flag (BGT) nccc == 1111 do not branch if Sign Flag != Carry Flag (BESC) otherwise if e == 1, then: nccc branch if this value matches the pins EBCA0-EBCA3 (BEXT)

The Branch opcode family is often represented as many different mnemonics, to make life a little easier for the programmer. The mnemonic used to represent this opcode depends on the combination of the e, n, and ccc parameters mentioned above, according to the following chart.

Mnemonics To Parameters

Mnemonicenccc
B00000
BC00001
BOV00010
BPL00011
BEQ or BZ00100
BLT00101
BLE00110
BUSC00111
NOPP01000
BNC01001
BNOV01010
BMI01011
BNEQ or BZ01100
BGE01101
BGT01110
BESC01111
BEXT1any value