![]() | ||
| Home | SwiftX Archive | SwiftForth Archive | |

At 06:47 PM 3/29/2002 -0600, you wrote:
>How would I write a word that returns the depth of the return stack right
>before that word was called?
>
>Given that Motorola 68k RP@ returns the address of the top of the return
>stack (ie. the address an EXIT in RP@ would return to):
>CODE RP@ ( -- addr ) R S -) MOV RTS END-CODE
>
>RDEPTH's 1- accounts for RP@ returning top with address within RDEPTH that
>it's EXIT will return to. Problem is, SwiftX's optimizer replaces jumps at
>end of definitions to branches so the following definition is unreliable:
>: RDEPTH ( -- n ) STATUS RP@ - CELL / 1- ;
>
>: test1 RDEPTH ; ok
>test1 . 4 ok
>: test2 RDEPTH . ; ok
>test2 5 ok
RDEPTH is perfectly reliable, it's accurately reporting two different
situations.
I assume you're doing this for debugging purposes. If you want to,
you can turn off the optimizer using -OPTIMIZER for your code
being debugged. Turn it back on with +OPTIMIZER.
Cheers,
Elizabeth
================================================
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310-491-3356
5155 W. Rosecrans Ave. #1018 Fax: +1 310-978-9454
Los Angeles, CA 90250
http://www.forth.com
"Forth-based products and Services for real-time
applications since 1973."
================================================
----------------------------------------------------------------------
swiftx_at_forth.com The SwiftX programming discussion email list
To unsubscribe, send subject "unsubscribe swiftx" to listar_at_forth.com
For help with listar commands, send subject "help" to listar_at_forth.com
Archives are located at http://www.forth.com/swiftx -- check them out!
----------------------------------------------------------------------
THIS LIST IS NOT FOR BUG REPORTS! Send bug reports to support_at_forth.com.
Received on Fri Mar 29 2002 - 17:01:14 PST
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST