INT 21 U - Qualitas 386MAX v6.00+ - IOCTL INPUT - GET STATE AX = 4402h BX = file handle for device "386MAX$$" CX = number of bytes to read DS:DX -> BYTE 03h followed by 386MAX state buffer (see below) Return: CF clear if successful buffer at DS:DX+1 filled AX = number of bytes actually copied CF set on error AX = error code (01h,05h,06h,0Dh) (see AH=59h) Notes: if the value given in CX is less than the size of the state record (5Ah for v6.01, 66h for v7.00), only a partial state record will be returned the state is 40h bytes for 386MAX (actually ASTEMM) v2.20 ("386MAX$$" did not exist yet, use "QMMXXXX0" and then "EMMXXXX0" instead) and 56h bytes for v5.11. to invoke 386MAX API functions, push DX onto the stack, load DX with the word at offset 25h in the returned state, load all other registers as needed for the desired function, and execute an OUT DX,AL or OUT DX,AX; DX will be set to the pushed value on return if it is not otherwise modified by the API function. For safety, in case a function is not supported or 386MAX is not present, SP should be saved and restored around the API call. Windows 3.1 Standard mode, LAN Manager, and Windows for Workgroups all use the 386MAX API; LAN Manager and Windows for Workgroups reportedly make some calls incorrectly SeeAlso: AX=4403h/SF=03h"386MAX",INT 67/AH=3Fh Format of 386MAX v6.01+ state: Offset Size Description -1 BYTE (call) 03h 00h 6 BYTEs signature "386MAX" 06h 4 BYTEs version string "N;NN" (i.e. "6;01" for v6.01) 0Ah WORD segment of low-memory portion of 386MAX.SYS 0Ch 2 BYTEs ??? 0Eh WORD segment of ??? memory block or 0000h 10h WORD bit flags 1 (see below) 12h WORD (v6.01) starting address of video memory in KB (v7.00) low memory size in bytes 14h 2 BYTEs ??? 16h WORD total high DOS memory in KB 18h 2 BYTEs ??? 1Ah WORD available shared memory in KB 1Ch WORD KBytes extended memory used by 386MAX 1Eh 2 BYTEs ??? 20h WORD total extended memory in KB 22h WORD IO port to write (OUT DX,AL) to invoke 386MAX INT 15 functions 24h WORD IO port to write (OUT DX,AL) to invoke 386MAX API functions 26h WORD ??? (depends on DOS version) 28h 2 BYTEs ??? 2Ah DWORD machine type (see below) 2Eh WORD ??? 30h WORD ??? 32h WORD system configuration flags (see below) 34h WORD debugging flags 1 (see below) 36h WORD debugging flags 2 (see below) 38h 2 BYTEs ??? 3Ah WORD segment of first MCB in high memory chain??? 3Ch WORD feature flags 1 (see below) 3Eh WORD feature flags 2 (see below) 40h WORD feature flags 3 (see below) 42h WORD segment of first 386MAX control block??? (see below) 44h WORD amount of memory to report available on INT 15/AH=88h 46h 4 BYTEs ??? 4Ah WORD number of K at start of address space swapped with fast extended memory (SWAP= parameter) 4Ch 2 BYTEs ??? 4Eh WORD ??? 50h WORD debugging flags 3 (see below) 52h DWORD old INT 21h 56h DWORD pointer to 386MAX's EMS (INT 67h) handler ---386MAX v7.00--- 5Ah DWORD KB of extended memory managed by 386MAX 5Eh DWORD bytes of extended memory (EXT= parameter) 62h 4 BYTEs ??? Bitfields for bit flags 1: bit 1 ??? bit 2 ??? bit 3 ??? (cleared by calling INT 67 functions) bit 4 high RAM present??? bit 5 386MAX in AUTO mode bit 6 386MAX enabled bit 7 386MAX is providing EMS services bit 8 ??? bit 9 A20 enabled??? (see INT 15/AX=2402h) bit 10 Weitek support enabled bit 11 ??? bit 12 ??? bit 13 QPMS has been used bit 14 ??? bit 15 ??? Bitfields for system configuration flags: bit 1 ROM compressed??? bit 3 ??? bit 5 386MAX loaded into high memory bit 6 Microchannel bus bit 7 Weitek math coprocessor detected bit 11 PC/XT (thus only single 8259 interrupt controller present, DMA only in 1st megabyte, etc) bit 13 LMLTOP= specified bit 15 ??? Bitfields for debugging flags 1: bit 0 DEBUG=LED bit 1 DEBUG=X67 bit 2 DEBUG=INV bit 3 DEBUG=EMSPTED bit 4 DEBUG=JMP bit 5 DEBUG=CALL bit 6 DEBUG=HLT bit 7 DEBUG=PMR bit 8 DEBUG=CR3 bit 9 DEBUG=CAPS or DEBUG=INT bit 10 DEBUG=RC bit 11 DEBUG=ROM bit 12 DEBUG=XM bit 13 DEBUG=SOR bit 14 DEBUG=XR bit 15 DEBUG=EMSERR Bitfields for debugging flags 2: bit 0 DEBUG=ROMSWAP bit 1 DEBUG=UNSHADOWROM bit 2 DEBUG=COMPROM bit 3 DEBUG=DPMIPHYS bit 4 DEBUG=ALLROM bit 5 DEBUG=VMS bit 6 DEBUG=XMS bit 7 DEBUG=I06 bit 8 DEBUG=VCPI bit 9 DEBUG=XDMA bit 10 DEBUG=X09 bit 13 DEBUG=I67 bit 14 DEBUG=EVM bit 15 DEBUG=EMSSAVE or DEBUG=VDS Bitfields for debugging flags 3: bit 10 DEBUG=EPM bit 12 DEBUG=ABIOS bit 13 DEBUG=XMSPTED bit 14 DEBUG=TIME bit 15 DEBUG=SCRUB Bitfields for feature flags 1: bit 1 Weitek present bit 2 no DPMI services bit 3 NODMA bit 4 TERSE bit 5 NOROM bit 6 NOPARITY bit 8 NOFLEX (IGNOREFLEXFRAME) bit 11 don't create UMBs bit 12 don't backfill below video memory (NOLOW) bit 13 FRAME= specified bit 14 EXT= specified bit 15 NOEMS, allow prior expanded memory manager to provide EMS Bitfields for feature flags 2: bit 0 UNSHIFT specified (FORCEA20 disabled) bit 1 NOXRAM bit 2 NOSCSI specified bit 3 SCREEN specified bit 4 enabled EISADMA bit 5 slow DMA bit 6 RESETKEYB specified bit 7 ??? bit 9 TOP384 bit 11 NOWARMBOOT bit 12 USE= specified bit 13 ROM= specified Bitfields for feature flags 3: bit 0 Windows3 support enabled bit 1 SHADOWROM bit 2 don't compress ROM (NOCOMPROM) bit 3 ??? (related to PRGREG=) bit 4 ??? (related to PRGREG=) bit 5 SHADOWRAM bit 6 DOS4 specified bit 7 NOLOADHIGH bit 8 NOPULSE bit 11 FORCEA20 bit 12 DMA buffer enabled bit 13 NOSCRUB bit 15 NOFRAME Bitfields for machine type: bit 12 Amstrad bit 13 Epson bit 14 Zenith Data Systems bit 15 "ASEM" bit 16 NEC bit 17 "HPRS" model codes 69h and 6Ah bit 18 Dell bit 19 "CA" bit 20 ITT (Xtra Business Systems/Alcatel) bit 21 Toshiba 5100 bit 22 Olivetti bit 23 Quadram Quad386 (BIOS model FEh, submodel A6h) bit 24 Tandy??? bit 25 AST 386 bit 26 INBOARD, ??? version bit 27 INBOARD, ??? version bit 28 INBOARD, ??? version bit 29 "HPRS" bit 30 Compaq 386 bit 31 JET386 Format of 386MAX control block: Offset Size Description 00h WORD segment of next block (FFFFh if last) 02h WORD segment of previous block (FFFFh if first) 04h 12 BYTEs filename 10h WORD resident size in paragraphs 12h WORD environment size??? 14h WORD real prsent environment size + 1 (0000h if ENVSAVE used) 16h 2 BYTEs ??? 18h DWORD initial size or SIZE=n in 386LOAD commandline 1Ch DWORD SIZE=-1 ??? 20h DWORD SIZE= ??? 24h BYTE PRGREG= if specified, else FFh 25h BYTE ENVREG= if specified, else FFh 26h BYTE FlexFrame (00h not present, 01h present) 27h 3 BYTEs ??? 2Ah BYTE GROUP= or 00h if not present 2Bh BYTE ??? 2Ch WORD PSP Format of high memory info record: Offset Size Description 00h WORD segment address of memory region 02h WORD size of memory region in paragraphs 04h BYTE type or flags??? 00h if locked out 02h if EMS page frame 04h if high RAM 42h if ROM 05h BYTE ??? Format of ROM shadowing record: Offset Size Description 00h WORD segment of ROM??? 02h WORD segment of ROM??? 04h 2 BYTEs ??? 06h WORD size of shadowed ROM in paragraphs 08h 4 BYTEs ??? Values for memory type: 00h unused by EMS 01h DOS 04h page frame overlapping ROM??? 80h high memory 84h page frame??? 87h video ROM??? Note: the type may be 00h (unused) if the 16K page is split among different uses (such as ROM and high RAM) Call 386MAX API (via OUT DX,AL) with: STACK: WORD value for DX AH = 01h get high memory information ES:DI -> buffer for array of high memory info records (see above) Return: CX = number of records placed in buffer AH = 02h get shadowed ROM info??? ES:DI -> buffer for array of ROM shadowing records (see above) Return: CX = number of records placed in buffer AH = 03h get 386MAX state ES:DI -> 90-byte buffer for state (see above) Return: AH = 00h (successful) buffer filled Note: unlike INT 21/AX=4402h"386MAX", this function omits the first byte specifying the state buffer version AH = 04h get memory types??? ES:DI -> buffer for memory type info (array of bytes, one per 16K page) (see above) Return: CX = number of bytes placed in buffer AH = 05h get ??? AL = A20 control (00h enable A20 first, 01h leave unchanged) CX = number of 4K pages to report (0000h for default) SI = first K to report (rounded down to 4K page) ES:DI -> buffer for returned info on ??? Return: CX = number of 4K pages reported on ??? AH = 06h get memory speed info ES:DI -> buffer for memory speed records (see below) Return: AH = 00h (successful) CX = number of bytes placed in buffer Note: this function can take over a second to execute AH = 07h ??? DX = EMS handle (on stack) ??? Return: ??? AH = 08h "EMM2_GOREAL" check whether possible to disable 386MAX AL = ??? (00h or nonzero) Return: AH = status (00h OK, A4h not possible at this time) Note: if AL=00h, this function always returns success AH = 09h toggle Bit Flags 1 flags BX = bitmask of bit flags 1's flags to toggle (see above) Return: AH = 00h (successful) Note: enables A20 first AH = 0Ah toggle system configuration flags BX = bitmask of system configuration flags to toggle (see above) Return: AH = 00h (successful) Notes: enabled A20 first does ??? if bit 3 on after specified bits are toggled AH = 0Bh toggle debugging flags 1 BX = bitmask of debugging flags 1's bits to toggle (see above) Return: AH = 00h (successful) Note: enables A20 first AH = 0Ch toggle feature flags 3 BX = bitmask of feature flags 3's bits to toggle (see above) Return: AH = 00h (successful) Note: enables A20 first AH = 0Dh specify 386MAX high-memory location BX = segment address of high-memory real-mode portion of 386MAX CX = current segment of real-mode stub??? Return: AH = status (00h successful) ??? AH = 0Eh CRT controller register virtualization AL = subfunction 00h allow access to CRTC I/O ports 03B4h/03B5h, 03D4h/03D5h 01h trap accesses to CRTC I/O ports AH = 0Fh reboot system Return: never AH = 11h get high memory information ES:DI -> 96-byte buffer for high memory info Return: AH = 00h (successful) ES:DI buffer filled Notes: each byte in buffer contains bit flags for a 4K page in the A000h-FFFFh region bit 0: ??? bit 1: physical address same as linear address bit 2: EMS page frame bit 6: ??? this function can take over a second to execute, because it also tests the memory AH = 12h ??? AL = subfunction 00h ??? 01h ??? ??? Return: AH = 00h (successful) if AL=00h or 01h AH = 8Fh otherwise AH = 13h page protection??? AL = subfunction 00h set all ??? 4K pages to read-only??? 01h set all ??? 4K pages to read-write??? ??? Return: AH = 00h (successful) if AL=00h or 01h AH = 8Fh otherwise AH = 14h ??? ES:DI -> 54-byte buffer for ??? Return: AH = 00h if successful AH = A4h on error AH = 15h ??? ??? Return: ??? AH = 16h get 386MAX memory usage screen ES:DI -> buffer for memory info display CX = size of buffer in bytes Return: ES:DI buffer filled with '$'-terminated string (if large enough to hold entire usage screen) Note: the screen is 0303h bytes in v7.00 AH = 17h Windows 3 startup/termination AL = subfunction 00h Windows3 initializing DX (on stack) = Windows startup flags DI = Windows version number (major in upper byte) ES:BX = 0000h:0000h DS:SI = 0000h:0000h Return: CX = 0000h if OK for Windows to load <> 0 if Windows should not load ES:BX -> startup info structure DS:SI -> Virtual86 mode enable/disable callback 01h Windows3 terminating ES:BX -> ??? DX (on stack) = Windows exit flags Return: ??? AH = 18h QPMS (Qualitas Protected Memory Services) AL = subfunction 00h get QPMS configuration Return: BX = starting segment of QPMS memory window CX = number of 4K pages reserved for QPMS??? DX = number of 4K pages in QPMS window??? 01h map QPMS memory page??? BX = 4K page number within memory reserved for QPMS??? CL = 4K page number within QPMS memory window??? 02h mark all QPMS memory read-only 03h mark all QPMS memory read-write Return: AH = status (00h,8Ah,8Bh,8Fh) AH = 19h get linear address for physical address EDX = physical address (low word on stack) Return: AH = status 00h successful EDX = linear address at which physical address may be accessed 8Bh physical address currently not addressable Note: enables A20 first AH = 1Ah set page table entry??? EDX = new page table entry??? (low word on stack) ESI = linear address of page??? Return: AH = status (00h,8Bh) Note: enables A20 first AH = 1Bh get ??? Return: AH = status BX = ??? CX = ??? EDX = physical address of ??? AH = 1Ch get original interrupt vector AL = interrupt vector (00h-7Fh) Return: AH = 00h (successful) EDX = original vector before 386MAX loaded (segment in high word, offset in low word) Note: no range checking is performed; requests for INTs 80h- FFh will return random values AH = 1Dh display string??? SI = ??? Return: AH = 00h (successful) ??? AH = 1Eh get memory info ES:DI -> memory info (see below) Return: ??? AH = 1Fh get DPMI host information Return: AX = 0000h if successful BX = DPMI flags (see INT 31/AX=0400h) CL = CPU type (02h = 80286, 03h = 80386, etc.) DX = DPMI ver supported (DH=major, DL=2-digit minor) SI = ??? ES???:DI -> ??? Note: NOP if NODPMI switch specified AH = 20h (v7.00) ??? AL = ??? Return: EDX = ??? for ??? AL AH = 21h (v7.00) STACKS support AL = 00h get STACKS parameters Return: BX = ??? CX = number of stacks for hardware interrupts DX = size of each stack in bytes SI = ??? DI = ??? AL = 01h set ??? "EMM2_DSTKS" EBX = ??? ECX = ??? DS = ??? AL = 02h ??? BL = ??? (00h-03h) ??? AH = 22h (v7.00) AL = 00h ??? AL = nonzero ??? ??? AH = 23h (v7.00) ??? AL = 00h set ??? ??? AL = 01h ??? ??? AL = 02h get ??? CX = size of buffer ES:DI -> buffer for ??? Return: CX = number of bytes actually returned AL = 03h set ??? ES:DI -> buffer containing ASCIZ ??? AL = 04h get ??? ES:DI -> buffer for ASCIZ ??? AH = 24h (v7.00) ??? AL = 00h get ??? Return: BX = current state of ??? (0/1) AL = 01h set ??? BX = new state of ??? (0/1) AL = other ??? AH = 25h (v7.00) ??? AH = 26h (v7.00) ??? Return: BX = ??? CX = ??? AH = 27h (v7.00) ??? AL = 00h get ??? Return: BX = ??? AL = 01h ??? BX = ??? ES??? = ??? AL = 02h ??? ??? AL = 03h ??? CX = ??? DX = ??? ES??? = ??? Return: ??? AH = 28h (v7.00) get ??? Return: CX = ??? DX = ??? AH = 29h (v7.00) get ??? Return: AX = ??? AH = 40h-5Dh EMS services (see INT 67/AH=40h etc) AH = DEh VCPI services (see INT 67/AX=DE00h etc) Return: AH = status (as for EMS INT 67 calls) 00h successful 80h internal error 81h hardware malfunction 83h invalid handle 84h undefined function 8Ah invalid logical page nuber 8Bh illegal physical page number 8Fh undefined subfunction A4h access denied etc. STACK popped (value placed in DX if no specific return value for DX) Format of memory speed record: Offset Size Description 00h DWORD page table entry for 4K page 04h WORD number of microticks (840ns units) required for REP LODSD of entire 4K page Format of memory info [array]: Offset Size Description 00h DWORD ??? 04h DWORD ??? 08h 2 BYTEs ??? 0Ah BYTE type??? (03h = conventional???) 0Bh BYTE ??? .