	.title	k11rte	error codes and message text for kermit-11/rt11
	.ident	/2.22/


	.if ndf, K11INC
	.ift
	.include	/IN:K11MAC.MAC/
	.endc


;	Brian Nelson  10-Aug-84  09:24:56
;
;	Removed from K11RT4.MAC to save total size
;
;
;	Copyright (C) 1984 Change Software, Inc.





	.psect	$code
	.psect	errdat	,ro,d,lcl,rel,con
	.sbttl	error codes that we will need thoughout Kermit-11


	er$cre	==	-1		; can't create a file
	er$dev	==	-2		; invalid device name
	er$eof	==	-3		; end of file
	er$fnf	==	-4		; file not found
	er$fnm	==	-5		; bad filename
	er$ful	==	-6		; device full
	er$nmf	==	-7		; no more files found
	er$iop	==	-10		; invalid i/o request
	er$sys	==	-11		; system error
	er$lby	==	-12		; lun open
	er$rer	==	-13		; read error
	er$wer	==	-14		; write error
	er$prv	==	-15		; protection error
	er$rtb	==	-16		; record too big
	er$que	==	-17		; no que elements
	er$nin	==	-20		; no input for .mtget
	er$nat	==	-21		; not attached for .mtxxxx
	er$lun	==	-22		; non-existant lun for .mtxxxx
	er$bsy	==	-23		; device not available
	er$buf	==	-24		; invalid buffer for xm exec
	er$sup	==	-25		; missing exec feature
	er$map	==	-26		; terminal unit not initialized
	er$spe	==	-27
	er$sy1	==	-30
	er$sy2	==	-31
	er$sy3	==	-32
	er$sy4	==	-33
	er$vol	==	-34		; not an rt11 volume
	er$nop	==	-35		; i/o channel not open
	er$wld	==	-36		; no wildcard support
	er$xco	==	-37		; could not access XC:/XL:
	er$fun	==	-40		; invalid .spfun code
	er$hrd	==	-41		; hard i/o error
	er$fet	==	-42		; no room to load handler
	er$ukn	==	-43

	fa$imp	==	-44		; /51/ .SERR fatal errors
	fa$nhd	==	-45		; /51/ No device handler
	fa$dio	==	-46		; /51/ Error in directory I/O
	fa$fet	==	-47		; /51/ Fetch error
	fa$ovr	==	-50		; /51/ Overlay error
	fa$dfl	==	-51		; /51/ Directory full
	fa$adr	==	-52		; /51/ Bad address
	fa$lun	==	-53		; /51/ Bad lun
	fa$idr	==	-54		; /51/ Bad directory
	er$fgf	==	-55		; /51/ Fetching in FG
	er$pla	==	-56		; /51/ General PLAS error

	er$lin	==	-57		; /59/ Bad line for TSX+
	maxerr	==	57		; must be abs(maxerr)
	nodata	==	er$nin		; no data available

	.psect	errdat			; error message text
	.enabl	lc

baderr:	.asciz	#Unknown error call#
nosup:	.asciz	#Missing executive feature#
	.even

errmap:	.word	5$,10$,20$,30$,40$,50$,60$,70$,100$,110$,120$
	.word	130$,140$,150$,160$,170$,200$,210$,220$,230$,240$,250$
	.word	260$,270$,300$,310$,320$,330$,340$,350$,360$,370$,400$
	.word	410$,420$,430$,440$,450$,460$,470$,500$,510$,520$,530$
	.word	540$,550$,560$,570$
	.word	baderr,0
