Re: A82: ASH Routine


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

Re: A82: ASH Routine




In a message dated 98-04-10 15:14:48 EDT, you write:

>     I need an ASH routine that will exit to ASH no matter how deep in
>  subroutines I am.  I know I can inc the sp register that many times and
>  then ret but this routine may be called from many different points in my
>  program and I won't know how many subroutines I will be in when it is
>  called.

First of all, I have often wondered why people say ASH instead of Ash.  When
you're in Ash it is in title format!
Secondly, why didn't my ideas work?  here's what you do:

at the VERY beginning, do these instructions:

push sp
pop hl
ld (sp_buffer_that_is_two_bytes_long),hl

reserve two bytes in the text mem or your program for
sp_buffer_that_is_two_bytes_long.  then whenever you want to return to ash
call the RETURN subroutine, listed below:

ld hl, (sp_buffer_that_is_two_bytes_long)
push hl
pop sp
ret

and no matter how deep into the program you are or how many pushes you have
done, this will return to Ash.
What happens when you try to do this?
If there are any errors, please tell me!

~Adamman