home *** CD-ROM | disk | FTP | other *** search
- PAGE 60,132
- TITLE XDVEE: RUN DESQVIEW WITH REMM.SYS 4.2 LIMITED TO EEMS
- SUBTTL Copyright 1989 John Navas II, All Rights Reserved
-
- COMMENT \
- This program limits DV.EXE to EEMS functions, making high-performance
- communications multitasking possible even with REMM.SYS 4.2. It
- works by installing itself as a filter for INT 67h, pretending to be
- an EMS driver, and spawning XDV.COM (passing all command-line
- arguments).
- If ALLOW1 is not defined, it converts any Get EMS Version
- (Function 46h) response > 3.9 to 3.9 (the version returned by AST
- REMM.SYS 3.5); XDV.COM and DV.EXE are thereby fooled into using EEMS
- (instead of EMS 4.0) functions.
- If ALLOW1 is defined, it does not interfere with the first (and
- only the first) Get EMS Version (Function 46h) response; this lets
- XDV.COM allocate memory using EMS 4.0 functions, which permits larger
- windows in certain configurations, while still fooling DV.EXE into
- using EEMS functions.
- Written in Microsoft MASM 5.1. \
-
- EEMS EQU 39h ; Version for REMM.SYS 3.5
-
- SSIZE EQU 400 ; stack size during spawn
-
- BELL EQU 07h ; audible bell
- LF EQU 0Ah ; line feed
- CR EQU 0Dh ; carriage return
-
- DOSTERM EQU 20H ; old style DOS terminate
-
- DOSINT EQU 21h ; DOS call interrupt
- DSPSTR EQU 09h ; display string function
- S_INT EQU 25h ; set interrupt vector function
- VERSION EQU 30h ; get DOS version number
- G_INT EQU 35h ; get interrupt vector function
- CHMOD EQU 43h ; get/set file attributes
- SETBLK EQU 4Ah ; modify allocated memory
- EXEC EQU 4Bh ; load and execute
- TERM EQU 4Ch ; terminate a process function
-
- EMMINT EQU 67h ; EMM driver interrupt
- EMMVER EQU 46h ; get EMM spec version
-
- PROG GROUP prog1,prog2,prog3
-
- prog1 SEGMENT PARA
-
- ;PROGRAM HEADER
- DB 44 DUP(?)
- env_str DW ? ; environment string pointer
- DB 46 DUP(?)
- fcb1 DB 16 DUP(?) ; dos fcb's
- fcb2 DB 16 DUP(?)
- DB 4 DUP(?)
- arg_len DB ? ; length of commard line args
- arg_val DB 7Fh DUP(?) ; command line string
-
- ASSUME cs:PROG
- begin: jmp init_code
- ASSUME cs:NOTHING
-
- EVEN
- parmblk LABEL WORD ; parameter block for spawn
- env_vec DW ? ; segment addr of environment string
- cmd_lin DW arg_len ; pointer to command line
- DW ? ; (segment)
- fcb1v DW fcb1 ; pointer to 1st fcb
- DW ? ; (segment)
- fcb2v DW fcb2 ; pointer to 2nd fcb
- DW ? ; (segment)
-
- spsave DW ? ; save stack pointer
-
- pathstr DB 'XDV.COM',0 ; build path name
- ORG pathstr+65
-
- prog1 ENDS
-
- PAGE
-
- prog2 SEGMENT PARA
-
- header DD ? ; FAKE EMM HEADER
- DW 3 DUP(?)
- emmnam DB 'EMMXXXX0' ; driver name
- IFDEF ALLOW1
- once DB 0 ; switch for XDV/DV
- ENDIF
-
- prog0 SEGMENT AT 0
- dummy LABEL FAR ; use for FAR JMP prototype
- prog0 ENDS
-
- ASSUME cs:prog2
-
- emment: ; FILTER entry
- cmp ah,EMMVER ; get version function?
- je emmchg ; yes
- jmp dummy ; no, go to original driver
- emm_v EQU DWORD PTR $-4 ; (original driver vector)
-
- emmchg: sti ; allow interrupts
- pushf ; simulate interrupt to orig driver
- call [emm_v]
- IFDEF ALLOW1
- cmp [once],0 ; XDV or DV?
- mov [once],0FFh ; (flip switch from XDV to DV)
- jz emmxit ; XDV (use EMS 4.0)
- ENDIF
- test ah,ah ; error?
- jnz emmxit ; yes
- cmp al,EEMS ; EEMS?
- jna emmxit ; yes
- mov al,EEMS ; change to REMM.SYS 3.5 EEMS
- emmxit: iret ; return to caller
-
- ASSUME cs:NOTHING
-
- prog2 ENDS
-
- PAGE
-
- prog3 SEGMENT WORD
-
- ;TERMINATION
-
- zerror DB 'ERROR: EXEC FAILURE!',BELL,CR,LF
- DB '$'
-
- ASSUME cs:PROG,ds:PROG ; ds valid only before spawn
-
- termsec:
- mov sp,OFFSET PROG:memend ; shrink stack
-
- mov ah,SETBLK ; release excess memory in es:bx
- int DOSINT
- jnc mmok ; success
-
- lea dx,[merror]
- mov ah,DSPSTR ; display error
- int DOSINT
- mov ax,TERM SHL 8 + 1 ; and bail
- int DOSINT
-
- mmok:
- mov ds,di ; vector from di:dx
- ASSUME ds:NOTHING
- mov ax,S_INT SHL 8 + EMMINT ; set my EMM vector
- int DOSINT
-
- push cs ; setup ds & es
- pop ds
- ASSUME ds:PROG
- push cs
- pop es
- lea bx,[parmblk] ; parameter block
- lea dx,[pathstr] ; program path name
- mov [spsave],sp ; save stack pointer
- mov ax,EXEC SHL 8 ; load and execute
- int DOSINT
- ASSUME ds:NOTHING
- cli ; suppress interrupts
- mov bx,cs ; restore .com stack segment
- mov ss,bx
- mov sp,[spsave] ; restore stack pointer
- sti ; restore interrupts
- jnc puzl ; DOS error reported
-
- push cs ; (ensure ds set up)
- pop ds
- lea dx,[zerror]
- mov ah,DSPSTR ; display error message
- int DOSINT
-
- puzl:
- lds dx,[emm_v]
- mov ax,S_INT SHL 8 + EMMINT ; restore EMM vector
- int DOSINT
-
- mov ax,TERM SHL 8 ; done at last
- int DOSINT ; call DOS
-
- EVEN ; stack area
- memend EQU $ + SSIZE ; END OF PROTECTED PROGRAM AREA
-
- PAGE
-
- ;INITIALIZATION
-
- xdvnam DB 'XDV.COM',0 ; DESQview loader
- pathnam DB 'PATH=' ; environment path string
-
- banner DB 'XDVEE'
- IFDEF ALLOW1
- DB '1'
- ENDIF
- DB ': DESQview(tm) loader for REMM.SYS 4.2',CR,LF
- DB '$'
-
- verror DB 'ERROR: MUST BE DOS VERSION 2 OR GREATER!',BELL,CR,LF
- DB '$'
-
- perror DB 'ERROR: CANNOT FIND XDV.COM!',BELL,CR,LF
- DB '$'
-
- nerror DB 'ERROR: REMM.SYS NOT INSTALLED!',BELL,CR,LF
- DB '$'
-
- copyr DB 'Copyright 1989 John Navas II, All Rights Reserved',CR,LF
- DB '$'
-
- ASSUME ds:PROG ; only before spawn
-
- init_code:
- lea dx,[banner]
- mov ah,DSPSTR ; display banner message
- int DOSINT
-
- mov ax,VERSION SHL 8 ; get DOS version number
- int DOSINT
- cmp al,2 ; must be version 2+
- jnb whew ; ok, continue
-
- lea dx,[verror]
- mov ah,DSPSTR ; display error
- int DOSINT
- int DOSTERM ; and bail
-
- whew:
- lea dx,[copyr]
- mov ah,DSPSTR ; display copyright
- int DOSINT
-
- mov [cmd_lin+2],cs ; setup parameter block
- mov [fcb1v+2],cs
- mov [fcb2v+2],cs
-
- mov es,[env_str] ; get env string segment pointer
- mov [env_vec],es ; and put in parameter block
- xor di,di
- cld ; setup for string ops
-
- snxt: cmp BYTE PTR es:[di],0 ; no more strings?
- je sgot ; none
- lea si,[pathnam] ; keyword
- mov cx,5 ; length of keyword
- repe cmpsb ; test for keyword
- je sgot ; found it!
- xor al,al
- mov cx,-1
- repne scasb ; scan for string terminator
- jmp snxt ; check next string
-
- sgot:
- lea dx,[pathstr]
- mov ax,CHMOD SHL 8 ; test for file found
- int DOSINT
- jnc sdot ; found it!
-
- cmp BYTE PTR es:[di],0 ; next path string?
- jne spth
-
- lea dx,[perror]
- mov ah,DSPSTR ; display error
- int DOSINT
- mov ax,TERM SHL 8 + 2 ; error code
- int DOSINT ; and bail
-
- spth:
- lea si,[pathstr - 1] ; build path name
- scnt: mov al,es:[di] ; path char
- test al,al ; end?
- jz schk ; yes
- inc di ; to next path char
- cmp al,';'
- je schk
- inc si ; locate for char
- mov [si],al ; store in work area
- jmp scnt ; continue
-
- schk:
- cmp BYTE PTR [si],'\' ; got delimiter?
- je sfnh ; yes
- cmp BYTE PTR [si],'/' ; got delimiter?
- je sfnh ; yes
- inc si ; next position
- mov BYTE PTR [si],'\' ; set delimiter
- sfnh:
-
- xor bx,bx ; move program name
- sxxx: mov al,[xdvnam+bx] ; next char
- inc bx ; & increment
- inc si ; inc for output
- mov [si],al ; store in buffer
- test al,al ; null terminator?
- jnz sxxx ; no, continue
-
- jmp sgot ; try to find this file
-
- sdot:
- mov ax,G_INT SHL 8 + EMMINT ; get EMM vector
- int DOSINT
- mov WORD PTR [emm_v],bx ; save it for later
- mov WORD PTR [emm_v+2],es
-
- mov di,OFFSET emmnam ; check name in driver
- lea si,[emmnam] ; against my name
- mov cx,8
- repe cmpsb
- je namok ; matches
-
- lea dx,[nerror]
- mov ah,DSPSTR ; display error
- int DOSINT
- mov ax,TERM SHL 8 + 3 ; error code
- int DOSINT ; and bail
-
- namok:
- mov di,cs ; compute new vector in di:dx
- mov ax,OFFSET PROG:header ; compute effective segment
- mov cl,4
- shr ax,cl
- add di,ax
- mov dx,emment - header ; effective offset
-
- mov bx,cs ; compute memory I need in es:bx
- mov es,bx ; point to my segment
- mov bx,OFFSET PROG:memend ; number of paragraphs
- add bx,15
- mov cl,4
- shr bx,cl
-
- jmp termsec ; go to termination section
-
- merror DB 'ERROR: MEMORY ALLOCATION FAILURE!',BELL,CR,LF
- DB '$' ; (must be above small stack)
-
- prog3 ENDS
-
- END begin
-