Subversion Repositories Kolibri OS

Rev

Rev 5131 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. ;
  2. ; x86 format converters for HERMES
  3. ; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
  4. ; This source code is licensed under the GNU LGPL
  5. ;
  6. ; Please refer to the file COPYING.LIB contained in the distribution for
  7. ; licensing conditions         
  8. ;
  9. ; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
  10. ;
  11.  
  12. BITS 32
  13.        
  14. SECTION .text ALIGN=16
  15.        
  16. GLOBAL _ConvertX86
  17. GLOBAL _x86return
  18. GLOBAL _Hermes_X86_CPU
  19.                
  20. ;; _ConvertX86:  
  21. ;; [ESP+8] ConverterInfo*
  22. ;; --------------------------------------------------------------------------
  23. ;; ConverterInfo (ebp+..)
  24. ;;   0: void *s_pixels
  25. ;;   4: int s_width
  26. ;;   8: int s_height
  27. ;;  12: int s_add
  28. ;;  16: void *d_pixels
  29. ;;  20: int d_width
  30. ;;  24: int d_height
  31. ;;  28: int d_add
  32. ;;  32: void (*converter_function)()
  33. ;;  36: int32 *lookup
  34.        
  35. _ConvertX86:
  36.         push ebp
  37.         mov ebp,esp
  38.  
  39. ; Save the registers used by the blitters, necessary for optimized code
  40.         pusha
  41.  
  42.         mov eax,[ebp+8]
  43.  
  44.         cmp dword [eax+4],BYTE 0
  45.         je endconvert
  46.        
  47.         mov ebp,eax
  48.        
  49.         mov esi,[ebp+0]
  50.         mov edi,[ebp+16]
  51.        
  52. y_loop:
  53.         mov ecx,[ebp+4]
  54.  
  55.         jmp [ebp+32]
  56.  
  57. _x86return:
  58.         add esi,[ebp+12]
  59.         add edi,[ebp+28]
  60.        
  61.         dec dword  [ebp+8]
  62.         jnz y_loop
  63.  
  64. ; Restore the registers used by the blitters, necessary for optimized code
  65.         popa
  66.        
  67.         pop ebp
  68.  
  69. endconvert:    
  70.         ret            
  71.  
  72.  
  73.  
  74. ;; Hermes_X86_CPU returns the CPUID flags in eax
  75.        
  76. _Hermes_X86_CPU:
  77.         pushfd
  78.         pop eax
  79.        
  80.         mov ecx,eax
  81.        
  82.         xor eax,040000h
  83.         push eax
  84.        
  85.         popfd
  86.         pushfd
  87.  
  88.         pop eax
  89.         xor eax,ecx
  90.         jz .L1                  ; Processor is 386
  91.  
  92.         push ecx
  93.         popfd
  94.  
  95.         mov eax,ecx
  96.         xor eax,200000h
  97.  
  98.         push eax
  99.         popfd
  100.         pushfd
  101.  
  102.         pop eax
  103.         xor eax,ecx
  104.         je .L1
  105.        
  106.         pusha
  107.        
  108.         mov eax,1
  109.         cpuid
  110.  
  111.         mov [cpu_flags],edx
  112.  
  113.         popa
  114.  
  115.         mov eax,[cpu_flags]
  116.  
  117. .L1:   
  118.         xor eax,eax
  119.         ret
  120.  
  121. section '.DATA' ALIGN=16
  122.  
  123. cpu_flags dd 0
  124.        
  125.