SWAGOLX.EXE (c) 1993 GDSOFT ALL RIGHTS RESERVED 00005 DESQVIEW ROUTINES 1 05-28-9313:37ALL SWAG SUPPORT TEAM DESQVIEW.PAS IMPORT 39 { Does anyone know the routine For making a Program DV aware, and if itπ finds it, can you get it to make calls to it instead of Dos?π}πHere is a desqview Unit I have used in the past.ππUnit DESQVIEW ;ππ{$O+,F+}ππInterfaceππUses Dos ;ππVarπ DV_ACTIVE : Boolean ; { True if running under DESQview }π Win_ACTIVE : Boolean ; { True if Windows 3.x Enhanced Mode }π DV_VERSION : Word ; { desqVIEW version number }π DV_VSEG : Word ;π DV_VMODE : Byte Absolute $0040:$0049 ;π DV_VWIDTH : Byte ;π DV_VROWS : Byte ;π DV_VofS : Word ;πππProcedure DV_RQM ; { Give up the rest of our timeslice }πProcedure DV_begin_CRITICAL ; { Turn Task Switching off. }πProcedure DV_end_CRITICAL ; { Turn switching back on. }πProcedure DV_VIDEO_BUFFER ; { Set Global Video Variables }πFunction DV_Window_NUMBER : Byte ; { Returns Window Number }πProcedure DV_COMMON_MEMorY(Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_CONV_MEMorY (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_EMS_MEMorY (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_FASTWrite (X,Y: Word; STR: String; FG,BG: Word) ;ππImplementationππVarπ REG : Registers ;ππProcedure DV_RQM ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, 1000hπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, 1680hπ int 2fhπ end ;π end ;π end ;πend { dv_rqm };ππProcedure DV_begin_CRITICAL ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $101bπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, 1681hπ int 2fhπ end ;π end ;π end ;πend ; { dv_begin_critical }ππProcedure DV_end_CRITICAL ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $101cπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, $1682π int 2fhπ end ;π end ;π end ;πend ; { dv_end_critical }ππProcedure DV_VIDEO_BUFFER ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $2b02π mov bx, $4445 ; { DE }π mov dx, $5351 ; { SQ }π int 21hπ mov DV_VSEG, dxπ mov DV_VWIDTH, blπ mov DV_VROWS, bhπ mov DV_VofS, 0π end ;π end else beginπ if (DV_VMODE = 7) then DV_VSEG := $b000 else DV_VSEG := $b800 ;π DV_VWIDTH := memw[$0040:$004a] ;π DV_VROWS := 25 ;π DV_VofS := memw[$0040:$004e] ;π end ;πend ; { dv_video_buffer }ππFunction DV_Window_NUMBER ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de07π int 15hπ mov @RESULT, alπ end ;π end else beginπ DV_Window_NUMBER := 0 ;π end ;πend ;ππProcedure DV_COMMON_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de04π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_CONV_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de05π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_EMS_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de06π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_FASTWrite ;ππVarπ I : Word ;ππbeginπ X := DV_VofS + ((Y-1) * DV_VWIDTH + (X-1)) * 2 ;π For I := 1 to length(STR) do beginπ MEMW[DV_VSEG:X] := (((BG shl 4) + FG) shl 8) + ord(STR[I]) ;π X := X + 2 ;π end ;πend ;ππbegin { main }π REG.AX := $2b01 ;π REG.CX := $4445 ; { DE }π REG.DX := $5351 ; { SQ }π intr($21,REG) ;ππ Win_ACTIVE := False ;π DV_ACTIVE := (REG.AL <> $ff) ;ππ DV_VERSION := 0 ;π if DV_ACTIVE then beginπ DV_VERSION := REG.BX ;π REG.AX := $de0b ;π REG.BX := $0200 ; { Minimum of Desqview 2.00 }π intr($15,REG) ;π end else beginπ REG.AX := $1600 ;π intr($2f,REG) ;π Case REG.AL ofπ $00 : ; { An enhanced Windows API is not Running }π $80 : ; { An enhanced Windows API is not Running }π $01 : ; { Windows / 386 Version 2.x }π $ff : ; { Windows / 386 Version 2.x }π else beginπ Win_ACTIVE := True ;π DV_VERSION := swap(REG.AX) ;π end ;π end ;π end ;ππ DV_VIDEO_BUFFER ;πend. { main }π 2 05-28-9313:37ALL SWAG SUPPORT TEAM DETCTWIN.PAS IMPORT 38 {πHere's a little something that will detect Desqview and Windows ...π}πUnit DESQVIEW ;π{$O+,F+}ππInterfaceπUses Dos, Crt;ππVarπ DV_ACTIVE : Boolean ; { True if running under DESQview }π Win_ACTIVE : Boolean ; { True if Windows 3.x Enhanced Mode }π DV_VERSION : Word ; { desqVIEW version number }π DV_VSEG : Word ;π DV_VMODE : Byte Absolute $0040:$0049 ;π DV_VWIDTH : Byte ;π DV_VROWS : Byte ;π DV_VofS : Word ;πππProcedure DV_RQM ; { Give up the rest of our timeslice }πProcedure DV_begin_CRITICAL ; { Turn Task Switching off. }πProcedure DV_end_CRITICAL ; { Turn switching back on. }πProcedure DV_VIDEO_BUFFER ; { Set Global Video Variables }πFunction DV_Window_NUMBER : Byte ; { Returns Window Number }πProcedure DV_COMMON_MEMorY(Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_CONV_MEMorY (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_EMS_MEMorY (Var AVAIL, LARGEST, toTAL: Word) ;πProcedure DV_FASTWrite (X,Y: Word; STR: String; FG,BG: Word) ;ππImplementationππVarπ REG : Registers ;ππProcedure DV_RQM ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, 1000hπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, 1680hπ int 2fhπ end ;π end ;π end ;πend;ππProcedure DV_begin_CRITICAL ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $101bπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, 1681hπ int 2fhπ end ;π end ;π end ;πend ; { dv_begin_critical }ππProcedure DV_end_CRITICAL ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $101cπ int 15hπ end ;π end else beginπ if Win_ACTIVE then beginπ Asmπ mov ax, $1682π int 2fhπ end ;π end ;π end ;πend ; { dv_end_critical }ππProcedure DV_VIDEO_BUFFER ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $2b02π mov bx, $4445 ; { DE }π mov dx, $5351 ; { SQ }π int 21hπ mov DV_VSEG, dxπ mov DV_VWIDTH, blπ mov DV_VROWS, bhπ mov DV_VofS, 0π end ;π end else beginπ if (DV_VMODE = 7) then DV_VSEG := $b000 else DV_VSEG := $b800 ;π DV_VWIDTH := memw[$0040:$004a] ;π DV_VROWS := 25 ;π DV_VofS := memw[$0040:$004e] ;π end ;πend ; { dv_video_buffer }ππFunction DV_Window_NUMBER ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de07π int 15hπ mov @RESULT, alπ end ;π end else beginπ DV_Window_NUMBER := 0 ;π end ;πend ;ππProcedure DV_COMMON_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de04π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_CONV_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de05π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_EMS_MEMorY ;ππbeginπ if DV_ACTIVE then beginπ Asmπ mov ax, $de06π int 15hπ les di, AVAILπ mov es:[di], bxπ les di, LARGESTπ mov es:[di], cxπ les di, toTALπ mov es:[di], dxπ end ;π end else beginπ AVAIL := 0 ;π LARGEST := 0 ;π toTAL := 0 ;π end ;πend ;ππProcedure DV_FASTWrite ;ππVarπ I : Word ;ππbeginπ X := DV_VofS + ((Y-1) * DV_VWIDTH + (X-1)) * 2 ;π For I := 1 to length(STR) do beginπ MEMW[DV_VSEG:X] := (((BG shl 4) + FG) shl 8) + ord(STR[I]) ;π X := X + 2 ;π end ;πend ;ππbegin { main }π REG.AX := $2b01 ;π REG.CX := $4445 ; { DE }π REG.DX := $5351 ; { SQ }π intr($21,REG) ;ππ Win_ACTIVE := False ;π DV_ACTIVE := (REG.AL <> $ff) ;ππ DV_VERSION := 0 ;π if DV_ACTIVE then beginπ DV_VERSION := REG.BX ;π REG.AX := $de0b ;π REG.BX := $0200 ; { Minimum of Desqview 2.00 }π intr($15,REG) ;π end else beginπ REG.AX := $1600 ;π intr($2f,REG) ;π Case REG.AL ofπ $00 : ; { An enhanced Windows API is not Running }π $80 : ; { An enhanced Windows API is not Running }π $01 : ; { Windows / 386 Version 2.x }π $ff : ; { Windows / 386 Version 2.x }π else beginπ Win_ACTIVE := True ;π DV_VERSION := swap(REG.AX) ;π end ;π end ;π end ;ππ DV_VIDEO_BUFFER ;πend. { main }π 3 05-28-9313:37ALL SWAG SUPPORT TEAM DV-VIDEO.PAS IMPORT 7 {π> Has anyone done any work With DV's virtual screen? Someplace Iπ> used to have the address For it, but I seem to have lost it. Doesπ> anybody know what it is?ππ> What I'm trying to do is bypass TJT's direct screen Writes byπ> replacing the BaseOfScreen Pointer With the one For DV's virtualπ> screen. if I can't do that then I'm going to have to make anotherπ> attempt at rewriting the assembly level screen routines.π}ππFunction DV_Video_Buffer;πbeginπ Reg.AH := $0F;π INTR($10, Reg);π if Reg.AL = 7 thenπ Reg.ES := $B000π elseπ Reg.ES := $B800;π if DV_Loaded thenπ beginπ Reg.DI := 0;π Reg.AX := $FE00;π INTR($10, Reg);π end;π DV_Video_Buffer := Reg.ES;πend;π 4 11-26-9318:18ALL FRED COHEN Time SLICES for OS/2 & DVSWAG9311 23 t {πFrom: FRED COHENπ Time Slices...ππlooking for routines for giving up time slices toπvarious multi-taskers, mainly DV and OS/2. Please eitherπpost them if they are small enough, or tell me where I canππYou will need turbo pascal 6.0+ for this to compile. It is easy toπconvert over to regular pascal though.π}ππConstππ MDOS = 0; { DOS }π OS2 = 1; { OS/2 is installed }π WIN = 2; { Windoze }π DV = 3; { DesqView }ππVarππ Ops : Byte; { Operating System OS/2/DOS/WIN/DV}πππPROCEDURE giveslice; Assembler; {Gives up remainder of clock cycleπ under dos, windows, os/2 }π asmπ CMP ops,MDos { Compare to DOS }π JE @MSDOS { Jump if = }π CMP ops,Dv { Compare to Desqview }π JE @DESQVIEW { Jump if = }π CMP ops, Win { Compare to Windows }π JE @WINOS2 { Jump if = }π CMP ops, OS2 { Compart OS/2 }π JE @WINOS2 { Jump if = }π JMP @NONE { None found, Jump to End }πππ @MSDOS:π INT 28h { Interupt 28h }π JMP @NONE { Jump to the end }ππ @DESQVIEW:π MOV ax,1000h { AX = 1000h }π INT 15h { Call Interupt 15h }π JMP @NONE { Jump to the end }ππ @WINOS2:π MOV AX, 1680h { AX = 1680h }π INT 2Fh { Call Interupt 2Fh for Win-OS/2 TimeSlice }ππ @NONE:ππend; {GiveSlice}ππ{***********}ππPROCEDURE checkos; Assembler;π{ Currently Supports DesqView, Microsoft Windows and IBM's OS/2 }ππasmπ mov ops, MDos { Default DOS }π mov ah, 30h { AH = 30h }π int 21h { dos version }π cmp al, 14hπ jae @IBMOS2 { Jump if >= to 20 }πππ mov ax,2B01hπ mov cx,4445hπ mov dx,5351hπ int 21h { Desqview Installed? }π cmp al, 255π jne @DesqView { Jump if AL <> 255 }ππ mov ax,160Ahπ int 2Fh { Windows Install?}π cmp ax, 0hπ je @Windows { If = Jump to Windows }π jmp @Finish { Nothing found, go to the end }ππ@IBMOS2:π mov Ops, Os2 { Set OS Value }π jmp @Finishππ@DesqView:π mov ops, Dv { Set OS Value }π jmp @Finishππ@Windows:π mov ops, win { Set OS Value }π jmp @Finishππ@FINISH:πend; { checkos }ππ{*********** MORE ********}ππprocedure GiveTimeSlice; ASSEMBLER;πasm { GiveTimeSlice }π cmp MultiTasker, DesqViewπ je @DVwaitπ cmp MultiTasker, Windowsπ je @WinOS2waitπ cmp MultiTasker, OS2π je @WinOS2waitπ cmp MultiTasker, NetWareπ je @Netwarewaitπ cmp MultiTasker, DoubleDOSπ je @DoubleDOSwaitππ@Doswait:π int $28π jmp @WaitDoneππ@DVwait:π mov AX, $1000π int $15π jmp @WaitDoneππ@DoubleDOSwait:π mov AX, $EE01π int $21π jmp @WaitDoneππ@WinOS2wait:π mov AX, $1680π int $2Fπ jmp @WaitDoneππ@Netwarewait:π mov BX, $000Aπ int $7Aππ@WaitDone:πend; { TimeSlice }ππ 5 02-09-9411:50ALL JOEL BERGEN DESQVIEW Support Unit SWAG9402 17 t (* ------------------------------------------------------------ *)ππ{ This unit adds support for the DESQview" multi-tasking enviromentπ By Joel Bergen last revised: 9/17/90 }ππ{$A+,B-,D+,E+,F-,I+,L+,N-,O+,R+,S+,V+}π{$M 1024,0,0}ππUNIT DESQview;ππINTERFACEππUSES DOS;ππVARπ Dv_Loaded : BOOLEAN; {True if running under DESQview }π Dv_Version : WORD; {DESQview" version number }π {Returns "0" if DESQview" is not loaded. }π {Use: }π {WRITELN(Hi(Dv_Version)+Lo(Dv_Version)/100:4:2); }π {to display the version of "Desqview" correctly. }πππFUNCTION Dv_There : BOOLEAN; {True if Desqview loaded. Sets Dv_Version}πPROCEDURE Dv_Pause; {Give up the rest of our timeslice}πPROCEDURE Dv_Begin_Critical; {Turn switching off for time critical ops}πPROCEDURE Dv_End_Critical; {Turn switching back on}πFUNCTION Dv_Video_Buffer : WORD; {returns address of video buffer}ππIMPLEMENTATIONππVARπ Reg : REGISTERS;ππFUNCTION Dv_There;πBEGINπ Reg.CX:=$4445;π Reg.DX:=$5351;π Reg.AX:=$2B01;π INTR($21,Reg);π Dv_Loaded:=(Reg.AL<>$0FF);π IF Dv_Loaded THEN Dv_Version:=Reg.BX ELSE Dv_Version:=0;π Dv_There:=Dv_Loaded;πEND;ππPROCEDURE Dv_Pause;πBEGINπ IF DV_Loaded THEN BEGINπ Reg.AX:=$1000;π INTR($15,Reg);π END;πEND;ππPROCEDURE Dv_Begin_Critical;πBEGINπ IF DV_Loaded THEN BEGINπ Reg.AX:=$101B;π INTR($15,Reg);π END;πEND;ππPROCEDURE Dv_End_Critical;πBEGINπ IF DV_Loaded THEN BEGINπ Reg.AX:=$101C;π INTR($15,Reg);π END;πEND;ππFUNCTION DV_Video_Buffer;πBEGINπ Reg.AH:=$0F;π INTR($10,Reg);π IF Reg.AL=7 THEN Reg.ES:=$B000 ELSE Reg.ES:=$B800;π IF DV_Loaded THEN BEGINπ Reg.DI:=0;π Reg.AX:=$FE00;π INTR($10,Reg);π END;π DV_Video_Buffer:=Reg.ES;πEND;ππBEGIN { Checks to see if desqview is loaded at startup. }π Dv_Loaded:=Dv_There;πEND.ππ