Concatenating Variables
Chris Spacone
Posts: 7
I would like to accomplish the following:
Port_0_Val = $FF - this is the low portion of the ports_val
Port_1_Val = $FF - this is the high portion of the ports_val
Ports_Val =$FFFF - this would be the concatenated variable
I reviewed page 89 of the BS Syntax & Ref manual covering aliases and modifiers. I'm then lead to the conclusion that the following should work
Ports_Val VAR Word ' this is the final value I want to evaluate
Port_0_Val VAR Ports_Val.LOWBYTE 'This is the low portion of Ports_Val
Port_1_Val VAR Ports_Val.HIGHBYTE 'This is the high portion of Ports_Val
Question: am I on the right track? Does the LOWBYTE line and HIGHBYTE line order of appearance matter?
Thanks,
Chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
TWSRO schmismo! Low level scanning is the key to total field perception!
Port_0_Val = $FF - this is the low portion of the ports_val
Port_1_Val = $FF - this is the high portion of the ports_val
Ports_Val =$FFFF - this would be the concatenated variable
I reviewed page 89 of the BS Syntax & Ref manual covering aliases and modifiers. I'm then lead to the conclusion that the following should work
Ports_Val VAR Word ' this is the final value I want to evaluate
Port_0_Val VAR Ports_Val.LOWBYTE 'This is the low portion of Ports_Val
Port_1_Val VAR Ports_Val.HIGHBYTE 'This is the high portion of Ports_Val
Question: am I on the right track? Does the LOWBYTE line and HIGHBYTE line order of appearance matter?
Thanks,
Chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
TWSRO schmismo! Low level scanning is the key to total field perception!
Comments
Ports_Val.LOWBYTE = Port_0_Val
Ports_Val.HIGHBYTE = Port_1_Val
This could also be done in a single line by:
Ports_Val = Port_1_Val << 8 + Port_0_Val
I hope this helps. Take care.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Post Edited (Chris Savage (Parallax)) : 7/19/2009 9:59:28 PM GMT
-Chris
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
TWSRO schmismo! Low level scanning is the key to total field perception!