Mercurial > sdl-ios-xcode
annotate src/hermes/x86_main.asm @ 4414:2e253188dcd2 SDL-1.2-olpc
Closing obsolete SDL-1.2-olpc named branch
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Sun, 28 Feb 2010 00:21:35 -0500 |
parents | eb4d9d99849b |
children | 180fa05e98e2 |
rev | line source |
---|---|
0 | 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 | |
1873
eb4d9d99849b
Renamed, per Mike's comment on bug #157
Sam Lantinga <slouken@libsdl.org>
parents:
1871
diff
changeset
|
14 %include "common.inc" |
1871 | 15 |
16 SDL_FUNC _ConvertX86 | |
17 SDL_FUNC _x86return | |
0 | 18 |
1871 | 19 SDL_FUNC _Hermes_X86_CPU |
0 | 20 |
21 SECTION .text | |
22 | |
23 ;; _ConvertX86: | |
24 ;; [ESP+8] ConverterInfo* | |
25 ;; -------------------------------------------------------------------------- | |
26 ;; ConverterInfo (ebp+..) | |
27 ;; 0: void *s_pixels | |
28 ;; 4: int s_width | |
29 ;; 8: int s_height | |
30 ;; 12: int s_add | |
31 ;; 16: void *d_pixels | |
32 ;; 20: int d_width | |
33 ;; 24: int d_height | |
34 ;; 28: int d_add | |
35 ;; 32: void (*converter_function)() | |
36 ;; 36: int32 *lookup | |
37 | |
38 _ConvertX86: | |
39 push ebp | |
40 mov ebp,esp | |
41 | |
42 ; Save the registers used by the blitters, necessary for optimized code | |
43 pusha | |
44 | |
45 mov eax,[ebp+8] | |
46 | |
47 cmp dword [eax+4],BYTE 0 | |
48 je endconvert | |
49 | |
50 mov ebp,eax | |
51 | |
52 mov esi,[ebp+0] | |
53 mov edi,[ebp+16] | |
54 | |
55 y_loop: | |
56 mov ecx,[ebp+4] | |
57 | |
58 jmp [ebp+32] | |
59 | |
60 _x86return: | |
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 | |
77 ;; Hermes_X86_CPU returns the CPUID flags in eax | |
78 | |
79 _Hermes_X86_CPU: | |
80 pushfd | |
81 pop eax | |
82 | |
83 mov ecx,eax | |
84 | |
85 xor eax,040000h | |
86 push eax | |
87 | |
88 popfd | |
89 pushfd | |
90 | |
91 pop eax | |
92 xor eax,ecx | |
93 jz .L1 ; Processor is 386 | |
94 | |
95 push ecx | |
96 popfd | |
97 | |
98 mov eax,ecx | |
99 xor eax,200000h | |
100 | |
101 push eax | |
102 popfd | |
103 pushfd | |
104 | |
105 pop eax | |
106 xor eax,ecx | |
107 je .L1 | |
108 | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
109 push ebx |
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
110 |
0 | 111 mov eax,1 |
112 cpuid | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
113 mov eax,edx |
0 | 114 |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
115 pop ebx |
0 | 116 |
117 .L1: | |
118 ret | |
1199
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
119 |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
120 %ifidn __OUTPUT_FORMAT__,elf |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
121 section .note.GNU-stack noalloc noexec nowrite progbits |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
122 %endif |