266 ● ZS  DMC-40x0 Command Reference 
ZS   
FUNCTION:  Zero Subroutine Stack 
DESCRIPTION: 
The ZS command is only valid in an application program and is used to avoid returning from an 
interrupt (either input or error).  ZS alone returns the stack to its original condition.  ZS1 
adjusts the stack to eliminate one return.  This turns the jump to subroutine into a jump. Do 
not use RI (Return from Interrupt) when using ZS.  To re-enable interrupts, you must use II 
command again. 
The status of the stack can be interrogated with the operand _ZSn - see operand usage below.  
ARGUMENTS:  ZS n  where  
  n = 0   Returns stack to original condition 
  n = 1   Eliminates one return on stack 
USAGE:    DEFAULTS: 
While Moving  Yes  Default Value  0 
In a Program  Yes  Default Format  3.0 
Command Line  No     
Controller Usage 
ALL CONTROLLERS 
OPERAND USAGE: 
_ZSn contains the stack level for the specified thread where n = 0 to 7.   
EXAMPLES: 
#A  ;'Main Program 
II1  ;'Input Interrupt on 1 
#B;JP #B;EN  ;'Loop 
#ININT  ;'Input Interrupt 
MG "INTERRUPT"  ;'Print message 
S=_ZS  ;'Interrogate stack 
S= 
;'Print stack 
ZS  ;'Zero stack 
S=_ZS  ;'Interrogate stack 
S= 
;'Print stack 
EN  ;'End