发信人: black() 
整理人: wenbobo(2002-12-06 22:36:44), 站内信件
 | 
 
 
这东西不用连载,凡是分析DOS技术的书都有,
 
                       XMS     调 用 简 介
      使用 XMS 前必须测试系统有无加载 HIMEM.SYS,方法如下:
                      MOV AX,4300H                     INT 2FH                     CMP AL,80H                     JNE NO_XMS          ; XMS 不存在
  然后获得 XMS 驱动程序控制功能的地址,如下:
                      MOV AX,4310H                     INT 2FH                     MOV WORD PTR XMS_CONTROL,   BX                     MOV WORD PTR XMS_CONTROL+2, ES
  现在就可以给相应的寄存器赋值,用 CALL [XMS_CONTROL] 调用 XMS。 ┌────┬────────┬───────────┬──────────────┐ │ 功能号 │    功能解释    │      调用寄存器      │         返回寄存器         │ ├────┼────────┼───────────┼──────────────┤ │ 08H    │最大可用 XMS尺  │ AH = 08H             │ AX=最大可用 XMS 内存       │ │        │寸,以KB为单位  │                      │                            │ ├────┼────────┼───────────┼──────────────┤ │ 09H    │分配 XMS 空间   │ AH = 09H             │ AH=0000H失败,AB=0001H成功 │ │        │                │ DX = 以KB计的内存块  │ DX = 分配块的句柄( HANDLE )│ │        │                │                      │ BL = 错误代码              │ ├────┼────────┼───────────┼──────────────┤ │ 0AH    │释放 XMS 空间   │ AH = 0AH             │ AH=0000H失败,AB=0001H成功 │ │        │                │ DX = 释放块句柄      │ BL = 错误代码              │ ├────┼────────┼───────────┼──────────────┤ │ 0BH    │移动 XMS 块数据 │ AH = 0BH             │ AH=0000H失败,AB=0001H成功 │ │        │                │ DS:SI=指向 XMS 移动  │ BL = 错误代码              │ │        │                │ 结构的指针(附表)     │                            │ ├────┼────────┼───────────┼──────────────┤ │        │                │                      │                            │ └────┴────────┴───────────┴──────────────┘
          XMS 移动结构 ┌───────┬──────────────┐ │  偏 移 量    │       含         义        │ ├───────┼──────────────┤ │ 000H - 003H  │ 需传送的字节数             │ ├───────┼──────────────┤ │ 004H - 005H  │ 源块句柄                   │ ├───────┼──────────────┤ │ 006H - 009H  │ 32位源段址及偏移值         │ ├───────┼──────────────┤ │ 00AH - 00BH  │ 目的句柄                   │ ├───────┼──────────────┤ │ 00CH - 00FH  │ 32位目的段址及偏移值       │ └───────┴──────────────┘
 
      XMS (Int 2F/43; Multiplex)
   INT 2F - INSTALLATION CHECK      AX = 4300h
   Return: AL = 80h XMS driver installed      AL <> 80h no driver
   Notes:  XMS gives access to extended memory and noncontiguous/nonEMS        memory above 640K      this installation check DOES NOT follow the format used by other        software
   SeeAlso: AX=4310h
   --------  INT 2F - XMS - GET DRIVER ADDRESS      AX = 4310h
   Return: ES:BX -> driver entry point
   SeeAlso: AX=4300h
   Perform a FAR call to the driver entry point with AH set to the function         code      AH  function      00h  Get XMS version number           Return: AX = XMS version (in BCD)               BX = internal revision number               DX = 0001h if HMA (1M to 1M + 64K) exists                0000h if HMA does not exist      01h  Request High Memory Area (1M to 1M + 64K)           DX = memory in bytes (for TSR or device drivers)            FFFFh if application program           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      02h  Release High Memory Area           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      03h  Global enable A20, for using the HMA           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      04h  Global disable A20           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      05h  Local enable A20, for direct access to extended memory           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      06h  Local disable A20           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      07h  Query A20 state           Return: AX = 0001h enabled              = 0000h disabled               BL = error code (0 = successful)      08h  Query free extended memory, not counting HMA           Return: AX = size of largest extended memory block in K               DX = total extended memory in K               BL = error code (see below)      09h  Allocate extended memory block           DX = Kbytes needed           Return: AX = 0001h success                 DX = handle for memory block              = 0000h failure                 BL = error code (see below)      0Ah  Free extended memory block           DX = handle of block to free           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      0Bh  Move extended memory block           DS:SI -> EMM structure (see below)           Note: if either handle is 0000h, the corresponding offset is             considered to be an absolute segment:offset address in             directly addressable memory           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      0Ch  Lock extended memory block           DX = handle of block to lock           Return: AX = 0001h success                 DX:BX = 32-bit linear address of locked block              = 0000h failure                 BL = error code (see below)      0Dh  Unlock extended memory block           DX = handle of block to unlock           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      0Eh  Get handle information           DX = handle for which to get info           Return: AX = 0001h success                 BH = block's lock count                 BL = number of free handles left                 DX = block size in K              = 0000h failure                 BL = error code (see below)      0Fh  Reallocate extended memory block           DX = handle of block           BX = new size of block in K           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)      10h  Request upper memory block (nonEMS memory above 640K)           DX = size of block in paragraphs           Return: AX = 0001h success                 BX = segment address of UMB                 DX = actual size of block              = 0000h failure                 BL = error code (see below)                 DX = largest available block      11h  Release upper memory block           DX = segment address of UMB to release           Return: AX = 0001h success              = 0000h failure                 BL = error code (see below)
   Note:   HIMEM.SYS requires at least 256 bytes free stack space
   Format of EMM structure:  Offset  Size    Description   00h    DWORD   number of bytes to move (must be even)   04h    WORD    source handle   06h    DWORD   offset into source block   0Ah    WORD    destination handle   0Ch    DWORD   offset into destination block
   Error codes returned in BL:      80h Function not implemented      81h Vdisk was detected      82h An A20 error occurred      8Eh a general driver error      8Fh unrecoverable driver error      90h HMA does not exist      91h HMA is already in use      92h DX is less than the /HMAMIN= parameter      93h HMA is not allocated      94h A20 line still enabled      A0h all extended memory is allocated      A1h all available extended memory handles are allocated      A2h Invalid handle      A3h Source handle is invalid      A4h Source offset is invalid      A5h Destination handle is invalid      A6h Destination offset is invalid      A7h Length is invalid      A8h Move has an invalid overlap      A9h Parity error occurred      AAh Block is not locked      ABh Block is locked      ACh Block lock count overflowed      ADh Lock failed      B0h Only a smaller UMB is available      B1h No UMB's are available      B2h UMB segment number is invalid
 
  【 在 gdxkz (Ice Bird) 的大作中提到: 】
 
  -- ------------------------------------------------------------------------------- 黑夜给了我黑色的眼睛,我用它寻找光明 Email : [email protected]
  ※ 来源:.网易 BBS bbs.netease.com.[FROM: 202.103.173.119]
  | 
 
 
 |