BM_0160E:	; Y2K bugged date conversion
conv_SET_date_to_TOS_date:
	movem.l	d3-d4/a3-a5,-(a7)		; push some entry regs
	subq	#6,a7				; reserve 3 int on stack
	movea.l	a0,a5
	move	d0,d4
	lea	$0002(a7),a3			; a3 -> int for month
	lea	$0004(a7),a4			; a4 -> int for day_in_month
	pea	(a7)
	movea.l	a3,a1
	movea.l	a4,a0
	move.l	a1,-(a7)
	move.l	a0,-(a7)
	jsr	Tgetdate_sub.l
	movea.l	(a7)+,a0
	movea.l	(a7)+,a1
	bsr.w	conv_TOS_date_to_realdate
	addq	#4,a7
	movea.l	a5,a0
	jsr	strlen.l
	move.l	d0,d3
	tst	d3
	ble.s	L01654
	moveq	#$02,d0
	movea.l	a5,a0
	jsr	substr_atoi.l			; conv day_in_month to int
	move	d0,(a4)				; (a4) = day_in_month
L01654:
	cmp	#$0002,d3
	ble.s	L01668
	moveq	#$02,d0
	lea	$0002(a5),a0
	jsr	substr_atoi.l			; conv month to int
	move	d0,(a3)				; (a3) = month
L01668:
	cmp	#$0004,d3
	ble.s	L0167C
	moveq	#$02,d0
	lea	$0004(a5),a0
	jsr	substr_atoi.l			; conv 2-digit year to int
	move	d0,(a7)				; (a7) = year_offset
L0167C:
	move	d4,d0
	subq	#1,d0
	beq.s	L01688
	subq	#1,d0
	beq.s	L01694
	bra.s	L0169E

L01688:
	movea.l	a3,a1				; a1 -> month
	movea.l	a4,a0				; a0 -> day_in_month
	jsr	swap_int.l
	bra.s	L0169E

L01694:
	lea	(a7),a1				; a1 -> year_offset
	movea.l	a4,a0				; a0 -> day_in_month
	jsr	swap_int.l
L0169E:
;;;orig:	addi	#$076C,(a7)			; year_offset += 1900
;;;orig:	move	(a3),d0				; d0 = month
	jsr	Y2K_fix2_sub
	lsl	#5,d0				; d0 = month<<5
	or	(a4),d0				; d0 |= day_in_month
	move	(a7),d1				; d1 = year
	add	#-$07BC,d1			; d1 -= 1980
	moveq	#$09,d2
	lsl	d2,d1
	or	d1,d0				; d0 = (year-1980)<<9+month<<5+day_in_month
	addq	#6,a7				; release 3 auto ints
	movem.l	(a7)+,d3-d4/a3-a5		; pull some entry regs
	rts					; return to caller

;next label is strcalc_TOS_time:
