Random number module

xiaoxiao2021-03-06  43

There are many modules that have been completed, and some are part of the combination. It is really tired with the compilation of the game. It is necessary to use more than 20 pages of Word documents; ************ ********** ********; function name: random; function: random seed; pass parameters: empty; function returns: empty; ********** ***************************** Random Proc Push AX Push BX Push CX Push DX Push Si Push Di STI MoV AH, 0; Read Clock Counter Value INT 1AH Add DX, SEED And DX, 8FFFH MOV SEED, DX POP DI POP SI POP DX POP CX POP BX POP AX RETRANDOM ENDP

******************************; function name: rand; function: generate random number of specified range size; transfer parameters: The range of Si numbers 1; function returns: AX returns the value of the random number; ************************************* Rand Proc Push BX Push CX Push DX Push Si Push Di STI MOV AH, 0; Read Clock Counter Value INT 1AH MOV AX, SEED AX, DX AND AX, 8FFFH MOV SEED, AX MOV DX, 0 MOV BX, Si; Specified Random range DIV BX MOV AX, DX POP DI POP SI POP DX POP CX POP BX Retrand ENDP

转载请注明原文地址:https://www.9cbs.com/read-79082.html

New Post(0)