A86: Re: No memory


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

A86: Re: No memory




This makes a lot of sense as long as you don't push stuff onto the stack
during those calls without popping it (somewhat uncommon). This also has the
extreme advantage that in the case of > 128 bytes worth of these things, the
use of 3-byte JP has been replaced with one byte RET.

This is actually kind of interesting... If you have <= 4 branches, the jr z
method is most efficient; if you have a lot of branches, especially if they
are in consecutive byte values, a lookup table is most efficient; and
otherwise this looks most efficient.

----- Original Message -----
From: David Phillips <david@acz.org>
To: <assembly-86@lists.ticalc.org>
Sent: Saturday, March 04, 2000 12:17 AM
Subject: A86: No memory


>
> This link was posted on the gbdev list:
>
> http://www.jdm.homepage.dk/nomem.htm
>
> I've never seen this used anywhere before, but it's quite an interesting
at
> programming.  A variation that I have used allows a smaller way of
returning
> from a large case type structure.  Instead of doing this:
>
>  ...
>  jr z,end
>  ...
>  jr z,end
>  ...
> end:
>
>
> Something like this:
>
>  ld hl,end
>  push hl
>  ...
>  ret z
>  ...
>  ret z
>  ...
> end:
>
>
> Comments?
>
> --
> David Phillips <david@acz.org>
> http://www.acz.org/
>
>



References: