Re: How does RND() and TIMER work?
Posted: Tue Sep 09, 2014 1:26 pm
Good question... I will check this. Maybe my simple PIA implementation is wrong here... Thanks for the suggestions...
The Dragon Archive Forums
http://archive.worldofdragon.org/phpBB3/
http://archive.worldofdragon.org/phpBB3/viewtopic.php?f=8&t=4894
Code: Select all
9d3d| b6ff03 LDA $ff03 cc=98 a=b5 b=01 dp=00 x=00b4 y=b39b u=82ec s=7f1e| E..IN...
9d43| b6ff02 LDA $ff02 cc=94 a=00 b=01 dp=00 x=00b4 y=b39b u=82ec s=7f1e| E..I.Z..
Code: Select all
10 CLS
20 TIMER=0
30 FOR I=0 TO 100
40 PRINT @0,"COUNTER=";I;"- TIMER=";TIMER
50 NEXT
Code: Select all
COUNTER=100 - TIMER=244
Code: Select all
COUNTER=100 - TIMER=245
Code: Select all
COUNTER=100 - TIMER=246
Code: Select all
COUNTER=100 - TIMER=154
It's hard to say just by looking at the numbers. It's behaving as if (1) a large class of instructions are adding too many cycles to the counter or (2) the irq callback is occurring faster than once per 17784 cycles.jedie wrote:Are my CPU cycles completely wrong or are my trigger with 17784 cycles wrong?
Code: Select all
10 COUNT=500
20 CLS
30 TIMER=0
40 FOR I=0 TO COUNT
50 PRINT @0,"COUNTER=";I;"- TIMER=";TIMER
60 NEXT
I start it multiple times and get: 760, 761, 760, 761, 761, 761, 761, 761, 761, 760COUNTER=500 - TIMER=761
and also start multiple times: 771, 771, 771, 771, 767, 770, 770, 771, 770, 771COUNTER=500 - TIMER=771
and: 1228, 1229, 1228, 1228, 1228, 1229, 1229COUNTER=500 - TIMER=1228