	.even
attny:
	mov	r1,-(sp)		/save r1
	tst	token2			/"/" present?
	bne	0f
	jsr	r5,wattny		/write attorney's initials
	j.attny
	br	9f
0:
	tst	token3			/"*" present?
	beq	1f			/branch if no
	clr	j.attny			/null-out attny initials
	clr	j.attny+2		/and no. field
	clr	j.attny+4
	movb	$1,cflag		/set core changed
	br	9f
1:
	inc	token2
	mov	token2,1f
	jsr	r5,rattny		/validate attorney
1:	0
	j.attny
	tstb	eflag			/attorney name legal?
	bne	2f			/branch if no
	movb	$1,cflag		/set core changed
	br	9f
2:
	jsr	r5,mesg
	<3ILL ATTNY4\n\0>
	.even
9:
	mov	(sp)+,r1		/restore r1
	rts	r5


	.even
dir:
	mov	r1,-(sp)		/save r1
	tst	token2			/"/" present?
	bne	0f
	jsr	r5,wattny		/write attorney's initials
	j.dir
	br	9f
0:
	tst	token3			/"*" present?
	beq	1f			/branch if no
	clr	j.dir			/null-out attny initials
	clr	j.dir+2			/and no. field
	clr	j.dir+4
	movb	$1,cflag		/set core changed
	br	9f
1:
	inc	token2
	mov	token2,1f
	jsr	r5,rattny		/validate attorney
1:	0
	j.dir
	tstb	eflag			/attorney name legal?
	bne	2f			/branch if no
	movb	$1,cflag		/set core changed
	br	9f
2:
	jsr	r5,mesg
	<3ILL ATTNY4\n\0>
	.even
9:
	mov	(sp)+,r1		/restore r1
	rts	r5


	.even
super:
	mov	r1,-(sp)		/save r1
	tst	token2			/"/" present?
	bne	0f
	jsr	r5,wattny		/write attorney's initials
	j.super
	br	9f
0:
	tst	token3			/"*" present?
	beq	1f			/branch if no
	clr	j.super			/null-out attny initials
	clr	j.super+2		/and no. field
	clr	j.super+4
	movb	$1,cflag		/set core changed
	br	9f
1:
	inc	token2
	mov	token2,1f
	jsr	r5,rattny		/validate attorney
1:	0
	j.super
	tstb	eflag			/attorney name legal?
	bne	2f			/branch if no
	movb	$1,cflag		/set core changed
	br	9f
2:
	jsr	r5,mesg
	<3ILL ATTNY4\n\0>
	.even
9:
	mov	(sp)+,r1		/restore r1
	rts	r5



	.even
/"wattny" is a subroutine to write an attorney's initials
/input:
/	r5 pts to address of 6 chars to be written
/
wattny:
	mov	(r5)+,0f		/retrieve address arg
	mov	$1,r0
	sys	write; 0:..; 6		/write attny field
	rts	r5


/"rattny" reads and validates attorney initials
/inputs:
/	r5 pts to address to begin reading from
/	r5+2 pts to place to store initials if valid
/outputs:
/	eflag = 1 if error; cleared otherwise
/	attorney initials stored at address pointed to by
/	r5+2 if legal initials
/
rattny:
	mov	r1,-(sp)		/save regs
	mov	r2,-(sp)
	mov	(r5)+,r1		/retrieve 1st arg
	mov	(r5)+,r2		/retrieve 2nd arg
	clr	temp+2			/reserved for initials
	clr	temp+4			/stripped from input line
	clr	temp+6
	mov	$temp+2,r0
0:
	cmpb	(r1),$'\n
	beq	0f
	movb	(r1)+,(r0)+		/move input char
	cmp	r0,$temp+8.
	blo	0b
	cmpb	(r1),$'\n
	beq	0f
	jsr	r5,mesg
	<3ATTNY INITIALS TRUNCATED TO & CHARS4\n\0>
	.even
0:
	sys	open; f.attnys; 0
	mov	r0,temp			/save "f.attnys" id
0:
	clr	temp+8.			/clear field in preparation
	clr	temp+10.		/for reading attorney initials
	clr	temp+12.		/from attny file
	mov	$temp+8.,r1
1:
	mov	r1,2f
	mov	temp,r0			/id "f.attnys" -> r0
	sys	read; 2:..; 1		/read 1 attny initials char
	tst	r0
	beq	8f			/branch if at end file
	cmpb	(r1),$',		/at end initials?
	beq	3f
	cmpb	(r1),$'\n		/at end initials?
	beq	3f
	inc	r1
	cmp	r1,$temp+14.		/attnys initials over 6 chars?
	blos	1b
2:
	jsr	r5,mesg
	<3ATTNY FILE BAD AROUND "\0>
	.even
	mov	$1,r0
	sys	write; temp+8.; 6
	jsr	r5,mesg
	<"4\n\0>
	.even
	jsr	r5,ioerror
	<53>				/BAD ATTNY FILE ENTRY
3:
	clrb	(r1)			/clear "," or "\n" from field
	mov	$temp+2,r0
	mov	$temp+8.,r1
3:
	cmpb	(r0)+,(r1)+
	bne	4f
	cmp	r1,$temp+14.
	blo	3b
	br	7f			/successful match
4:
	mov	temp,r0
	sys	read; temp+8.; 1	/read 1 attny name char
	tst	r0
	beq	8f			/at end file and no match
	cmpb	temp+8.,$',		/at end attny name?
	beq	0b
	cmpb	temp+8.,$'\n		/at end attny name?
	bne	4b
	br	0b			/start compare at next initials
7:					/transfer here if match
	clrb	eflag			/reset error indicator
	mov	$temp+2,r1
7:
	movb	(r1)+,(r2)+		/move valid initials to
	cmp	r1,$temp+8.		/specified place
	blo	7b
	br	9f
8:
	movb	$1,eflag		/set error indicator
9:
	mov	temp,r0			/"f.attnys" id -> r0
	sys	close
	mov	(sp)+,r2		/restore regs
	mov	(sp)+,r1		/restore regs
	rts	r5			/return
