Maximum variables allowed in SX/B ?
Tony Leyland
Posts: 71
Hi,
I've been developing with SX/B and have come across the following observation when I declare this many Variables:-
Test1 var byte
Test2 var byte
Test3 var byte
Test4 var byte
Test5 var byte
Test6 var byte
Test7 var byte
Test8 var byte
Test9 var byte
Test10 var byte
Test11 var byte
Test12 var byte
Test13 var byte
Test14 var byte
Test15 var byte
Test16 var byte
Test17 var byte
Test18 var byte
Test20 var byte
Test21 var byte
Test22 var byte
Test23 var byte
Test24 var byte
I get the error "Variable Exceed Available RAM" when it gets to the Test22 declaration. I understand that at this point the space in the first Bank is now full.
Is there a way to use other RAM Banks to allocate more Vars ?
Also, I have a UART VP in ASM that is 'Included' within SX/B. It stores its many vars in another Bank. What is the prefered method of accessing the Vars in this
UART bank from within SX/B ? Or am I going about this the wrong way ! - Should I allocate the Vars in SX/B and access them from with the UART VP ? Which brings me
back to the first part of this post.
Many thanks
Tony
I've been developing with SX/B and have come across the following observation when I declare this many Variables:-
Test1 var byte
Test2 var byte
Test3 var byte
Test4 var byte
Test5 var byte
Test6 var byte
Test7 var byte
Test8 var byte
Test9 var byte
Test10 var byte
Test11 var byte
Test12 var byte
Test13 var byte
Test14 var byte
Test15 var byte
Test16 var byte
Test17 var byte
Test18 var byte
Test20 var byte
Test21 var byte
Test22 var byte
Test23 var byte
Test24 var byte
I get the error "Variable Exceed Available RAM" when it gets to the Test22 declaration. I understand that at this point the space in the first Bank is now full.
Is there a way to use other RAM Banks to allocate more Vars ?
Also, I have a UART VP in ASM that is 'Included' within SX/B. It stores its many vars in another Bank. What is the prefered method of accessing the Vars in this
UART bank from within SX/B ? Or am I going about this the wrong way ! - Should I allocate the Vars in SX/B and access them from with the UART VP ? Which brings me
back to the first part of this post.
Many thanks
Tony
Comments
test22 var byte (1)
There are a few commands that can't use array elements, but most can. And as long as it's declared as a 1 element array, you can just use the name without the need for the (0) after the name so:
test22 = 123
is the same as
test22(0) = 123
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
Those that would give up freedom for security will have neither.
·
In another post we were talking about working with LCD Panels and 4 bit interfaces.· In that thread I posted a program that had a couple of techniques for using memory and arrays·that will help.· File is attached as a zip.
The file is a zip file because it consists of seven files:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I like the example you gave me John, so much so that it made me understand how to write SX/B apps with
ASM subroutines that can access the SX/B vars.
I've included a demo here of what I've put together so far (being a relative newbie, I've learnt a lot from this). When you step
through it you can see (in SXSim) the registers change. The file 'SX-B Variables Example.SXB' is the main source to try, the
other one being a 'Declarations' file.
My vars are of 3 types:- Global, Normal, Extended.
1) Global variables. These are available whatever bank we are currently in and so are very special.
2) Normal variables. These are assigned within Bank Zero only. These are the most common ones used, but only 15 bytes or so.
3) Extended variables. These are 1 -> 16 byte arrays, assigned within Banks 1 -> 6 (SX/B uses Bank 7).
Only use these when the 'Normal' ones have been used up (they need extra code overhead to access them).
Single byte Arrays can be used to store Vars in other Banks. However, they do not work in FOR / NEXT loops apparantly.
Thanks again,
Tony