Previous Messages |
Posted By
Harry Potter on 2024-08-27 18:51:05
| Re: Timer 1 $ff00
gerliczer: My pseudo-random number generator allows you to factor in a number into the generator, and that number could be something like the current raster line or a timer or anything that's unpredictable. You can also not factor in a number if you want, in which case, it will factor in a 0.
|
|
Posted By
gerliczer on 2024-08-27 10:08:02
| Re: Timer 1 $ff00
That, in the worst case, could mean your code is sampling the register at a rate that coincides with some multiple of the interval after which the same value returns.
To make better pseudo-random numbers you could add entropy to the generator by collecting data from the human interaction. Like the sequence and timing of player input.
|
|
Posted By
Haegar on 2024-08-27 07:34:15
| Re: Timer 1 $ff00
Great, thank you very much. I actually just load a value from $ff00 and don't store it there. But maybe there is something somewhere in the depths of the code that makes the timer stop.
@Harry Potter: Thanks, I'll take a look at it when I get a chance. A random generator is always useful. Here I "only" need a really simple random generator for numbers between 0-3. I noticed that the random map selection in Bombtank isn't very oaky and some maps are called up much more often than others.
|
|
Posted By
Harry Potter on 2024-08-27 07:12:07
| Re: Timer 1 $ff00
If you want, I have my own random number generator. It uses a 16-bit seed, and, if you want, you can pass a number to it, such as a timer. It should be very efficient, as it doesn't involve any complex operations such as multiplication. It is written in cc65 Assembler and located at https://sourceforge.net/projects/cc65extra/files/util/. Try it out!
|
|
Posted By
Charles on 2024-08-27 06:27:28
| Re: Timer 1 $ff00
I think this is well documented, just found one for you Look at the end of the first paragraph.
|
|
Posted By
Haegar on 2024-08-27 04:59:52
| Re: Timer 1 $ff00
Can someone please give me a tip where this is documented.
|
|
Posted By
gerliczer on 2024-08-27 03:34:15
| Re: Timer 1 $ff00
AFAIK, it is a well documented* feature of TED Timers that writing their register pairs in a specific order will first stop them from counting, then start them counting. Your experience seem to indicated that you inadvertently trigger this feature.
* Please, refer to the plethora of available publications.
|
|
Posted By
Haegar on 2024-08-27 02:06:36
| Timer 1 $ff00
Hello,
I have another question. I wrote a small routine to generate a more or less random number. To do this, I use $ff00 of Timer 1. The routine works very well, but when I put it into my program, it sometimes happens that Timer 1 doesn't count and just stands still.
I have this problem under Yape and on a real Plus/4.
Timer 2 $ff02, $ff03 continues to run normally.
My question is, how can Timer 1 not count?
|
|