home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
ZSUS
/
ZSUS009.LBR
/
QUIET12.LBR
/
QUIET12.MZC
/
QUIET12.MAC
Wrap
Text File
|
1990-06-23
|
6KB
|
239 lines
; Program: QUIET
; Author: Richard Conn
; Version: 1.0
; Date: 29 Mar 84
;
; QUIET sets, resets, and displays the ZCPR3 quiet flag.
;
Vers equ 12
SubVers equ ' '
;
; 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.
;
; 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.
;
; DISPLAY Displays current state of quiet flag. This is the
; default option.
;
; SET Turns on (sets) quiet flag.
;
; RESET Turns off (resets) quiet flag.
;
; ON Turns on (sets) quiet flag.
;
; OFF Turns off (resets) quiet flag.
;
; If the wheel byte is off, the SET/RESET and ON/OFF options cause
; no display on the console. If invalid option is given, program
; error code set to 19 and error handler is invoked.
;
; Equates
;
fcb equ 5Ch
z3env SET 0F400h
cr equ 0Dh
lf equ 0Ah
;
MACLIB Z80
;
; SYSLIB and Z3LIB Routines
;
ext z3init,getefcb,gzmtop,getwhl,getquiet,putquiet
ext puter2,inverror
ext eprint,phl4hc,bout
;
; 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.
; This is header code that can be used at the beginning of a type-3-environment
; program so that it will abort with an error message when not loaded to the
; correct address (such as when a user tries to run it under CP/M or Z30).
;
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
;
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 OldStk ; save old stack pointer
call gzmtop ; get top of memory
sphl ; ..and set up new stack
;
; 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?
jrz usage
getopt: cpi ' ' ; a space?
jz qdisp
cpi 'R' ; reset?
jz qreset
cpi 'S' ; set?
jz qset
cpi 'D' ; display?
jz qdisp
cpi 'O' ; on/off?
jrnz invopt
inx h ; get next character
mov a,m
cpi 'F' ; off?
jz qreset
cpi 'N' ; on?
jz qset
invopt: call eprint
db 'Invalid option.',0
mvi a,19 ; set error code
jr ErExit
;
Exit: mvi a,0 ; 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 OldStk ; restore old stack
ret ; ..and return to CCP
;
; 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 comnam
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 'If no option is given, DISPLAY is assumed.'
db 0
jmp Exit
;
; comnam -- prints actual program name from external file control block,
; if available, or prints 'QUIET'.
;
comnam: call getefcb
jrz noefcb
mvi b,8
comnm1: inx h
mov a,m
ani 7Fh
cpi ' '
cnz bout
djnz comnm1
ret
;
noefcb: call eprint
db 'QUIET',0
ret
;
; Reset Quiet
;
qreset: mvi a,0 ; reset value
call putquiet
call getwhl ; check wheel byte
jz Exit ; (off, no display)
jmp qdisp
;
; Set Quiet
;
qset: mvi a,0FFh ; set value
call putquiet
call getwhl ; check wheel byte
jz Exit ; (off, no display)
;
; Display Quiet Flag
;
qdisp: call getquiet ; get quiet flag
call eprint
db ' Quiet Flag is ',0
jz qdispr
call eprint
db 'On (Set)',0
jmp Exit
;
qdispr: call eprint
db 'Off (Reset)',0
jmp Exit
;
; Uninitialized data . . .
;
DSEG
;
OldStk: ds 2
;
end