Subversion Repositories Kolibri OS

Rev

Rev 8210 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8210 Rev 9172
Line 8... Line 8...
8
; 
8
; 
9
; Routines adjusted for Hermes by Christian Nentwich (brn@eleet.mcb.at)
9
; Routines adjusted for Hermes by Christian Nentwich (brn@eleet.mcb.at)
10
; Used with permission.
10
; Used with permission.
11
; 
11
; 
Line 12... Line -...
12
 
-
 
13
	
12
 
Line 14... Line -...
14
BITS 32
-
 
15
 
-
 
16
GLOBAL _ConvertX86p16_32RGB888
-
 
17
GLOBAL _ConvertX86p16_32BGR888
-
 
18
GLOBAL _ConvertX86p16_32RGBA888
-
 
19
GLOBAL _ConvertX86p16_32BGRA888
-
 
20
GLOBAL _ConvertX86p16_24RGB888
-
 
21
GLOBAL _ConvertX86p16_24BGR888
-
 
22
GLOBAL _ConvertX86p16_16BGR565
-
 
23
GLOBAL _ConvertX86p16_16RGB555
13
BITS 32
Line -... Line 14...
-
 
14
 
-
 
15
%include "common.inc"
24
GLOBAL _ConvertX86p16_16BGR555
16
 
25
GLOBAL _ConvertX86p16_8RGB332
17
SDL_FUNC _ConvertX86p16_16BGR565
Line -... Line 18...
-
 
18
SDL_FUNC _ConvertX86p16_16RGB555
Line 26... Line 19...
26
 
19
SDL_FUNC _ConvertX86p16_16BGR555
Line 27... Line -...
27
EXTERN _ConvertX86
-
 
28
EXTERN _x86return
-
 
29
 
20
SDL_FUNC _ConvertX86p16_8RGB332
Line 30... Line 21...
30
 
21
 
31
SECTION .text
22
EXTERN _ConvertX86
32
 
23
 
Line 33... Line 24...
33
 
24
SECTION .text
34
 
25
 
35
_ConvertX86p16_16BGR565:
26
_ConvertX86p16_16BGR565:
36
 
27
 
37
    ; check short
28
    ; check short
38
    cmp ecx,BYTE 16
29
    cmp ecx,BYTE 16
Line 54... Line 45...
54
    mov [edi+1],ah
45
    mov [edi+1],ah
55
    add esi,BYTE 2
46
    add esi,BYTE 2
56
    add edi,BYTE 2
47
    add edi,BYTE 2
57
    dec ecx
48
    dec ecx
58
    jnz .L1
49
    jnz .L1
59
.L2
50
.L2:
60
    jmp _x86return
51
    retn
Line 61... Line 52...
61
 
52
 
62
.L3 ; head
53
.L3: ; head
63
    mov eax,edi
54
    mov eax,edi
64
    and eax,BYTE 11b
55
    and eax,BYTE 11b
65
    jz .L4
56
    jz .L4
66
    mov al,[esi]
57
    mov al,[esi]
Line 77... Line 68...
77
    mov [edi+1],ah
68
    mov [edi+1],ah
78
    add esi,BYTE 2
69
    add esi,BYTE 2
79
    add edi,BYTE 2
70
    add edi,BYTE 2
80
    dec ecx
71
    dec ecx
Line 81... Line 72...
81
 
72
 
82
.L4 ; save count
73
.L4: ; save count
Line 83... Line 74...
83
    push ecx
74
    push ecx
84
 
75
 
Line 91... Line 82...
91
 
82
 
92
    ; negative counter 
83
    ; negative counter 
93
    neg ecx
84
    neg ecx
Line 94... Line 85...
94
    jmp SHORT .L6
85
    jmp SHORT .L6
95
                              
86
                              
Line 96... Line 87...
96
.L5     mov [edi+ecx*4-4],eax
87
.L5:    mov [edi+ecx*4-4],eax
97
.L6     mov eax,[esi+ecx*4]
88
.L6:    mov eax,[esi+ecx*4]
Line 98... Line 89...
98
 
89
 
Line 132... Line 123...
132
    mov [edi],al
123
    mov [edi],al
133
    mov [edi+1],ah
124
    mov [edi+1],ah
134
    add esi,BYTE 2
125
    add esi,BYTE 2
135
    add edi,BYTE 2
126
    add edi,BYTE 2
Line 136... Line 127...
136
 
127
 
137
.L7
128
.L7:
Line 147... Line 138...
147
    ; check short
138
    ; check short
148
    cmp ecx,BYTE 32
139
    cmp ecx,BYTE 32
149
    ja .L3
