Re: A83: Question about compares.
[Prev][Next][Index][Thread]
Re: A83: Question about compares.
Actually no. jr's and jp's aren't quite the same thing. Jp's are faster
than jr's. Jr takes 2 bytes while jp takes 3 (contrary to what you said).
Jp also has many more conditions to jump on that jr. Oh and another thing,
jr can only jump, what is it, 128 bytes forward and 126 bytes backwards?
(not 256 either way). So, jp's and jr's are really not interchangable. If
you need every clock for a speed intesive game, you'd want to use jp, if you
wanted to save as much space as possible, you'd use jr, if you need to check
for conditions other than z,nz,c,nc you'd use jp, and if you needed to jump
past the range of jr, you'd use jp. In any case, you can see that they can
have different uses (although in most cases it doesn't really matter which
you use)
-Dan
>
>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
Follow-Ups: