[A83] Re: Another lame question.... getting backed up by calls....


[Prev][Next][Index][Thread]

[A83] Re: Another lame question.... getting backed up by calls....




This will work:

And: ;input's: a,hl
     ;outputs: ld (hl),a
cp 10
ret c
cp 20
ret nc
; all made it so:
jp dooit


dooit:
ld (hl),a
ret

Explaination:
when you call, the address to return to is pushed on the stack.
a jp does not affect the stack. So when you do a ret after the jp, it reads the
correct value from the stack, and returns to it.

compare it with using "ret" in a quit routine you jp to, that works too...

> 
>        In a call label that I have, use a makeshift AND statement, using two 
> cp's and two ret  nc's. (So if first thing is false, then ret, if true, then 
> continue and if second thing is false, then ret, if true, then continue) 
> After that, I had a jp without any conditionals, since if both got this far, 
> then they must both be true, so jp label. In that label that is jped to, can 
> I have a ret that will return back to where I first called the AND Label? If 
> not, then how do I do so?
> 
> Sorry for the confusing questions.
> Thanks,
> darkfire139@aol.com
> 
> 
> 





References: