SDL-1.2.14
[sdl_omap.git] / src / hermes / mmx_main.asm
1 ;
2 ; mmx format converter main loops for HERMES
3 ; Some routines Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
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
10 BITS 32
11
12 %include "common.inc"
13
14 SDL_FUNC _ConvertMMX
15
16 SECTION .text
17                 
18 ;; _ConvertMMX:  
19 ;; [ESP+8] ConverterInfo*
20 ;; --------------------------------------------------------------------------
21 ;; ConverterInfo (ebp+..)
22 ;;   0: void *s_pixels
23 ;;   4: int s_width
24 ;;   8: int s_height
25 ;;  12: int s_add
26 ;;  16: void *d_pixels
27 ;;  20: int d_width
28 ;;  24: int d_height
29 ;;  28: int d_add
30 ;;  32: void (*converter_function)() 
31 ;;  36: int32 *lookup
32         
33 _ConvertMMX:
34         push ebp
35         mov ebp,esp
36
37 ; Save the registers used by the blitters, necessary for optimized code
38         pusha
39
40         mov eax,[ebp+8]
41
42         cmp dword [eax+4],BYTE 0
43         je endconvert
44         
45         mov ebp,eax
46         
47         mov esi,[ebp+0]
48         mov edi,[ebp+16]
49         
50 y_loop: 
51         mov ecx,[ebp+4]
52
53         call [ebp+32]
54
55         add esi,[ebp+12]
56         add edi,[ebp+28]
57         
58         dec dword  [ebp+8]
59         jnz y_loop
60
61         
62 ; Restore the registers used by the blitters, necessary for optimized code
63         popa
64
65         pop ebp
66
67 endconvert:
68         emms
69         
70         ret             
71
72 %ifidn __OUTPUT_FORMAT__,elf
73 section .note.GNU-stack noalloc noexec nowrite progbits
74 %endif