[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[f-cpu] Stack handling
- To: FCpu English <f-cpu@seul.org>
- Subject: [f-cpu] Stack handling
- From: Thomas Lavergne <thomas.lavergne@laposte.net>
- Date: Tue, 23 Jul 2002 06:42:26 +0200
- Delivered-To: archiver@seul.org
- Delivered-To: f-cpu-outgoing@seul.org
- Delivered-To: f-cpu@seul.org
- Delivery-Date: Tue, 23 Jul 2002 00:49:13 -0400
- Organization: THallium Software
- Reply-To: f-cpu@seul.org
- Sender: owner-f-cpu@seul.org
- User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.0.0) Gecko/20020530
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/