Hello,
Use of the Lehmer algorithm, as suggested by JimD, may be somewhat overkill for an 8-bit result, since 32-bit quantities are used during the calculation.
You might also consider a pseudo-random sequence (PRS), similar to that used for CRC calculations. The suitability will depend on your application. For an 8-bit PRS, the pattern will repeat after 255 iterations, and for 16-bit, the sequence length would be 65535 iterations. Each of the possible (non-zero) values will occur once within each sequence.
The starting point for the sequence will be determined by initialisation of a "seed" value. If the starting point should be different for each equipment, the seed must be related to an external event. Perhaps read the TPM counter when this randomly timed event occurs, and use the LS byte as the seed.
The following 8-bit PRS is based on a CRC function coded in C, and then converted to ASM. The ASM code is untested. The 8-bit polynomial used is X^8 + X^5 + X^4 + 1. The subroutine assumes that you have allocate a byte variable RAND, preferably within zero page RAM, and that this has been initialised to the required non-zero seed value.
POLYVAL EQU $8C ; Polynomial value
; PRS sub-routine:
; On exit, ACC = next value of sequence
NEXTVAL:
LDX #8
LDA RAND
NV1: LSRA
BCC NV2
EOR #POLYVAL
NV2: DBNZX NV1 ; Loop for next bit
STA RAND
RTS
This process could be easily extended to a 16 bit PRS, obviously using a suitable 16-bit polynomial.
Regards,
Mac