From 68bf4662483ddff9819cc18b6d3b13c9930a1e1d Mon Sep 17 00:00:00 2001 From: Michael Keyes Date: Fri, 22 Apr 2022 14:42:47 +0100 Subject: [PATCH] =?UTF-8?q?Another=20unneeded=20file=20from=20the=20old=20?= =?UTF-8?q?version=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tplswrap.asm | 214 --------------------------------------------------- 1 file changed, 214 deletions(-) delete mode 100644 tplswrap.asm diff --git a/tplswrap.asm b/tplswrap.asm deleted file mode 100644 index de7f234..0000000 --- a/tplswrap.asm +++ /dev/null @@ -1,214 +0,0 @@ -.8086 -.MODEL TINY -.STACK 80h -OPTION MZ: 0:16:0:0 ; zeros to minimize all allocations (make room for Rayman and TSR) - -.CODE -entry: - push cs - pop ds ; standard for "tiny" programs... - - ; Fill in the segment for stuff to copy to child PSPs - mov word ptr [pfCmdTail+2],es - mov word ptr [pfrFCB_1+2],es - mov word ptr [pfrFCB_2+2],es - - ; Check for EMS - precursor to VCPI check... - mov ax,3567h ; get interrupt vector 67h - int 21h - mov word ptr [ems_vec],bx - mov word ptr [ems_vec+2],es - - ; Check for DPMI - mov ax,1687h ; DPMI check - int 2Fh - test ax,ax - jnz start_dpmi - test bx,1 ; 32-bit support? - jnz have_dpmi - -start_dpmi: - mov ax,4B00h ; exec and load - mov dx,offset dpmi_exe - push ds - pop es - mov bx,offset wEnvSeg - mov word ptr [orig_stack],sp - mov word ptr [orig_stack+2],ss - int 21h ; execute the TSR - ; restore the stack after the exec call: - mov ss,word ptr [cs:orig_stack+2] - mov sp,word ptr [cs:orig_stack] - ; and the data segment - push cs - pop ds - - jc failed_dpmi_exec - mov ah,4Dh ; get exit code - int 21h - cmp ah,3 ; TSR-ed - jne failed_dpmi_exec - -have_dpmi: - .386 ; if 32-bit DPMI is available, it means we're at least on a 386 - mov ebx,[ems_vec] - test ebx,ebx - jz no_vcpi ; vector is null - - ; Before actually checking for VCPI, check for Windows 3.0 - ; Apparently, it "objects violently" to VCPI checks... - mov ax,4680h - int 2Fh - test ax,ax - jz hide_vcpi ; Windows 3.0 running - hide VCPI to make sure nothing else incurs its wrath! - - mov ax,1600h - int 2Fh - cmp ax,0003h ; Windows 3.0 in enhanced mode - je hide_vcpi - - mov ax,0DE00h ; VCPI installation check - int 67h - test ah,ah - jnz no_vcpi ; AH did not get zeroed - -hide_vcpi: - ; OK, VCPI is available. - ; This means we need to hide it from DOS32 to make it use DPMI! - ; (May also be the case for Rayman itself, depending on how - ; PMODE/W was compiled...) - mov ax,2567h ; set interrupt vector 67h - mov dx,offset vcpi_hider - int 21h - -no_vcpi: - ; Check if TPLS is already installed - mov ax,0CE00h + 'T' - mov bl,'P' - mov cl,'L' - mov dl,'S' - int 2Fh - cmp al,'P' - jne install_tsr - cmp bl,'l' - jne install_tsr - cmp cl,'u' - jne install_tsr - cmp dl,'M' - je tsr_installed - -install_tsr: - mov ax,4B00h ; exec and load - mov dx,offset tsr_exe - push ds - pop es - mov bx,offset wEnvSeg - mov word ptr [orig_stack],sp - mov word ptr [orig_stack+2],ss - int 21h ; execute the TSR - ; restore the stack after the exec call: - mov ss,word ptr [cs:orig_stack+2] - mov sp,word ptr [cs:orig_stack] - ; and the data segment - push cs - pop ds - - jc failed_tsr_exec - - mov ah,4Dh ; get exit code - int 21h - cmp ah,3 ; TSR-ed - jne failure ; no need to print a message since the TSR will have done so anyway - -tsr_installed: - ; We're good so far - run Rayman now! - mov ax,4B00h ; exec and load - mov dx,offset ray_exe - push ds - pop es - mov bx,offset wEnvSeg - mov word ptr [orig_stack],sp - mov word ptr [orig_stack+2],ss - int 21h ; execute the TSR - ; restore the stack after the exec call: - mov ss,word ptr [cs:orig_stack+2] - mov sp,word ptr [cs:orig_stack] - ; and the data segment - push cs - pop ds - - jc failed_ray_exec - - mov [exit_code],0 - jmp finish - -failed_dpmi_exec: - .8086 ; if we're here, we may not be on a 386 - mov dx,offset failed_dpmi_msg - jmp failure_msg - -failed_tsr_exec: - mov dx,offset failed_tsr_msg - jmp failure_msg - -failed_ray_exec: - mov dx,offset failed_ray_msg - -failure_msg: - mov ah,9 ; print message - int 21h -failure: - mov [exit_code],-1 - -finish: - ; restore EMS/VCPI vector - it's saved anyway, whether or not we modified it - push ds - lds dx,[ems_vec] - mov ax,2567h ; set interrupt vector 67h - int 21h - pop ds - - mov ah,4Ch ; exit - mov al,[exit_code] - int 21h - - -vcpi_hider: - cmp ax,0DE00h ; VCPI installation check - je vcpi_hider_ret - jmp cs:ems_vec -vcpi_hider_ret: - ; Pretend VCPI's not installed - ; Only hide the installation check, not any other calls, - ; since the DPMI host may itself be using them. - iret - - -.DATA - TSR_EXE_DEF equ "TPLSTSR3.EXE" - RAY_EXE_DEF equ "RAYMAN.EXE" - DPMI_EXE_DEF equ "CWSDPMI.EXE" - tsr_exe db TSR_EXE_DEF,0 - ray_exe db RAY_EXE_DEF,0 - dpmi_exe db DPMI_EXE_DEF,0 - - failed_tsr_msg db "Couldn't exec ",TSR_EXE_DEF," - is it in the right directory?",0Dh,0Ah,'$' - failed_ray_msg db "Couldn't exec ",RAY_EXE_DEF," - is it in the right directory?",0Dh,0Ah - db "Note TPLS is resident anyway, so you can try running Rayman directly now",0Dh,0Ah,'$' - failed_dpmi_msg db "No 32-bit DPMI available, and couldn't exec ",DPMI_EXE_DEF,".",0Dh,0Ah - db "Note that this doesn't scan PATH, so you may need to run it manually.",0Dh,0Ah - db "You can also start a different DPMI host of your choice, or else run in a VDM",0Dh,0Ah - db "under Windows 9x or Windows 3.x in Enhanced Mode.",0Dh,0Ah,"$" - - ; exec parameters - wEnvSeg dw 0 ; copy parent environment - pfCmdTail dd 80h ; copy parent cmdline (seg to fill in at runtime) - pfrFCB_1 dd 5Ch ; copy parent FCB1 (seg to fill in at runtime) - pfrFCB_2 dd 6Ch ; copy parent FCB2 (seg to fill in at runtime) - -.DATA? - ems_vec dd ? - orig_stack dd ? - exit_code db ? - -END entry