	title	Module from library BASE_1 : SETRND
	name	('SETRND')
	maclib	baselib.lib

; Calculate random record from sequential one

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

;		Version 1.0 September 1991

; ENTRY	Reg pair DE points to OPENED FCB

; EXIT	Reg HL holds low and middle byte of random record
;	Accu holds high byte
;	Zero flag reflects state of Accu

	entry	setrnd

; ===== Constants =====

	entry	setrnd

setrnd:
	push	bc
	push	de
	_OSCAL_	.setrrn		; Set record
	pop	de
	ld	hl,_RRN
	add	hl,de		; Point to random record
	push	de
	ld	e,(hl)		; Get it
	inc	hl
	ld	d,(hl)
	inc	hl
	ld	a,(hl)
	ex	de,hl
	pop	de
	pop	bc
	or	a		; Set result
	ret

	end

