Category : Files from Magazines
Archive   : DDJ0892.ZIP
Filename : WIN_SCH.ASC

Output of file : WIN_SCH.ASC contained in archive : DDJ0892.ZIP
by Matt Pietrek

Figure 1:

//------------------STARTUP SECTION-------------------
Save registers on stack of outgoing task
Update task profiles
If ( TDB signature not OK)
goto Walk_through_task_list
Get DirectedYield field in TDB into AX; zero it out in TDB
If ( DirectedYield hTask == 0 )
goto Walk_through_task_list
If ( event count in DirectedYield TDB != 0 )
goto startup_this_task
//---------------TOP HALF OF TASK WALK-------------
Point to the first task in the linked list of tasks
if ( another task in list )
goto Does_this_task_have_an_event?
//---------------THE IDLE LOOP--------------------
ShrinkHeap() // In KRNL386 only
DiscardFreeBlocks() // In KRNL386 only
if ( fPokeAtSegments != 0 )
if ( USER is idle )
Call routine to load a boot time module segment
goto Walk_through_task_list
INT 28h
INT 2Fh, AX = 1689h
goto Walk_through_task_list
//-------------BOTTOM HALF OF TASK WALK----------------------
if ( event count field == 0 )
point to next TDB
goto Try_next_task
//-------------TASK SWITCHING CODE------------------------
// Found a potential task to switch to
// Make sure it's OK to switch
if ( found task == current task )
goto Reschedule_done
if ( there is a locked task, and it's not the current task )
goto Reschedule_done
If ( InDOS flag )
goto Try_next_task
// It's OK to switch tasks now
Increment InScheduler flag
Delete & re-insert task into TDB list to give it proper priority.
Lock the global heap
Save SS:SP in current TDB
Call function that checks the following
if ( 80x87 present )
save control word in outgoing TDB
if ( Current disk not set in TDB )
Save the current DOS disk/directory in the TDB
Call routine that sends task switch out notification
Set new Windows current TDB value
Set new Windows PDB value from the PDB value in the incoming TDB
if ( 80x87 present )
load control word from incoming TDB
Call routine that sends task switch in notification
Switch to SS:SP from incoming TDB
Update the "current TDB" global variable
Decrement InScheduler flag
Tell the display driver that we've switched // In KRNL386 only
Unlock the global heap
Restore registers from stack

  3 Responses to “Category : Files from Magazines
Archive   : DDJ0892.ZIP
Filename : WIN_SCH.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: