user1018183
user1018183

Reputation: 95

Show the return stack

Can you show the return stack in Forth?

.S shows the parameter stack. Is there a similar word showing the contents of the return stack?

I found SHOWSTACK on the web, but it does't work.

Upvotes: 2

Views: 702

Answers (2)

Lehs
Lehs

Reputation: 822

I think you could use this code if you are curious about the return stack:

: RTEST RP@ DUP >R RP@ RDROP SWAP - ;

RTEST CONSTANT RSTEP
RP@ CONSTANT RBIAS

: .RETURNSTACK \ --
  RP@ RBIAS 
  DO I @ U. RSTEP
  +LOOP CR ;

Upvotes: 4

Lars Brinkhoff
Lars Brinkhoff

Reputation: 14325

There's no such word in ANS Forth.

As for Gforth, there is the word bt since late 2012.

Upvotes: 1

Related Questions