On 7/28/06, Daniel Martin <martin / snowplow.org> wrote:
> > While I'm on the subject, let's talk about addresses in detail. Your
> > current address in the file is how many bytes you are from the
> > beginning of the file. So if I am at address 008 in the file, I am
> > eight bytes away from the beginning of the file, and therefore the
> > next byte I read will be byte nine. Say we had the opcode 100F, that
> > means we would jump to after byte 16 (it is a hex remember).
>
> I'm not sure you mean this.  I think you mean either "jump to before
> the 16th byte" or meant to use opcode 1010.
>
> Looking at your program, I see an easy way to make this explanation
> easier:
>
>   Opcode 0100 will send you back to the beginning, so that the next
>   instruction read and executed is the first instruction of the file.
>   Opcode 0102 will send you back to the second instruction in the file
>   (remember that instructions are four hex digits - or two bytes -
>   long).  Other addresses follow.

I think you mean 1000 and 1002 in the description above. :)

So, should an absolute jump to N make it so that the Nth (0-based
index) instruction is the next executed, or the (N+1)th? You're
example above seems to put it both ways. 1000 sends you back to the
beginning, so the "0th" instruction (first instruction in the file) is
the next executed. But then 1002 should make it so that the "2nd"
instruction (third instruction in the file) is the next executed,
right? Maybe this is what you meant by "second" anyways...

Jacob Fugal