Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
9172 turbocat 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
%include "common.inc"
15
 
16
SDL_FUNC _ConvertX86
17
SDL_FUNC _Hermes_X86_CPU
18
 
19
SECTION .data
20
cpu_flags dd 0
21
 
22
SECTION .text
23
 
24
;; _ConvertX86:
25
;; [ESP+8] ConverterInfo*
26
;; --------------------------------------------------------------------------
27
;; ConverterInfo (ebp+..)
28
;;   0:	void *s_pixels
29
;;   4:	int s_width
30
;;   8:	int s_height
31
;;  12:	int s_add
32
;;  16:	void *d_pixels
33
;;  20:	int d_width
34
;;  24:	int d_height
35
;;  28:	int d_add
36
;;  32:	void (*converter_function)()
37
;;  36: int32 *lookup
38
 
39
_ConvertX86:
40
	push ebp
41
	mov ebp,esp
42
 
43
; Save the registers used by the blitters, necessary for optimized code
44
	pusha
45
 
46
	mov eax,[ebp+8]
47
 
48
        cmp dword [eax+4],BYTE 0
49
	je endconvert
50
 
51
	mov ebp,eax
52
 
53
	mov esi,[ebp+0]
54
	mov edi,[ebp+16]
55
 
56
y_loop:
57
	mov ecx,[ebp+4]
58
 
59
	call [ebp+32]
60
 
61
	add esi,[ebp+12]
62
	add edi,[ebp+28]
63
 
64
	dec dword  [ebp+8]
65
	jnz y_loop
66
 
67
; Restore the registers used by the blitters, necessary for optimized code
68
	popa
69
 
70
	pop ebp
71
 
72
endconvert:
73
	ret
74
 
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
	ret
119
 
120
 
121
%ifidn __OUTPUT_FORMAT__,elf32
122
section .note.GNU-stack noalloc noexec nowrite progbits
123
%endif