Preemptive context switching, aka multitasking

Announce (tech) demos or games releases

Moderator: Mask of Destiny

Post Reply
andlabs
Very interested
Posts: 62
Joined: Sat Aug 08, 2009 4:44 pm

Preemptive context switching, aka multitasking

Post by andlabs » Sat Aug 08, 2009 5:00 pm

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
Last edited by andlabs on Sat Aug 08, 2009 10:08 pm, edited 1 time in total.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sat Aug 08, 2009 6:20 pm

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.

andlabs
Very interested
Posts: 62
Joined: Sat Aug 08, 2009 4:44 pm

Post by andlabs » Sat Aug 08, 2009 9:31 pm

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

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Aug 09, 2009 3:22 pm

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.

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Tue Sep 24, 2013 7:17 pm

Sorry, I am arriving rather late to this Thread but does anyone have the Archive File that he posted? The Link is now dead :(

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

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

Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Tue Sep 24, 2013 9:24 pm

Hey thanks, TmEE - that was quick work :D I'll have a look at his work now :wink:

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Sep 24, 2013 10:23 pm

My MD dev folder has a loooooot of stuff in it. I made a search for the filename and found it ^^
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

MintyTheCat
Very interested
Posts: 484
Joined: Sat Mar 05, 2011 11:11 pm
Location: Berlin, Germany

Post by MintyTheCat » Tue Sep 24, 2013 10:33 pm

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.

Post Reply