	.title	idadow
;
; Idadow calculates day of week after 1 jan 72
; call idadow( date, byte(10) )
; returns 9 charstring, null terminated
;
;
	.dsabl	gbl
	.globl	lapse
	.globl	r5laps, ndays

	.psect	user$i
idadow::
	tst	(r5)+

	mov	(r5)+,r5laps+2		; copy date address
	mov	r5,-(sp)		; save r5
	mov	#r5laps,r5
	call	lapse			; calculates days since 1 jan 72

	mov	(sp)+,r5		; restore r5
	mov	ndays,r3		; ndays / 7
	clr	r2
	div	#7,r2			; r3 = 0,1,2,3,4,5,6

	asl	r3			; * 2
	mov	tabday(r3),r3		; get i/p pointer
	mov	(r5)+,r1		; get o/p pointer

20$:	movb	(r3)+,(r1)+		; copy day of week
	bne	20$
	return

	.psect	user$d,d

tabday:: sat, sun, mon, tues, wed, thur, fri
sat:	.asciz	/Saturday/
sun:	.asciz	/Sunday/
mon:	.asciz	/Monday/
tues:	.asciz	/Tuesday/
wed:	.asciz	/Wednesday/
thur:	.asciz	/Thursday/
fri:	.asciz	/Friday/
	.even

	.end
