	cmpb	cc+1,$20. / is character count for console tty greater
		          / than 20
	bhis	2f / yes; branch to put process to sleep
	jsr	r0,putc; 1 / find place in freelist to assign to console
		           / tty and
		br 2f / place character in list; if none available
		      / branch to put process to sleep
	jsr	r0,startty / attempt to output character on tty
	br	wtty
2:
	mov	r1,-(sp) / place character on stack
	jsr	r0,sleep; 1 / put process to sleep
	mov	(sp)+,r1 / remove character from stack
	br	1b / try again to place character in clist and output

wppt:
	jsr	r0,cpass / get next character from user buffer area,
		         / if none return to writei's calling routine
	jsr	r0,pptoc / output character on ppt
	br	wppt
/wlpr:
/	jsr	r0,cpass
/	cmp	r0,$'a
/	blo	1f
/	cmp	r1,$'z
/	bhi	1f
/	sub	$40,r1
/1:
/	jsr	r0,lptoc
/	br	wlpr

wmem: / transfer characters from a user area of core to memory file
	jsr	r0,cpass / get next character from users area of core and
		         / put it in r1
	mov	r1,-(sp) / put character on the stack
	mov	*u.fofp,r1 / save file offset in r1
	inc	*u.fofp / increment file offset to point to next available
		        / location in file
	movb	(sp)+,(r1) / pop char off stack, put in memory loc assigned
		           / to it
	br	wmem / continue
1:
	jmp	error / ?

dskw: / write routine for non-special files
	mov	(sp),r1 / get an i-node number from the stack into r1
	jsr	r0,iget / write i-node out (if modified), read i-node 'r1'
		        / into i-node area of core
	mov	 *u.fofp,r2 / put the file offset [(u.off) or the offset in
		            / the fsp entry for this file] in r2
	add	 u.count,r2 / no. of bytes to be written + file offset is
		            / put in r2
	cmp	 r2,i.size / is this greater than the present size of
		           / the file?
	blos	 1f / no, branch
