	title	Module from library BASE_2 : DDMMYY
	name	('DDMMYY')
	maclib	baselib.lib

; Convert date to format dd mmm yy

; Copyright (C)	Werner Cirsovius
;		Hohe Weide 44
;		D-20253 Hamburg
;		Tel.: +49-40-4223247

;		Version 1.0 December 1992

; ENTRY	Reg HL points to string to be filled
;	Reg B  holds character to be stored at the end
;	Reg C  holds delimiter between data
;	Location 'DDMMYY'-2 may hold user defined month table
;	with a length of three characters of each month

; EXIT	Reg HL points to end character

	entry	ddmmyy

	ext	getclk,cnvday,putbcd

	dw	montab
ddmmyy:
	push	de
	push	ix
	push	bc		; Save a bit
	push	hl
	call	getclk		; Get time and date
	call	cnvday		; Convert date
	pop	hl
	pop	bc
	ld	a,(ix+0)	; Get date
	call	putbcd		; .. store
	ld	(hl),c		; Set delimiter
	inc	hl
	push	hl
	ld	a,(ix+1)	; Get month
	bit	4,a		; Test .GT. 9
	jr	z,dat_j1	; .. nope
	and	LoMask
	add	a,10		; .. make binary
dat_j1:
	dec	a		; Get index
	ld	e,a
	add	a,a		; *2
	add	a,e		; *3
	ld	e,a
	ld	d,0
	ld	hl,(ddmmyy-2)	; Get base of table
	add	hl,de
	pop	de
	push	bc
	ld	bc,$len
	ldir			; Unpack name
	pop	bc
	ex	de,hl
	ld	(hl),c
	inc	hl
	ld	a,(ix+2)	; Get year
	call	putbcd
	ld	(hl),b		; .. close line
	pop	ix
	pop	de
	ret

	dseg

montab:
	db	'Jan'
$len	equ	$-montab
	db	'FebMarAprMayJunJulAugSepOctNovDec'

	end

