Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/13/02 14:03
Read: times


 
#32392 - RE: generating random words 8051
When the game is initialised i want the 8051 to be able to genarate a word at random
Dead easy, require the user to press a key to indicate "start of game". While waiting for that key to be pressed run a loop such as
WaitForStart:
inc dptr
jb KeyPressed,EndOfWait
sjmp WaitForStart
EndOfWait:
mov dph,HighRandomNumber
mov dpl,LowRandomNumber
This will even give you a truly random number since the loop will rin in abt 200ms and the keypress wait will be more than that.

Erik

List of 10 messages in thread
TopicAuthorDate
generating random words 8051            01/01/70 00:00      
RE: generating random words 8051            01/01/70 00:00      
mahmood            01/01/70 00:00      
RE: generating random words 8051            01/01/70 00:00      
RE: generating random words 8051            01/01/70 00:00      
RE: generating random words 8051            01/01/70 00:00      
RE: generating random words 8051            01/01/70 00:00      
RE: generating random words 8051, Kunal            01/01/70 00:00      
Deja vu            01/01/70 00:00      
RE: Deja vu            01/01/70 00:00      

Back to Subject List