Sign in to follow this  
Followers 0
hugheydarryl

Shifting data by bytes

4 posts in this topic

I am trying to load string data in some registers. 

I am using the [ $MOV "20.job" R10700 } instruction.

This moves the "2" into the first 8 bits of R10700 and the "0" into the next 8 bits of R10700.  The "." is then loaded into the first 8 bits of R10701 and the "j" is loaded into the next 8 bits of R10701.  So on and so on.

I am needing the data to all shift 8 bits so that the first 8 bits of R10700 are empty and the rest follows.

I tried the SFL instruction ... but it just removes the bits from the lowe byte.

Any suggestions on how to fill my registers starting with the upper byte of a word or to shift all my bytes leaving the lower byte of the first word empty.

Thanks,

 

Edited by hugheydarryl
wrong term used

Share this post


Link to post
Share on other sites

What is the CPU type? That will determine instruction set. Then you can check what options are available - there could be suitable instructions for this...

But you can always manipulate data yourself. For example to extract lower byte, just AND the value with 255.

To get the upper byte use swap instruction then again and the value with 255.

 

 

Share this post


Link to post
Share on other sites

With string type, the nibbles are inverted and it is normal. So registers will be R1070=HEX3032, R1071=HEX6A2E and R1072=HEX626F.

 

Share this post


Link to post
Share on other sites

Im trying to picture it, but what exactly do you want the final string to be?

Currently it looks like this: 

R10700     2  0 

R10701     .  j

R10702     o b

 

What your describing sounds something like this: 

R10700     [ ]  2   (thats a blank space)

R10701     0  . 

R10702     j   o

R10703    b

 

In which case just adjust your $MOV to be " 20.job" then AND H00FF With the D10700

Edited by WattUp

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0