SWI "OS_Byte" 129, 0, 0 waits for 1 cs ?
André Timmermans (100) 655 posts |
I have some file converters tools which were not much faster on the Pi 3 than on the Risc PC. It checked for keypresses using OS_Byte 129, 0, 0 in the main file writing loop and by modifying it to perform the check only once per second, a conversion batch of 37 min now runs in 2 min 20 s. The doc states that OS_Byte 129 waits for a key press with a timeout of (R1 + 256 * R2) cs. Am I right in assuming that it does not follow the doc but waits ( 1 + R1 + 256 * R2) cs? |
Clive Semmens (2335) 3276 posts |
I don’t think it does wait 1 cs, no. If there’s anything in the keyboard buffer already, it should return immediately and report it; if not, it should return immediately reporting “no key pressed.” |
Jeffrey Lee (213) 6048 posts |
Some experimentation suggests that there’s no delay when running the code single-tasking. But in a task window – depending on OS version – you may get a delay of 1cs more than the requested delay (RISC OS 3 doesn’t show the problem, but RISC OS 5.22 does) Digging through CVS suggests that this change might be the culprit – originally it relied on VSync events for the INKEY timer (and assumed 50Hz!). When it was switched over to TickerV the divide by two was removed, but there’s still a +1 in there which probably shouldn’t be. |
Jeffrey Lee (213) 6048 posts |
(double post) (edit #2, might as well use it for something useful) Now fixed: https://www.riscosopen.org/viewer/revisions/logs?ident=1496430497-690926.html |
Chris Evans (457) 1614 posts |
Possible bug reported. Fixed within three hours! |