| ??? 12/25/03 23:06 Read: times |
#61400 - RE: Random number from 1 to 8 Responding to: ???'s previous message |
hi, I can. Here it is below.
Please note the fact that I use 4 generators with different formulas of XOR-gates.
; The pseudo-generator 1 shift routine
; formula 15^10^1
; input:
; - R2 is the low byte of shift-register;
; - R3 is the high byte
SUB_PSYGEN1_ROLL:
CALL SUB_PSYGEN_CHECK
MOV A,R3
ANL A,#10000100b
MOV R0,A
MOV A,R2
ANL A,#00000010b
ORL A,R0
JMP SUB_PSYGEN_ROLL_END
; formula 15^5^2
SUB_PSYGEN2_ROLL:
CALL SUB_PSYGEN_CHECK
MOV A,R3
ANL A,#10000000b
MOV R0,A
MOV A,R2
ANL A,#00100100b
ORL A,R0
JMP SUB_PSYGEN_ROLL_END
; formula 15^12^3
SUB_PSYGEN3_ROLL:
CALL SUB_PSYGEN_CHECK
MOV A,R3
ANL A,#10010000b
MOV R0,A
MOV A,R2
ANL A,#00001000b
ORL A,R0
JMP SUB_PSYGEN_ROLL_END
; formula 15^11^2
SUB_PSYGEN4_ROLL:
CALL SUB_PSYGEN_CHECK
MOV A,R3
ANL A,#10001000b
MOV R0,A
MOV A,R2
ANL A,#00000100b
ORL A,R0
; common part used as shift-routine
SUB_PSYGEN_ROLL_END:
MOV C,P
MOV A,R2
RLC A
MOV R2,A
MOV A,R3
RLC A
MOV R3,A
RET
; common subroutine which checks for degenerating
SUB_PSYGEN_CHECK:
MOV A,R2
ORL A,R3
JNZ SUB_PSYGEN_CHECK_END
MOV R2,#1 ; re-install it then
SUB_PSYGEN_CHECK_END:
RET
sorry if I did some typpo above due I modified come code to be more clean. Good days! |



