Skip to content

Latest commit

 

History

History
122 lines (86 loc) · 1.74 KB

x86_main.asm

File metadata and controls

122 lines (86 loc) · 1.74 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
3
4
5
6
7
8
9
10
11
12
13
;
; x86 format converters for HERMES
; Some routines Copyright (c) 1998 Christian Nentwich (brn@eleet.mcb.at)
; This source code is licensed under the GNU LGPL
;
; Please refer to the file COPYING.LIB contained in the distribution for
; licensing conditions
;
; Most routines are (c) Glenn Fiedler (ptc@gaffer.org), used with permission
;
BITS 32
Jun 21, 2006
Jun 21, 2006
14
%include "common.inc"
Jun 21, 2006
Jun 21, 2006
15
16
17
SDL_FUNC _ConvertX86
SDL_FUNC _x86return
Apr 26, 2001
Apr 26, 2001
18
Jun 21, 2006
Jun 21, 2006
19
SDL_FUNC _Hermes_X86_CPU
Apr 26, 2001
Apr 26, 2001
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
SECTION .text
;; _ConvertX86:
;; [ESP+8] ConverterInfo*
;; --------------------------------------------------------------------------
;; ConverterInfo (ebp+..)
;; 0: void *s_pixels
;; 4: int s_width
;; 8: int s_height
;; 12: int s_add
;; 16: void *d_pixels
;; 20: int d_width
;; 24: int d_height
;; 28: int d_add
;; 32: void (*converter_function)()
;; 36: int32 *lookup
_ConvertX86:
push ebp
mov ebp,esp
; Save the registers used by the blitters, necessary for optimized code
pusha
mov eax,[ebp+8]
cmp dword [eax+4],BYTE 0
je endconvert
mov ebp,eax
mov esi,[ebp+0]
mov edi,[ebp+16]
y_loop:
mov ecx,[ebp+4]
jmp [ebp+32]
_x86return:
add esi,[ebp+12]
add edi,[ebp+28]
dec dword [ebp+8]
jnz y_loop
; Restore the registers used by the blitters, necessary for optimized code
popa
pop ebp
endconvert:
ret
;; Hermes_X86_CPU returns the CPUID flags in eax
_Hermes_X86_CPU:
pushfd
pop eax
mov ecx,eax
xor eax,040000h
push eax
popfd
pushfd
pop eax
xor eax,ecx
jz .L1 ; Processor is 386
push ecx
popfd
mov eax,ecx
xor eax,200000h
push eax
popfd
pushfd
pop eax
xor eax,ecx
je .L1
Jan 5, 2006
Jan 5, 2006
109
110
push ebx
Apr 26, 2001
Apr 26, 2001
111
112
mov eax,1
cpuid
Jan 5, 2006
Jan 5, 2006
113
mov eax,edx
Apr 26, 2001
Apr 26, 2001
114
Jan 5, 2006
Jan 5, 2006
115
pop ebx
Apr 26, 2001
Apr 26, 2001
116
117
118
.L1:
ret
Dec 12, 2005
Dec 12, 2005
119
120
121
122
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif