pcsxr-1.9.92
[pcsx_rearmed.git] / plugins / dfxvideo / i386.asm
1 ; i386.asm  -  description
2 ; -------------------
3 ; begin                : Sun Nov 08 2001
4 ; copyright            : (C) 2001 by Pete Bernert
5 ; email                : BlackDove@addcom.de
6
7 ; ported from inline gcc to nasm by linuzappz
8
9
10 ; This program is free software; you can redistribute it and/or modify  *
11 ; it under the terms of the GNU General Public License as published by  *
12 ; the Free Software Foundation; either version 2 of the License, or     *
13 ; (at your option) any later version. See also the license.txt file for *
14 ; additional informations.                                              *
15
16
17 bits 32
18
19 section .text
20
21 %include "macros.inc"
22
23 NEWSYM i386_BGR24to16
24         push ebp
25         mov ebp, esp
26         push ebx
27         push edx
28         
29         mov eax, [ebp+8]            ; this can hold the G value
30         mov ebx, eax                ; this can hold the R value
31         mov edx, eax                ; this can hold the B value
32         shr ebx, 3                  ; move the R value
33         and edx, 00f80000h          ; mask the B value
34         shr edx, 9                  ; move the B value
35         and eax, 00f800h            ; mask the G value
36         shr eax, 6                  ; move the G value
37         and ebx, 0000001fh          ; mask the R value
38         or  eax, ebx                ; add R to G value
39         or  eax, edx                ; add B to RG value
40         pop edx
41         pop ebx
42         mov esp, ebp
43         pop ebp
44         ret
45
46 NEWSYM i386_shl10idiv
47         push ebp
48         mov ebp, esp
49         push ebx
50         push edx
51
52         mov eax, [ebp+8]
53         mov ebx, [ebp+12]
54         mov edx, eax
55     shl eax, 10
56         sar edx, 22
57         idiv ebx
58
59         pop edx
60         pop ebx
61         mov esp, ebp
62         pop ebp
63         ret
64 %ifidn __OUTPUT_FORMAT__,elf
65 section .note.GNU-stack noalloc noexec nowrite progbits
66 %endif
67