Re: A83: Re: jr and jp


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

Re: A83: Re: jr and jp




If you use jr then the sign bit is set (bit 7) on the relative address,
and with a jp then you would have to compare it to PC and use the c flag
to tell which way. There really is no need to be able to know which way
though.

yhean wrote:
> 
> How can we know if the jump is backward or forward?
> 
> On Tue, 30 Nov 1999 21:49:18   David Phillips wrote:
> >
> >JR = 38 XX           ; 2 bytes, 12 t-states
> >
> >XX is a signed byte, indicating a relative number of bytes to jump to,
> >backwards or forwards.  The jump takes place after the program counter is
> >incremented, so a value of 0 would be the instruction following the JR.  JR
> >should be used anytime to move inside the program, if possible.  It can be
> >used at all times, since the assembler will (should) warn if the relative
> >jump is too long.  In that case, it can be changed to a JP.
> >
> >JP = C3 XX XX     ; 3 bytes, 10 t-states
> >
> >XX XX is a word value, indicating an absolute address to jump to.  This can
> >be used to make jumps of any distance, anywhere in memory.  It should be
> >used when jumping to ROM calls, or memory locations too far away for JR to
> >be used.
> >
> >The difference in a large program could be several hundred bytes, but in a
> >small program would not likely be very noticable.  However, all effort
> >should be made to use JR when possible.  The differences in speed do not
> >warrant using JP in even the most tightly optimized code (no code I have
> >ever seen or written would be sped up enough to make JP useful over
> >JR...including the ROM linking routines).
> >
> >> i know ASMhuru explains these commands but..how do i know which one to
> >> use...and will using jr make any significant size differences in the
> >program
> >
> >
> >
> >
> 
> Get your FREE Email at http://mailcity.lycos.com
> Get your PERSONALIZED START PAGE at http://my.lycos.com

-- 
Scott "_Wrath_" Dial
wrath@calc.org
ICQ#3608935
TimeCity AI Guy II - www.timecity.org
Member of TCPA - tcpa.calc.org
__________________________________________
NetZero - Defenders of the Free World
Get your FREE Internet Access and Email at
http://www.netzero.net/download/index.html


References: