Chapter 4 Optimization
56 Usage Example
Example: branch destination of conditional branch instruction out of range

This example shows a branch outside the permitted range (-128 to +127 of PC) of a BCC LABEL con-

ditional branch instruction.

The source list is as follows.

The final list file after assembly is shown next. LABEL exceeds the permitted branch range of BCC LA-

BEL, so the code has been converted to BCS *+5, JMP LABEL. Note that the mnemonics and object

code are different.

opt on
_TEXT section CODE, PUBLIC,1
sub_func mov 0, D2
cmp D1, D2
addr_set bcc func_end
org addr_set+128
func_end rts
end
opt2.lst Page 1
*** PanaX series Series MN1030 Cross Assembler ***
Loc Object Line Source
1opton
2 _TEXT section CODE, PUBLIC, 1
40000000 3 sub_func
40000000 8A00 4 mov 0, D2
40000002 A6 5 cmp D1, D2
40000003 C405CC0080 @6 addr_set bcc func_end
7
8 org addr_set+128
40000083 9 func_end
40000083 F0FC 10 rts
11 end
12 opt2.lst Page 2
*** Symbol Table ***
40000000 T sub_func
40000003 T addr_set
40000083 T func_end