*-------------------------------------------------------------
*
* TSCRAND.ASM
*    This is the random number generator used by TSC software
*    that loads at $A04A. Created by disassembly of the Space
*    Voyage game by TSC. 
*
*-------------------------------------------------------------
	org	$A04A

random	stab	saveB		;preserve B
	ldab	#8		;loop 8 times

ranLoop	ldaa	randNum+3
	asla
	asla
	asla
	eora	randNum+3
	asla
	asla
	rol	randNum
	rol	randNum+1
	rol	randNum+2
	rol	randNum+3
	decb
	bne	ranLoop

	ldab	saveB		;restore B
	ldaa	randNum		;return random number in A
	rts

* Data Area

saveB	rmb	1
randNum	rmb	4

	end
