; ; Program: SHCTRL ; Author: Richard Conn ; Version: 1.0 ; Date: 29 Mar 84 ; version equ 10 z3env SET 0f400h ; ; SHCTRL is used to provide simple control of the ZCPR3 shell ; stack from the command line. This program accepts one of two parameters: ; ; SHCTRL CLR or SHCTRL C <-- Clear the Shell Stack ; SHCTRL DIS or SHCTRL D <-- Display Shell Stack ; SHCTRL POP or SHCTRL P <-- Pop the Shell Stack ; ; ; Equates ; fcb equ 5ch cr equ 0dh lf equ 0ah ; ; SYSLIB and Z3LIB Routines ; ext z3init,shpop,getsh2,qprint,print,pafdc,pstr ; ; Environment Definition ; if z3env ne 0 ; ; External ZCPR3 Environment Descriptor ; jmp start db 'Z3ENV' ;This is a ZCPR3 Utility db 1 ;External Environment Descriptor z3eadr: dw z3env start: lhld z3eadr ;pt to ZCPR3 environment ; else ; ; Internal ZCPR3 Environment Descriptor ; MACLIB Z3BASE.LIB MACLIB SYSENV.LIB z3eadr: jmp start SYSENV start: lxi h,z3eadr ;pt to ZCPR3 environment endif ; ; Start of Program -- Initialize ZCPR3 Environment ; call z3init ;initialize the ZCPR3 Env and the VLIB Env ; ; Print Banner ; call qprint db 'SHCTRL Version ' db (version/10)+'0','.',(version mod 10)+'0',0 ; ; Check for Command ; lda fcb+1 ;get first char cpi 'C' ;clear? jz shclear cpi 'D' ;display? jz shdisplay cpi 'P' ;pop? jz shspop ; ; Print help ; call print db cr,lf,'SHCTRL - Control Shell Stack' db cr,lf,'Syntax:' db cr,lf,' SHCTRL C or SHCTRL CLR - Clear Shell Stack' db cr,lf,' SHCTRL D or SHCTRL DIS - Display Shell Stack' db cr,lf,' SHCTRL P or SHCTRL POP - Pop Shell Stack' db 0 ret ; ; Clear Shell Stack ; shclear: call getsh2 ;get address of shell stack mvi m,0 ;clear it call qprint db ' - Shell Stack Clear',0 ret ; ; Pop Shell Stack ; shspop: call shpop ;pop stack call qprint db ' - Shell Stack Popped',0 ret ; ; Display Shell Stack ; shdisplay: call getsh2 ;get address of shell stack (HL), size of ; shell stack entry (DE), and count (A,B) call print ;print message db ' - Shell Stack Data' db cr,lf,' Size of Shell Stack: ',0 mov a,b ;get size call pafdc ;print call print db ' Elements' db cr,lf,' Shell Stack Elements:',0 mov a,m ;check for empty ora a jnz shdisp1 call print db cr,lf,' Shell Stack Empty',0 ret shdisp1: mov a,m ;check for done ora a rz call print db cr,lf,' --> ',0 push h ;save ptr call pstr ;print element pop h ;get ptr dad d ;count down dcr b ;count down jnz shdisp1 ret end