5$:	.byte	0
10$:	.asciz	#Can't create file#
20$:	.asciz	#Invalid device name#
30$:	.asciz	#End of file#
40$:	.asciz	#File not found#
50$:	.asciz	#Bad filename#
60$:	.asciz	#Device full#
70$:	.asciz	#No more files#
100$:	.asciz	#Invalid i/o operation request#
110$:	.asciz	#System error#
120$:	.asciz	#Logical unit already open#
130$:	.asciz	#Device read error#
140$:	.asciz	#Device write error#
150$:	.asciz	#File is protected#
160$:	.asciz	#Record too large for user buffer#
170$:	.asciz	#No QUE elements available#
200$:	.asciz	#MT service - No data available/Buffer overflow#
210$:	.asciz	#MT service - Line not attached#
220$:	.asciz	#MT service - Non-existent unit#
230$:	.asciz	#MT service - Device not available#
240$:	.asciz	#MT service - Bad user buffer address (XM)#
250$:	.asciz	#Multiple Terminal Service support not present in executive#
260$:	.asciz	#MT service - RT11 device unit not mapped to internal LUN#
270$:	.asciz	#Unknown speed#
300$:	.asciz	#System error from RT11 .CLOSE#
310$:	.asciz	#System error from RT11 .CSISPC#
320$:	.asciz	#System error from RT11 .ENTER#
330$:	.asciz	#System error from RT11 .FETCH#
340$:	.asciz	#Disk home block is not RT11 format#
350$:	.asciz	#I/O channel not open#
360$:	.asciz	#Wildcarding not supported for this operation#
370$:	.asciz	#Could not open the XC/XL port#
400$:	.asciz	#Invalid function code to .SPFUN for XC:/XL:#
410$:	.asciz	#Hard I/O error on device XC:/XL:#
420$:	.asciz	#Insufficient lowcore memory to load handler#
430$:	.asciz	#Unknown serial line device name#
440$:	.asciz	#Internal/unknown error from .SERR#	; /51/
450$:	.asciz	#NO device handler#			; /51/
460$:	.asciz	#Error doing directory I/O#		; /51/
470$:	.asciz	#.FETCH error, please manually load handler# ; /51/
500$:	.asciz	#Overlay read error#			; /51/
510$:	.asciz	#No room for file in directory#		; /51/
520$:	.asciz	#Invalid address#			; /51/
530$:	.asciz	#Invalid channel#			; /51/
540$:	.asciz	#Invalid directory structure#		; /51/
550$:	.asciz	#Can't .FETCH handler in Foreground. Please LOAD it# ; /51/
560$:	.asciz	#PLAS mapping error#
570$:	.asciz	#Invalid line for TSX - use a CL line, as in CL1:#
	.even

plaser::.word	5$,10$,20$,30$,40$,50$,60$,70$,100$,110$
5$:	.asciz	#PLAS- Window alingnment error#
10$:	.asciz	#PLAS- Attempt to define more the seven windows#
20$:	.asciz	#PLAS- Invalid region identifier#
30$:	.asciz	#PLAS- Invalid window identifier#
40$:	.asciz	#PLAS- Offset into window inconsistent with map size#
50$:	.asciz	#PLAS- Specified window not mapped#
60$:	.asciz	#PLAS- No region control blocks available#
70$:	.asciz	#PLAS- Insufficient memory available to create region#
100$:	.asciz	#PLAS- Invalid region size or insufficient contiguous memory#
110$:	.asciz	#PLAS- Unknown plas error#
	.even


	.sbttl	error print and mapping

	.psect	$code

maperr::asl	r0
	mov	plaser(r0),r0
	return


;	R M S E R R 
;
;	input:	@2(r5)	error number	(fortran/bp2 calling standard)
;	output:	4(r5)	the error text


syserr::calls	rmserr	,<#2,r5,2(r5)>	; simple
	return

rmserr::save	<r0,r1>			; the registers we will use
	mov	#baderr	,r1		; preset bad error text
	mov	4(r5)	,r0		; insure default of nothing
	clrb	@r0			; .asciz
	mov	@2(r5)	,r0		; the error number
	bge	10$			; must change into > 0
	neg	r0			; make it > 0
10$:	cmp	r0	,#maxerr	; is this a valid call today?
	bhi	20$			; yes
	asl	r0			; no, get error number into word
	mov	errmap(r0),r1		; offset and get the text address
20$:	mov	4(r5)	,r0		; where to put the error text
	mov	r1	,-(sp)
30$:	movb	(r1)+	,(r0)+		; copy it until a null byte
	bne	30$			; next please
	cmp	(sp)+	,#baderr	; ?Unknown error call ?
	bne	100$			; no
	movb	#'(	,-1(r0)		; yes, convert the error number
	deccvt	@2(r5)	,r0		; so we can see what it was
	add	#6	,r0		; skip past the converted number
	movb	#')	,(r0)+		; terminate the string
	movb	#40	,(r0)+		; a space to be nice
	clrb	@r0			; finally, .asciz please
100$:	unsave	<r1,r0>			; pop registers we used and exit
	return				; bye
	

	.end
