Page 1 of 1

Preemptive context switching, aka multitasking

Posted: Sat Aug 08, 2009 5:00 pm
by andlabs
Hi. Like snkenjoi before me, I am also from Sonic Retro.

I decided to make a simple preemptive context switcher on the Genesis, based on some code I already had for x86 and some guidelines I found a while ago.

http://idisk.mac.com/pietro10-Public/mtask.zip

It just flashes between a and b every second or two. Not really much to say :D

Comments are welcome, source code is included. Read the main source code file for the thanks. =P

Posted: Sat Aug 08, 2009 6:20 pm
by Chilly Willy
It's small, but not really a great framework for tasks. You'd be better off to use the Amiga task switching. It was easily capable of handling 100 switches a second on a stock 7MHz 68000, only took a few K of code, and had a small struct for the tasks. Get the exec.library disassembly off AmiNet and look it over. If you have any questions, just ask - I was an expert on that part of exec.

Posted: Sat Aug 08, 2009 9:31 pm
by andlabs
Chilly Willy wrote:It's small, but not really a great framework for tasks. You'd be better off to use the Amiga task switching. It was easily capable of handling 100 switches a second on a stock 7MHz 68000, only took a few K of code, and had a small struct for the tasks. Get the exec.library disassembly off AmiNet and look it over. If you have any questions, just ask - I was an expert on that part of exec.
Right. The Genesis isn't really the best system for serious multitasking, especially with very limited RAM (that repeats). It is a small proof of concept. I will look into this Amiga multitasker though. I didn't make this a flexible system because I didn't want to =P

Posted: Sun Aug 09, 2009 3:22 pm
by Chilly Willy
Well, there's more CODE in the Amiga task switching than the example you posted, but that would be in ROM. It uses far less RAM than your example, and would have no trouble working fine on the MD.

Posted: Tue Sep 24, 2013 7:17 pm
by MintyTheCat
Sorry, I am arriving rather late to this Thread but does anyone have the Archive File that he posted? The Link is now dead :(

Posted: Tue Sep 24, 2013 9:00 pm
by TmEE co.(TM)

Posted: Tue Sep 24, 2013 9:24 pm
by MintyTheCat
Hey thanks, TmEE - that was quick work :D I'll have a look at his work now :wink:

Posted: Tue Sep 24, 2013 10:23 pm
by TmEE co.(TM)
My MD dev folder has a loooooot of stuff in it. I made a search for the filename and found it ^^

Posted: Tue Sep 24, 2013 10:33 pm
by MintyTheCat
TmEE co.(TM) wrote:My MD dev folder has a loooooot of stuff in it. I made a search for the filename and found it ^^
Good move. To be honest I think it would be really useful to have a backed-up Store for Files such as Tools, Sourcecode and Demos that have been made for the MD.