BRSET - assembly listing

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

BRSET - assembly listing

ソリューションへジャンプ
6,101件の閲覧回数
leesp
Contributor I

Hi,

I am using CodeWarrior for MC9S08. I am trying to understand the assembly listing in the True-Time Simulator & Real-Time Debugger. The first line of the listing is

 

0000   000000   BRSET   0,0x00, *+3        ;abs = 0x0003

 

but from what I understand from the instruction set, the source and object code for BRSET is:

Source

BRSET   n, opr8a, rel

 

Object

00 dd rr   (assuming we are dealing with b0)

 

Therefore the object code should be 000003.

Why is it 000000 instead?

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 解決策
2,986件の閲覧回数
kef
Specialist I

     BRSET   0,0x00, *+3

 

Is the same like

 

L1:  BRSET 0,0x00,L2

L2:

 

* is quivalent to L1

 

rel is calculated relative to L2. rel=0 means branch from L2 to L2+rel = L2+0 = L2

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
2,986件の閲覧回数
kef
Specialist I

rel is relative to the first byte of next instruction. * is first byte of current instruction. So *+3 and opcode is correct.

0 件の賞賛
返信
2,986件の閲覧回数
leesp
Contributor I

Hi Kef,

Pardon me I still don't understand. Am I right that

BRSET   0,0x00, *+3  means:

Branch if bit 0 in memory location 0x00 is set; the branch-to location is +3 bytes from the next instruction?

Then according to:

Source

BRSET   n, opr8a, rel

Object

00 dd rr   , n = 00, opra8a = 0x00, rel = +3, the opcode should be 000003 right?

Please help to answer. Thanks..

0 件の賞賛
返信
2,987件の閲覧回数
kef
Specialist I

     BRSET   0,0x00, *+3

 

Is the same like

 

L1:  BRSET 0,0x00,L2

L2:

 

* is quivalent to L1

 

rel is calculated relative to L2. rel=0 means branch from L2 to L2+rel = L2+0 = L2

0 件の賞賛
返信
2,986件の閲覧回数
leesp
Contributor I

Ok Kef, thanks a lot I understand now.

I didn't know " * " means the current program counter value. I think the MC9s08 user manual assume a newbie like me understand this!

Where can I find out more fundamental things like this (since the uC manual does not provide this information)?

0 件の賞賛
返信
2,986件の閲覧回数
kef
Specialist I

* should be mentioned in Codewarrior assembler manual. Disassembler just uses same notation.

0 件の賞賛
返信