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


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

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




I believe it's the equivalent of the AND statement you wrote.  The ;input
hl, a and ;output (hl),a are just there as an example code. With this code,
you must set hl and a to something before you call it.  If the AND
statement is true, then the routine loads a into (hl).  You can change the
input and output to whatever you like, however.  Just make sure that
register a equals the number you want to compare in the AND statement.

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

_____________________________________________
Free email with personality! Over 200 domains!
http://www.MyOwnEmail.com