Shop OBEX P1 Docs P2 Docs Learn Events
high/low bytes of an array - how to access... — Parallax Forums

high/low bytes of an array - how to access...

pacmanpacman Posts: 327
edited 2013-04-09 18:28 in Propeller 1
I searched and read, but I'm still no clser to knowing the answer - I'm sure someone out their alrady knows the answer..

I have an array defined globally

word R30000[5]


From a subroutine - I want to access the high byte (and low byte) of each word in the array.

Low byte is easy - byte[R30000][0]

My reading suggestes that for the high byte I could use byte[r30000][1] {propellor manual 1.2 page 55{ish}}

But wouldn't byte[R30000][1], actually be the low byte of the 2nd word?

As a workaround - should I copy R30000[0] into a local variable and then use the byte[x], byte [x+1] method, or am I missing a greater truth?

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2013-04-09 18:08
    R30000{0}.byte[2*n]    ' low bytes, n word index (0..4)
    R30000{0}.byte[2*n+1]  ' high bytes
    
  • pacmanpacman Posts: 327
    edited 2013-04-09 18:28
    Once again Kuroneko I owe you a beer...

    Or other beverage - {perhaps you dont drink?}

    Thanks
Sign In or Register to comment.