BRSET - assembly listing

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

BRSET - assembly listing

Jump to solution
4,533 Views
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?

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,418 Views
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

View solution in original post

0 Kudos
5 Replies
1,418 Views
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 Kudos
1,418 Views
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 Kudos
1,419 Views
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 Kudos
1,418 Views
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 Kudos
1,418 Views
kef
Specialist I

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

0 Kudos