Re: TIB: How does goto work?


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

Re: TIB: How does goto work?




On Mon, Jan 31, 2000 at 10:42:05 -0500, KeysDezes@aol.com wrote:
> 
> Well, they would have to still be there so that you can see them when you 
> edit the code.  Comments still have to be there too!  I'm wondering if the 
> goto changes.  That really is pretty stupid if it actually does it like 
> that...

Uhm... yeah, right. I didn't think of that.

I was actually disassembling the "Goto" command in the interpreter. It
basically starts searching for "Label" and when it finds one, it compares
the labels and, if the labels match, updates the program execution pointer.
Otherwise it searches for the next label, etc.

The tokenized code for Goto and Label is:
Goto:	$E4,$2E,$00,<label>,$00
Label:	$E4,$30,$00,<label>,$00
(note: the codes are stored backwards on the calc)

As you can see, the only reference from the Goto to the Label is the <label>
part. There's no "jump forward/backward this many bytes" encoding at all.


/Johan


References: