home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / misc / psy_kit.zip / 32BMM.DOC next >
Text File  |  1993-09-04  |  12KB  |  288 lines

  1. ███████████████████████████████████████████████████████████████████████████████
  2. ███████████████████████████████████████████████████████████████████████████████
  3. ███████████████████████████████████████████████████████████████████████████████
  4. ███████████████████████████████████████████████████████████████████████████████
  5. ████████████████████████                                ███████████████████████
  6. ████████████████████████      32bMM : DOCUMENTATION     ███████████████████████
  7. ████████████████████████      ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀    ███████████████████████
  8. ████████████████████████   32 bits Memory Manager was   ███████████████████████
  9. ████████████████████████ Coded by LCA of Psychose Inc.  ███████████████████████
  10. ████████████████████████              V.1               ███████████████████████
  11. ████████████████████████                                ███████████████████████
  12. ████████████████████████   (C)opyright 1993 by LCA of   ███████████████████████
  13. ████████████████████████         Psychose Inc.          ███████████████████████
  14. ████████████████████████                                ███████████████████████
  15. ███████████████████████████████████████████████████████████████████████████████
  16. ███████████████████████████████████████████████████████████████████████████████
  17. ███████████████████████████████████████████████████████████████████████████████
  18. ███████████████████████████████████████████████████████████████████████████████
  19. ███████████████████████████████████████████████████████████████████████████████
  20. ███████████████████████████████████████████████████████████████████████████████
  21. ███████████████████████████████████████████████████████████████████████████████
  22. █                                                                             █
  23. █                                                                             █
  24. █ 1) Introduction                                                             █
  25. █       α/ Who's done it?                                                     █
  26. █       α/ What for?                                                          █
  27. █       α/ Can you use it?                                                    █
  28. █                                                                             █
  29. █ 2) How to use it?                                                           █
  30. █       α/ New addressing mode                                                █
  31. █       α/ Use the Flat-Real mode in your programs                            █
  32. █       α/ The Object-File : "32bMM.OBJ"                                      █
  33. █                                                                             █
  34. █ 3) Do you want to contact "Psychose Inc."?                                  █
  35. █       α/ Use your MINITEL if you are French                                 █
  36. █       α/ Write to me                                                        █
  37. █                                                                             █
  38. █ 4) Conclusion                                                               █
  39. █                                                                             █
  40. █                                                                             █
  41. ███████████████████████████████████████████████████████████████████████████████
  42. ███████████████████████████████████████████████████████████████████████████████
  43. ███████████████████████████████████████████████████████████████████████████████
  44. ███████████████████████████████████████████████████████████████████████████████
  45. ███████████████████████████████████████████████████████████████████████████████
  46.  
  47.  
  48. 1) Introduction
  49. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  50.     α/ Who's done it?
  51.     ═════════════════
  52.         I (LCA of "Psychose Inc.") coded this Object-File. It was of 
  53. course programmed in assembler.
  54.  
  55.  
  56.     α/ What for?
  57.     ════════════
  58.         Two years ago, I read a book in which the writer explains how
  59. to address 4 Giga-bytes in linear mode AND in real mode on a 80386. Then months
  60. after months I got bored with those coders that were proud of addressing the
  61. memory in flat protected mode. And I hope that you know that the protected-mode
  62. is slower than the real mode. Then I decided to code a Memory-Manager in Flat-
  63. Real Mode: 32bMM. The purpose of this unit is to address the memory:
  64.             * in flat-mode
  65.             * in real-mode
  66.             * stay compatible with DOS
  67.  
  68.         The problem is to stay compatible with DOS. So I decided to use
  69. the XMS-driver to keep the compatibility. Therefore, if you want to use 32bMM,
  70. the XMS-Driver must be installed.
  71.  
  72.         Be careful : The processor MUST NOT be in protected-mode when
  73. using 32bMM. If it is, then the 32bMM won't initialize and you won't be able to
  74. use the Flat-Real mode.
  75.  
  76.  
  77.     α/ Can you use it?
  78.     ══════════════════
  79.         This Object-File is FreeWare : you can use it IF AND ONLY IF :
  80.             * The program using 32bMM is not a commercial program
  81. (shareware is considered as commercial software).
  82.             * You mention in your program that you used "32bMM of
  83. Psychose Inc.".
  84.             * 32bMM is not modified in any way and stay in its
  85. original form.
  86.  
  87.         You can (sorry, YOU MUST!!!!) copy the 32bMM-package. I just
  88. hope 32bMM won't be used by little coders also called lamers............
  89.  
  90.         Moreover, SEND me your programs using 32bMM, I would be pleased
  91. to try it!!!
  92.  
  93.  
  94.  
  95. ████████████████████████████████████████████████████████████████████████████████
  96.  
  97. 2) How to use it?
  98. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  99.     α/ New addressing mode:
  100.     ═══════════════════════
  101.         With the Flat-Real Mode, you can address the whole memory that
  102. way : MOV Reg,[GS:reg32] or anyway you want, provided that the segment is "GS".
  103. Indeed, here is how the Flat-Real mode is initialized:
  104.     * All segments except GS have a length of 64 Kilo-Bytes.
  105.     * The segment "GS" has a length of 4 Giga-Bytes, and GS=0000h.
  106.  
  107. What does it mean?
  108. Let's study this question threw some examples:
  109. 1/ Before instruction:
  110.     * ESI=4000h    ("4" and three "0")
  111.    Instruction:
  112.        * MOV AL,[ESI]
  113.    Action:
  114.        * the byte pointed by DS:ESI is transfered to AL... Well nothing new...
  115.  
  116. 2/ Before instruction:
  117.     * ESI=40000h    ("4" and four "0")   
  118.    Instruction:
  119.        * MOV AL,[ESI]
  120.    Action:
  121.        * ERROR because the size of DS is 64 Kilo-Bytes and ESI>65535!!
  122.  
  123. 3/ Before instruction:
  124.     * ESI=40000h    ("4" and four "0")
  125.    Instruction:
  126.        * MOV AL,[GS:ESI]
  127.    Action:
  128.        * the byte pointed by GS:ESI is transfered to AL... That is new!!
  129.  
  130. Do you understand the advantages of Flat-Real mode??
  131.  
  132.  
  133.     α/ Use the Flat-Real mode in your programs
  134.     ══════════════════════════════════════════
  135.         To use 32bMM in your programs, you just have to do two things:
  136.     * Insert the line:
  137. INCLUDE 32bMM.INC
  138.                in your source-text.
  139.     * LINK your Objects-Files with "32bMM.OBJ"
  140.  
  141. Note : The 32bMM-procedures or variables are in a FAR-Segment, but the Class of
  142. this segment is 'CODE' so that you won't have problems to set the memory size
  143. needed by your program, as you'll soon see in the example-file.
  144.  
  145.  
  146.     α/ The Object-File : "32bMM.OBJ"
  147.     ════════════════════════════════
  148.         Ok, here you'll learn how to call the 32bMM-Procedures with
  149. their parameters and so on.....
  150. 1) VARIABLES:
  151.         * MemoryMode (Byte)
  152.     In this variable, there is the way the memory is being allocated. That
  153. is to say, either in DOS mode or in XMS mode.
  154.     In the Include File :"32bMM.INC", there are 2 Constants:
  155.   DOS_Mode = 0
  156.   XMS_Mode = 1
  157.     These are the only values possible in MemoryMode.
  158.  
  159.         * Processor (Byte)
  160.     In this variable, there is the number corresponding to the Detected-
  161. Processor. The possible values are:
  162.   CPU8086 = 0
  163.   CPU286  = 2
  164.   CPU386  = 3        ; 80386 in Real-Mode
  165.   CPU386P = 4        ; 80386 in Protected Mode
  166.               ;    If the CPU is in V86 Mode ('cause of an EMS-
  167.               ; driver...), it is necessary in Protected-Mode.
  168.  
  169. Note : There is no constant for the other processors and for the 80286 in
  170. Protected-Mode, because it is useless.
  171.  
  172.         * How reaching these constants??
  173.     Well, it is very simple:
  174. Example:    mov ax,Seg MemoryMode
  175.         push es
  176.         mov es,ax
  177.         mov al,es:MemoryMode
  178.         pop es
  179.  
  180.  
  181. 2) PROCEDURES
  182.         * Init32bMM
  183.     -Parameters
  184.             CALL    : No parameters
  185.             RETURN    : AL=Processor
  186.                   AH=MemoryMode
  187. The content of AH and AL is the value in MemoryMode and Processor. See the
  188. previous section for more informations...
  189.  
  190. Note : Other registers may have been modified.
  191.  
  192.     -Action
  193.     You must call this procedure to initialize the Flat-Real Mode.
  194. Therefore, you should call it at the beginning of your Code. It will detect the
  195. current Processor, and it will also detect if an XMS-Driver is installed. If
  196. ever the Processor value (=AL) is not CPU386, then the Flat-Real Mode is not
  197. initialized and you should send a message to the user, either to buy a new
  198. computer, or to remove his EMS-Driver (or the program that puts the CPU in
  199. Protected-Mode!!).
  200. YOU SHOULDN'T modifie the content of GS in your code, if so, you may lose some
  201. datas...
  202.  
  203.  
  204.         * End32bMM
  205.     -Parameters
  206.             CALL    : No parameters
  207.             RETURN    : Nothing
  208. Note : some registers may have been modified.
  209.  
  210.     -Action
  211.     This will remove the Flat-Real Mode (if Processor=CPU386). You must
  212. call this procedure at the end of your program.
  213.  
  214.  
  215.         * AskRAM
  216.     -Parameters
  217.             CALL    : AX = Size in Kilo-Byte of the wanted memory
  218.                                   block.
  219.             RETURN    : If EAX=0 then an error has occured!!
  220.                   else
  221.                   GS:EAX=pointer to the selected block
  222.                   CL=MemoryMode
  223.                   DX=handle number
  224.  
  225.     -Action
  226.     This procedure allocates a Memory Block. Its size is in AX (Kilo-
  227. Bytes). If an XMS-Driver was detected, then it will try to allocate an XMS-
  228. memory block. If it can't, then it'll try to allocate a DOS-Memory block. If it
  229. still can't, then EAX=0.
  230.     If it could allocate the Memory Block, then EAX is a 32 bits pointer to
  231. the beginning of this block.
  232.     You MUST save CL and DX in your own variables, so as to free this block
  233. later with LetRAM (See bellow).
  234.  
  235.  
  236.         * LetRAM
  237.     -Parameters
  238.             CALL    : CL=MemoryMode of the selected block
  239.                   DX=Handle Number of the selected block
  240.             RETURN    : Nothing
  241.  
  242.     -Action
  243.     This procedure will free the previously selected block with AskRAM.
  244.  
  245.  
  246.  
  247. ████████████████████████████████████████████████████████████████████████████████
  248.  
  249. 3) Do you want to contact "Psychose Inc."?
  250. ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
  251.  
  252.     If your deepest dream is to get in touch with us (hahaha!!!???), then
  253.  
  254.     α/ If you are French, then use your lovely MINITEL:
  255.     ═══════════════════════════════════════════════════
  256.  
  257.     * 3615 RTEL
  258.         BAL : LCA        (Coder of Psychose Inc.)
  259.         BAL : NAPALM        (......................)
  260.         BAL : HACKER CROLL    (......................)
  261.  
  262.  
  263.     α/ If you wanna contact me, then write to:
  264.     ══════════════════════════════════════════
  265.  
  266.     BERMOND Cedric (LCA)
  267.     12, Rue Paul RONIN
  268.     42100 Saint-Etienne
  269.     FRANCE
  270.  
  271.     But, you must know that I may not answer to every letters since I am
  272. not rich and I've got lots of homework with my study.
  273. Therefore can you put in your letter a self-addressing envelope???
  274.  
  275.  
  276.  
  277. ████████████████████████████████████████████████████████████████████████████████
  278.  
  279. 3) Conclusion
  280. ▀▀▀▀▀▀▀▀▀▀▀▀▀
  281.  
  282.     I hope you'll enjoy this little Object-File. Since it is the first
  283. version, there are not a lot of procedures (like knowing the free memory and
  284. so on...). But, as soon as I can, I'll improve it!!
  285.     Well I haven't got anything else to tell you, so
  286. Have a good programming (ASM ONLY!!!!!!),
  287.         LCA of Psychose Inc.
  288.