Extracting Byte Variable from a Word Variable
Hey all,
In the SX/B·help manual it says you can extract a byte variable from a word variable.· To wit:
==============================
Word variables have an additional assignment option with two byte values (variables or constants):
wordVar = lsbValue, msbValue==================================If I call a subroutine an immediately store the word variable,
what is the syntax for getting the lsb? (I know it is going to
be painfully simple its just that the manual does not give an example.===============================tempW1 = __WPARAM12····' get string address
templsb = tempW1.lsb ' doesn't work===============================
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
In the SX/B·help manual it says you can extract a byte variable from a word variable.· To wit:
==============================
Word variables have an additional assignment option with two byte values (variables or constants):
wordVar = lsbValue, msbValue==================================If I call a subroutine an immediately store the word variable,
what is the syntax for getting the lsb? (I know it is going to
be painfully simple its just that the manual does not give an example.===============================tempW1 = __WPARAM12····' get string address
templsb = tempW1.lsb ' doesn't work===============================
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Comments
WordVarName_MSB ' = high byte of word variable "WordVarName"
ByteVarName = WordVarName_LSB ' move lower byte into byte variable "ByteVarName"
If you view the list file generated from your SX/B code, you will see where all the variable constants (register addresses) are set up -- any Word variable will automatically create variables for the _LSB and _MSB byte of the word.
There are other ways of accessing bytes of defined Words, arrays, etc., too. Check the SX/B and SX Manuals for more.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
tempW1 = __WPARAM12 ' get string address
templsb = tempW1_LSB '
'or
templsb = __PARAM1 ' first byte of all params, a.k.a. lower byte of __WPARAM12
See SX/B documentation for full list of accessible parameter bytes, words, and parameter count.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College