Minor SX/B Issues
Tony Leyland
Posts: 71
Hi,
I spotted a couple of things recently in V1.42. Appologies if these have already been discussed:-
With the following code snippit and the CARRYX directive set, this loop does not loop, but exits immediately.
TestVar = 1
do
loop until TestVar = 0
The following Macro declare and then using it, actually works:-
\IO_Port EQU ra
\MacroTest MACRO
\ setb IO_Port.\1
\ENDM
\MacroTest 1
But when enclosed within ASM ENDASM like the following it does not:-
\IO_Port EQU ra
ASM
MacroTest MACRO
setb IO_Port.\1
ENDM
ENDASM
\MacroTest 1
The following produces an error about too many parameters:-
TestVar = 1+8+1 ' Data bits for Serial Comms (1 start, 8 data, 1 stop)
I noticed that the following produces the error "CONSTANT EXPECTED"
TestCon2 CON TestCon1
TestCon1 CON 123
Since the order that they are defined is out of sequence, so to speak. Is this a fundamental feature of compiler / SASM ?
Also, any DATA statements that are used must be before the line of code that references them. Will this change or is likely to be the norm.
Many Thanks,
Tony
I spotted a couple of things recently in V1.42. Appologies if these have already been discussed:-
With the following code snippit and the CARRYX directive set, this loop does not loop, but exits immediately.
TestVar = 1
do
loop until TestVar = 0
The following Macro declare and then using it, actually works:-
\IO_Port EQU ra
\MacroTest MACRO
\ setb IO_Port.\1
\ENDM
\MacroTest 1
But when enclosed within ASM ENDASM like the following it does not:-
\IO_Port EQU ra
ASM
MacroTest MACRO
setb IO_Port.\1
ENDM
ENDASM
\MacroTest 1
The following produces an error about too many parameters:-
TestVar = 1+8+1 ' Data bits for Serial Comms (1 start, 8 data, 1 stop)
I noticed that the following produces the error "CONSTANT EXPECTED"
TestCon2 CON TestCon1
TestCon1 CON 123
Since the order that they are defined is out of sequence, so to speak. Is this a fundamental feature of compiler / SASM ?
Also, any DATA statements that are used must be before the line of code that references them. Will this change or is likely to be the norm.
Many Thanks,
Tony
Comments
As for the first example, SX/B is not compatible with the CARRYX option
As for the second example, check the generated assembly "Run->View List" and see what happening.
As for the third example "TestVar = 1+8+1", SX/B only allows 1 math operator during assignment.
If you use CON you can use multiple operators so "TestVar CON 1+8+1" will work.
As for the·fouth example, SX/B is a 1 pass compiler (that's why it's so fast). So names must be declared before they are used.
Version 1.42.01 (download from the sticky in the SX forum) solves the DATA before use issue.
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.
Post Edited (Bean (Hitt Consulting)) : 11/25/2005 1:48:32 PM GMT
Cheers
Tony