: \ [ $ 000A l ] word ] drop ] ; : yy [ $ 1c l ] ; \ from assembler.f : stack-end ( -- n ) \ smaller number ] yy ] @ \ byte address of the upmost stack element \ *in memory*, not the TOS ] 1+ ] ; \ yy has been on the stack. \ add only one to convert to word address : stack-begin ( -- n ) \ higher number ] interp [ $ 0ff l ] + \ byte address of the downmost stack element ] 1- ] ; \ convert to word address : stack-length ( in memory stack, without TOS ) ] stack-begin ] stack-end ] - ] 2/ ] ; \ we would have to add 1 again, but as "stack-begin" is itself \ on the stack, the value is already incremented : .s-element ( stack-begin n -- stack-begin n-1 ) ] swap ] dup ] @ ] h. ] 1- ] 1- ] swap \ print stack element, decrement ] 1- ] if ] .s-element ] ; ] then ] drop ] ; ( loop ) : .s ] stack-begin ] stack-length ] .s-element ] drop ] ; \ We don't need to correct the length although "stack-begin" \ is itself on the stack. This is just fine as it occupies \ the TOS register, and we print only the in memory stack \ without the TOS. It's just what we want. )