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
/
CPM
/
BYE5
/
B5C-DS.LBR
/
DSTOBYE.ZZ0
/
DSTOBYE.Z80
Wrap
Text File
|
2000-06-30
|
3KB
|
91 lines
;Program: DSTOBYE
;Author: Bruce Morgen
;Date: May 11, 1988
;Purpose: Establishes an RST vector to the running DateStamper
;clock, if detected. A default address of 0008h is assumed if
;none is specified. An address may be specified in decimal,
;hex, binary or octal. The warm boot (RST 0) and debugger
;trap (RST 7/RST 38h) vectors are disallowed, as are addresses
;not reachable via 8080/Z80 RST instructions. Numeric input
;lower than 0008h is assumed to correspond to Intel-convention
;RST arguments, therefore 1 is equivalent to 0008h, 2 to 0010h,
;5 to 0028h, etc. Illegal input results in a help screen, as
;does the Z3-style "//" help query syntax.
;ASCII constants
CR EQU 13
LF EQU 10
BEL EQU 7
;DSLIB & SYSLIB external references
EXTRN FINDCK,EPRINT,PHL4HC,MULHD,EVAL
;We begin...
LD A,(5DH) ; Get character from FCB #1
CP '/' ; Help query?
JP Z,HELP ; Comply if so
LD DE,8 ; Load default RST vector addr.
CP ' ' ; No other specified?
JR Z,DFAULT ; Then go use it
LD HL,82H ; Point to command tail
CALL EVAL ; Evaluate it to binary
INC D ; Can't be 16-bit value
DEC D
JP NZ,HELP ; So give help if it is
OR A ; RST 0 is not available
JP Z,HELP ; Give help if required
CP 7 ; 0038h (RST 7) no good either
JP Z,HELP ; So give help if required
LD HL,8 ; Intel must be multiplied by 8
CP L ; See if Zilog
JR NC,DFAULT ; Branch ahead if so
CALL MULHD ; Result into HL
EX DE,HL ; Swap into DE
DFAULT:
LD A,E ; Check range
CP 30H+1 ; 30h is highest legal address
JR NC,HELP ; Give help if needed
LEGAL:
SUB 8 ; Subtract constant
JR C,HELP ; Oops, any remainder is n/g...
JR NZ,LEGAL ; Loop until done
PUSH DE ; Save address
CALL FINDCK ; Find The DateStamper
POP DE ; Restore address
JR Z,DSFAIL ; Barf if no DS
CALL EPRINT ; EPRINT & PHL4DC preserve regs
DB CR,LF,'DateStamper vector to ',0
CALL PHL4HC ; Print DS clock address
CALL EPRINT
DB 'h established at ',0
EX DE,HL ; Swap registers
CALL PHL4HC ; Print vector location
CALL EPRINT
DB 'h for BYE',CR,LF,0
LD (HL),0C3H ; Poke JP instruction first
INC HL ; Point to address LSB
LD (HL),E ; Poke LSB
INC HL ; Point to address MSB
LD (HL),D ; Poke MSB
RET ; All done
DSFAIL: CALL EPRINT ; The usual bitch 'n barf
DB BEL,CR,LF,'Can''t find The DateStamper',CR,LF,0
RET
HELP: CALL EPRINT
DB CR,LF,'DSTOBYE, Version 1.0',CR,LF
DB 'Builds a vector to DateStamper for BYE',CR,LF
DB 'Syntax:',CR,LF
DB ' DSTOBYE [rst addr.]',CR,LF
DB 'If the rst addr. is omitted, 0008h is assumed.',CR,LF
DB 'Either Zilog (address) or Intel (level)',CR,LF
DB 'RST nn conventions are accepted, RST 0 and',CR,LF
DB 'RST 38h (RST 7 in Intel) are disallowed,',CR,LF
DB 'as are addresses not reachable via RSTs.',CR,LF,0
RET
END