32DE, 32-bit DOS-Extender, v0.15, Copyright (C) 1995 Sami Kantoluoto ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ 32DE consists of two main parts: the DOS extender and the DPMI host. The DOS extender takes care about extending the DOS (INT21) API functions and the DPMI host provides the client program with a subset of DPMI (INT31) v0.9 API functionality. You can use 32DE freely in public domain productions, but any commercial/shareware use and/or distribution without permission is prohibited. If you use 32DE, it would be nice if you gave me the credits for it... ;) 1. Initialization and termination ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 32DE has two directly callable FAR functions to facilitate easy switching to protected mode, these being _pm_info and _pm_init. _pm_info gives info about the machine that the program currently runs on and _pm_init swithes to protected mode. After a call to _pm_init, if the carry flag is clear, the system will be in 32-bit protected mode, running in a 16-bit code segment. If the carry flag is set, then some error occurred and the mode switch failed. Terminating the program is easy: you do it just as you would in plain old DOS - by issuing INT 21h with AH=4C. The header then frees all allocated resources and returns to DOS... _pm_info: --------- parameters: - returns: CF = set on error AX = return code: 0000h = OK... ;) 0001h - No 80386+ detected 0002h - system already in protected mode and no VCPI or DPMI present 0003h - DPMI - host is not 32bit CF = clear if successful: BX = paragraphs needed to protected mode data CL = CPU type (5 = Pentium, 4 = 486 etc.) CH = pmode type (3=DPMI, 2=VCPI, 1=XMS, 0=RAW) _pm_init: --------- parameters: ES = segment of protected mode data returns: CF = set on error AX = return code: 0000h = OK... ;) 0001h - No 80386+ detected 0002h - system already in protected mode and no VCPI or DPMI present 0003h - DPMI - host is not 32bit 0004h - Could not enable A20 gate 0005h - DPMI - could not enter 32bit protected mode 0006h - DPMI - could not allocate needed selectors 0007h - DPMI not present (only on DPMI-only extender) 0008h - XMS - Too old version (v3.0 needed) CF - set on error, if no error: CS - 16bit selector for real mode CS with limit of 64k SS - 32bit selector for real mode SS with limit of 64k DS - 32bit selector for real mode DS with limit of 64k ES - 32bit selector for PSP with limit of 100h FS - 0 (NULL selector) GS - 0 (NULL selector) 2. The DOS extender ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The extended DOS function calls are listed below in a numerical order by the value of the AH register. All far pointers are in a selector:offset form, as it is to be expected from a protected mode program... AH=09h, Print string to standard output --------------------------------------- Parameters: DS:EDX -> the string (DOS '$'-terminated string) Returns: - AH=1Ah, Set DTA (Disk Transfer buffer Area) address --------------------------------------------------- Parameters: DS:EDX -> buffer area (43 bytes) Returns: - AH=1Bh, Get allocation information for current drive ---------------------------------------------------- Parameters: - Returns: AL = sectors per cluster (allocation unit) CX = bytes per sector DX = total number of clusters DS:EBX -> media ID byte AH=1Ch, Get allocation information for an arbitrary drive --------------------------------------------------------- Parameters: DL = drive number Returns: AL = sectors per cluster (allocation unit) CX = bytes per sector DX = total number of clusters DS:EBX -> media ID byte AH=1Fh, Get drive parameter block for current drive --------------------------------------------------- Parameters: - Returns: AL = Status 00: DS:EBX -> drive parameter block FF: invalid drive AH=25h, Set interrupt vector ---------------------------- Parameters: AL = vector number DS:EDX -> interrupt handler routine Returns: - AH=2Fh, Get DTA (Disk Transfer buffer Area) address --------------------------------------------------- Parameters: - Returns: ES:EBX -> DTA AH=32h, Get drive parameter block for an arbitrary drive -------------------------------------------------------- Parameters: DL = drive number Returns: AL = status 00: DS:EBX -> drive parameter block FF: invalid drive AH=34h, Get address of InDOS flag --------------------------------- Parameters: - Returns: ES:EBX -> one-byte InDOS flag AH=35h, Get interrupt vector ---------------------------- Parameters: - AL = interrupt vector number Returns: ES:EBX -> interrupt handler routine AH=39h, Create subdirectory --------------------------- Parameters: DS:EDX -> directory name (ASCIIZ) Returns: CF = clear if successful AX = unpredictable juttuj CF = set on error AX = error code AH=3Ah, Remove subdirectory --------------------------- Parameters: DS:EDX -> directory name (ASCIIZ) Returns: CF = clear if successful AX = unpredictable juttuj CF = set on error AX = error code AH=3Bh, Change directory ------------------------ Parameters: DS:EDX -> directory name (ASCIIZ) Returns: CF = clear if successful AX = unpredictable juttuj CF = set on error AX = error code AH=3Ch, Create or truncate file ------------------------------- Parameters: CX = file attributes DS:EDX -> filename (ASCIIZ) Returns: CF = clear if successful AX = file handle CF = set on error AX = error code AH=3Dh, Open file ----------------- Parameters: AL = access and sharing modes DS:EDX -> filename (ASCIIZ) Returns: CF = clear if successful AX = file handle CF = set on error AX = error code AH=3Fh, Read file ----------------- Parameters: BX = file handle ECX = bytes to read DS:EDX -> destination Returns: CF = clear if successful EAX = bytes read CF = set on error AX = error code AH=40h, Write file ------------------ Parameters: BX = file handle ECX = bytes to write DS:EDX -> source Returns: CF = clear if successful EAX = bytes written CF = set on error AX = error code AH=41h, Delete file ------------------- Parameters: DS:EDX -> filemask (filename) Returns: CF = clear if successful AX = unpredictable CF = set on error AX = error code AX=4300h, Get file attributes ----------------------------- Parameters: DS:EDX -> filename (ASCIIZ) Returns: CF = clear if successful CX = file attributes AX = ??? CF = set on error AX = error code AX=4301h, Set file attributes ----------------------------- Parameters: CX = file attributes DS:EDX -> filename (ASCIIZ) Returns: CF = clear if successful AX = ??? CF = set on error AX = error code AH=47h, Get current directory ----------------------------- Parameters: DL = drive number (00 = current, 01 = A:, etc.) DS:ESI -> 64-byte buffer for ASCIIZ directoryname Returns: CF = clear if successful AX = ??? CF = set on error AX = error code AH=48h, Allocate memory ----------------------- Parameters: BX = paragraphs to allocate (lowmemory) Returns: CF = clear if successful AX = selector for allocated block CF = set on error AX = error code BX = size of largest available memory block AH=49h, Free memory ------------------- Parameters: ES = selector of the memory block Returns: CF = clear if successful CF = set on error AX = error code AH=4Ah, Resize memory block --------------------------- Parameters: ES = selector of the memory block BX = new size Returns: CF = clear if successful CF = set on error AX = error code BX = size of largest available memory block AH=4Eh, Find first matching file -------------------------------- Parameters: CX = file attribute mask DS:EDX -> filemask (filename) Returns: CF = clear if successful DTA = findfile data block CF = set on error AX = error code AH=4Fh, Find next file ---------------------- Parameters: DTA = data block from previous findfirst/findnext call Returns: CF = clear if successful DTA = findfile data block CF = set on error AX = error code AH=56h, Rename file ------------------- Parameters: DS:EDX -> file to rename (ASCIIZ) ES:EDI -> new filename (ASCIIZ) Returns: CF = clear if successful CF = set on error AX = error code 3. The DPMI host ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ The DPMI host functions are described in a future version of this file. If you have questions, then get a DPMI 0.9 spec... ;) 4. Contact info ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ If you have something to ask/suggest/tell, contact me: ) E-mail: tstrike@kontu.bbs.fi ) Snail mail: Sami Kantoluoto Kukonm„entie 1 16600 J„rvel„ FiNLAND ) Voice: +358-18-1333039 (home) ) BBS: Eternal Fire, SysOp: Beaver +358-18-7530120