Bonsoir Sebastien!

> Since more days, I develop "from scratch" my "task switcher" on FreeDos in 
> asm/c++ 
> for preemption.

Have you tried improving the existing TriDOS instead?

>  * I succeeded to create stack memory in array, for each 
> tasks added. 
>  * I was not able to "switch" with two stack in asm inline

Try to switch only at "smart" moments. For example let programs
switch when they try to call int 21, by hooking int 21, but do
NOT switch while int 21 is already busy. Check the InDOS flag,
as well as related data. The problem is similar to what you get
with some TSR / hotkey systems, so a howto for that will also
help you to understand task switching. When switching between
tasks, you may also want to swap the contents of the SDA (DOS
swappable data area) and the DOS stack. Basically it is tricky
enough to swap tasks to give MS a good excuse why Windows even
refused to do it on non-Microsoft DOS in the beginning... :-p

Note that using DJGPP makes things even a lot more complicated,
because DJGPP programs always are DPMI tasks in protected mode,
usually with CWSDPMI as their protected mode host... So even for
simply calling DOS or BIOS from a DJGPP program, you have to be
careful to not fall into the gap between protected mode and DOS
and DJGPP only does it automatically for you in easy cases. For
others, you have to explicitly tell DJGPP how to bridge that gap.

> This is my complete code with Batch file for compile with GCC/G++ (DJGPP for 
> DOS)
> http://cpcdos.e-monsite.com/medias/files/task-switch-test.zip

Cheers, Eric



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to