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

[f-cpu] Stack handling



I've reread the manual and found a problem in stack handling suggestion

The manual say :

pop = load 8, r3, r2
push = store -8, r3, r2

With r3 a stack pointer and r2 a value to be pushed/poped to/from the stack.

but this was false, for example try to make :
push r2
pop r2

you obtain this code

store -8, r3, r2
load 8, r3, r2

you push r2 at r3 address and increment r3,
and after you get in r2 the value at r3 and decrement the pointer
so after executing this you don't have the same value in r2... Bug

We can't manage a stack without pre-decrement instruction, or we need a 
lot of tricks and obtain very bad code...

Tom

-- 
Thomas Lavergne                       "Le vrai rêveur est celui qui rêve
                                        de l'impossible."  (Elsa Triolet)
thomas.lavergne@laposte.net
d-12@laposte.net    ICQ:#137121910     http://assoc.wanadoo.fr/thallium/

*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/