Shifting

General discussion on mikroBasic PRO for 8051.
Post Reply
Author
Message
BarryP
Posts: 517
Joined: 02 Apr 2007 03:57
Location: New Zealand

Shifting

#1 Post by BarryP » 31 Jan 2013 08:09

Code: Select all


program testShift

dim x,y as word
dim word1,word2,word3 as word
dim lngword1,lngword2 as longword
main:
word1 = word(lngword1 >> 8)
'Produces this
'MOV _word1, _lngword1+1
'MOV _word1+1, _lngword1+2
'MOV _word1+2, _lngword1+3     <----- WRONG
'MOV _word1+3, #0              <----- WRONG                


end.

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: Shifting

#2 Post by janko.kaljevic » 31 Jan 2013 17:51

Hello,

Thanks for reporting the problem.
I have reproduced it and we will fix it.

At the moment you can use workaround with additional long variable.

Code: Select all

dim word1 as word
dim test as longword
dim lngword1 as longword
main:
test = word(lngword1 >> 8)
word1 = word2 and 0x0000FFFF
Best regards.

Post Reply

Return to “mikroBasic PRO for 8051 General”