home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 October / CMCD1004.ISO / Software / Shareware / Utilitare / pec / pec2setup.exe / sdk / codec / template / Codec_0_EntryPoints.asm next >
Encoding:
Assembly Source File  |  2004-07-15  |  978 b   |  52 lines

  1.  
  2. option casemap:none 
  3. .486p
  4. .model flat,stdcall
  5.  
  6. public Decode_Small
  7. public GetDecodeSmallFuncSize
  8.  
  9. Decode_Small PROTO :DWORD, :DWORD, :DWORD
  10. GetDecodeSmallFuncSize PROTO
  11.  
  12. include Codec_0_EntryPoints.inc
  13. .data
  14. db 'Codec0',0
  15.  
  16. .code
  17. _DecodeSmall:
  18. Decode_Small proc stdcall uses ebx esi edi lpvSource:DWORD, lpvDest:DWORD, lpvExtra:DWORD
  19.  
  20.     mov esi,lpvSource
  21.     cmp ([esi]+CODEC_0_HEADER.dwSignature),CODEC_0_SIGNATURE
  22.     jnz _ret_error
  23.     
  24.     mov edi,lpvDest
  25.     mov ecx,([esi]+CODEC_0_HEADER.dwDecodedSize)
  26.     add esi,size CODEC_0_HEADER
  27.     
  28.     push ecx  ; save for return value
  29.     
  30.     ; fast movs (dwords then remaining bytes)
  31.     mov eax,ecx
  32.     sar    ecx,2
  33.     rep    movsd
  34.     add    ecx,eax
  35.     and    ecx,3
  36.     rep    movsb        
  37.     
  38.     pop eax        ; eax=decoded size
  39.     ret    
  40.  
  41.   _ret_error:
  42.     xor    eax,eax    
  43.       ret
  44. Decode_Small endp
  45. _DecodeSmall_e:
  46.  
  47. GetDecodeSmallFuncSize proc stdcall
  48.     mov eax,offset _DecodeSmall_e-offset _DecodeSmall
  49.     ret
  50. GetDecodeSmallFuncSize endp
  51.  
  52. END