Re: A82: ASH Routine


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

Re: A82: ASH Routine




In a message dated 98-04-10 19:13:27 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.
>  
>  This works in CrASH too BTW.  This uses self-modifying code - if you
>  don't understand it, don't worry about it.
>  
>  At very beginning of program:
>  
>  ld hl,0
>  add hl,sp
>  ld (SAVED_SP+1),hl
>  
>  ...
>  
>  Then later:
>  
>  EXIT_2_CRASH:
>  SAVED_SP:
>  ld sp,0
>  ret
>  
>  
>  To return to CrASH, do jp EXIT_2_CRASH
>  
>  -- Barubary

that's pretty clever.  I have seen something of that sort done in other
languages, but never in ASM.  it's better than mine.  use this :-)

~Adamman