flat assembler
Message board for the users of flat assembler.

Index > DOS > DPMI program under Win32&DOS

Thread Post new topic Reply to topic

Joined: 28 Feb 2004
Posts: 6
Location: Russia - Rostov on Don
Need to code program, works under WIN 9X/NT & DOS
Optimal way - dos DPMI.
1) DosExtender for FASM - may use "dos32"
2) Example of allocation memory under dpmi - allocate 2 MB, read and write something. I already have PM examples from Forum, and mass other.

Sorry for terrible english. My native language is Russian

Post 01 Mar 2004, 07:15
View user's profile Send private message Reply with quote

Joined: 28 Feb 2004
Posts: 6
Location: Russia - Rostov on Don
Did anybody have experience on DPMI programing? I have read many references, but no one of them does not complete: they only about RAW PM - working on DOS without HIMEM.SYS or EMM386. But i want to code in win32 AND dos - programs that work on ALL platforms. Coding with DosExtender - is best way (i think), but i need some examples of DPMI programing. Best code i get from Internet - from Dieter Pawelczak's PASS32 assembler - with bult-in Extender
3.27 Function 0501h - Allocate Memory Block

Allocates a block of extended memory.

Function call: INT 31h
AX = 0501h
BX:CX = memory size to allocate in bytes

if successful:
carry flag clear
BX:CX = linear address of allocated memory block (*)
SI:DI = memory handle

if failed:
carry flag set
AX = error code

(*) You can easily allocate an descriptor for the linear address, see example

mov ax,0 ;Funktion 0
mov cx,1 ;Allocate 1 Descriptor
int 31h
mov MemDesk,AX
mov ax,0501h ;Allocate Memory
mov cx,0
mov bx,1 ;010000h Bytes of Memory
int 31h ;DPMI CALL
jc TooLessMemory
mov AX,0007h ;Function 7:Set Basis Address
mov BX,MemDesk
mov dx,cx ;Low Part of Linear Address
mov cx,bx ;upper Part of Linear Address
int 31h ;DPMI CALL
mov BX,MemDesk
mov ax,0008h ;Function 8:Set Limit of descriptor
mov cx,0ffffh
mov dx,0
int 31h ;set Limit
mov BX,MemDesk
mov fs,BX ; FS selector to 64K XMS Memory Location!
But when i try to read or write on this selector - program fail. GP - is wery bad thing. May be problem in wrong rivelegies levels? I seat on this code for 6 month. Dont give to dead. Please HEELP!

Sorry for my english.
Post 04 Mar 2004, 06:01
View user's profile Send private message Reply with quote

Joined: 18 Jan 2004
Posts: 97
Win interrupt functions, INT 71h ? has a LFN Long File Name checking interrupt.
I made a simple .COM file that returns an errorlevel to a batch file according to which OS is running, (Win or DOS) and
the batch file loads the DPMI if DOS 7.x is running,
Win doesn't need a DPMI loaded to use Fasm DOS if Win98 is running.
If you want the LFN checker (maybe even source code included in this version?)

Stuff I made is free to use in any way you want...
Post 08 Mar 2004, 09:37
View user's profile Send private message Reply with quote

Joined: 19 Feb 2004
Posts: 3170
Location: Denmark
You might want to have a look at WDOSX:

It's pretty old by now, but it worked very well for me back in the dos extending days. It works under both dos and windows (iirc it supports raw, himem.sys, emm386 and such), handles a couple of fileformats (including PE), and even has limited win32 API emulation.

If you want a more "raw" dos extender, see if you can find Tran's PMODE somewhere.

There are probably better extenders available by now, I saw something used in the dos version of the kaspersky antivirus scanner, I think the dos extender used is publicly available (and was written by a russian - I could be wrong, though).
Post 08 Mar 2004, 15:16
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.