SX/B 2.0 - what is going to be new?
![Timothy D. Swieter](https://forums.parallax.com/uploads/userpics/482/n6OIB3WNWVK0M.jpg)
I have heard murmurs of SX/B 2.0 being released this fall, I am about to be a user, so I was curious if there is any information on what features, commands, language elements, etc are being added to the new version.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
tdswieter.com
One little spark is all it takes for an idea to explode
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
tdswieter.com
One little spark is all it takes for an idea to explode
Comments
Also a form of task scheduling will be built in. Where you can declare tasks (subroutines) to be performed at certain time intervals.
GETBIT & PUTBIT allows you to set or retreive the status of a single bit where the bit position CAN be a variable.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter
tdswieter.com
One little spark is all it takes for an idea to explode
Thanks,
Scott
They are created on a stack. The "stack" is an array hence the reason only array elements can be local variables.
Different subroutines can use the same variable name and can use the same name as a global variable (rendering the global inaccessable in the subroutine).
The SX28 family is limited to a 16 byte stack, the SX48 is only limited by total array space.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
That will be a nice improvement. It will certainly make memory management much easier. When is the new version slated for release?
-Scott
No you cannot define word variables. Only arrays.
The way around this is to define some global WORD variables, then save their value at the beginning of the subroutine and restore the value at the end of the subroutine.
You need to do the same thing to get a "normal" byte variable to use as an array index.
tempW VAR WORD ' Global variable
SUB MySub
· saveTempW VAR BYTE (2)
· 'Save value of tempW
· saveTempW(0) = tempW_LSB
· saveTempW(1) = tempW_MSB
· FOR tempW = 0 TO 1000
· NEXT
· ' Restore value of tempW
· tempW_LSB = saveTempW(0)
· tempW_MSB =saveTempW(1)
· ENDSUB
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
It prevents subroutines from trying to use the same global variable.
From having to declare uumpteen temp global variables.
It makes subroutine more modular. They can stand alone without depending on certain variable names to be declared.
Subroutines can use the same variable names without any problem. If sub1 has a local var named "temp" and it calls sub2 that has a local var named "temp" it will still work just fine.
It saves RAM because all the variables for all the subroutines are not declared at the same time. In essence they are created "on-the-fly" at runtime.
If SX/B had not been geared towards learning assembly, I would made ALL variable work like array elements (through FSR). Then every variable type would work the same way. But the code would be alot larger and not nearly as easy to understand.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
“The United States is a nation of laws -· poorly written and randomly enforced.” - Frank Zappa
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·