Shop OBEX P1 Docs P2 Docs Learn Events
Keeping a WATCH on a string variable using SX/B — Parallax Forums

Keeping a WATCH on a string variable using SX/B

John KauffmanJohn Kauffman Posts: 653
edited 2006-03-15 12:09 in General Discussion
Keeping a WATCH on a string variable using SX/B
·
I’m trying to convert an example in AL Williams book SX-Key Development System Manual version 2.0 page 61 from Assembly to SX/B. He shows how to display a string in the WATCH window during Debug.
·
The key lines in assembly are:
·
String·· EQU $0B········ ;(3 chars, $0b - $0D)
WATCH String,3,FSTR
MOV·· String, #’H’
MOV·· String+1, #’i’
MOV·· String+2 #’!’
·
I understand (I think) that in the above code the String variable is setting a memory location (not the exact same as a variable name in SX/B) and then putting the three characters into that location and the following two bytes. WATCH then reads starting from the String location and going on through memory for a total of three characters.
·
Here is my try in SX/B:
·
MyString1 VAR Byte
MyString2 VAR Byte
MyString3 VAR Byte
MyString1 = 'H'
MyString2 = 'i'
MyString3 = '!'
Watch MyString1,3,Fstr
·
It fails on one level and I think will fail on another:
- If fails on line four with ‘invalid number of parameters.’ So I need to learn how to get a alphabetic character into a variable. (better yet to get a full string into one variable)
·
- I think it will also fail in the WATCH because I don’t think I can assume that MyString2 and 3 are going to follow MyString1 in the memory space.

I've also fooled around with putting the three characters into an array, but haven't been able to get WATCH to read that array as a string (only as three variables on three lines in the Watch window).

Any suggestions? I am certainly open to pointers that I am thinking about this completely wrong. I'm also happy to get a pointer to a post or book reference where this is explained. I probably need to learn more about handling strings in SX/B, but I've found nothing in the indices of the texts by Gunther or Al Williams.

Thanks.

Comments

Sign In or Register to comment.