140
    ja .L3
Line 150... Line 141...
150
 
141
 
151
 
142
 
152
.L1 ; short loop
143
.L1: ; short loop
153
    mov al,[esi]
144
    mov al,[esi]
154
    mov ah,[esi+1]
145
    mov ah,[esi+1]
155
    mov ebx,eax
146
    mov ebx,eax
Line 161... Line 152...
161
    mov [edi+1],ah
152
    mov [edi+1],ah
162
    add esi,BYTE 2
153
    add esi,BYTE 2
163
    add edi,BYTE 2
154
    add edi,BYTE 2
164
    dec ecx
155
    dec ecx
165
    jnz .L1
156
    jnz .L1
166
.L2
157
.L2:
167
    jmp _x86return
158
    retn
Line 168... Line 159...
168
 
159
 
169
.L3 ; head
160
.L3: ; head
170
    mov eax,edi
161
    mov eax,edi
171
    and eax,BYTE 11b
162
    and eax,BYTE 11b
172
    jz .L4
163
    jz .L4
173
    mov al,[esi]
164
    mov al,[esi]
Line 181... Line 172...
181
    mov [edi+1],ah
172
    mov [edi+1],ah
182
    add esi,BYTE 2
173
    add esi,BYTE 2
183
    add edi,BYTE 2
174
    add edi,BYTE 2
184
    dec ecx
175
    dec ecx
Line 185... Line 176...
185
 
176
 
186
.L4 ; save ebp
177
.L4: ; save ebp
Line 187... Line 178...
187
    push ebp
178
    push ebp
188
 
179
 
Line 198... Line 189...
198
 
189
 
199
    ; negative counter 
190
    ; negative counter 
200
    xor ebp,ebp
191
    xor ebp,ebp
Line 201... Line 192...
201
    sub ebp,ecx
192
    sub ebp,ecx
202
 
193
 
Line 203... Line 194...
203
.L5     mov eax,[esi+ebp*8]        ; agi?
194
.L5:    mov eax,[esi+ebp*8]        ; agi?
204
        mov ecx,[esi+ebp*8+4]
195
        mov ecx,[esi+ebp*8+4]
Line 224... Line 215...
224
        inc ebp
215
        inc ebp
225
        jnz .L5                 
216
        jnz .L5                 
Line 226... Line 217...
226
 
217
 
227
    ; tail
218
    ; tail
228
    pop ecx
219
    pop ecx
229
.L6 and ecx,BYTE 11b
220
.L6: and ecx,BYTE 11b
230
    jz .L7
221
    jz .L7
231
    mov al,[esi]
222
    mov al,[esi]
232
    mov ah,[esi+1]
223
    mov ah,[esi+1]
233
    mov ebx,eax
224
    mov ebx,eax
Line 240... Line 231...
240
    add esi,BYTE 2
231
    add esi,BYTE 2
241
    add edi,BYTE 2
232
    add edi,BYTE 2
242
    dec ecx
233
    dec ecx
243
    jmp SHORT .L6
234
    jmp SHORT .L6
Line 244... Line 235...
244
 
235
 
245
.L7 pop ebp
236
.L7: pop ebp
Line 255... Line 246...
255
    ; check short
246
    ; check short
256
    cmp ecx,BYTE 16
247
    cmp ecx,BYTE 16
257
    ja .L3
248
    ja .L3
Line 258... Line 249...
258
 
249
 
259
	
250
	
260
.L1 ; short loop
251
.L1: ; short loop
261
    mov al,[esi]
252
    mov al,[esi]
262
    mov ah,[esi+1]
253
    mov ah,[esi+1]
263
    mov ebx,eax
254
    mov ebx,eax
Line 274... Line 265...
274
    mov [edi+1],ah
265
    mov [edi+1],ah
275
    add esi,BYTE 2
266
    add esi,BYTE 2
276
    add edi,BYTE 2
267
    add edi,BYTE 2
277
    dec ecx
268
    dec ecx
278
    jnz .L1
269
    jnz .L1
279
.L2
270
.L2:
280
    jmp _x86return
271
    retn
Line 281... Line 272...
281
 
272
 
282
.L3 ; head
273
.L3: ; head
283
    mov eax,edi
274
    mov eax,edi
284
    and eax,BYTE 11b
275
    and eax,BYTE 11b
285
    jz .L4
276
    jz .L4
286
    mov al,[esi]
277
    mov al,[esi]
Line 299... Line 290...
299
    mov [edi+1],ah
290
    mov [edi+1],ah
300
    add esi,BYTE 2
291
    add esi,BYTE 2
301
    add edi,BYTE 2
