How does RND() and TIMER work?
Re: How does RND() and TIMER work?
Good question... I will check this. Maybe my simple PIA implementation is wrong here... Thanks for the suggestions...
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: How does RND() and TIMER work?
I found the IRQ trace part of XRoar: https://gist.github.com/jedie/4400c4c086c3b2d84592 (on gist, because of linebreaks here)
So, the IRQ routine reads PIA from $ff03 and $ff02:
... a while later ...
Think i found the bug in DragonPy and fix it with: https://github.com/jedie/DragonPy/commi ... 2650b854ce
Now i see the TIMER values increase...
I updated my test script:
I run it with DragonPy and CoCo and Dragon ROMs... results are:
CoCo:
Dragon64:
Dragon32:
But with XRoar these values are:
CoCo and Dragon32:
Hm... Are my CPU cycles completely wrong or are my trigger with 17784 cycles wrong?
So, the IRQ routine reads PIA from $ff03 and $ff02:
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..
... a while later ...
Think i found the bug in DragonPy and fix it with: https://github.com/jedie/DragonPy/commi ... 2650b854ce
Now i see the TIMER values increase...
I updated my test script:
Code: Select all
10 CLS
20 TIMER=0
30 FOR I=0 TO 100
40 PRINT @0,"COUNTER=";I;"- TIMER=";TIMER
50 NEXT
CoCo:
Code: Select all
COUNTER=100 - TIMER=244
Code: Select all
COUNTER=100 - TIMER=245
Code: Select all
COUNTER=100 - TIMER=246
CoCo and Dragon32:
Code: Select all
COUNTER=100 - TIMER=154
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Re: How does RND() and TIMER work?
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?
Does your instruction trace include irq events and the value of the cycle counter at each instruction? This might help you solve the mystery...
Stew
Re: How does RND() and TIMER work?
I modify the test script a little bit and count to 500:
I run this on a real Dragon 64 and get:
In Xroar i get:
and with DragonPy:
I wonder, that DragonPy also produce very equally result...
Now i will compare traces...
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
In Xroar i get:
and also start multiple times: 771, 771, 771, 771, 767, 770, 770, 771, 770, 771COUNTER=500 - TIMER=771
and with DragonPy:
and: 1228, 1229, 1228, 1228, 1228, 1229, 1229COUNTER=500 - TIMER=1228
I wonder, that DragonPy also produce very equally result...
Now i will compare traces...
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809