mrci.inc
Upload User: caisha3
Upload Date: 2013-09-21
Package Size: 208739k
Code Size: 11k
Category:

Windows Develop

Development Platform:

Visual C++

  1. ;----------------------------------------------------------------------------
  2. ;  MRCI.INC - Microsoft Real-Time Compression Interface definitions
  3. ;
  4. ;  Microsoft Confidential
  5. ;  Copyright (C) Microsoft Corporation 1992
  6. ;  All Rights Reserved.
  7. ;
  8. ;  History:
  9. ;    18-Jul-92 bens  Initial version.
  10. ;    25-Jul-92 billkru  Adapted for use by MS-Flash & ROMDOS environment.
  11. ;----------------------------------------------------------------------------
  12. intMRCIROM    equ    1Ah    ; ROM MRCI interrupt number
  13. mrciDETECTROM    equ    0B001h  ; ROM intMRCI AX for detecting MRCI server
  14. intMRCI   equ  2Fh    ; MRCI interrupt number
  15. mrciDETECT  equ  4a12h    ; intMRCI AX for detecting MRCI server
  16. mrciBackPatch  equ  4a13h
  17. ;----------------------------------------------------------------------------
  18. ;  sigOLD_CX, sigOLD_DX, sigNEW_CX, sigNEW_DX - MRCI Server detection
  19. ;
  20. ;  These values are used to verify that the response from issuing
  21. ;  intMRCI is coming from an MRCI server, and not some other piece
  22. ;  of code.
  23. ;
  24. ;  The *old* values are passed on the mrciQUERY call, and the server
  25. ;  must change CX/DX to the *new* values, so that the caller can
  26. ;  trust that the MRCI server was responding, and not some other
  27. ;  interrupt hooker.
  28. ;
  29. ;  The Server uses this code sequence to transform CX/DX:
  30. ;
  31. ;     ;------------- entry: cx='ab'  dx='cd'
  32. ;     xchg    ch,cl ; cx='ba'  dx='cd'
  33. ;     xchg    dh,dl ; cx='ba'  dx='dc'
  34. ;     xchg    dx,cx ; cx='dc'  dx='ba'
  35. ;----------------------------------------------------------------------------
  36. sigOLD_CX   equ 'MR'
  37. sigOLD_DX   equ 'CI'
  38. sigNEW_CX   equ 'IC'
  39. sigNEW_DX   equ 'RM'
  40. ;----------------------------------------------------------------------------
  41. ;    mcXXXX - flag values passed to MRCI operations
  42. ;
  43. ; MRCCompress and MRCDecompress take a flag to indicate whether the
  44. ; client is a *system* component (and hence may call with InDOS
  45. ; set), or an *application*.
  46. ;
  47. ; If a system client calls MRCCompress/MRCDecompress with mcSYSTEM,
  48. ; then it is the clients responsibility to ensure that one of the
  49. ; following is true:
  50. ;     1) InDOS is set
  51. ;     2) The call is made at interrupt time.
  52. ;
  53. ; FAILING TO FOLLOW THE ABOVE RULE WILL LIKELY RESULT IN A SYSTEM
  54. ; HANG AND LOSS OF USER DATA.
  55. ;----------------------------------------------------------------------------
  56. mcAPPLICATION equ 0 ; Client is an application
  57. mcSYSTEM equ 1 ; Client is a file system driver
  58. ;----------------------------------------------------------------------------
  59. ;  MRCI Server Busy flag values
  60. ;----------------------------------------------------------------------------
  61. MRCI_SERVER_IDLE equ 0
  62. ;----------------------------------------------------------------------------
  63. ;    MRCINFO - MRC Information data structure
  64. ;
  65. ; A pointer to an MRCINFO structure is returned from MRCQuery, and sent
  66. ; on MRCNotifyLoad.  This structure contains information on the MRCI
  67. ; server and its capabilities.
  68. ;----------------------------------------------------------------------------
  69. MRCINFO  struc
  70. mi_lVendor dd ? ; A 4-byte vendor ID.
  71. ; Microsoft's vendor ID is "MSFT".
  72. mi_wVendorVersion dw ? ; Version number of the MRC server.
  73. ; High byte is major number, low byte is minor.
  74. ; EXAMPLES: v3.20 = 0314h, v10.01 = 0A01h
  75. mi_wMRCIVersion  dw ? ; Version number of the MRCI supported by
  76. ; this server.
  77. mi_pfnOperate dd ? ; Far pointer of the server compression entry
  78. ; point.
  79. mi_flCapability  dw ? ; Bit field of server capabilities
  80. ; See micapXXX for bit definitions
  81. mi_flHWAssist dw ? ; Bit field of hardware assisted
  82. ; server capabilities. One-to-one
  83. ; correspondance with mi_flCapability
  84. ; bits.  A bit set in this field
  85. ; indicates the corresponding
  86. ; capability is hardware assisted.
  87. mi_cbMax dw ? ; Maximum number of bytes that the compression
  88. ; services provider can compress or decompress.
  89. ; Requests to compress or decompress buffers in
  90. ; excess of this length will fail.
  91. ; All MRCI servers must support at least
  92. ; 8192 byte (8Kb) blocks.
  93. MRCINFO  ends
  94. ;----------------------------------------------------------------------------
  95. ;    micapXXXXX - bit flags for MRCINFO.mi_flCapabilities
  96. ;
  97. ; These define both the capabilities of the Server, and also double
  98. ; as *operation* codes passed to the mi_pfnOperate entry point in
  99. ; the server.
  100. ; 111111
  101. ; 5432109876543210
  102. ;----------------------------------------------------------------------------
  103. micapNONE equ 0000000000000000b ; No capabilities
  104. micapSTANDARD equ 0000000000000001b ; Standard compress
  105. micapDECOMPRESS equ 0000000000000010b ; Standard compress
  106. micapUPDATE equ 0000000000000100b ; Update compress
  107. micapSUPER equ 0000000000001000b ; SuperCompress(tm)
  108. micapSUPERUPDATE equ 0000000000010000b ; Update SuperCompress(tm)
  109. micapINCDECOMP equ 0000000000100000b ; Incremental Decompress
  110. ; Remaining bits (6..14) are RESERVED and must be 0
  111. micapREADONLY equ 1000000000000000b ; MRCINFO structure is read-only
  112. micapDEINSTALL equ 1111111111111111b ; Server deinstall service
  113. ;----------------------------------------------------------------------------
  114. ;  MRCREQUEST - MRC compress/decompress Request packet
  115. ;
  116. ;  This structure is used to pass parameters to the server for
  117. ;  compress/decompress operations.
  118. ;
  119. ;  General Notes
  120. ;  -------------
  121. ;  1) <mr_pbSrc,mr_cbSrc> and <mr_pbDst,mr_cbDst> MUST NOT OVERLAP!
  122. ;
  123. ;  2) The safest practice is for mr_cbSrc and mr_cbDst to be identical
  124. ;     (except for decompress where mr_cbSrc is ignored and mr_cbDst is
  125. ;      the count of bytes to uncompress).
  126. ;
  127. ;  Details on Structure Members
  128. ;  ----------------------------
  129. ;  mr_pbSrc
  130. ;    This points to the *source* buffer.
  131. ;
  132. ;    On a *compress* operation, the contents of this buffer are
  133. ;    *uncompressed* data.
  134. ;
  135. ;    On an *update* operation, the contents of this buffer starting
  136. ;    at offset mr_offUpdate is valid, uncompressed data.  The contents
  137. ;    from the start of the buffer to the byte just prior to
  138. ;    mr_OffUpdate are ignored.
  139. ;
  140. ;    On a *decompress* operation, the contents of this buffer are
  141. ;    *compressed* data.
  142. ;
  143. ;  mr_cbSrc
  144. ;    This is the size of the *source* buffer.
  145. ;
  146. ;    This is the amount of data to be compressed or decompressed.
  147. ;    NOTE: For a decompress operation, this value may be ignored
  148. ;    by many implentations, since the MRC Format encoding has
  149. ;    a special code to indicate the end of the compressed data.
  150. ;
  151. ;  mr_offUpdate
  152. ;    NOTE: This is used for Update(Super)Compress only.
  153. ;
  154. ;    On INPUT, this is the offset (same segment as mr_pbSrc) in the
  155. ;    *source* buffer where the changed uncompressed data starts.
  156. ;
  157. ;    On OUTPUT, this is the offset (same segment as mr_pbDst) in the
  158. ;    *destination* buffer where the changed compressed data starts.
  159. ;
  160. ;  mr_pbDst
  161. ;    This points to the *destination* buffer.
  162. ;
  163. ;    On a *compress* operation, this buffer receives the *compressed*
  164. ;    result of the operation.
  165. ;
  166. ;    On an *update* operation, the contents of this buffer MUST be
  167. ;    the compressed representation of the uncompressed data in the
  168. ;    *source* buffer.  After the operation is completed, this buffer
  169. ;    receives the *compressed* result of the operation.
  170. ;
  171. ;    On a *decompress* operation, this buffer receives the
  172. ;    *uncompressed* result of the operation.
  173. ;
  174. ;  mr_cbDst
  175. ;    On a *compress* operation and on INPUT, this is the size of
  176. ;    the *destination* buffer. If, during the operation, the
  177. ;    Server would overflow this buffer length, then the operation
  178. ;    fails and the server returns the error MRCI_ERROR_BUFFER_OVERFLOW.
  179. ;
  180. ;    On a *decompress* operation and on INPUT, this is what the
  181. ;    *decompressed* size should be.  If, during the operation, the
  182. ;    Server would overflow this length, then the operation fails
  183. ;    and the server returns the error MRCI_ERROR_BUFFER_OVERFLOW.
  184. ;
  185. ;    On OUTPUT, the Server updates this field with the actual size
  186. ;    of the resulting compressed/uncompressed data.
  187. ;
  188. ;  mr_cbChunk
  189. ;    This is information that the Server compress routines can use to
  190. ;    "early out" of the compression as early as possible.
  191. ;
  192. ;    Valid values are 1 (client is interested in savings as small as
  193. ;    1 byte) to 32767. DblSpace passes 512, and MS-Flash passes 1.
  194. ;
  195. ;    This field is most easily explained by giving an example:
  196. ;
  197. ;    Example:
  198. ;      DblSpace does space allocation in chunks of 512 bytes (the
  199. ;      common sector size on a disk).
  200. ;
  201. ;      The compression server can use this information for two
  202. ;      optimizations:
  203. ;
  204. ;      1) If the Server cannot compress the uncompressed data
  205. ;   enough to save at least 512 bytes, then the data is
  206. ;   *incompressible* as far as DblSpace is concerned, even
  207. ;   if it could be compressed to save fewer than 512 bytes.
  208. ;
  209. ;      2) While compressing, if the Server gets to a point where
  210. ;   the remaining uncompressed data is of such a length that
  211. ;   it can be encoded simply (without table lookups, etc.)
  212. ;   and not cross a 512 byte boundary, then the Server can
  213. ;   do the simple encoding.
  214. ;
  215. ;      It is likely that these optimizations will be hard to perform
  216. ;      quickly in software, but it is possible that hardware can do
  217. ;      these optimizations without any performance loss.
  218. ;----------------------------------------------------------------------------
  219. MRCREQUEST struc
  220. mr_pbSrc dd ? ; Pointer to source buffer
  221. mr_cbSrc dw ? ; Size of source buffer, in bytes
  222. mr_offUpdate dw ? ; For UpdateCompress only: offset of (source) destination
  223. ; buffer where changed (un)compressed data starts.
  224. mr_pbDst dd ? ; Pointer to destination buffer
  225. mr_cbDst dw ? ; Size of destination buffer, in bytes
  226. mr_cbChunk dw ? ; Client compressed data storage chunk size (see above!)
  227. mr_dwIncDecomp dd ? ; Incremental Decompression state
  228. MRCREQUEST ends
  229. ;----------------------------------------------------------------------------
  230. ;  MRCI_ERROR_XXX definitions
  231. ;
  232. ;  Error codes returned from a request
  233. ;----------------------------------------------------------------------------
  234. MRCI_ERROR_NONE      equ     0 ; No error
  235. MRCI_ERROR_NOT_SUPPORTED    equ     1 ; Unsupported operation requested
  236. MRCI_ERROR_BUSY      equ     2 ; Server is busy
  237. MRCI_ERROR_BUFFER_OVERFLOW  equ     3 ; Destination buffer too small
  238. MRCI_ERROR_NOT_COMPRESSIBLE equ     4 ; Data could not be compressed
  239. MRCI_ERROR_BAD_MRC_FORMAT   equ     5 ; Compressed data format is bad
  240. ;---------------------------------------------------------------------------
  241. ; DblSpace MRCI Server constants
  242. ;---------------------------------------------------------------------------
  243. MRCIVERSION equ 0100h ; MRCI version supported by this server
  244. MYVERSION equ 0100h ; Version of this server/driver
  245. MYVENDOR equ 5446534Dh ; "MSFT" (reversed for byte ordering)
  246. MYVENDORhi equ 5446h ; High word of MYVENDOR
  247. MYVENDORlo equ 534Dh ; Low word of MYVENDOR
  248. ; Max buffer size set to 32k to avoid problems with compression code and
  249. ; buffer offsets near 0E000h.  See comments in rcomp.asm for details.
  250. MYCBMAX  equ (32*1024) ; Maximum compression buffer size
  251. ;  This server's capabilities.
  252. micapMINE = micapSTANDARD or micapDECOMPRESS or micapINCDECOMP
  253. MYHWASSIST equ 0 ;we have no hardware assist