Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to the forum
Board view  Mix view

MPXplay under CWSDPMI (Users)

posted by Rugxulo Homepage, Usono, 28.10.2010, 11:41
(edited by Rugxulo on 28.10.2010, 11:57)

N.B. I'm a horrible programmer. You are 10x the coder I will ever be. So please don't take any of this as condescending, it's not. I'm just clarifying what I (barely) know. You probably knew all of this already anyways. (Corrections and clarifications welcome.)

> I don't do anything with DPMI in my own source. I already have the 32-bit
> dpmi environment at (before) the first line of my code.

Who says it's using DPMI? It could be using raw, XMS, EMS/VCPI instead. DPMI is just an API, it's not the same as 32-bit pmode (esp. since DPMI can also be 16-bit, e.g. 286). VCPI existed for a while before DPMI (Win 3.0). Old "WIN.COM /S" (standard mode) was the only way to get VCPI in Windows, and that's long since been abandoned.

> I haven't checked, but I think so there's no such stuff in the linked stub
> neither (that calls the dos4g.exe). Probably the DPMI host checking is in
> the dos4g.exe (and it's not opensource), so I cannot modify it (but I don't
> want it neither)...

I haven't checked your sources lately, do you use much inline asm? But anyways, IIRC, DOS/4G and DOS/4GW weren't meant for DJGPP, nor was CWSDPMI meant for Watcom. CWSDPMI is not an "extender" at all, it only provides the DPMI API (plus low-level support) and even then only for 32-bit stuff. OpenWatcom/DOS (mostly) only supports LE while DJGPP only (properly) supports COFF. You can't use the DJGPP stub with OpenWatcom.

> btw. Laaca. I don't understand why did you load the cwsdpmi like a "host"
> (tsr). It have to work similar like the using of dos4g (the program should
> load the cwsdpmi if it needs, you don't have to pre-load it)...

Right, I can't see why he would want to use it either unless he wanted swapping for some reason.

>> And generaly - when I got crash with some DOS4GW or DOS32A program I
>> always try to run it also under CWSDPMI.

Most apps are only tested with one DPMI host or one extender. It's very rare that switching helps. I know OpenWatcom brags about their drop-in replacements, but none of them support the full DPMI 0.9 standard, even (last I checked), only a subset.

> btw2. (the answer to your original question) probably the DLL handling part
> of Mpxplay crashes, because there are no such functions (API) in the
> CWSDPMI (these functions are also missing from DOS4GW.EXE, only DOS4G.EXE
> have them)

Right, DLLs are not part of the standard. And all these extended 32-bit variants of the 16-bit DOS API are non-standard also. DJGPP doesn't use any of that, and CWSDPMI primarily exists only for DJGPP (though well-behaving apps from others could work too, in theory, and I'm not implying Mpxplay isn't well-behaving here). DJGPP does "have hooks" (as Rod P. often says) for full DPMI 1.0, but most of that is disabled because Windows never supported more than 0.9 (though OS/2 allegedly came closer with 0.95). DJ said that 0.9 was the older, 286 version. The unpopular 1.0 was where some additional 386-only features came into play.

> Maybe I can add something api check to my code with a nice exit-error
> message, but I cannot load a new/other dpmi host.

"Get DPMI Capabilities -- DPMI 1.0"

http://www.delorie.com/djgpp/doc/dpmi/api/310401.html

IIRC, only CWSDPMI r5 and up support this (which should be plenty of leeway, IMHO). r6 was never finalized and was buggy, so r7 is the true successor to that. r6 calls itself "5.00" also (bug). r7 does correctly identify itself as 7.00. Note that CWSDPMI is not a full 1.0 implementation. I don't know if anybody outside of DPMIONE (or its cousin 386MAX?) ever did that, not even HDPMI32 (yet? right??). Still, CWSDPMI does support a few 1.0 calls.


.get_dpmi:
  mov ax,401h                ; get DPMI capabilities
  mov cx,128
  mov edi,dpmi_buf
  stc
  int 31h
  jc .fiddle

.dosemu:
  cmp dword [dpmi_buf+2],'DOSE'
  jnz .cwsdpmi
  cmp dword [dpmi_buf+2+2],'SEMU'
  jz .no_fiddle

.cwsdpmi:
  cmp dword [dpmi_buf+2],'CWSD'
  jnz .fiddle
  cmp dword [dpmi_buf+2+3],'DPMI'
  jnz .fiddle
.no_fiddle:
  xor eax,eax
  inc al
  jmp .ret
.fiddle:
  xor eax,eax
.ret:
  pop edi
  ret


EDIT: Here's a DJGPP version I had lying around:


#include <stdio.h>
#include <dpmi.h>

int main() {
    int flags; char vendor[129];

if (__dpmi_get_capabilities(&flags,vendor) == 0)
    printf("\nVendor = %s, version = %d.%d\n",&vendor[2],vendor[0],vendor[1]);
else
    printf("\nNo vendor id found.\n");

return 0; }

 

Complete thread:

Back to the forum
Board view  Mix view
22762 Postings in 2122 Threads, 402 registered users (1 online)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum