BRSET - assembly listing

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

BRSET - assembly listing

跳至解决方案
6,811 次查看
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 解答
3,696 次查看
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 回复数
3,696 次查看
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 项奖励
回复
3,696 次查看
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 项奖励
回复
3,697 次查看
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 项奖励
回复
3,696 次查看
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 项奖励
回复
3,696 次查看
kef
Specialist I

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

0 项奖励
回复