⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xlib.doc

📁 XLIB 2.0版 32位应用程序开发 ASM/C语言的DOS 扩展库
💻 DOC
📖 第 1 页 / 共 5 页
字号:





























                             XLIB PROGRAMMER'S MANUAL
                                   VERSION 2.0

                              (DOS Extender Library)

                                TechniLib Company























                    Copyright 1993, by TechniLib (TM) Company
                               All Rights Reserved






                          TERMS OF USE AND DISTRIBUTION


       XLIB is a shareware product; therefore, unregistered copies of XLIB are
  made available free of charge so that potential purchasers will have the
  opportunity to examine and test the software before committing payment.
  Distribution of unregistered copies of XLIB to other potential users is also
  permitted and appreciated.  However, usage and distribution of XLIB must
  conform to the following conditions.  In the following statement, the term
  "commercial distribution," includes shareware distribution.

  1) XLIB and accompanying software must be distributed together in copies of
  the original archive provided by TechniLib.  Neither the archive nor
  individual files therein may be modified.

  2) The XLIB archive may be distributed in combination with other shareware
  products; however, the XLIB archive may not be distributed with other
  commercially distributed software without written consent of TechniLib.

  3) Copies of XLIB which have been used to develop software for commercial
  distribution must be registered before such software is marketed.  Copies of
  XLIB which have been used to develop noncommercial software must be registered
  if such software is to be regularly used either by the developer or others.

  4) Commercially distributed software must embed XLIB procedures in the
  software code.  Files contained in the XLIB archive may not be placed in the
  distribution media.

  5) XLIB is designed to offer a set of services to other executable code.  XLIB
  may not be used to develop software for commercial distribution which will
  essentially offer any of these same services to other executable code.
  Exceptions to this condition require written consent of TechniLib.

  6) Rights afforded by registering a single copy of XLIB pertain only to a
  single computer.

  7) XLIB may be registered for a fee of $35.00 per copy.  Accompany payment
  with the registration form included in the XLIB archive.  Registrants will be
  entitled to the most recent version of the XLIB archive.


                              DISCLAIMER OF WARRANTY


       XLIB AND ALL ACCOMPANYING SOFTWARE AND LITERATURE ARE DISTRIBUTED WITH
  THE EXCLUSION OF ANY AND ALL IMPLIED WARRANTIES, AND WITH THE EXCLUSION OF
  WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  TechniLib
  SHALL HAVE NO LIABILITY FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  RESULTING FROM THE USE OF XLIB OR ACCOMPANYING MATERIALS.  The user assumes
  the entire risk of using this software.


                    Copyright 1993, by TechniLib (TM) Company
                               All Rights Reserved






                                TABLE OF CONTENTS


  CHAPTERS
                                                                      Page
  1.  Introduction                                                       1
  2.  XLIB Conventions and Structure                                     4
  3.  XLIB Initialization and Termination                                6
  4.  Mode Switching                                                     9
  5.  Inline Mode Switching                                             13
  6.  Interrupt Management                                              16
  7.  Memory Management                                                 22
  8.  File Management                                                   25
  9.  Descriptor Management                                             29
  10. Using XLIB in High-Level Language Libraries                       30


  TABLES
                                                                      Page
  1.  XLIB Segments and Selectors by Public Symbol                       5
  2.  CALLPM/ENTERPM Register Storage Locations by Public Symbol        11
  3.  CALLRM Register Storage Locations by Public Symbol                12
  4.  XLIB File Control Block Structure                                 25


  EXAMPLES
                                                                      Page
  1.  Simple Mode Switching Under XLIB                                   3
  2.  Using INLINEPM/INLINERM in C                                      13
  3.  Calling Protected-Mode Libraries From BASIC                       30


  APPENDICES
                                                                      Page
  A. Description of XLIB Public Data                                    34
  B. XLIB Error Codes                                                   37
  C. DPMI 1.0 Error Codes                                               39
  D. XMS Error Codes                                                    40
  E. Calling Protected-Mode Libraries From C                            41
  F. Reporting Problems With XLIB                                       43
  G. The SWITCHPM and SWITCHRM Procedures                               44






                                 1. Introduction


       XLIB is an assembly language library which may be used with assembly
  language programs to greatly simplify protected-mode programming under the
  Microsoft DOS operating system.  Implementation of protected-mode procedures
  will often require no more than placing code in the proper segment and making
  two calls to XLIB procedures.  XLIB also simplifies protected-mode programming
  in C using inline assembly.
       XLIB is designed for the Intel 386, 486, and Pentium processors.  XLIB
  fully utilizes the 32-bit processing powers of these chips and makes these
  powers available to the user.  The compactness of XLIB follows largely from
  the fact that much of it is written in 32-bit code.
       XLIB is used to produce extended DOS applications.  DOS is unfortunately
  limited by the fact that it is a real-mode operating system intended to manage
  only real-mode programs.  Real-mode programs cannot use memory addresses
  requiring more than 20 bits, or use memory offsets requiring more than 16
  bits.  Such programs are further limited by the fact that 32-bit instructions
  execute awkwardly in real-mode.  When the processor is in real-mode, it will
  expect all 32-bit instructions to be preceded by at least one prefix.  Each of
  these prefixes consumes one byte of memory and requires at least one clock to
  execute.  Such limitations do not exist in 32-bit protected mode.  Extended
  DOS applications overcome the limitations of DOS with their ability to execute
  in both real and protected modes.  DOS services can be utilized from real mode
  while the 32-bit processing power of the CPU can be utilized from protected
  mode.
       There are presently several 32-bit operating systems available on the
  market.  Such systems include IBM OS/2, Microsoft Windows NT, and UNIX.  These
  systems can manage programs which operate exclusively in protected mode.  Such
  programs are generally easier to develop than extended DOS applications.
  However, extended DOS applications have an advantage in that they can execute
  under all of these operating systems because all of these systems can emulate
  DOS.
       Of course DOS will eventually become obsolete.  Future programs will
  likely operate exclusively in protected mode using the flat memory model.  The
  memory models supported by XLIB approximate the flat model; therefore, code
  written for XLIB will require little modification when being transported to
  flat-model operating environments.  Indeed, many procedures will require no
  modification whatsoever.  Moreover, XLIB includes flat-model descriptors which
  may be used to execute genuine flat-model code.  XLIB does not load and
  relocate such code; however, it does provide all the necessary tools to
  develop such procedures.
       XLIB procedures handle important tasks such as mode switching between
  real and protected modes, memory management under protected mode, protected-
  mode interrupt management, and protected-mode file management.  XLIB includes
  routines to perform these tasks in the absence of a protected-mode interface,
  or in the presence of the Virtual Control Program Interface (VCPI), or the DOS
  Protected Mode Interface (DPMI, version .9 or higher).  XLIB can also manage
  extended memory through the Extended Memory Specification (XMS).
       Upon initialization, XLIB will examine the operating environment for the
  presence of DPMI, VCPI, and XMS, and then configure itself accordingly.  The
  client program may therefore perform calls to XLIB procedures with few
  concerns as to the environment in which it is executing.




                                        1






       XLIB relieves the programmer of descriptor table management by supplying
  a set of predefined segments along with their associated descriptors and
  selectors.  Many protected-mode procedures will require no modification for
  XLIB other than being placed in the proper segment.  XLIB provides a single
  32-bit segment for protected-mode routines.  This segment may be larger than
  64K, but must reside in conventional memory so that DOS can load it.  However,
  code within this segment may access data throughout the address space.  XLIB
  does allow user-defined descriptors; however, these should be needful only in
  very rare cases.
       The following program illustrates the simplicity with which protected-
  mode execution may be initiated and terminated with XLIB.  The program was
  written with the Microsoft Assembler (MASM).  It first initializes XLIB by
  calling a procedure called INITXLIB.  After confirming that initialization is
  successful, the program then transfers control to a 32-bit protected-mode
  procedure which prints a message to the screen.  Control is transferred by
  placing the protected-mode target address on the stack and then calling an
  XLIB procedure named CALLPM (call protected mode).  CALLPM will expect the
  target procedure to be contained in a segment called TSEG.  The protected-mode
  procedure in TSEG returns control to real or virtual 8086 (V86) mode simply by
  executing the RET instruction.





































                                        2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -