Menu

Splitting Word variables into bytes etc.

Help
Mauried
2010-09-08
2013-05-30
  • Mauried

    Mauried - 2010-09-08

    I know that Gbasic can split a word variable into 2 byte variables by appending _h to the high variable, but does the reverse work .
    ie.
    Dim A1 as word
    A1_h=1
    A1=1

    Will this make A1 = 257.

     
  • Hugh Considine

    Hugh Considine - 2010-09-10

    That will work if you set A1 first, then A1_H. When you set A1 to 1, A1_H will be cleared.

    Another way to do that is to use an alias:

    Dim A1 As Word Alias A1Low, A1High
    A1High = 1
    A1Low = 1

    That would make A1 = 257 too, and would avoid the unnecessary clearing of the high byte that occurs without the alias.

     
  • Mauried

    Mauried - 2010-09-10

    Fantastic.
    Thats what I need.
    Thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.