Re: LZ-Adv: JR or JP cc, *


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

Re: LZ-Adv: JR or JP cc, *



>> You cant just say JR, there is a macro defined in the ti-85.h file
that
>> does it correctly for you.
>
>  Why?


He's got it backwards.  JR works, JP doesn't.


suppose you're at byte 0 of your program, (the first byte), and you want
to jump to byte 24


JR 24 says, essentialy, jump forward 24 bytes.  this works no matter what
byte you're on  if your program starts at byte 100, 24 bytes forward is
still the right place to be going.


JP 24 says "jump to to the byte that is 24 bytes from the start of the
memory."  if your program starts at byte zero, that's fine.  byte 24
would then be the 24th byte of the progeam.  But suppose your program
sterts at byte 100.  when your progam jumps to byte 24, it has just
jumped to a location that's completely outside of your program.  you
really need to jump to byte 124. 100  is the distance from the beginning
of memory, and 24 is the distance from program start.  Add them together,
and you've got the distance from beginning of memory to byte 24 of your
program.  but since programs can move around, you never know what the
first number is untill you run the program.  it might be 100, it might
not.  so what you do is use JUMP_(24) instead of JP 24.  JUMP_(x) is
actually a call to a routine that fugures out the location of the start
of your program, and adds it for you.  That way, it's all automated, so
you don't really have to think about it.  Just juse JUMP_(x) instead of
JP x.  (and JUMP_C(x) instead of JP  C,x and so on.)


Hope this helps,


Jason "Thursday" Wenger
jwenger@juno.com
Illegitimi no carborundum


References: