	.title	fcsdir	return fcs/dir error text into 64 byte array

	.ident	/82.1.2/
;
;
;	edits:	BDN	09-Dec-83 21:03	Change FCSERR psect to I space
;					since it will be in an overlay
;		EJR	29-Dec-83 15:52 Changed from FCSERR to DIRERR
;					changed from 2 to 3 digit error number
;		BDN	08-Jan-84 13:40	RSX11M-PLUS data psects
;		EJR	20-Jan-84 10:05 changed to both dir and fcs error
;		BDN	23-Oct-85 10:00	Remove FCS only errors for Kermit
;
;
;	usage:	call fcsdir(errnum,errtxt)
;
;	errtxt is returned .asciz

	.psect

;	F C S D I R
;
;	module size:	5200 (8) bytes ?


direrr::
fcsdir::mov	r1	,-(sp)		; save R1
	mov	r2	,-(sp)		; save R2
	mov	R3	,-(sp)		; save R3		; ejr
	mov	4(r5)	,r2		; get addr of return text
	mov	#100	,r1		; clear returned text first
10$:	movb	#40	,(r2)+		; simple
	sob	r1	,10$		; next please
	mov	4(r5)	,r2		; dest for the text
	clrb	@r2			; 
	mov	@2(r5)	,r1		; error number to return
	bgt	20$			; > 0 ?
	neg	r1			; always insure error > 0
20$:	mov	r1	,-(sp)		; save error number
	clr	r0			; and setup to convert to ascii
	div	#10.	,r0		; get the last digit	; ejr
	add	#'0	,r1		; make it ascii	ch[1]	; ejr
	mov	R1	,R3		; save it		; ejr
	mov	R0	,R1		; get the remainder	; ejr
	clr	R0			; set up to convert	; ejr
	div	#10.	,R0		; get the second digit	; ejr
	add	#60	,R1		; make it ascii	ch[2]	; ejr
	add	#60	,R0		; make it ascii	ch[3]	; ejr
	movb	#40	,(r2)+		; errortext[1] := ' ';
	movb	#'-	,(r2)+		; errortext[2] := '-';
	movb	r0	,(r2)+		; errortext[3] := ch[1] ;
	movb	r1	,(r2)+		; errortext[4] := ch[2] ;
	movb	r3	,(r2)+		; errortext[5] := ch[3] ;
	movb	#40	,(r2)+		; errortext[6] := ' '
	clrb	@r2
	mov	(sp)+	,r1		; restore error number
	cmp	r1	,#127.		; range ok ?
	bgt	100$			; no, just exit
	asl	r1			; convert to word offset
	mov	msgtbl-2(r1),r1		; get address of the text
	beq	100$			; nothing (unused error)
	mov	#100-6	,r0		; maximum number of characters to copy
30$:	movb	(r1)+	,(r2)+		; copy until null
	beq	100$			;
	sob	r0	,30$		; next please
100$:	mov	(SP)+	,R3		; restore R3		; ejr
	mov	(sp)+	,r2		; restore R2
	mov	(sp)+	,r1		; and r1 also please
	return				; bye


	.psect	direrr	,ro,d,lcl,rel,con


msgtbl:	.word	   1$,  2$,  3$,  4$,  5$,  6$,  7$,  8$,  9$, 10$
	.word	  11$, 12$, 13$, 14$, 15$, 16$, 17$, 18$, 19$, 20$
	.word	  21$, 22$, 23$, 24$, 25$, 26$, 27$, 28$, 29$, 30$
	.word	  31$, 32$, 33$, 34$, 35$, 36$, 37$, 38$, 39$, 40$
	.word	  41$, 42$, 43$, 44$, 45$, 46$, 47$, 48$, 49$, 50$
	.word	  51$, 52$, 53$, 54$, 55$, 56$, 57$, 58$, 59$, 60$
	.word	  61$, 62$, 63$, 64$, 65$, 66$, 67$, 68$, 69$, 70$
	.word	  71$, 72$, 73$, 74$, 75$, 76$, 77$, 78$, 79$, 80$
	.word	  81$, 82$, 83$, 84$, 85$, 86$, 87$, 88$, 89$, 90$
	.word	  91$, 92$, 93$, 94$, 95$, 96$, 97$, 98$, 99$,100$
	.word	 101$,102$,103$,104$,105$,106$,107$,108$,109$,110$
	.word	 111$,112$,113$,114$,115$,116$,117$,118$,119$,120$
	.word	 121$,122$,123$,124$,125$,126$,127$


	.enabl	lc

1$:	.asciz	\Bad parameters/Insufficient dynamic storage\
2$:	.asciz	\Invalid function code\
3$:	.asciz	\Device not ready\
4$:	.asciz	\Parity error/Insufficient dynamic storage for send\
5$:	.asciz	\Hardware option not present/Un-assigned LUN\
6$:	.asciz	\Illegal user buffer/Device handler not resident\
7$:	.asciz	\Device not attached/Task not active\
8$:	.asciz	\Device already attached\
9$:	.asciz	\Device not attachable\
10$:	.asciz	\End of file detected/Issuing task not checkpointable\
11$:	.asciz	\End of volume detected/Task is checkpointable\
12$:	.asciz	\Write attempted to locked unit\
13$:	.asciz	\Data overrun\
14$:	.asciz	\Send/receive failure\
15$:	.asciz	\Request terminated\
16$:	.asciz	\Privilege violation\
17$:	.asciz	\Sharable resource in use\
18$:	.asciz	\Illegal overlay request/No swap space available\
19$:	.asciz	\Odd byte count\
20$:	.asciz	\LBN too large\
21$:	.asciz	\Invalid UDC module #\
22$:	.asciz	\UDC connect error\
23$:	.asciz	\Caller's nodes exhausted\
24$:	.asciz	\Device full\
25$:
26$:
27$:
28$:
29$:
30$:
31$:
32$:
33$:
34$:
35$:
36$:
37$:
38$:
39$:
40$:
41$:
42$:
43$:
44$:
45$:
46$:
47$:
48$:
49$:
50$:
51$:
52$:
53$:
54$:
55$:
56$:
57$:
58$:	.byte	0
59$:	.asciz	\Fatal hardware error\
60$:
61$:
62$:
63$:
64$:
65$:	.asciz	\device off line\
66$:	.asciz	\Block check, CRC, or framing error\
67$:	.asciz	\Device online\
68$:	.asciz	\No such node\
69$:	.asciz	\Path lost to partner\
70$:	.asciz	\Bad logical buffer\
71$:	.byte	0
72$:	.asciz	\No dynamic space available\
73$:
74$:
75$:
76$:
77$:	.byte	0
78$:	.asciz	\No data available\
79$:	.asciz	\Task not linked to ICS/ICR\
80$:	.asciz	\Task not installed\
81$:	.asciz	\Device offline/Illegal mapping specified\
82$:	.asciz	\Invalid escape sequence\
83$:	.asciz	\Partial escape sequence\
84$:	.asciz	\Alignment error\
85$:	.asciz	\Address window allocation overflow\
86$:	.asciz	\Invalid region ID\
87$:	.asciz	\Invalid address window ID\
88$:	.asciz	\Transfer rejected by receiving CPU/Invalid TI parameter\
89$:	.asciz	\EFN already specified/Invalid send buffer size ( > 255.)\
90$:	.asciz	\LUN locked in use\
91$:	.asciz	\Inconsistent qualifier usage/Invalid UIC\
92$:	.asciz	\Invalid device/unit or device not a terminal\
93$:	.asciz	\Invalid time parameters\
94$:	.asciz	\Not a network task/Partition/region not in system\
95$:	.asciz	\Timeout on request/Invalid priority ( .GT. 250.)\
96$:	.asciz	\Connection rejected/Invalid LUN\
97$:	.asciz	\Invalid event flag ( .GT. 64.)\
98$:	.asciz	\Part of DPB out of user's space\
99$:	.asciz	\DIC or DPB size invalid\
100$:
101$:
102$:
103$:
104$:
105$:
106$:
107$:
108$:
109$:
110$:
111$:
112$:
113$:
114$:
115$:
116$:
117$:
118$:
119$:
120$:
121$:
122$:
123$:
124$:
125$:
126$:
127$:
128$:	.byte	0

	.even

	.end
