Chapter 4 Optimization

Example: unconditional branch instruction converted to relative branch

This example shows the branch destination of a JMP LABEL unconditional branch instruction within the permitted range (-128 to +127 of PC) for relative branching.

The source list is as follows.

 

opt

on

_TEXT

section

CODE, PUBLIC,1

sub_func

 

 

addr_set

jmp

func_end

fun_end

org

addr_set+127

end

 

 

 

The final list file after assembly is shown next. The branch destination of the JMP LABEL instruction on line number 4 is in the permitted range for relative branching, so it has been converted to BRA LA- BEL. Note that the mnemonics and object code are different.

 

 

 

opt3.lst Page 1

 

Loc

*** PanaX series Series MN1030 Cross Assembler ***

Object

Line

Source

opt

on

 

 

1

_TEXT

40000000

 

2

section

CODE, PUBLIC, 1

CA7F

3

sub_func

jmp

func_end

40000000

@4

addr_set

 

 

5

 

org

addr_set+127

4000007f

 

6

func_end

F0FC

7

rts

 

4000007f

8

 

 

 

 

9

 

end

 

 

 

 

opt3.lst Page 2

 

*** Symbol Table

***

 

40000000

T

sub_func

40000000

T

addr_set

4000007f

T

func_end

Usage Example 57

Page 69
Image 69
Panasonic MN1030 user manual CA7F