aboutsummaryrefslogtreecommitdiff
path: root/plugins/dfxvideo/i386.asm
blob: 86d6e2310599a5ec9bef8c188a8b9081d03ca80e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
; i386.asm  -  description
; -------------------
; begin                : Sun Nov 08 2001
; copyright            : (C) 2001 by Pete Bernert
; email                : BlackDove@addcom.de

; ported from inline gcc to nasm by linuzappz


; This program is free software; you can redistribute it and/or modify  *
; it under the terms of the GNU General Public License as published by  *
; the Free Software Foundation; either version 2 of the License, or     *
; (at your option) any later version. See also the license.txt file for *
; additional informations.                                              *


bits 32

section .text

%include "macros.inc"

NEWSYM i386_BGR24to16
	push ebp
	mov ebp, esp
	push ebx
	push edx
	
	mov eax, [ebp+8]            ; this can hold the G value
	mov ebx, eax                ; this can hold the R value
	mov edx, eax                ; this can hold the B value
	shr ebx, 3                  ; move the R value
	and edx, 00f80000h          ; mask the B value
	shr edx, 9                  ; move the B value
	and eax, 00f800h            ; mask the G value
	shr eax, 6                  ; move the G value
	and ebx, 0000001fh          ; mask the R value
	or  eax, ebx                ; add R to G value
	or  eax, edx                ; add B to RG value
	pop edx
	pop ebx
	mov esp, ebp
	pop ebp
	ret

NEWSYM i386_shl10idiv
	push ebp
	mov ebp, esp
	push ebx
	push edx

	mov eax, [ebp+8]
	mov ebx, [ebp+12]
	mov edx, eax
    shl eax, 10
	sar edx, 22
	idiv ebx

	pop edx
	pop ebx
	mov esp, ebp
	pop ebp
	ret
%ifidn __OUTPUT_FORMAT__,elf
section .note.GNU-stack noalloc noexec nowrite progbits
%endif