CALL / RET flags preserve
in Propeller 2
Hello,
Time for another explanation:
The documentation say that CALL pushes C and Z into stack along with address, and RET pops them back, however if you run this code, it seems that the flags are not preserved:
mov t1, #$08
cmp t1, #$08 wz ' Z=1
if_z call #func ' reset Z ?
if_z mov t1, #$FF
if_nz mov t1, #$00
debug(uhex_byte(t1))
jmp #$
func cmp t1, #$FF wz ' Z=0
ret
t1 long 0

It should set t1=$FF but it is $00 meaning that Z is reset by the called function. To prove it, comment the wz effect on the func row, and the assignment is correct.
Also have some doubt about_ret_ because while the description for ret(instruction) say that the flags are restored (but apparently not), the description for_ret_ (prefix) does not!
What I'm missing ?

Comments
I think you need to write:
func cmp t1, #$FF wz ' Z=0 ret wczto restore the flags to the state they were at subroutine entry.
Andy
RET WCZrestores C and Z.RET WCrestores C only.RET WZrestores Z only.RETdoes not restore C or Z._RET_does not restore C or Z.Yes, of course I missed the effects!
It is also a logic behaviour because someone may want the calling function to change the flags in some cases.
Thanks, sorry for the silly questions, I'm having lot of difficulties interpreting this documentation.