Keeping a WATCH on a string variable using SX/B
John Kauffman
Posts: 653
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.
·
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
SX/B uses double quotes for characters.
MyString1 = "H"
I would use an array to hold a string.
myString VAR Byte (5)
WATCH myString,5,FSTR
PUT myString, "Hello"
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
"SX-Video OSD module" Now available from Parallax for only·$49.95
http://www.parallax.com/detail.asp?product_id=30015
Product web site: www.sxvm.com
"Wise men know when they're right. The wisest also·know when they're wrong."
·