; QUIET.MAC ; ; Sets, resets, and displays the ZCPR3 quiet flag. ; Vers equ 13 SubVers equ ' ' ; ; USAGE: ; ; QUIET {{/}option} ; ; If no options are given, DISPLAY is assumed. ; ; OPTIONS: For all options only enough letters to be unique are required; ; that is, only a single letter for all options except ON and OFF, which ; require two letters. ; ; {Q}DISPLAY Displays current state of quiet flag. This is the ; default option. ; ; {Q}SET Turns on (sets) quiet flag. ; ; {Q}RESET Turns off (resets) quiet flag. ; ; {Q}ON Turns on (sets) quiet flag. ; ; {Q}OFF Turns off (resets) quiet flag. ; ; If the wheel byte is off or if the QtFlag configuration byte is set, ; the SET/RESET and ON/OFF displays will be suppressed. If any option ; is preceded by a "Q", the current default display state will be ; toggled to its non-default state. The "Q" modifier is ignored if it ; is used alone or with the DISPLAY option. If an invalid option is ; given, the program error code is set to 19 and the error handler is ; invoked. ; ; Version 1.3 -- October 11, 1990 -- Gene Pizzetta ; Added command line quiet option and quiet configuration byte. ; Put stack in DSEG and a few other changes to modernize code. ; Still under 1K. ; ; Version 1.2 -- June 24, 1990 -- Gene Pizzetta ; It seems a little silly for QUIET to obey the quiet flag, since ; the flag is apt to change while the program is running. Instead, ; this version uses the wheel byte like a quiet flag. Also added ; ON and OFF as alternate options for SET and RESET. Made DISPLAY ; option the default. Now allows leading slash for options. Added ; Type 3 header. Displays version and load address only on the ; help screen. Sets program error flag and invokes error handler ; if invalid option is given. Now uses library routines for most ; functions. Uses actual program name on help screen. ; ; Version 1.1 -- ; I did not have access to the source code for version 1.1, but the ; only difference from 1.0 appears to be observance of the quiet ; flag for display of the help screen, the use of Z80-specific ; opcodes, and printing the program name and version number with ; the D option. ; ; Program: QUIET ; Author: Richard Conn ; Version: 1.0 ; Date: 29 Mar 84 ; ; Equates ; fcb equ 5Ch z3env equ 0FE00h cr equ 0Dh lf equ 0Ah ; MACLIB Z80 ; extended Intel mnemonics ; ; SYSLIB and Z3LIB Routines ; ext z3init,getwhl,getquiet,putquiet,puter2,inverror,prtname ext eprint,phl4hc ; ; TYP3HDR.MAC, Version 1.1 -- Extended Intel Mnemonics ; This code has been modified as suggested by Charles Irvine so that it will ; function correctly with interrupts enabled. ; Extended Intel mnemonics by Gene Pizzetta, April 30, 1989. ; entry: jr start0 ; Must use relative jump db 0 ; Filler db 'Z3ENV',3 ; Type-3 environment z3eadr: dw z3env ; Filled in by Z33 dw entry ; Intended load address ; ; Configuration area . . . ; db 'QUIET' ; for ZCNFG db Vers/10+'0',Vers mod 10+'0',' ' QtFlag: db 0 ; non-zero=default to quiet mode ; start0: lxi h,0 ; Point to warmboot entry mov a,m ; Save the byte there di ; Protect against interrupts mvi m,0c9h ; Replace warmboot with a return opcode rst 0 ; Call address 0, pushing RETADDR onto stack retaddr: mov m,a ; Restore byte at 0 dcx sp ; Get stack pointer to point dcx sp ; ..to the value of RETADDR pop h ; Get it into HL and restore stack ei ; We can allow interrupts again lxi d,retaddr ; This is where we should be xra a ; Clear carry flag push h ; Save address again dsbc de ; Subtract -- we should have 0 now pop h ; Restore value of RETADDR jrz start ; If addresses matched, begin real code ; lxi d,notz33msg-retaddr ; Offset to message dad d xchg ; Switch pointer to message into DE mvi c,9 jmp 0005h ; Return via BDOS print string function notz33msg: db 'Not Z33+$' ; Abort message if not Z33-compatible ; ; Start of program . . . ; Start: lhld z3eadr ; get descriptor address call z3init ; initialize environment sspd Stack ; save old stack pointer lxi sp,Stack ; ..and set up new stack ; ; Set default Q option ; call getwhl ; is wheel byte set? lda QtFlag ; get configuration byte jrnz SetZQt ; (wheel, so config has priority) mvi a,0FFh ; no wheel, so default to quiet mode SetZQt: sta OpQFlg ; ; ; Check for Command ; lxi h,fcb+1 mov a,m ; get first option character cpi '/' ; slash? jrnz getopt inx h ; skip slash mov a,m cpi '/' ; help request? jz usage getopt: cpi 'Q' ; quiet request? cz qqopt cpi ' ' ; a space? jrz qdisp cpi 'R' ; reset? jrz qreset cpi 'S' ; set? jrz qset cpi 'D' ; display? jrz qdisp cpi 'O' ; on/off? jrnz invopt inx h ; get next character mov a,m cpi 'F' ; off? jrz qreset cpi 'N' ; on? jrz qset invopt: call eprint db 'Invalid option.',0 mvi a,19 ; set error code jr ErExit ; Exit: xra a ; set for no error ErExit: call puter2 ; set program error code mov b,a ; put code in B ora a ; error? cnz inverror ; yes, invoke error handler lspd Stack ; restore old stack ret ; ..and return to CCP ; ; Reset Quiet ; qreset: xra a ; reset value call putquiet lda OpQFlg ; check Q flag ora a jrnz Exit ; (no display) jr qdisp ; ; Set Quiet ; qset: mvi a,0FFh ; set value call putquiet lda OpQFlg ; check Q flag ora a jrnz Exit ; (no display) ; ; Display Quiet Flag ; qdisp: call getquiet ; get quiet flag call eprint db ' Quiet Flag is ',0 jrz qdispr call eprint db 'On (Set)',0 jr Exit ; qdispr: call eprint db 'Off (Reset)',0 jr Exit ; ; Print usage ; usage: call eprint db 'QUIET Version ' db (Vers/10)+'0','.',(Vers mod 10)+'0',SubVers,' (loaded at ',0 lxi h,entry call phl4hc call eprint db 'h)',CR,LF,0 call eprint db 'Usage:',CR,LF,' ',0 call prtname call eprint db ' {{/}option}',CR,LF db 'Sets, Resets, and Displays ZCPR3 Quiet Flag.',CR,LF db 'Options:',CR,LF db ' D{ISPLAY} Show current flag status.',CR,LF db ' S{ET} Turn flag on.',CR,LF db ' R{ESET} Turn flag off.',CR,LF db ' ON Turn flag on.',CR,LF db ' OF{F} Turn flag off.',CR,LF db 'Default is DISPLAY.',CR,LF db 'Q before option (e.g., "QON"), ',0 lda OpQFlg ; check configuration byte ora a jrnz Usage1 call eprint db 'inhibits',0 jr Usage2 Usage1: call eprint db 'causes',0 Usage2: call eprint db ' display of result.' db 0 jmp Exit ; ; Toggle Q option ; qqopt: lda OpQFlg ; get Q flag rar ; get low bit into carry sbb a ; set all bits according to carry cma ; flip sta OpQFlg ; ..and set it inx h ; increment pointer mov a,m ; ..and get next character ret ; ; Uninitialized data . . . ; DSEG ; OpQFlg: ds 1 ds 30 Stack: ds 2 ; end