Exact match. Not showing close matches.
PICList
Thread
'[SX] SXB 2.0 Compiler problem?'
2009\04\05@061821
by
RS_Jimn/a
|
|
Good Morning Bean:
I have been enjoying working with SXB 2.0 since the public beta became available. I am using 2.0.19 of April 1. Last night I came up with the following problem:
This code snippit:
' -------------------------------------------------------------------------
'dtac is delta tac reading since the last time func called
'
' -------------------------------------------------------------------------
FUNC DTAC
Bank @timing
l_dt1 Var Word
l_dt2 Var Word
' l_dt2 = Tac2 - Tac1
l_dt2 = BCD_WORD_SUB Tac1, TAC2
' l_dt1 = Tac1 - Tac0
l_dt1 = BCD_WORD_SUB Tac0, TAC1
Tac0 = Tac1
Tac1 = Tac2
' __wparam12 = l_dt2
' __wparam12 = l_dt2 - l_dt1
__wparam12 = BCD_wORD_SUB l_dt1, l_dt2
Bank
' tmpW2 = __wparam12 return 'Tmpw2
ENDFUNC
compiles as:
;' -------------------------------------------------------------------------
;'dtac is the delta tac reading since the last time func called
;'
;' -------------------------------------------------------------------------
DTAC: ;FUNC DTAC
BANK timing ;Bank @timing l_dt1 = __STACK-$02 ;l_dt1 Var Word
ADD __STACKPTR,#2
l_dt1_LSB = __STACK-$02
l_dt1_MSB = __STACK-$01
l_dt2 = __STACK-$04 ;l_dt2 Var Word
ADD __STACKPTR,#2
l_dt2_LSB = __STACK-$04
l_dt2_MSB = __STACK-$03
;' l_dt2 = Tac2 - Tac1
MOV __PARAM0,Tac1_LSB ; l_dt2 = BCD_WORD_SUB Tac1, TAC2
MOV __PARAM1,Tac1_MSB
MOV __PARAM2,Tac2_LSB
MOV __PARAM3,Tac2_MSB
MOV __PARAMCNT,#3
CALL @__BCD_WORD_SUB
MOV W,#l_dt2
ADD W,__STACKPTR
MOV FSR,W
MOV IND,__PARAM1
INC FSR
MOV IND,__PARAM2
;' l_dt1 = Tac1 - Tac0
MOV __PARAM0,Tac0_LSB ; l_dt1 = BCD_WORD_SUB Tac0, TAC1
MOV __PARAM1,Tac0_MSB
MOV __PARAM2,Tac1_LSB
MOV __PARAM3,Tac1_MSB
MOV __PARAMCNT,#3
CALL @__BCD_WORD_SUB
MOV W,#l_dt1
ADD W,__STACKPTR
MOV FSR,W
MOV IND,__PARAM1
INC FSR
MOV IND,__PARAM2
MOV Tac0_LSB,Tac1_LSB ; Tac0 = Tac1
MOV Tac0_MSB,Tac1_MSB
MOV Tac1_LSB,Tac2_LSB ; Tac1 = Tac2
MOV Tac1_MSB,Tac2_MSB
;' __wparam12 = l_dt2
;' __wparam12 = l_dt2 - l_dt1
MOV W,#l_dt1 ; __wparam12 = BCD_wORD_SUB l_dt1, l_dt2
ADD W,__STACKPTR
MOV FSR,W
MOV __PARAM1,IND
INC FSR
MOV __PARAM2,IND
BANK timing
MOV W,#l_dt2
ADD W,__STACKPTR
MOV FSR,W
MOV __PARAM3,IND
INC FSR
MOV __PARAM4,IND
BANK timing
MOV __PARAMCNT,#4
CALL @__BCD_wORD_SUB
BANK $00 ;Bank
;' tmpW2 = __wparam12
SUB __STACKPTR,#4 ;return 'Tmpw2
RETP
The assembler complains about __param0. I use the FUNC BCD_WORD_SUB elswhere without the local variables and it compiles and runs fine. But when I attempt to use the local variables the compiler wants to add __param0. I have a work around in mind that I can do that will eliminate the local variables but I really wanted to use them in this case.
Thanks
RS_Jim
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=340972
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
2009\04\05@162015 by JonnyMacn/a
|
|
It's hard to tell without having the whole program to experiment with, but my guess (it is just that) is that the you're telling the routine to be in one bank while using the stack (which is another) -- then calling a routine which may be accessing another bank altogether. Since you're using the "timing" bank can you put all of your variables in it? And if you use 2.xx declarations such that you don't require __PARAMCNT you can use __PARAM5 to save and restore the present bank when going into and back out of BCD_WORD_SUB.
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=340972#m341075
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
2009\04\09@065149 by RS_Jimn/a
|
|
JonnyMac,
Thanks for the reply, I will try loading up my local VARS from the timing bank by using get and put. Maybe that will end the necessity of changing banks to the timing bank. BCD_sub only cares what vars are passed to it in __wparam12 and __wparam24.
At first quick brush with passing with get and put I am still getting compiler wanting to create __param0. I will look deeper into the code to see why I can;t pass the params without needing "param0"
RS Jim
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=340972#m342191
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
2009\04\14@154934 by RS_Jimn/a
|
|
Ok, I have installed Ver 2.0.20 and that solved the __param0 problem. Keep up the good work Bean and thanks!
rs_jim
---------- End of Message ----------
You can view the post on-line at:
http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=340972#m343682
Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com
The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)
More... (looser matching)
- Last day of these posts
- In 2009
, 2010 only
- Today
- New search...