transfer from spin to assembly problem solved
Julian800
Posts: 31
Hi All,
I am tring to transfer some Spin into assembly. I stuck with some·error code(Just can't find where is the problem ). the code is Ramp up frequency of counter.
if NextFreqRegA <> frqa
············ repeat·· until NextFreqRegA == frqa
··············· Delay :=clkfreq/1_000 + cnt
·············· if NextFreqRegA > frqa
··················· frqa :=· frqa + RampSpeed <# NextFreqRegA
·············· elseif· NextFreqRegA < frqa················
··················· frqa := frqa· - RampSpeed #> NextFreqRegA
············· waitcnt(Delay)
·········
········
Ramp······
·········· Cmp··· frqa,· Retun WZ , WC···················· '·Return is·NextFreqRegA in Spin
·········· IF_E· Jmp· #CalcFrqReg··
················ Mov·· Temp, frqa
·········· if_c· Add·· Temp , PerStep
·········· if_c· Max·· Temp , Retun
·········· if_nc· Sub·· Temp , PerStep
·········· if_nc· Min·· Temp , Retun
·········· Cmp· frqa, Zero··· WZ
··········· IF_NE· WAITPEQ···port , #%0010
··········· IF_NE· WAITPNE·· port, #%0010
·········· Mov·· frqa, Temp
·········· wrlong· Temp, ReturnAddr
·········· Mov··· Time , cnt
·········· Add··· Time ,Delay
·········· waitcnt Time ,Delay
·········· JMP· #Ramp
········
Post Edited (pussycat) : 6/9/2010 11:56:56 AM GMT
I am tring to transfer some Spin into assembly. I stuck with some·error code(Just can't find where is the problem ). the code is Ramp up frequency of counter.
if NextFreqRegA <> frqa
············ repeat·· until NextFreqRegA == frqa
··············· Delay :=clkfreq/1_000 + cnt
·············· if NextFreqRegA > frqa
··················· frqa :=· frqa + RampSpeed <# NextFreqRegA
·············· elseif· NextFreqRegA < frqa················
··················· frqa := frqa· - RampSpeed #> NextFreqRegA
············· waitcnt(Delay)
·········
········
Ramp······
·········· Cmp··· frqa,· Retun WZ , WC···················· '·Return is·NextFreqRegA in Spin
·········· IF_E· Jmp· #CalcFrqReg··
················ Mov·· Temp, frqa
·········· if_c· Add·· Temp , PerStep
·········· if_c· Max·· Temp , Retun
·········· if_nc· Sub·· Temp , PerStep
·········· if_nc· Min·· Temp , Retun
·········· Cmp· frqa, Zero··· WZ
··········· IF_NE· WAITPEQ···port , #%0010
··········· IF_NE· WAITPNE·· port, #%0010
·········· Mov·· frqa, Temp
·········· wrlong· Temp, ReturnAddr
·········· Mov··· Time , cnt
·········· Add··· Time ,Delay
·········· waitcnt Time ,Delay
·········· JMP· #Ramp
········
Post Edited (pussycat) : 6/9/2010 11:56:56 AM GMT
Comments
Looks better with (code)(/code) tags.
The JMP Ramp should be JMP #Ramp. There are very few occasions where a jmp does not need a # in front of the address (register jumps).
Not sure what your WAITPEQ/WAITPNE are supposed to do, as there are no equivalent lines in the Spin source. You usually specify a destination register (label) and it looks like the source fields (%0010) are both supposed to be immediate values, so it needs a # before them. I guess you want to write waitpeq portval, #%0010 with portval long %0010 in the variables section.
In the lines with conditions if_c_and_nz and if_nc_and_nz you can strip the _and_nz, because before them you already jumped on the if_e (= if_z) condition.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Pullmoll's Propeller Projects
Post Edited (pullmoll) : 6/9/2010 10:50:28 AM GMT
WAITPEQ waite· pin tranafer state, so I can keep wave in highspeed updeate
Post Edited (pussycat) : 6/9/2010 11:53:45 AM GMT