Random Number Generator Info
This routine basically emulates a "linear feedback shift register"
which is any number of bits long.  The process actually generates a random
sequence of ones and zeros, and only repeates after [2^(#of bits)]-1;
in this case I am using just 16 bits, so will generate a unique sequence of
ones and zeros that will only repeat after 65535 iterations with the same seed.
To prevent any repitition, each time a new game is started a new seed number
is generated using some ROM calls.  I do not call the routine 8 times to generate
the random one-byte number; rather I just use the upper byte of the register that
started out with the seed number.
The seed number is the starting value with which the whole process takes place.
The actual variable "seed" also holds the current sequence of ones and zeros.
Here is the process I used:

1.Load the seed number
2.Shift the register left (arithmetic)
3.Compare the upper byte with values that divide 255 into 6 "bins"
4.In each bin, the appropriate die face value is stored to "randnum"
5.XOR bits 14&15 of the register and place that number at bit 0
6.Store the register back into the seed number.

This routine is MUCH more random than the pseudo-random routine common in other programs.
It is also just as fast, even though it looks longer. 
Each die calls 7 random numbers before stoping, totalling 35 calls to this routine.  It has
to be fast, otherwise it would look like crap!

NOTE:If you use this routine, remember to define seed as a 2-byte variable, and randnum as
a single-byte variable, unless you want to change their names.
In order to change the number of bins (and hence the range of values) you need to modify the appropriate section of code.
Here is the actual code:

RSeed:				;generate a new starting number
	call _random		;0<=op1<1
	call _inco1exp		;op1*10
	call _inco1exp		;"		these 4 lines =op1*10,000
	call _inco1exp		;"
	call _inco1exp		;"
	call _INTGR			;make op1 an integer
	call _convop1		;conv op1 to de,a
	ld (seed),de		;we want 2 bytes of random stuff
	ld b,3			;set loop counter at 3
ShiftSeedLoop:
	ld hl,(seed)		;this section shifts seed as a whole.
	sla h
	bit 7,l			;test bit 7 of lower byte
	jr z,noinc
	inc h
noinc:
	sla l
	ld (seed),hl 		;end
	djnz ShiftSeedLoop	;we must shift the initial seed# 3 times so the
	ret			;upper numbers will be reached.

Random:
;Random Number Generator by Steven Hunt (shlefty@home.com).  For details
;on how this routine works, see random.txt
;Please give me credit if you use it.
	ld hl,(seed)	;this section shifts seed as a whole.
	sla h
	bit 7,l		;test if shifting LB would overflow
	jr z,noinc1	;if not, don't inc UB
	inc h
noinc1:
	sla l
	ld (seed),hl ;end

	ld a,h	;higher byte->a

	cp 42		;0-41=one
	jp c,face1
	cp 86		;42-85=two
	jp c,face2
	cp 130	;86-129=three  *these numbers are off by 1 due to the nature of a carry flag
	jp c,face3
	cp 174	;130-173=four
	jp c,face4
	cp 218	;174-217=five
	jp c,face5
face6:		;217-255=six
	ld a,6
	ld (randnum),a
	jp testbit
face1:
	ld a,1
	ld (randnum),a
	jp testbit
face2:
	ld a,2
	ld (randnum),a
	jp testbit
face3:
	ld a,3
	ld (randnum),a
	jp testbit
face4:
	ld a,4
	ld (randnum),a
	jp testbit
face5:
	ld a,5
	ld (randnum),a
testbit:			;prepare new seed number (xor bit 14&15, store in bit 0)
	ld a,h			;restore higher byte of seed
	and %01000000		;mask all but bit 7 (15 of seed#)
	ld b,a			;save result
	ld a,h
	sla a			;shift higher byte left
	and %01000000		;mask all but bit 7 (14 of seed# after shift)
	xor b			;see if bits 15&14 are =
	jp z,resbit		;test result of xor
	ld hl,seed
	set 0,(hl)		;they were different, so set bit 0 of seed
	ret
resbit:				;they were the same, so reset bit 0 of seed
	ld hl,seed
	res 0,(hl)
	ret			
