Shop OBEX P1 Docs P2 Docs Learn Events
SX/B word variables — Parallax Forums

SX/B word variables

CrustyNoodleCrustyNoodle Posts: 15
edited 2008-06-10 05:33 in General Discussion
Hi,

Tried to reasearch·this·for myself but I'm not getting terribly far...

I'd like to define and use more word variables than currently fit in the 19 Bytes of "first level" variable memory so that I can set a watch on these word variables and view them at a break point.· Does anybody know if it is possible to define some form of alias that would allow me define a word variable (as a two byte array) and then view this array as a word using the watch command?··I'd prefer not to copy the LSB and MSB to a word variable and then view this as I'd like to be able to see all of my word variables at the one time (at a break point).

Comments

  • JonnyMacJonnyMac Posts: 9,216
    edited 2008-06-10 05:33
    For just holding onto values you can use a two-byte array like a word and move values back and forth between the array and Word variables. For example, you could define these variables:

    gWord1          VAR     Word                    ' part of globals
    gWord2          VAR     Word
    
    wTest           VAR     Byte (2)                ' in banked array
     wTest_LSB      VAR     wTest(0)
     wTest_MSB      VAR     wTest(1)
    


    ... and then do this:

    Start:
      gWord1 = 3546
      gWord2 = 0
    
      wTest = gWord1                                ' SX/B copies both bytes
      gWord2 = wTest
    
      WATCH wTest, 16, udec
      WATCH gWord2, 16, udec
      BREAK
    
      ' use Debug --> Run
    
    Main:
      GOTO Main
    

    Post Edited (JonnyMac) : 6/10/2008 5:39:31 AM GMT
Sign In or Register to comment.