flat assembler
Message board for the users of flat assembler.
Index
> DOS > History of DPMI |
Author |
|
Tomasz Grysztar 17 Dec 2006, 20:36
I've posted this link in the other thread, however it perhaps got lost in a vast discussion there. I am reposting it, because I consider it to be really important reading for anyone who ever did any DOS protected mode programming:
http://lists.gnu.org/archive/html/lynx-dev/1998-04/msg00773.html I first stumbled upon the above message when it was mentioned on the freedos-dev list back in early 2000, about the same time when I was posting the announcements of the very first releases of fasm there. Since then I was hoping I would one day see the True DPMI specification, however it never happened and it seems the knowledge about it limited to a small number of people. There are a few follow-up messages in the same archives about this (with even more interesting notes): http://lists.gnu.org/archive/html/lynx-dev/1998-05/msg00157.html http://lists.gnu.org/archive/html/lynx-dev/1998-05/msg00159.html However I never found it mentioned in any other place of internet. Myself I anyway always rely only on the basic DPMI 0.9 functionality, since I don't even know a method to detect whether the DPMI is True or not - in the first message linked here Michael Sokolov states that he used such method, but CWSDPMI was "screwed" in a way that it was not working with it. If anyone has some deeper knowledge about the topic, please let me know. |
|||
17 Dec 2006, 20:36 |
|
vid 17 Dec 2006, 21:52
someone please mention this in wikipedia (i don't have experience editing it)
http://en.wikipedia.org/wiki/DPMI |
|||
17 Dec 2006, 21:52 |
|
Tomasz Grysztar 17 Dec 2006, 23:36
Indeed, I tested with QDPMI and HDPMI and they both report as "MS-DOS" vendor (correctly, as they both support 32-bit INT 21h API), while CWSDPMI does not. Is it possible that some old version of CWSDPMI was reporting this way and this was what was "broken" about it? Or was he referring to some other detection method?
Anyway, this method seems to be reliable. Thanks! Code: ; A True DPMI example format MZ heap 0 ; no additional memory segment loader use16 push cs pop ds mov ax,1687h int 2Fh or ax,ax ; DPMI installed? jnz error test bl,1 ; 32-bit programs supported? jz error mov word [mode_switch],di mov word [mode_switch+2],es mov bx,si ; allocate memory for DPMI data mov ah,48h int 21h jc error mov es,ax mov ax,1 call far [mode_switch] ; switch to protected mode jc error mov ax,168Ah mov esi,_msdos ; True DPMI functionality supported? int 2Fh or al,al jnz error mov cx,1 xor ax,ax int 31h ; allocate descriptor for code mov si,ax xor ax,ax int 31h ; allocate descriptor for data mov di,ax mov dx,cs lar cx,dx shr cx,8 or cx,0C000h mov bx,si mov ax,9 int 31h ; set code descriptor access rights mov dx,ds lar cx,dx shr cx,8 or cx,0C000h mov bx,di int 31h ; set data descriptor access rights mov ecx,main shl ecx,4 mov dx,cx shr ecx,16 mov ax,7 ; set descriptor base address int 31h mov bx,si int 31h mov cx,0FFFFh mov dx,0FFFFh mov ax,8 ; set segment limit to 4 GB int 31h mov bx,di int 31h mov ds,di mov es,di mov fs,di mov gs,di push 0 push si push dword start retfd error: mov ax,4CFFh int 21h _msdos db 'MS-DOS',0 mode_switch dd ? segment main use32 start: mov ah,9 mov edx,hello int 21h mov ax,4C00h int 21h hello db 'Hello from protected mode!',0Dh,0Ah,'$' |
|||
17 Dec 2006, 23:36 |
|
coconut 18 Dec 2006, 03:28
some commented code from tomasz! maybe he'll develope the habit in fasm source
|
|||
18 Dec 2006, 03:28 |
|
vid 18 Dec 2006, 06:20
Quote: i wouldn't be afraid of that... |
|||
18 Dec 2006, 06:20 |
|
Japheth 18 Dec 2006, 08:35
> Indeed, I tested with QDPMI and HDPMI
the "MS-DOS" vendor call is also supported by DPMIONE (+386MAX), 32RTM, DosEmu, OS/2 VDMs and Windows DOS boxes. |
|||
18 Dec 2006, 08:35 |
|
DOS386 06 Mar 2008, 06:56
Download now: http://board.flatassembler.net/download.php?id=3651
Applied 2 "critical" fixes to the code Code: mov eax,$168A ; 5 lea ebx,[eax+$30C5] ; 6 push ebx ; 1 xor ebx,$442D1402 ; 6 push ebx ; 1 mov esi,esp ; 2 push eax ; 1 int $2F ; 2 -> 24 Test, may destroy EAX and ES ; We have result in AL cmp al,0 ; 2 Sets ZF, AL=0 -> found !!! pop eax ; 1 Doesn't affect ZF je @f ; 2 Found pop ecx ; 1 pop ebx ; 1 mov bh,ch ; 2 push ebx ; 1 push ecx ; 1 int $2F ; 2 -> 37 Recheck @@: ; We have result in AL pop ebx ; 1 pop ebx ; 1 -> 39 Done ! ; Here our result is in AL : AL=0 -> "API" found |
|||
06 Mar 2008, 06:56 |
|
Goplat 07 Mar 2008, 00:31
What's wrong with "push dword 'OG', push dword 'MS-D'", and what DPMI host has that entry point?
|
|||
07 Mar 2008, 00:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.