Mercurial > sdl-ios-xcode
annotate src/hermes/x86_main.asm @ 1303:52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
From: Sean Childs
Subject: [SDL] Compiling SDL 1.2.8 with the free Borland compiler
When compiling SDL 1.2.8 with the free Borland compiler, I received this
error (there is a similar error that occurs in
src\video\windx5\sdl_dx5events.c):
Error E2342 ..\..\src\video\windib\sdl_dibevents.c 189: Type mismatch in
parameter 'lpPrevWndFunc' (wanted 'int (__stdcall *)()', got 'long
(__stdcall *)(void *,unsigned int,unsigned int,long)') in function
DIB_HandleMessage
I checked the MSDN library at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/
windowsuserinterface/windowing/windowprocedures/windowprocedurereference/wind
owprocedurefunctions/callwindowproc.asp
and it had this to say:
If STRICT is not defined, the lpPrevWndFunc parameter has the data type
FARPROC. The FARPROC type is declared as follows:
int (FAR WINAPI * FARPROC) ()
In C, the FARPROC declaration indicates a callback function that has an
unspecified parameter list. In C++, however, the empty parameter list in
the declaration indicates that a function has no parameters. This subtle
distinction can break careless code. Following is one way to handle this
situation:
#ifdef STRICT
WNDPROC MyWindowProcedure
#else
FARPROC MyWindowProcedure
#endif
...
lResult = CallWindowProc(MyWindowProcedure, ...)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 31 Jan 2006 15:30:42 +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 |