Re: LZ: jump tables vs. lookup tables (WAS: Re: LZ: my 2 frozen
[Prev][Next][Index][Thread]
Re: LZ: jump tables vs. lookup tables (WAS: Re: LZ: my 2 frozen
Ben Shakal wrote:
>
> Keith Burzinski wrote:
>
[snip]
> > MUCH earlier on (before I even tried it), I had just looked over the
> > orginal 85b in a HEX editor. (I wanted to find some ROM info... ;)
> > anyway, what I found was a series of addrs preceded by "C3"s...
> > indicating one thing: JUMP TABLES!!! Do you all know how
> > size-inefficient that is??? VERY!!! yeah, it is _faster_, but MUCH
> > larger! Especially with all the new (44?) ROM calls they added.
> > HA!
>
> What are they so much larger than, lookup tables? It seems to me
> that you still need to store the actual address to jump to, just
> without the C3's. So if you did that, you would save, according to
> your estimate, 44 bytes, one for each ROM call. And that doesn't
> include the code needed to actually calculate the lookup table
> offset. So it doesn't sound like you are really saving a huge amount
> of space with lookup tables, and because of the significant time
> savings of a jump table, I think it is worth the extra few bytes (not
> even 44).
Well, I suppose that is, in a way, true, however with the jump table
(the way our shells are set up--index numbers) you would still need to
look up the address of the proper jp instruction... so, really, most of
the code still needs to be there....
> (BTW, in CShell, how many bytes of code does it take to
> perform the lookup? Just curious.)
The code in CShell that does this is not very big (~50 bytes I think).
I have made it a bit more efficient than what is in ZShell (by a few
bytes). I am currently planning an entirely new way to handle this that
will use a significantly smaller amount of space and will also be MUCH
faster... :)
HAND,
--
~Keith
TSK3000@Prodigy.Net
----
VISIT THE OFFICIAL CSHELL HOMEPAGE AT:
http://pages.prodigy.net/tsk3000/CShell/
References: