[A86] Re: TI-86 Menu Routine
[Prev][Next][Index][Thread]
[A86] Re: TI-86 Menu Routine
On Mon, 2 Sep 2002 07:08:23 -0500 "David Phillips" <david@acz.org>
writes:
>
> Michael Williams writes:
> > No, I havent actually done that, but I read about it once. My
> other
> > thought would be to do this:
> >
> > ld hl,table
> > call Do_Menu
>
> Passing arguments in registers will almost always give you better
> performance (space and time) than passing on the stack. This is
> especially
> true on the z80 since it doesn't have instructions that optimize
> stack frame
> creation.
Well, except here the choice is between passing parameters on the stack
or passing them in memory with a pointer, and he's not even using a stack
frame. This code would not be callable from C, but it reminds me of that
:)
If anyone's wondering, here's how a stack frame generally works on a z80:
; enter stack frame
push ix
ld ix,0
add ix,sp
; here you can allocate space on the stack for local vars
; usually by pushing garbage, but if you need a lot you'd sbc it from sp
; ix-5 = last byte of parameters
; ix+0 = first byte of local vars
; exit stack frame
ld sp,ix
pop ix
ret
Not very efficient at all.
-rabidcow
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
http://dl.www.juno.com/get/web/.