src/hermes/mmx_main.asm
author Ryan C. Gordon
Wed, 29 Nov 2006 10:30:05 +0000
branchSDL-1.2
changeset 3900 ce3a2bd11305
parent 1873 eb4d9d99849b
child 2134 180fa05e98e2
permissions -rw-r--r--
Wrapped some macro params in parentheses for alloca wrappers.
Thansk, Suzuki Masahiro.
slouken@0
     1
;
slouken@0
     2
; mmx format converter main loops for HERMES
slouken@0
     3
; Some routines Copyright (c) 1998 Christian Nentwich (c.nentwich@cs.ucl.ac.uk)
slouken@0
     4
; This source code is licensed under the GNU LGPL
slouken@0
     5
; 
slouken@0
     6
; Please refer to the file COPYING.LIB contained in the distribution for
slouken@0
     7
; licensing conditions		
slouken@0
     8
;
slouken@0
     9
slouken@0
    10
BITS 32
slouken@0
    11
slouken@1873
    12
%include "common.inc"
slouken@1871
    13
slouken@1871
    14
SDL_FUNC _ConvertMMX
slouken@1871
    15
SDL_FUNC _mmxreturn
slouken@0
    16
slouken@0
    17
SECTION .text
slouken@0
    18
		
slouken@0
    19
;; _ConvertMMX:	 
slouken@0
    20
;; [ESP+8] ConverterInfo*
slouken@0
    21
;; --------------------------------------------------------------------------
slouken@0
    22
;; ConverterInfo (ebp+..)
slouken@0
    23
;;   0:	void *s_pixels
slouken@0
    24
;;   4:	int s_width
slouken@0
    25
;;   8:	int s_height
slouken@0
    26
;;  12:	int s_add
slouken@0
    27
;;  16:	void *d_pixels
slouken@0
    28
;;  20:	int d_width
slouken@0
    29
;;  24:	int d_height
slouken@0
    30
;;  28:	int d_add
slouken@0
    31
;;  32:	void (*converter_function)() 
slouken@0
    32
;;  36: int32 *lookup
slouken@0
    33
	
slouken@0
    34
_ConvertMMX:
slouken@0
    35
	push ebp
slouken@0
    36
	mov ebp,esp
slouken@0
    37
slouken@0
    38
; Save the registers used by the blitters, necessary for optimized code
slouken@0
    39
	pusha
slouken@0
    40
slouken@0
    41
	mov eax,[ebp+8]
slouken@0
    42
slouken@0
    43
        cmp dword [eax+4],BYTE 0
slouken@0
    44
	je endconvert
slouken@0
    45
	
slouken@0
    46
	mov ebp,eax
slouken@0
    47
	
slouken@0
    48
	mov esi,[ebp+0]
slouken@0
    49
	mov edi,[ebp+16]
slouken@0
    50
	
slouken@0
    51
y_loop:	
slouken@0
    52
	mov ecx,[ebp+4]
slouken@0
    53
slouken@0
    54
	jmp [ebp+32]
slouken@0
    55
slouken@0
    56
_mmxreturn:	
slouken@0
    57
	add esi,[ebp+12]
slouken@0
    58
	add edi,[ebp+28]
slouken@0
    59
	
slouken@0
    60
	dec dword  [ebp+8]
slouken@0
    61
	jnz y_loop
slouken@0
    62
slouken@0
    63
	
slouken@0
    64
; Restore the registers used by the blitters, necessary for optimized code
slouken@0
    65
	popa
slouken@0
    66
slouken@0
    67
	pop ebp
slouken@0
    68
slouken@0
    69
endconvert:
slouken@0
    70
	emms
slouken@0
    71
	
slouken@0
    72
	ret		
slouken@0
    73
icculus@1199
    74
%ifidn __OUTPUT_FORMAT__,elf
icculus@1199
    75
section .note.GNU-stack noalloc noexec nowrite progbits
icculus@1199
    76
%endif