[A83] Re: Stacking


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

[A83] Re: Stacking




This should work:

but maybe not, if io pushes some things onto the stack and wants to pop them again.


> 
> .nolist
> #include "ion.inc"
> .list
> #ifdef TI83P
>         .org    progstart-2
>           .db     $BB,$6D
> #else
>         .org    progstart
> #endif
>         ret
>         jr      nc,begin
> 
>         .db     "DeztroyThaVAT",0
> Begin:
   ld (saferam),sp
>  ld b,$FF
>  ld hl,$0000
   ld sp,(VAT)
> loop:
>  push hl
>  djnz loop
   ld sp,(saferam)
>  ret
> .end
> END
> 
> 
> How Evil Is This >:->
> However, it doesn't seem to work.
> 
> >Good point, I had written the message before I thought well.
> >Point of concern is that you must remember to put the stack pointer at the
> >END of the memory block, in the example case:
> >ld sp,plotsscreen+300h
> >
> >If you don't, then PUSHES :-) will corrupt other data.
> >
> >Thanks for the correction.
> >--(Peter-Martijn)
> >
> >>
> >> Popping doesn't corrupt data anyway, only pushing does.  And if your code
> >> doesn't manage it's pushes and pops properly, it's likely to crash no
> matter
> >> where the stack pointer is.
> >>
> >>
> >> In a message dated 7/14/2001 10:38:20 AM Eastern Daylight Time,
> >> hyper@hysoft-automation.com writes:
> >>
> >>
> >> > Well, I meant that if you need to be careful, since if you pop a little
> too
> >> > often, you end up corrupting data.
> >> > Also, I might have misinterpreted some previous posts about using the
> stack
> >> > pointer, and I actually added the statement to point out that I do know
> >> > about
> >> > the dangers.
> >> >
> >> >
> >>
> >>
> >>
> >>
> >> ----
> >> Jonah Cohen
> >> <ComAsYuAre@aol.com>
> >> http://jonah.ticalc.org
> >>
> >>
> >>
> >
> >
> >
> 
> 
> 




References: