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

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
----------------------------------------------------------------------
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 - 16:47:49 PST
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:23 PST