Mercurial > sdl-ios-xcode
annotate src/hermes/x86_main.asm @ 1215:d082d2d66ec8
Added support for parsing /etc/fb.modes, based on Stephane Marchesin's patch
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 02 Jan 2006 09:08:05 +0000 |
parents | 2d6dc7de1145 |
children | 3202d727bb4b |
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 | |
14 GLOBAL _ConvertX86 | |
15 GLOBAL _x86return | |
16 | |
17 GLOBAL _Hermes_X86_CPU | |
18 | |
19 SECTION .data | |
20 | |
21 cpu_flags dd 0 | |
22 | |
23 | |
24 SECTION .text | |
25 | |
26 ;; _ConvertX86: | |
27 ;; [ESP+8] ConverterInfo* | |
28 ;; -------------------------------------------------------------------------- | |
29 ;; ConverterInfo (ebp+..) | |
30 ;; 0: void *s_pixels | |
31 ;; 4: int s_width | |
32 ;; 8: int s_height | |
33 ;; 12: int s_add | |
34 ;; 16: void *d_pixels | |
35 ;; 20: int d_width | |
36 ;; 24: int d_height | |
37 ;; 28: int d_add | |
38 ;; 32: void (*converter_function)() | |
39 ;; 36: int32 *lookup | |
40 | |
41 _ConvertX86: | |
42 push ebp | |
43 mov ebp,esp | |
44 | |
45 ; Save the registers used by the blitters, necessary for optimized code | |
46 pusha | |
47 | |
48 mov eax,[ebp+8] | |
49 | |
50 cmp dword [eax+4],BYTE 0 | |
51 je endconvert | |
52 | |
53 mov ebp,eax | |
54 | |
55 mov esi,[ebp+0] | |
56 mov edi,[ebp+16] | |
57 | |
58 y_loop: | |
59 mov ecx,[ebp+4] | |
60 | |
61 jmp [ebp+32] | |
62 | |
63 _x86return: | |
64 add esi,[ebp+12] | |
65 add edi,[ebp+28] | |
66 | |
67 dec dword [ebp+8] | |
68 jnz y_loop | |
69 | |
70 ; Restore the registers used by the blitters, necessary for optimized code | |
71 popa | |
72 | |
73 pop ebp | |
74 | |
75 endconvert: | |
76 ret | |
77 | |
78 | |
79 | |
80 ;; Hermes_X86_CPU returns the CPUID flags in eax | |
81 | |
82 _Hermes_X86_CPU: | |
83 pushfd | |
84 pop eax | |
85 | |
86 mov ecx,eax | |
87 | |
88 xor eax,040000h | |
89 push eax | |
90 | |
91 popfd | |
92 pushfd | |
93 | |
94 pop eax | |
95 xor eax,ecx | |
96 jz .L1 ; Processor is 386 | |
97 | |
98 push ecx | |
99 popfd | |
100 | |
101 mov eax,ecx | |
102 xor eax,200000h | |
103 | |
104 push eax | |
105 popfd | |
106 pushfd | |
107 | |
108 pop eax | |
109 xor eax,ecx | |
110 je .L1 | |
111 | |
112 pusha | |
113 | |
114 mov eax,1 | |
115 cpuid | |
116 | |
117 mov [cpu_flags],edx | |
118 | |
119 popa | |
120 | |
121 mov eax,[cpu_flags] | |
122 | |
123 .L1: | |
124 ret | |
1199
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
125 |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
126 %ifidn __OUTPUT_FORMAT__,elf |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
127 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
|
128 %endif |