Category : Pascal Source Code
Archive   : PIBMDOS.ZIP
Filename : TRYMDOS.PAS
PROGRAM TryMDos;
(*----------------------------------------------------------------------*)
(* TryMDos --- Try multitaskers for DOS *)
(*----------------------------------------------------------------------*)
(* *)
(* Author: Philip R. Burns *)
(* *)
(* Date: September, 1986 *)
(* Version: 1.0 *)
(* *)
(* Overview: This program demonstrates the routines contained in the *)
(* file PIBMDOS.PAS, which provide Turbo Pascal interfaces *)
(* to several popular multitasking programs for DOS: *)
(* *)
(* - DesqView from QuarterDeck *)
(* - TaskView from Sunny Hill Software *)
(* - TopView from IBM *)
(* - DoubleDos from SoftLogic *)
(* *)
(* Because MicroSoft Windows will emulate TopView, these *)
(* routines are also useful for Windows. *)
(* *)
(* The TaskView interface assumes the program has been *)
(* loaded using the LD-TVEM.EXE loader program provided *)
(* as part of the TaskView release materials. *)
(* *)
(* Remarks: This sample program simply writes lines of text to the *)
(* screen until a key is depressed. Then, it loops waiting *)
(* for input to show the difference between giving up and *)
(* not giving up unused time to other partitions. *)
(* *)
(* The include file PIBMDOS.PAS contains the actual *)
(* multitasker interface routines. In addition, a general *)
(* purpose routine to write a string is included. The *)
(* string is written directly to screen memory if no *)
(* multitasker is active, or to the virtual buffer if a *)
(* multitasker is active. It can also write the string *)
(* using standard BIOS calls if desired. *)
(* *)
(* Global variables of importance: *)
(* *)
(* Virtual_Screen --- address of real screen if no *)
(* multitasker running, else *)
(* address of virtual screen. *)
(* MultiTasker --- which multitasker is active. *)
(* TimeSharingActive --- TRUE if multitasker is active. *)
(* Wait_For_Retrace --- Set this TRUE if your color *)
(* graphics card produces snow *)
(* when screen memory is accessed *)
(* (e.g., set TRUE for IBM's CGA *)
(* but FALSE for Zeniths and *)
(* Compaqs, among others). *)
(* Write_Screen_Memory --- TRUE to write directly to *)
(* screen memory -- either the *)
(* genuine screen memory or the *)
(* virtual buffer for a multi- *)
(* tasker. FALSE to use the BIOS *)
(* instead. *)
(* *)
(* I would appreciate it if anyone familiar with the other *)
(* multitaskers for which no interface is provided would *)
(* add the relevant code and upload a corrected copy *)
(* for all of us to learn from. *)
(* *)
(*----------------------------------------------------------------------*)
(*$I TRYMDOS.GLO *)
(*$I PIBMDOS.PAS *)
(*$I READKBD.PAS *)
(*$I YESNO.PAS *)
VAR
LineCount : REAL;
Ch : CHAR;
S : STRING[8];
Y : INTEGER;
(*----------------------------------------------------------------------*)
(* Flush_Keyboard --- Flush pending keystrokes in keyboard *)
(*----------------------------------------------------------------------*)
PROCEDURE Flush_Keyboard;
VAR
Ch: CHAR;
BEGIN (* Flush_Keyboard *)
WHILE( KeyPressed ) DO
READ( Kbd, Ch );
END (* Flush_Keyboard *);
(*----------------------------------------------------------------------*)
(* Initialize --- Initialize multitasker demonstration *)
(*----------------------------------------------------------------------*)
PROCEDURE Initialize;
BEGIN (* Initialize *)
(* Clear screen *)
ClrScr;
(* Allow direct memory writes *)
Write_Screen_Memory := TRUE;
(* Don't wait for retrace *)
Wait_For_Retrace := FALSE;
(* See which multitasker active *)
TimeSharingActive := IsTimeSharingActive;
(* Indicate which is active *)
CASE MultiTasker OF
(* No multitasker -- ask if we should *)
(* wait for retraces in direct screen *)
(* writes, or use BIOS. *)
MultiTasker_None : BEGIN
WRITELN('No multitasker active.');
Wait_For_Retrace := YesNo('Wait for retrace in direct screen writes?');
Write_Screen_Memory := YesNo('Use BIOS instead of direct screen writes?');
WRITELN;
END;
TopView : WRITELN('TopView active.');
DesqView : WRITELN('DesqView active.');
TaskView : WRITELN('TaskView active.');
DoubleDos : WRITELN('DoubleDos active.');
ELSE;
END (* CASE *);
END (* Initialize *);
(*----------------------------------------------------------------------*)
(* Try_Screen_Writes --- Try writing strings to screen memory *)
(*----------------------------------------------------------------------*)
PROCEDURE Try_Screen_Writes;
BEGIN (* Try_Screen_Writes *)
(* Write lines to screen until a key *)
(* is hit. *)
WRITELN('First test is writing text to virtual buffer.');
WRITELN('A continuous series of lines will be written until');
WRITELN('a key is pressed. You can switch to another partition');
WRITELN('and see that no bleed though occurs.');
WRITE ('Hit a key to start test: ');
Read_Kbd( Ch );
Flush_Keyboard;
LineCount := 0.0;
Y := WhereY;
WHILE( NOT KeyPressed ) DO
BEGIN
LineCount := LineCount + 1.0;
STR( LineCount:8:0 , S );
WriteSXY( 'Line ' + S + ' is now being displayed on the screen.', 1, Y, White );
Y := Y + 1;
IF ( Y > 25 ) THEN
Y := 1;
END;
(* Flush keyboard buffer *)
Flush_Keyboard;
END (* Try_Screen_Writes *);
(*----------------------------------------------------------------------*)
(* Try_GiveAway --- Try giving up time to other partitions *)
(*----------------------------------------------------------------------*)
PROCEDURE Try_GiveAway;
BEGIN (* Try_GiveAway *)
ClrScr;
WRITELN('Test of busy program in this partition.');
WRITELN('This program will loop here waiting until a key is struck.');
WRITELN('Time is NOT donated to the other partitions.');
WRITELN('After this starts, switch to another partition and use a program');
WRITELN('like CPU.COM to see the effective CPU speed for that partition.');
WRITE ('Hit a key to stop test: ');
WHILE( NOT KeyPressed ) DO;
Flush_Keyboard;
WRITE('Key pressed, test ends.');
WRITELN;
WRITELN;
WRITELN('Test of busy program in this partition, but now');
WRITELN('time IS donated to the other partitions.');
WRITELN('This program will loop here waiting until a key is struck.');
WRITELN('After this starts, switch to another partition and use a program');
WRITELN('like CPU.COM to see the effective CPU speed for that partition.');
WRITELN('You should see a notable increase in the effective CPU speed');
WRITELN('over the last test.');
WRITELN;
WRITE ('Hit a key to stop test: ');
WHILE( NOT KeyPressed ) DO
GiveAwayTime( 2 );
Flush_Keyboard;
WRITE('Key pressed, test ends.');
END (* Try_GiveAway *);
(*----------------------------------------------------------------------*)
BEGIN (* TryMDos *)
(* Initialize *)
Initialize;
(* Try writing to virtual buffer *)
Try_Screen_Writes;
(* Try giving up idle time while *)
(* waiting for keyboard input *)
IF TimeSharingActive THEN
Try_GiveAway
ELSE
BEGIN
ClrScr;
WRITELN('Test of giving up time not performed since');
WRITELN('multitasker not active.');
END;
WRITELN;
WRITELN;
WRITELN('End of multitasker demonstration.');
END (* TryMDos *).
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/