A lil help glueing to bytes to make a word
grasshopper
Posts: 438
I am trying to "glue" to bytes to make a word. Here is some pseudo code.
This is not working as I would expect. I wanted Glued to = $204B. Perhaps some of you seasoned programmers could guide me in the right direction.
Var Word Glued Byte X, Y Main X = $20 Y = $4B Glued = X << 4 Glued = Y
This is not working as I would expect. I wanted Glued to = $204B. Perhaps some of you seasoned programmers could guide me in the right direction.
Comments
Your last assignment statement "Glued = Y" blows away what you've already assigned to Glued. I think you need to do something like this:
I think you could also use the long/word/byte addressing in spin to do the same thing like this:
For some reason the one of the lines above gets munched when I post . Here's my second suggestion again but not as code:
Glued.byte[noparse][[/noparse]0]:=y
Glued.byte [noparse][[/noparse] 1 ] :=x
This is explained pretty well in the manual pg 168.
pgb
Post Edited (pgbpsu) : 11/13/2008 3:31:05 PM GMT
John Abshier
You could save a couple of variables and code space doing something like this...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.