[A83] Re: again: a ret-problem


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

[A83] Re: again: a ret-problem



Well, in label2 it looks like you're missing an "or a" to check the state 
before branching, but that's not your only problem.  The real problem is, you 
have label2 returning when it's both jumped to and called, so when it's 
jumped to and it returns, you'll exit the program--behavior you indicate you 
_don't_ want...  Basically, you need to make each routine either a subroutine 
or a regular part of the program flow, because making it both at the same 
time will just convolute your code unnecessarily.


In a message dated 4/15/2001 9:00:02 AM Eastern Daylight Time, 
jandebeule@belgacom.net writes:


> This a 'simplyfied' (i think you'll find it confusing, but please try to
> folow it)  code from a program i'm trying to make.  Can anybody tell me
> what's wrong with it, 'cause it just jumps out of the program (i know it has
> something to do with a 'ret', but i can't find what's wrong (btw i really
> need it that way (i mean i need to 'call' AND 'jump' (depends on '(state)')
> label2)
> 
> Main:
> ...
> call   label1
> ....                                 =>(*)
> ld     a,1                                => simplified !!!!!
> ld     (state),a
> jp     label2
> ...
> jp     label3
> ...
> 
> label1:
>        xor   a
>        ld     (state),a
>        ld     a,(var)
>        cp     1
>        jp     z,label2
>        cp     2
>        jp     z,label3
>        ...
> 
> label2:
>        ....
>        call   label4       => i think this is an important call (because you
> have a call in a call)
>        ld     a,(state)
>        jp     z,label5
>        ret                 => i want him to go back to (*)
> 
> label3:
>        ...
>        the same as label2
> 
> label4:
>        ....
>        ret
> 
> label5:
>        rest of my program



----
Jonah Cohen
<ComAsYuAre@aol.com>
http://jonah.ticalc.org





Follow-Ups: