This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
109 Views 1 Replies Last post: Mar 2, 2010 10:38 AM by ckgrier RSS
Marco1973 Newbie 2 posts since
Mar 2, 2010
Currently Being Moderated

Mar 2, 2010 9:05 AM

[Help] MOV.B R0L,R0L instruction. Why?

Hi!

I usually write code with C programming language, but this time I need to explore a .lst output to solve a problem.

Maybe it is a silly question... but I don't have strong experience with assembly code.

 

I'm using a H8S 2378 microcontroller.

I need some help about this very short code fragment:

                            
MOV.B       R0L,R0L
MOV.B       R0L,R4L
MOV.B       R4L,R4L
BNE           address....

 

The instruction MOV.B R0L,R4L seems to be clear: the value in the 8-bit register R0L is transferred into R4L

But I don't understand the benefit of the other two MOV instructions (with source equal to destination) and the subsequent branch if not equal.

There is a lot of instructions like this in the .lst file.

 

Could you help me?

 

Thanks.

Marco

ckgrier Apprentice 840 posts since
Mar 16, 2009
Currently Being Moderated
Mar 2, 2010 10:38 AM in response to: Marco1973
Re: [Help] MOV.B R0L,R0L instruction. Why?

Basic compiler optimization should help. Non-optimized code can sometimes have unproductive opcodes.

More Like This

  • Retrieving data ...

Bookmarked By (0)