Showstack#

Displaying Stack Contents#

The contents of the stack are normally invisible. However, properly visualizing the current stack contents is important for achieving the desired result. To show the stack contents with every ok prompt, type: showstack
ok
showstack
44 7 ok
8
47 7 8 ok
noshowstack
ok

The topmost stack item is always shown as the last item in the list, immediately before the "ok" prompt. In the above example, the topmost stack item is 8.

showstack ( -- )

Prints the content of the stack preceding the "ok" prompt.

noshowstack ( -- )

Stops printing of the stack content

Source Code#

( showstack )

BASE @ ( save base )
HEX

: .SOK .S ." ok" R> 3 + >R ;

2F7B CONSTANT OKPROMPT ( <-- implementation dependent! )
OKPROMPT @ CONSTANT ORGOK
' .SOK CFA CONSTANT NEWOK

: SHOWSTACK NEWOK OKPROMPT ! ;
: NOSHOWSTACK ORGOK OKPROMPT ! ;

BASE ! ( restore base )
." SHOWSTACK loaded..."
  

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-2) was last changed on 03-Feb-2023 16:21 by Carsten Strotmann  
G’day (anonymous guest) My Prefs
© 2010-2021 AtariWiki
All content in the Wiki is licensed under Creative Commons Share Alike License, unless otherwise noted.
JSPWiki v2.8.3