Before Arduino was even a thing, there was a time where the PIC16F877(A) could save you (or break you). To ease my work, I wrote a minimalist multitasking kernel, only to understand why "it was not a thing" before : you can't interrupt, save or restore a task !
My trusted ICD2 helped me write and debug the core of the switcher, and make sure the crazy macros worked.
Among limits : fixed number of tasks/threads, no recursion, you have to keep count of your call depth, you have to RETURN FROM ALL ROUTINES before switching/yielding... So it's not a project for the beginners.
OTOH it has a nice LCD driver for HD44780-compatible displays with a 4-bits bus, which saved this code from oblivion.