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


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

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



Hey I'm a bit confused... is this statement an equivalent of my AND 
statement, or is it needed for what I asked? If so, then where do I put it in 
my and label? Also, why does it input a,hl and output (hl),a?

> 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...
>