292
    add edi,BYTE 2
302
    dec ecx
293
    dec ecx
Line 303... Line 294...
303
 
294
 
304
.L4 ; save count
295
.L4: ; save count
Line 305... Line 296...
305
    push ecx
296
    push ecx
306
 
297
 
Line 313... Line 304...
313
 
304
 
314
    ; negative counter 
305
    ; negative counter 
315
    neg ecx
306
    neg ecx
Line 316... Line 307...
316
    jmp SHORT .L6
307
    jmp SHORT .L6
317
                              
308
                              
Line 318... Line 309...
318
.L5     mov [edi+ecx*4-4],eax
309
.L5:     mov [edi+ecx*4-4],eax
319
.L6     mov eax,[esi+ecx*4]
310
.L6:     mov eax,[esi+ecx*4]
Line 320... Line 311...
320
 
311
 
Line 358... Line 349...
358
    mov [edi],al
349
    mov [edi],al
359
    mov [edi+1],ah
350
    mov [edi+1],ah
360
    add esi,BYTE 2
351
    add esi,BYTE 2
361
    add edi,BYTE 2
352
    add edi,BYTE 2
Line 362... Line 353...
362
 
353
 
363
.L7
354
.L7:
Line 373... Line 364...
373
    ; check short
364
    ; check short
374
    cmp ecx,BYTE 16
365
    cmp ecx,BYTE 16
375
    ja .L3
366
    ja .L3
Line 376... Line 367...
376
 
367
 
377
 
368
 
378
.L1 ; short loop
369
.L1: ; short loop
379
    mov al,[esi+0]
370
    mov al,[esi+0]
380
    mov ah,[esi+1]
371
    mov ah,[esi+1]
381
    mov ebx,eax
372
    mov ebx,eax
Line 391... Line 382...
391
    mov [edi],al
382
    mov [edi],al
392
    add esi,BYTE 2
383
    add esi,BYTE 2
393
    inc edi
384
    inc edi
394
    dec ecx
385
    dec ecx
395
    jnz .L1
386
    jnz .L1
396
.L2
387
.L2:
397
    jmp _x86return
388
    retn
Line 398... Line 389...
398
 
389
 
399
.L3 mov eax,edi
390
.L3: mov eax,edi
400
    and eax,BYTE 11b
391
    and eax,BYTE 11b
401
    jz .L4
392
    jz .L4
402
    mov al,[esi+0]
393
    mov al,[esi+0]
403
    mov ah,[esi+1]
394
    mov ah,[esi+1]
Line 415... Line 406...
415
    add esi,BYTE 2
406
    add esi,BYTE 2
416
    inc edi
407
    inc edi
417
    dec ecx
408
    dec ecx
418
    jmp SHORT .L3
409
    jmp SHORT .L3
Line 419... Line 410...
419
 
410
 
420
.L4 ; save ebp
411
.L4: ; save ebp
Line 421... Line 412...
421
    push ebp
412
    push ebp
422
 
413
 
Line 429... Line 420...
429
    ; prestep
420
    ; prestep
430
    mov dl,[esi+0]
421
    mov dl,[esi+0]
431
    mov bl,[esi+1]
422
    mov bl,[esi+1]
432
    mov dh,[esi+2]
423
    mov dh,[esi+2]
Line 433... Line 424...
433
        
424
        
434
.L5     shl edx,16
425
.L5:     shl edx,16
Line 435... Line 426...
435
        mov bh,[esi+3]
426
        mov bh,[esi+3]
436
        
427
        
Line 470... Line 461...
470
    ; check tail
461
    ; check tail
471
    pop ecx
462
    pop ecx
472
    and ecx,BYTE 11b
463
    and ecx,BYTE 11b
473
    jz .L7
464
    jz .L7
Line 474... Line 465...
474
 
465
 
475
.L6 ; tail
466
.L6: ; tail
476
    mov al,[esi+0]
467
    mov al,[esi+0]
477
    mov ah,[esi+1]
468
    mov ah,[esi+1]
478
    mov ebx,eax
469
    mov ebx,eax
479
    mov edx,eax
470
    mov edx,eax
Line 489... Line 480...
489
    add esi,BYTE 2
480
    add esi,BYTE 2
490
    inc edi
481
    inc edi
491
    dec ecx
482
    dec ecx
492
    jnz .L6
483
    jnz .L6
Line 493... Line 484...
493
 
484
 
494
.L7 pop ebp
485
.L7: pop ebp
Line -... Line 486...
-
 
486
    retn
-
 
487
 
-
 
488
%ifidn __OUTPUT_FORMAT__,elf32