BigEd wrote:
Very nice! Pi checks out - to the last displayed digit too, which is always a risky digit. (And then, should one round or truncate? In this case, truncate, and I think that feels right to me too.)
Remind me - is this cooperative or preemptive multitasking?
It's preemptive.
So if a program sits in an infinite loop then it will all go slow, but other tasks will run.
Internally it works a bit like the transputer did which handled it all in it's microcode engine. Here the "microcode engine" is the Cintcode VM environment which takes the timer interrupt and switches tasks at the required time - currently in a strict round robin manner but I'm looking at the possibility of a concept of high priority for the one interactive task.
Those clocks work by simply sleeping for a period of time (semi-random to deliberately make sure the second hands don't sync. from 900 to 1100 ms) I'll "improve" it when I get a hardware RTC ... You don't have to do anything special in your code but being "nice" by calling delay() when the task has nothing else to do is... well, nice.
This does mean that if you run something outside the VM environment (say a large subroutine written entirely in
'816 ASM), then the whole system will stall until that routine returns. Since I don't plan to write much more
'816 ASM this is something I can live with.
-Gordon
_________________
--
Gordon Henderson.
See my
Ruby 6502 and 65816 SBC projects here:
https://projects.drogon.net/ruby/