I'm also a little puzzled about real preemption on a Z80, but http://www.cpcwiki.eu/index.php/SymbOS#Technical_background states
"Even the Z80 8-bit CPU is able to run a pre-emptive multitasking environment. Missing mechanisms like memory protection, which are often called as a condition for multitasking, are system stability issues only. The MP/M operating system already proved, that multitasking on Z80 computers is possible.
While the MOS Technology 6502 can not move the stack, the Z80 can freely replace it to any position in the memory, which is more or less a condition for pre-emptive multitasking. The existance of an alternative register set accelerates the content switching between the tasks dramatically. The restriction of Z80 systems to a 64 kB address space can be solved with bank switching. In this way computers like the Amstrad CPC and PCW, MSX, Enterprise or SAM Coupé are able to access hundred or thousand of kilobytes of memory. "
The previous sentence is "I want to give everything to SymbOS what a modern OS needs.", so I read that as being a statement of what the developer wants the OS to have in the future.
Further down the page, in the details section, it states "Priority based preemptice [sic] and cooperative multitasking" is done. Wikipedia mentions that a combination of preemptive and cooperative task management is used [1]. I'm confused.
(And just to be clear: I'm not trying to be negative. I'm very impressed with the technology and tenacity of the author.)
At least it can address enough memory to make it not a complete waste.
(In either case, you'll probably want some mechanism for tasks to relinquish their timeslice early; no reason not to make multitasking run better when tasks cooperate, even if it doesn't absolutely require that.)
To do the actual task switch, do exactly what you do on any system:
- save register state in tasks's register area (the state will be available on entry to the interrupt routine, in the usual fashion. The task pointer will be a system global at a fixed address)
- set timer for one timeslice hence (timers probably count down to zero, so this will just be a question of putting a value somewhere into an I/O register)
- resumes task by jumping to the program counter value from the task's register area
- GOTO 10...
(The complications come on something like the 6502, which has a fixed-size, fixed-address stack - but this it hard task-switching difficult, not the preemption! How I imagine CLIPS gets around this: it requires CMD SuperCPU, which is a 65816. Like the Z80 and 6809, but unlike the 6502, the 65816 has a relocatable stack. So it will probably behave as I describe above.)
CLiPS (on the same site) appears to support preemption [2], but that requires a C64. I don't know how that is achieved.
Very impressive work nevertheless.
[1] http://www.symbos.de/facts.htm
[2] http://www.symbos.de/mirrors/www.clips64.de/details.htm