	title	PDMMAX
	subttl	Module from library PULL_DOWN_1 : PDMMAX

; Truncate number of elements to max

; Copyright (C)	Werner Cirsovius
;		Hohe Weide 44
;		D-2000 Hamburg 20
;		Tel.: 040/4223247

;		Version 1.0 October 1987

; ENTRY	Reg C holds selected number

; EXIT	Reg C unchanged or set to max on overflow

	public	pdmmax

	.xlist
	include	PDM.LIB
	.list

pdmmax:
	ld	a,c
	or	a		; Test zero
	jr	nz,maxtst
	ld	c,1		; Set limit if so
	ret
maxtst:
	ld	a,(ix+numele)	; Test element overflow
	cp	c
	ret	nc
	ld	c,a		; ..set max if so
	ret

	end

