Re: A83: Question about compares.
[Prev][Next][Index][Thread]
Re: A83: Question about compares.
>From owner-assembly-83-outgoing@towerguard.unix.edu.sollentuna.se Fri
Sep 11 15:48:38 1998
>Delivered-To: assembly-83-outgoing@towerguard.unix.edu.sollentuna.se
>Received: by towerguard.unix.edu.sollentuna.se (VMailer, from userid
507)
> id 440E34769A; Sat, 12 Sep 1998 00:48:28 +0200 (CEST)
>From: Jkhum98@aol.com
>Message-ID: <67e5ead5.35f9a877@aol.com>
>Date: Fri, 11 Sep 1998 18:47:19 EDT
>To: assembly-83@lists.ticalc.org
>Mime-Version: 1.0
>Subject: A83: Question about compares.
>Content-type: text/plain; charset=US-ASCII
>Content-transfer-encoding: 7bit
>X-Mailer: AOL for Macintosh sub 161
>Sender: owner-assembly-83@lists.ticalc.org
>Precedence: list
>Reply-To: assembly-83@lists.ticalc.org
>Errors-To: assembly-83-errors@lists.ticalc.org
>
>
>I have a question about 'compare' and 'conditional jumps'... Am I right
to
>beleive that the one line after a 'cp' is read for that statement?
Also, does
>it ONLY have to be jump, either 'jp' or 'jr' ? For example, would this
code
>be ASM Legal...?
>
> ...
> ld a, (value) ; I'm going to compare to test what's in (value)...
> cp 1 ; If the cp was zero, this Next ONE line would be exec?
must have a 'jp z' or a 'jr z' or a 'call z'
> ld b, 10 ; But if "cp 1" was nz, dont carry out THIS line?
> cp 2 ; But if the value WAS '1', THIS line wouldnt be tested,
> ld b, 12 ; and THIS line would Not be carried out?
> ...
do it like this
ld a,(value)
cp 1
jr nz,two
ld b,10
jr fin
two:
cp 2
jr nz,fin
ld b,12
jr fin ;here for explanation reasons only
fin:
...
and instead of fin, you could add a three, or so on.
-Phelan 'Amen' Wolf
>
>Am I wrong to think this, and just kinda messed up, or is this
possible...?
>I hope I dont have to do a different label in each compare just to do
one "ld
>b"
>command for each... someone clarify me on this please, thanx... =)
>
> --Jason K.
>
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com