Live data from Hacker News

Pre-emptive Z80 multitasking explainer

github.com

1–10 of 33 posts

Re: Pre-emptive Z80 multitasking explainer

#3
Funniest 8080-era multitasker was made by Siemens in 1976. Instead of allocating memory from common RAM, they just switched small RAMs mechanically. You only needed to dump registers at each switch. Particularly economical in 8080 which is not good for indexed memory models like Z80.

Re: Pre-emptive Z80 multitasking explainer

#4
Writing my own pre-emptive multitasker in Turbo Pascal on our x86 as a self-taught teenager was a core memory thing.

I recall spending a few days mulling over the exact sequence of instructions to save the state of the previous task without clobbering the flags or any registers.

The result was that I could register functions (procedures) as tasks with their own little stack, and it would switch preemptively between them in a round-robin fashion.

I'm not familiar with Z80 asm but from what I can gather it looks very similar to what I had. I was running in real mode so also had very limited resources for each task, and a hardcoded upper limit on the number of tasks.

While I'm wildly more productive these days, I kinda miss how not having internet made accomplishments so much greater. It's like walking up a mountain on your own vs taking a tour bus to the summit.

Re: Pre-emptive Z80 multitasking explainer

#6
post #3

Funniest 8080-era multitasker was made by Siemens in 1976. Instead of allocating memory from common RAM, they just switched small RAMs mechanically. You only needed to dump registers at each switch. Particularly economical in 8080 which is not good for indexed memory models like Z80.

"mechanically" with relays or something? Do you know the model number?

Re: Pre-emptive Z80 multitasking explainer

#9
Did this on my Atari ST 68000 back in the 90s... I did not even heard about the word "preemptive" at the time (guys, I did not even know the Amiga OS did this natively), it was just an idea. Task switching every 10 or 20 HBL or so. I was so glad to have two routines running, each one changing color index 0 register to red and blue so I can see it realtime.

Re: Pre-emptive Z80 multitasking explainer

#10

If you look at old issues of Byte magazines you see a huge number of ads for high-end S100 system vendors that sold systems that could run MP/M, a multitasking OS for the Z80 https://en.wikipedia.org/wiki/MP/M

It's hard to imagine getting work done on a shared Z80 machine with everybody sharing the same 64kB of memory. Z80s were already plenty slow and the working memory tight. Sharing that with other users sounds miserable.
Post reply on HN