Re: A83: Question about compares.


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

Re: A83: Question about compares.




jr is the same thing as jp just it is a relative jump, but you don't
have to worry about the +/- to it since the compiler will do it for you,
but a jr has to be within 256 bytes either way of the label. 

JP cc,nn    --  Conditional Jump -- If cc JP(cc=C,NC,NZ,Z) -- 3 bytes --
10/1 clock time
JR cc,e     --  Conditional Jump -- If cc JR(cc=C,NC,NZ,Z) -- 3 bytes --
12/7 clock time



Dan Englender wrote:
> 
> And jr, but you can only use what? zero and carry with jr?
> 
> -Dan
> 
> >
> >Well, you can put anything between the cp and whatever that doesn't
> >affect the system flags (z&nz, c&nc, pe, po, m, any more?).  Only CALL
> >and JP can use it though.
> >
> >>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?
> >> 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?
> >> ...
> >>
> >>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.
> >>
> >
> >_____________________________________________________________________
> >You don't need to buy Internet access to use free Internet e-mail.
> >Get completely free e-mail from Juno at http://www.juno.com
> >Or call Juno at (800) 654-JUNO [654-5866]

-- 
Scott Dial
revenant_1@hotmail.com
ICQ#3608935


References: