	title	CP/M spool program
	name	('SPOOL')

; A CP/M spooler

; This is the installer of the spooler RSX

BDOS	equ	0005h

.os	equ	 0
.string	equ	 9
.vers	equ	12
.rsx	equ	60

CPMv	equ	31h

SPOLrsx	equ	120

lf	equ	0ah
cr	equ	0dh
eof	equ	1ah
eot	equ	'$'

	jp	MAIN
;
	db	cr,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf,lf
	db	'M.M.L. Systems  Ltd. 11 Sun Str.London EC2M 2PS '
	db	'(C) Copyright   1986            '
;
	db	eof,eof,eof,eof,eof,eof,eof,eof,eof
	db	eof,eof,eof,eof,eof,eof,eof
;
MAIN:
	ld	c,.vers
	call	BDOS		; Get OS version
	cp	CPMv		; Verify correct one
	ld	de,$ILL.OS
	ld	c,.string
	jp	nz,BDOS		; Tell error if not
	ld	de,InstRSX
	ld	c,.rsx
	call	BDOS		; Install it
	ld	de,$SPOOL.OK
	or	a		; Test success
	jr	z,SpoolMsg	; Yeap
	ld	de,$SPOOL.ABORT	; Installation aborted
SpoolMsg:
	ld	c,.string
	call	BDOS		; Give final message
	ld	c,.os
	jp	BDOS		; That's all
;
InstRSX:
	db	SPOLrsx
	db	0
	db	0,0
$ILL.OS:
	db	'SPOOL: ? Requires CP/M 3.1',eot
$SPOOL.OK:
	db	cr,lf
	db	'SPOOL installed - output to LST: device now spooled'
	db	eot
$SPOOL.ABORT:
	db	cr,lf
	db	'<< Cannot install SPOOL >>'
	db	eot

	end


