Mercurial > sdl-ios-xcode
annotate src/hermes/x86_main.asm @ 1554:0ca607a5d173
Fixed bug #84
Date: Sun, 23 Oct 2005 16:39:03 +0200
From: "A. Schmid" <sahib@phreaker.net>
Subject: [SDL] no software surfaces with svgalib driver?
Hi,
I noticed that the SDL (1.2.9) svgalib driver only makes use of linear
addressable (framebuffer) video modes. On older systems (like one of
mine), linear addressable modes are often not available.
Especially for cards with VESA VBE < 2.0 the svgalib vesa driver is
unusable, since VESA only supports framebuffering for VBE 2.0 and later.
The changes necessary to add support for software surfaces seem to be
relatively small. I only had to hack src/video/svga/SDL_svgavideo.c (see
attached patch). The code worked fine for me, but it is no more than a
proof of concept and should be reviewed (probably has a memory leak when
switching modes). It also uses the vgagl library (included in the
svgalib package) and needs to be linked against it.
-Alex
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Mar 2006 12:04:40 +0000 |
parents | 3202d727bb4b |
children | 393092a3ebf6 |
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 .text | |
20 | |
21 ;; _ConvertX86: | |
22 ;; [ESP+8] ConverterInfo* | |
23 ;; -------------------------------------------------------------------------- | |
24 ;; ConverterInfo (ebp+..) | |
25 ;; 0: void *s_pixels | |
26 ;; 4: int s_width | |
27 ;; 8: int s_height | |
28 ;; 12: int s_add | |
29 ;; 16: void *d_pixels | |
30 ;; 20: int d_width | |
31 ;; 24: int d_height | |
32 ;; 28: int d_add | |
33 ;; 32: void (*converter_function)() | |
34 ;; 36: int32 *lookup | |
35 | |
36 _ConvertX86: | |
37 push ebp | |
38 mov ebp,esp | |
39 | |
40 ; Save the registers used by the blitters, necessary for optimized code | |
41 pusha | |
42 | |
43 mov eax,[ebp+8] | |
44 | |
45 cmp dword [eax+4],BYTE 0 | |
46 je endconvert | |
47 | |
48 mov ebp,eax | |
49 | |
50 mov esi,[ebp+0] | |
51 mov edi,[ebp+16] | |
52 | |
53 y_loop: | |
54 mov ecx,[ebp+4] | |
55 | |
56 jmp [ebp+32] | |
57 | |
58 _x86return: | |
59 add esi,[ebp+12] | |
60 add edi,[ebp+28] | |
61 | |
62 dec dword [ebp+8] | |
63 jnz y_loop | |
64 | |
65 ; Restore the registers used by the blitters, necessary for optimized code | |
66 popa | |
67 | |
68 pop ebp | |
69 | |
70 endconvert: | |
71 ret | |
72 | |
73 | |
74 | |
75 ;; Hermes_X86_CPU returns the CPUID flags in eax | |
76 | |
77 _Hermes_X86_CPU: | |
78 pushfd | |
79 pop eax | |
80 | |
81 mov ecx,eax | |
82 | |
83 xor eax,040000h | |
84 push eax | |
85 | |
86 popfd | |
87 pushfd | |
88 | |
89 pop eax | |
90 xor eax,ecx | |
91 jz .L1 ; Processor is 386 | |
92 | |
93 push ecx | |
94 popfd | |
95 | |
96 mov eax,ecx | |
97 xor eax,200000h | |
98 | |
99 push eax | |
100 popfd | |
101 pushfd | |
102 | |
103 pop eax | |
104 xor eax,ecx | |
105 je .L1 | |
106 | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
107 push ebx |
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
108 |
0 | 109 mov eax,1 |
110 cpuid | |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
111 mov eax,edx |
0 | 112 |
1227
3202d727bb4b
From Mike Frysinger and/or Gentoo:
Ryan C. Gordon <icculus@icculus.org>
parents:
1199
diff
changeset
|
113 pop ebx |
0 | 114 |
115 .L1: | |
116 ret | |
1199
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
117 |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
118 %ifidn __OUTPUT_FORMAT__,elf |
2d6dc7de1145
From: Mike Frysinger <vapier@gentoo.org>
Ryan C. Gordon <icculus@icculus.org>
parents:
1166
diff
changeset
|
119 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
|
120 %endif |