[A83] Re: again: a ret-problem


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

[A83] Re: again: a ret-problem



I don't agree with that last thing
Look at label 2 (indeed i forgot a 'or a'): if state is equal to 1 you jump
to label5 (and the 'ret' isn't important then, 'cause you 'jumped over it'),
if state is equal to 0 you do the 'ret', going back from where the call (in
that case) was made.  Isn't that possible?  Otherwise i have to write almost
the same code twice and that would be a waste




-- Attached file included as plaintext by Listar --

Reply-To: <assembly-83@lists.ticalc.org>
From: <ComAsYuAre@aol.com>
Sender: <assembly-83-bounce@lists.ticalc.org>
To: <assembly-83@lists.ticalc.org>
Subject: [A83] Re: again: a ret-problem
Date: Sun, 15 Apr 2001 15:12:20 +0200
Message-ID: <b2.141095ea.280af834@aol.com>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: AOL 6.0 for Windows US sub 352
X-listar-version: Listar v1.0.0
X-original-sender: ComAsYuAre@aol.com
X-list: assembly-83
X-UIDL: 0500a571955da91ec06c155b7c130275
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300

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








References: