why "undefined ?_ret symbol"
stevenolan
Posts: 3
Would appreciate any advice on why I am getting "undefined ?_ret symbol" error on following code.
Compiler complains about RD_SDI symbol.
Using Prop Tool V1.3.2.
I cannot find any relevant posted help with this problem.
Many thanks in advance.
Steve Nolan..
VAR
long cog
PUB start
cog := cognew(@entry) + 1
PUB stop
if cog
cogstop(cog~ - 1)
DAT
org 0
entry and dira,pinsoff '
or dira,pinson ' Set Output Pins
or outa,pinson ' All Outputs are Pulled High
RD_16 xor outa,#%00_0100 ' CS Low
xor outa,#%00_1000 ' CK Low
call #RD_SDI
mov ch0,rdpins
mov loop1,#15
gbits call #RD_SDI
shl ch0,#1
or ch0,rdpins
djnz loop1,gbits
or outa,#%00_1000 ' CK High
or outa,#%00_0100 ' CS High
mov loop1,#500
:wait4me
nop
djnz loop1,#:wait4me
jmp #RD_16
RD_SDI or outa,#%00_1000 ' CK High
mov rdpins,ina ' Read Pins
xor outa,#%00_1000 ' CK Low
and rdpins,#%10_0000 ' SDI pin
shr rdpins,#5
ret
pinsoff long $ffff_ffc0 ' Uses Pins P0..P5
pinson long $0000_001d ' Output Pins
rdpins res 1
ch0 res 1
ch1 res 1
loop1 res 1
Compiler complains about RD_SDI symbol.
Using Prop Tool V1.3.2.
I cannot find any relevant posted help with this problem.
Many thanks in advance.
Steve Nolan..
VAR
long cog
PUB start
cog := cognew(@entry) + 1
PUB stop
if cog
cogstop(cog~ - 1)
DAT
org 0
entry and dira,pinsoff '
or dira,pinson ' Set Output Pins
or outa,pinson ' All Outputs are Pulled High
RD_16 xor outa,#%00_0100 ' CS Low
xor outa,#%00_1000 ' CK Low
call #RD_SDI
mov ch0,rdpins
mov loop1,#15
gbits call #RD_SDI
shl ch0,#1
or ch0,rdpins
djnz loop1,gbits
or outa,#%00_1000 ' CK High
or outa,#%00_0100 ' CS High
mov loop1,#500
:wait4me
nop
djnz loop1,#:wait4me
jmp #RD_16
RD_SDI or outa,#%00_1000 ' CK High
mov rdpins,ina ' Read Pins
xor outa,#%00_1000 ' CK Low
and rdpins,#%10_0000 ' SDI pin
shr rdpins,#5
ret
pinsoff long $ffff_ffc0 ' Uses Pins P0..P5
pinson long $0000_001d ' Output Pins
rdpins res 1
ch0 res 1
ch1 res 1
loop1 res 1
Comments
Please enclose source code in [ code ] [/code ] tags. The code tags keep the original formatting.
RD_SDI_ret ret
This is because the propeller does not use a stack for subroutine calls. It changes the "ret" instruction to jump back, so it needs a label on the ret line.
Bean
All I want to add is that you should be aware of the consequences of this:
1) You cannot have recursive subroutine calls in PASM unless you implement your own stack mechanism. i.e. No funcA calls funcA or funcA calls funcB calls funcA, etc etc.
2) You can only have one exit point, RET, in your subroutine. To make an early exit from the routine you must JMP to your RET location.