4 ms·
I've done this before [1], many years ago. At the time, I had never heard of setjmp or longjmp. I understood task switching as 'push all registers onto the st
by snarfy 6y ago
I've done this before [1], many years ago. At the time, I had never heard of setjmp or longjmp. I understood task switching as 'push all registers onto the stack, change stacks, pop all registers off the stack', and so that's what I wrote for the task switching routines using gnu assembler. Making it pre-emptive was a matter of calling it periodically. I wasn't sure about timers either so I ended up hooking the timer interrupt handlers directly. You could use either irq0 timer or irq8 timer. I recall getting my dos boxes to 'multitask' inside windows by hooking irq8.
[1] - https://github.com/zenakuten/lwp20 https://github.com/zenakuten/lwp20