home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / XLIB40.ZIP / README.DOC < prev    next >
Text File  |  1994-03-26  |  19KB  |  359 lines

  1. ******************************************************************************
  2. Quick Start with XLIB
  3. ******************************************************************************
  4.  
  5.      The user manual is largely dedicated to cover specifics of XLIB which will
  6. not be of concern to many programmers.  A few notes are added here to expedite 
  7. matters for these programmers.
  8.      If you are not an assembly language programmer, then consider using EASYX 
  9. rather than XLIB.  EASYX does not require use or knowledge of assembly 
  10. language.  The documentation for EASYX is in the file EASYX.DOC.
  11.      If you are familiar with assembly language, then start by reading the file
  12. DONTREAD.ME.  This file is for those who don't particularly enjoy reading 60 
  13. page user manuals.  It is an excellent tutorial.  You will probably be ready 
  14. to program with XLIB after working through the tutorial.
  15.  
  16. ******************************************************************************
  17. A Note to Previous XLIB Users
  18. ******************************************************************************
  19.  
  20.      Version 4.0 is the fifth generation of XLIB.  We appreciate those who have
  21. labored with us through earlier generations when we were stomping several
  22. bugs and correcting deficiencies.  
  23.      Thanks to your patience and help, XLIB is now a solid product.  It is
  24. presently being used in several high tech industries.  We feel that XLIB is
  25. the easiest way available to program in protected mode under DOS, and it 
  26. remains far less expensive than retail DOS extenders.
  27.  
  28.                                                                                                          TechniLib
  29.  
  30. ******************************************************************************
  31. Registering XLIB
  32. ******************************************************************************
  33.  
  34.      XLIB may be registered for $40/copy.  Registrants will be sent a registered
  35. copy of the XLIB archive along with a printed copy of the user manual.  The
  36. registration fee is $60 for those who have used or intend to use technical
  37. support.  The additional charges do not pertain to those reporting problems
  38. with XLIB.
  39.      There are three ways to register XLIB:
  40.  
  41. 1) By credit card through Public (software) Library:
  42.  
  43.      You can order with MC, Visa, Amex, or Discover from Public (software)
  44. Library by calling 800-2424-PsL or 713-524-6394 or by FAX to 713-524-6398
  45. or by CIS Email to 71355,470.  You can also mail credit card orders to PsL
  46. at P.O.Box 35705, Houston, TX 77235-5705.  The product identification number 
  47. for XLIB is 11077.
  48.  
  49. PHONE NUMBERS ABOVE ARE FOR ORDERS ONLY.  Any questions about the status of 
  50. the shipment of the order, refunds, registration options, product details, 
  51. technical support, volume discounts, dealer pricing, site licenses, etc, 
  52. should NOT be directed to PsL.  Direct all such questions to TechniLib.
  53.  
  54. 2) Through CompuServe:
  55.      
  56.      Use GO SWREG (shareware registration).  The program identification number 
  57. is 1778.  The program title is XLIB 4.0.  
  58.  
  59. 3) By mail to TechniLib:
  60.  
  61.      Complete and mail the form in REGISTER.FRM
  62.  
  63. ******************************************************************************
  64. Improvements in XLIB Version 4.0 Over Version 3.0
  65. ******************************************************************************
  66.  
  67. Additions:
  68.  
  69.      The principal improvement in version 4.0 is the inclusion of libraries
  70. with exception trapping capabilities.  XLIB 4.0 can trap all protected-mode
  71. exceptions.  If DPMI 1.0 is installed, then real-mode exceptions can be
  72. trapped as well.  These libraries also contain new functions for managing
  73. debug watchpoints.
  74.      XLIB 3.0 was limited in that it did not allow the main program to spawn
  75. other processes.  This limitation has been corrected.
  76.      The global descriptor table has been made public in version 4.0.  
  77.      PMPRINT.ASM has been replaced with PMIO.INC.  The latter contains better
  78. print routines as well as new keyboard and speaker routines.  PMIO.INC is
  79. designed for either MASM or TASM.
  80.      The MOVMEM routine in EASYX has been redesigned to be faster and to be
  81. reentrant.  This routine may now be called in the main thread, in interrupt
  82. handlers, or both.
  83.      Microsoft BASIC 7.0 files have been included to illustrate usage of EASYX.
  84.  
  85. Corrections:
  86.  
  87.      Version 4.0 corrects certain bugs and makes accommodations for anomalies
  88. in BIOS and common resident software.
  89.      The most severe bug in version 3.0 was a mistake in the include file
  90. XLIB.INC.  The combine type on segment DSEG was set to FAR_DATA, whereas it
  91. should have been DATA.
  92.      A second bug caused the machine to crash with a call to INITXLIB when
  93. certain memory managers were used with the NOEMS option.
  94.      Version 3.0 did not preserve the interrupt flag through mode switches.
  95. Instead it always enabled interrupts after the switch.  This lead to awkward
  96. situations when attempting to use SWITCHPM and SWITCHRM in interrupt handlers.
  97. Version 4.0 always preserves the interrupt flag through a mode switch.
  98.      A bug prevented SWITCHPM and SWITCHRM from being reentrant under VCPI.
  99. This bug existed in both versions 3.0 and 3.1.  This would have caused a
  100. problem if nested mode switches were being performed, as would be the case
  101. with calls to DEFLECTPM or other mode switches within interrupt handlers.
  102.      Certain versions of SMARTDRV.EXE do not restore the global descriptor
  103. table register.  Version 3.0 was not prepared for this
  104.      Certain BIOS software interrupts return with interrupts enabled.  Neither
  105. version 3.0 nor version 3.1 were prepared for this anomaly.  It caused the
  106. machine to hang upon certain hardware interrupts, keypresses in particular.
  107.      The other bugs were applicable only when running XLIB in the absence of
  108. VCPI and DPMI (HIMEM.SYS only or no memory manager at all).  Accesses to
  109. extended memory failed in some cases.  In some cases the machine was left in
  110. an unstable state.
  111.  
  112. ******************************************************************************
  113. Upgrades
  114. ******************************************************************************
  115.      
  116.      Previous registrants can upgrade to XLIB version 4.0 for $10.  Send
  117. all such orders directly to TechniLib.
  118.  
  119. ******************************************************************************
  120. Communicating with TechniLib Via Electronic Mail
  121. ******************************************************************************
  122.  
  123.      You can communicate with TechniLib via CompuServe electronic mail.  Direct
  124. mail to account 74730,167.  
  125.  
  126. ******************************************************************************
  127. Instructions for Constructing Protected-Mode Libraries for Microsoft
  128. ******************************************************************************
  129.  
  130.      The following batch file uses Microsoft LIB to combine an OBJ file with
  131. XLIB.LIB to produce a protected-mode library.  Call the batch file using the
  132. base name of the OBJ file as the argument.  This base name will also be given
  133. to the library.  It is assumed that the OBJ file and XLIB.LIB are in the
  134. current directory.  LIB.EXE is assumed to be in the ..\BIN directory.
  135.  
  136. @echo on
  137. del %1.lib
  138. ..\bin\lib %1.lib /noi +%1.obj+xlib.lib;
  139.  
  140.      The following batch file uses Microsoft LINK and LIB to combine an OBJ
  141. file with XLIB.LIB to produce a protected-mode library and quick library for
  142. Microsoft BASIC 7.0.  Call the batch file using the base name of the OBJ
  143. file as the argument.  This base name will also be given to the library and
  144. the quick library.  It is assumed that all files apart from LINK.EXE and
  145. LIB.EXE are in the current directory.  The current directory must also
  146. contain the file QBXQLB.LIB (included in the BASIC distribution disks).
  147. LINK.EXE and LIB.EXE are assumed to be in the ..\BIN directory.
  148.  
  149. @echo on
  150. del %1.qlb
  151. del %1.lib
  152. ..\bin\link /q/nopackf xlib.lib+%1.obj,%1.qlb,,qbxqlb.lib;
  153. ..\bin\lib %1.lib +xlib.lib+%1.obj;
  154.  
  155.      The following command may be used to create a quick library from EASYX.LIB.
  156. The quick library is called EASYX.QLB:
  157.  
  158. ..\bin\link /q/nopackf easyx.lib,easyx.qlb,,qbxqlb.lib;
  159.  
  160. ******************************************************************************
  161. Instructions for Constructing Libraries and Linking with Borland
  162. ******************************************************************************
  163.      
  164.      The following batch file uses TLINK to link an OBJ file from TASM with
  165. XLIBB.LIB to produce a DOS-extended executable.  The base name of the OBJ
  166. is supplied as an argument to the batch file.  The executable will be given 
  167. the same base name as the OBJ file.  It is assumed that the OBJ file is in 
  168. the current directory and that TLINK is in the ..\BIN directory.
  169.  
  170. @echo on
  171. ..\bin\tlink /3/c %1.obj,,,xlibb.lib
  172.  
  173.      The following batch file uses Borland TLIB to combine an OBJ file with
  174. XLIBB.LIB to produce a protected-mode library.  Call the batch file using the
  175. base name of the OBJ file as the argument.  This base name will also be given
  176. to the library.  It is assumed that XLIBB.LIB and the OBJ file are in the 
  177. current directory.  TLIB is assumed to be in the ..\BIN directory.
  178.  
  179. @echo on
  180. del %1.lib
  181. ..\bin\tlib /C %1.lib +xlibb.lib+%1.obj
  182.  
  183.      Borland C and Turbo C users can compile within the IDE; however, they must
  184. use the command line linker because an option will be needed which is not
  185. included in the IDE linker.  In particular, the /3 option will be needed to
  186. enable processing of 32-bit segments.  The appropriate commands to TLINK will
  187. depend upon the memory model being used.  The following batch command will 
  188. link a program called MYPROG with a library call MYLIB under the large memory 
  189. model.  The batch command must be issued from the directory containing 
  190. MYPROG.OBJ.  It is assumed that TLINK is in the ..\BIN directory and that
  191. MYLIB.LIB is in the ..\LIB directory.  It is also assumed that all of the C 
  192. link libraries are in the ..\LIB directory.  The resulting executable will be 
  193. called MYPROG.EXE and the map file will be called MYPROG.MAP.  The command 
  194. line is lengthy and is therefore broken into two lines below.
  195.  
  196.  
  197.                                                      --------------------- model specification
  198.                                                      .   ----------------- obj file name
  199.                                                      .   |      ---------- exe file name
  200.                                                      .   |      |      --- map file name
  201.                                                      . ______ ______ ______
  202. ..\bin\tlink /3/c ..\lib\c0l myprog,myprog,myprog,
  203.  
  204.      ..\lib\mylib ..\lib\fp87 ..\lib\mathl ..\lib\cl 
  205.                     -----                        .         .
  206.                         |                          -------------- model specification
  207.                         ----------------------------------------- lib file name
  208.  
  209. To link under the small memory model, replace "l" with "s" at the model
  210. specification characters.  Use "m" for the medium model; "c" for the compact
  211. model, and "h" for the huge model.
  212.  
  213. ******************************************************************************
  214. NOEMS and Equivalent Options
  215. ******************************************************************************
  216.  
  217.      Numerous of you could never get previous versions of XLIB initialized
  218. because you were running your memory managers with the NOEMS or equivalent 
  219. option.  This problem should be corrected under version 4.0, but we suggest
  220. that you avoid NOEMS.  If you want the upper memory area used by the page
  221. frame than try FRAME=NONE or equivalent option.
  222.      When EMS is present, VCPI has control of the machine.  This means that
  223. XLIB must work cooperatively with VCPI when performing switches to protected
  224. mode; otherwise, XLIB would cause a protection violation (exception #13).
  225. VCPI is a subset of EMS.  When you declared NOEMS, it appeared to former 
  226. version of XLIB that VCPI was absent.  The latter assumption was false, 
  227. because the memory manager was hiding VCPI behind the NOEMS option.  XLIB 
  228. then proceeded to perform uncooperative mode switches.  This then generated 
  229. the exception.  Version 4.0 takes measures to detect a deceptive memory 
  230. manager.
  231.  
  232. ******************************************************************************
  233. General Debugging Instructions
  234. ******************************************************************************
  235.  
  236.      Neither Turbo Debugger nor Codeview will be able to debug protected-mode
  237. instructions.  However, you should still be able to use the debuggers for
  238. real-mode areas of your programs.  Just step over calls to protected-mode
  239. procedures.
  240.      Debuggers tend to have problems when XLIB is initialized for DPMI.  Use
  241. VCPI instead.  You do this by setting bit 0 of IFLAGS.  Of course, a VCPI 
  242. driver needs to be loaded.  EMM386, QEMM386, and 386MAX all have VCPI.  You 
  243. cannot run VCPI in Windows or OS/2.
  244.      In the event that you can debug under DPMI, then you will have to remember
  245. that XLIBE and XLIBEB attempt to trap exceptions in real mode, including
  246. debug exceptions and breakpoints.  You better turn these features off by 
  247. setting bit 1 of IFLAGS.  This disables all exception trapping and prevents
  248. remap of hardware interrupts.
  249.      Be sure to read the documentation about the new debugging functions in
  250. XLIBE.LIB and XLIBEB.LIB.  These can be used in protected mode.  The new
  251. exception handlers are going to make life much easier also.
  252.  
  253. ******************************************************************************
  254. Instructions for Debugging in the Borland IDE
  255. ******************************************************************************
  256.  
  257.      To run the IDE debugger, XLIB should be initialized for VCPI.  However,
  258. under the default behavior of the IDE, a VCPI program will not be able to
  259. allocate extended memory within the IDE.  There are potentially two reasons 
  260. for this.  First, the default behavior of the DPMI kernel under which the 
  261. IDE operates is to claim all EMS memory and convert it to DPMI memory.  
  262. Since VCPI seeks extended memory through EMS, no extended memory will appear 
  263. to be available.  To limit the memory consumption of the DPMI kernel, 
  264. include a statement such as the following in the batch file used to invoke 
  265. the IDE:
  266.  
  267. set dpmimem=maxmem 2000
  268.  
  269. This statement limits the memory usage of the DPMI kernel to 2000Kb.  If
  270. EMS memory exceeds this amount, then EMS memory will be available to the 
  271. IDE.  However, EMS memory will not be available to a VCPI program running 
  272. within the IDE if the IDE has itself consumed all EMS memory.  Therefore, 
  273. one may have to limit EMS memory usage of the IDE.  This can be done in the 
  274. OPTIONS|ENVIRONMENT|STARTUP menu of the IDE.  Typically, EMS memory usage
  275. should be set to zero here.
  276.  
  277. ******************************************************************************
  278. Known Bugs/Peculiarities in Memory Managers
  279. ******************************************************************************
  280.  
  281. 1) All versions of QDPMI appear to map physical address spaces incorrectly.
  282.      The actual mapping call will succeed; however, this call affects QDPMI
  283.      internally such that subsequent calls to allocate extended memory do not
  284.      function correctly.  This means that MAPIO and PMMAPIO will not work
  285.      reliably with QDPMI.
  286.  
  287. 2) Version 1.03 of QDPMI does not handle exceptions properly.  The exception
  288.      handler receives the wrong value for the interrupted SS on the stack.
  289.      As a consequence, XLIB will not be able to terminate a program after an
  290.      exception under this version of QDPMI.  Reboot will be necessary.  This
  291.      problem may also exist in previous versions.
  292.  
  293. 3) QDPMI apparently does not function properly when the NOEMS option has been
  294.      used on QEMM.  NOEMS typically should not be used with any memory manager.
  295.      If you need the space normally allocated to the EMS page frame, then set
  296.      FRAME=NONE (or equivalent option) instead of using NOEMS.
  297.  
  298. 4) 386MAX versions 6.X and 7.0 leave interrupts disabled after calls to
  299.      certain VCPI memory management functions.  This means that when VCPI is
  300.      being used, interrupts will be disabled after calls to PMGETMEM, PMFREEMEM,
  301.      PMRESETMEM, and PMMAPIO.
  302.  
  303. 5) 386MAX version 7.0 does not properly report the virtual debug status
  304.      register (virtual DR6) upon debug exceptions.  Consequently, the DR6
  305.      value presented by the XLIBE exception handler will not be valid.  This
  306.      version also fails to clear debug breakpoints upon termination, as required
  307.      of DPMI 1.0 hosts.  XLIBE corrects the latter problem by clearing
  308.      breakpoints itself when terminating.
  309.  
  310. 6) 386MAX version 7.0 apparently mismanages exception #13 from real mode.
  311.      When the XLIBE exception handler attempts to terminate after such 
  312.      exceptions, a second exception #13 occurs.  This has not proven to be a
  313.      major problem.  Simply ignore the second exception.
  314.  
  315. ******************************************************************************
  316. Real-Mode Exception Trapping with DPMI Version 1.0 
  317. ******************************************************************************
  318.  
  319.      DPMI 1.0 enables XLIBE to trap exception in real mode.  This makes XLIBE
  320. potentially useful to programmers who would otherwise have no interest in
  321. protected-mode programming.  Simply place a call to INITXLIB early in your
  322. program and link with XLIBE.LIB (XLIBEB.LIB for Borland users) to implement
  323. this feature.
  324.      386MAX version 7.X is the only DPMI 1.0 host of which we are presently 
  325. aware.  Notwithstanding the bugs mentioned above, it is an outstanding
  326. product.
  327.  
  328. ******************************************************************************
  329. Contracted Programming and Consultation
  330. ******************************************************************************
  331.  
  332.      TechniLib will perform contract programming at competitive rates.
  333. TechniLib will also serve as a consultant to other programmers.  Contact
  334. TechniLib through the channels presented above.
  335.  
  336. ******************************************************************************
  337. Improvements in XLIB Version 2.0 Over Version 1.0
  338. ******************************************************************************
  339.  
  340. 1) Procedures enabling protected-mode programming in C using inline assembly.
  341. 2) Protected-mode file routines which can transfer extended memory to files 
  342.      or files to extended memory.  Sequential and random access are supported.
  343. 3) Better interrupt management services.
  344. 4) User-defined descriptors.
  345. 5) More descriptors.  
  346. 6) More configurability.
  347. 7) Minor bug fixes
  348. 8) Better documentation.
  349.  
  350. ******************************************************************************
  351. Improvements in XLIB Version 3.0 Over Version 2.0
  352. ******************************************************************************
  353.  
  354. 1) Files included in Borland formats.
  355. 2) EASYX library included for those unfamiliar with assembly langauge.
  356. 3) MAPIO and PMMAPIO procedures added to XLIB for accessing memory-mapped 
  357.      input/output devices.
  358. 4) Better documentation
  359.