; PROGRAM: SHSET ; VERSION: 1.0 ; DATE: 19 July 84 ; AUTHOR: Richard Conn ; PREVIOUS VERSIONS: None ; z3env equ 0f400h VERS EQU 10 ;version number ; SHSET is copyright (c) 1984 by Richard Conn ; All Rights Reserved ; SHSET may be used freely by the ZCPR3 Community ; ; SHSET is used to establish a command line as a shell. It pushes ; the command line (including semicolons) which follow the verb SHSET onto ; the shell stack if it fits. ; ; Syntax: ; SHSET cmd1;cmd2;... ; ; The sequence of commands "cmd1;cmd2;..." becomes the shell. ; ; ; SYSLIB, Z3LIB, and VLIB References ; ext z3init ext shpush,getcl1,getcl2,putshm,getsh,getsh2 ext eprint,phlfdc ext codend ; ; Basic Definitions ; TRUE EQU 0FFH ;define true and.. FALSE EQU 0 ;..false. ; ; System Addresses ; OS$BASE EQU 000H ;system base.. BDOS EQU OS$BASE+05H FCB EQU OS$BASE+5CH FCB2 EQU OS$BASE+6CH TBUFF EQU OS$BASE+80H TPA EQU OS$BASE+100H ; ; ASCII Chars ; LF EQU 0AH ;..linefeed.. CR EQU 0DH ;..carriage return.. ; ; 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 ; ; Mainline ; call z3init ;initialize the ZCPR3 Env ; ; Print Prompt ; call eprint db 'SHSET, Version ' db (VERS/10)+'0','.',(VERS MOD 10)+'0' db 0 lda fcb+1 ;check for help request cpi '/' ;help? jz help cpi ' ' jnz shinit ; ; Print Help Message ; help: call eprint db cr,lf,' Syntax: SHSET cmd1;cmd2;...' db cr,lf,' SHSET defines the command sequence to be a shell' db 0 ret ; ; Initialize Shell ; shinit: call shtest1 ;there must be a shell stack call shtest2 ;there must be a command line buffer ; ; HL now points to the command line buffer ; call codend ;pt to free area xchg ;... in DE lxi h,tbuff+1 ;pt to option input mov a,m ;check for no input ora a ;none if zero jz checkcl inx h ;pt to first good char call copystr ;copy string checkcl: call getcl2 ;get address of command line jz setsh ;set shell command call copystr ;copy string setsh: call codend ;pt to string call shpush ;push onto shell stack jnz sherr ;error? ; ; Set Shell Messages ; mvi a,0 ;Zero Message 0 mvi b,0 call putshm ; mvi a,0 ;Zero Message 1 mvi b,1 call putshm ; call eprint db ' Shell Installed',0 ; exit: call getcl2 ;terminate following command mvi m,0 ;set ending 0 ret ; ; Error in Shell Stack Installation ; sherr: cpi 2 ;shell stack full jnz sherr1 call eprint db ' Shell Stack Full',0 jmp exit sherr1: call eprint db ' Shell Entry too Large -- Limit is ',0 call getsh2 ;get limit in DE xchg call phlfdc ;print as floating decimal call eprint db ' Characters',0 jmp exit ; ; Check for Presence of Shell Stack ; shtest1: call getsh ;get shell stack data rnz pop psw ;clear stack call eprint db ' No Shell Stack',0 ret ; ; Check for Command Line ; shtest2: call getcl1 ;get command line data rnz pop psw ;clear stack call eprint db ' No Command Line',0 ret ; ; Copy string from HL to DE ; Store ending 0 and leave pointer in DE to it ; copystr: mov a,m ;get char stax d ;store it ora a ;done? rz inx h ;pt to next inx d jmp copystr end