-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDGUTILS.asm
More file actions
102 lines (89 loc) · 3.01 KB
/
DGUTILS.asm
File metadata and controls
102 lines (89 loc) · 3.01 KB
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
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
; Dust Ultimate Game Library (DUGL)
; Copyright (C) 2025 Fakhri Feki
;
; 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 3 of the License, or
; (at your option) any later version.
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
; You should have received a copy of the GNU General Public License
; along with this program. If not, see <https://www.gnu.org/licenses/>.
;
; contact: libdugl(at)hotmail.com
;=============================================================================
struc DuglSurf
.ScanLine RESD 1
.rlfb RESD 1
.OrgX RESD 1
.OrgY RESD 1
.MaxX RESD 1
.MaxY RESD 1
.MinX RESD 1
.MinY RESD 1;-----------------------
.Mask RESD 1
.ResH RESD 1
.ResV RESD 1
.vlfb RESD 1
.NegScanLine RESD 1
.OffVMem RESD 1
.BitsPixel RESD 1
.SizeSurf RESD 1;-----------------------
.Size:
endstruc
; constants
Prec EQU 12
MaxResV EQU 8192
BlendMask EQU 0x1f
CMaskB_RGB16 EQU 0x1f ; blue bits 0->4
CMaskG_RGB16 EQU 0x3f<<5 ; green bits 5->10
CMaskR_RGB16 EQU 0x1f<<11 ; red bits 11->15
MaxDeltaDim EQU 1<< (32-Prec)
BMFONTOctaDQSize EQU 48
; param ESI: source Surf, EDI: Dest Surf
; use mm0, ... , mm3
; return no : surf copied
%macro CopySurfDA 0
OR ESI,ESI
JZ SHORT %%NoCopySurf
; SSE/SSE2
MOVDQA xmm0,[ESI]
MOVDQA xmm1,[ESI+32]
MOVDQA xmm2,[ESI+16]
MOVDQA xmm3,[ESI+48]
MOVDQA [EDI],xmm0
MOVDQA [EDI+32],xmm1
MOVDQA [EDI+16],xmm2
MOVDQA [EDI+48],xmm3
%%NoCopySurf:
%endmacro
%macro CopySurfSA 0
OR ESI,ESI
JZ SHORT %%NoCopySurf
; SSE/SSE2
MOVDQA xmm0,[ESI]
MOVDQA xmm1,[ESI+32]
MOVDQA xmm2,[ESI+16]
MOVDQA xmm3,[ESI+48]
MOVDQU [EDI],xmm0
MOVDQU [EDI+32],xmm1
MOVDQU [EDI+16],xmm2
MOVDQU [EDI+48],xmm3
%%NoCopySurf:
%endmacro
%macro CopySurfSNA 0
OR ESI,ESI
JZ SHORT %%NoCopySurf
; SSE/SSE2
MOVDQU xmm0,[ESI]
MOVDQU xmm1,[ESI+32]
MOVDQU xmm2,[ESI+16]
MOVDQU xmm3,[ESI+48]
MOVDQA [EDI],xmm0
MOVDQA [EDI+32],xmm1
MOVDQA [EDI+16],xmm2
MOVDQA [EDI+48],xmm3
%%NoCopySurf:
%endmacro