[A83] again: a ret-problem


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

[A83] again: a ret-problem



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