Subversion Repositories Kolibri OS

Rev

Rev 3415 | Rev 3684 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3415 Rev 3416
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
7
 
8
$Revision: 3415 $
8
$Revision: 3416 $
9
 
9
 
10
include "../lang.inc"
10
include "lang.inc"
11
 
11
 
12
;------------------------------------------------------------------------------
12
;------------------------------------------------------------------------------
13
align 4
13
align 4
14
dtext_asciiz_esi:                          ; for skins title out
14
dtext_asciiz_esi:                          ; for skins title out
15
        push    eax
15
        push    eax
16
        xor     eax, eax
16
        xor     eax, eax
17
        inc     eax
17
        inc     eax
18
        jmp     dtext.1
18
        jmp     dtext.1
19
;------------------------------------------------------------------------------
19
;------------------------------------------------------------------------------
20
align 4
20
align 4
21
dtext:
21
dtext:
22
; ebx x & y
22
; ebx x & y
23
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB )
23
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB )
24
; X = ABnnb:
24
; X = ABnnb:
25
; nn = font
25
; nn = font
26
; A = 0 <=> output esi characters; otherwise output ASCIIZ string
26
; A = 0 <=> output esi characters; otherwise output ASCIIZ string
27
; B = 1 <=> fill background with color eax
27
; B = 1 <=> fill background with color eax
28
; edx start of text
28
; edx start of text
29
; edi 1 force or user area for redirect
29
; edi 1 force or user area for redirect
30
        push    eax
30
        push    eax
31
        xor     eax, eax
31
        xor     eax, eax
32
;--------------------------------------
32
;--------------------------------------
33
align 4
33
align 4
34
.1:
34
.1:
35
        pushad
35
        pushad
36
        movsx   eax, bx         ; eax=y
36
        movsx   eax, bx         ; eax=y
37
        sar     ebx, 16         ; ebx=x
37
        sar     ebx, 16         ; ebx=x
38
        xchg    eax, ebx        ; eax=x, ebx=y
38
        xchg    eax, ebx        ; eax=x, ebx=y
39
        cmp     esi, 255
39
        cmp     esi, 255
40
        jb      .loop
40
        jb      .loop
41
 
41
 
42
        mov     esi, 255
42
        mov     esi, 255
43
;--------------------------------------
43
;--------------------------------------
44
align 4
44
align 4
45
.loop:
45
.loop:
46
        test    ecx, ecx
46
        test    ecx, ecx
47
        js      .test_asciiz
47
        js      .test_asciiz
48
 
48
 
49
        dec     esi
49
        dec     esi
50
        js      .end
50
        js      .end
51
 
51
 
52
        jmp     @f
52
        jmp     @f
53
;--------------------------------------
53
;--------------------------------------
54
align 4
54
align 4
55
.test_asciiz:
55
.test_asciiz:
56
        cmp     byte [edx], 0
56
        cmp     byte [edx], 0
57
        jz      .end
57
        jz      .end
58
 
58
 
59
        cmp     byte [esp+28], 1
59
        cmp     byte [esp+28], 1
60
        jne     @f
60
        jne     @f
61
 
61
 
62
        dec     esi
62
        dec     esi
63
        js      .end
63
        js      .end
64
;--------------------------------------
64
;--------------------------------------
65
align 4
65
align 4
66
@@:
66
@@:
67
        inc     edx
67
        inc     edx
68
        pushad
68
        pushad
69
        movzx   edx, byte [edx-1]
69
        movzx   edx, byte [edx-1]
70
        test    ecx, 0x10000000
70
        test    ecx, 0x10000000
71
        jnz     .font2
71
        jnz     .font2
72
 
72
 
73
        mov     esi, 9
73
        mov     esi, 9
74
        lea     ebp, [FONT_I+8*edx+edx]
74
        lea     ebp, [FONT_I+8*edx+edx]
75
;--------------------------------------
75
;--------------------------------------
76
align 4
76
align 4
77
.symloop1:
77
.symloop1:
78
        mov     dl, byte [ebp]
78
        mov     dl, byte [ebp]
79
        or      dl, 1 shl 6
79
        or      dl, 1 shl 6
80
;--------------------------------------
80
;--------------------------------------
81
align 4
81
align 4
82
.pixloop1:
82
.pixloop1:
83
        shr     dl, 1
83
        shr     dl, 1
84
        jz      .pixloop1end
84
        jz      .pixloop1end
85
 
85
 
86
        jnc     .nopix
86
        jnc     .nopix
87
 
87
 
88
        test    ecx, 0x08000000  ; redirect the output to the user area
88
        test    ecx, 0x08000000  ; redirect the output to the user area
89
        jz      @f
89
        jz      @f
90
 
90
 
91
        call    draw_text_to_user_area
91
        call    draw_text_to_user_area
92
        jmp     .pixloop1cont
92
        jmp     .pixloop1cont
93
;--------------------------------------
93
;--------------------------------------
94
align 4
94
align 4
95
@@:
95
@@:
96
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
96
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
97
;        call    [putpixel]
97
;        call    [putpixel]
98
        call    __sys_putpixel
98
        call    __sys_putpixel
99
        jmp     .pixloop1cont
99
        jmp     .pixloop1cont
100
;--------------------------------------
100
;--------------------------------------
101
align 4
101
align 4
102
.nopix:
102
.nopix:
103
        test    ecx, 0x40000000
103
        test    ecx, 0x40000000
104
        jz      .pixloop1cont
104
        jz      .pixloop1cont
105
 
105
 
106
        push    ecx
106
        push    ecx
107
        mov     ecx, [esp+4+20h+20h]
107
        mov     ecx, [esp+4+20h+20h]
108
 
108
 
109
        test    ecx, 0x08000000  ; redirect the output to the user area
109
        test    ecx, 0x08000000  ; redirect the output to the user area
110
        jz      @f
110
        jz      @f
111
 
111
 
112
        call    draw_text_to_user_area
112
        call    draw_text_to_user_area
113
        pop     ecx
113
        pop     ecx
114
        jmp     .pixloop1cont
114
        jmp     .pixloop1cont
115
;--------------------------------------
115
;--------------------------------------
116
align 4
116
align 4
117
@@:
117
@@:
118
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
118
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
119
;        call    [putpixel]
119
;        call    [putpixel]
120
        call    __sys_putpixel
120
        call    __sys_putpixel
121
        pop     ecx
121
        pop     ecx
122
;--------------------------------------
122
;--------------------------------------
123
align 4
123
align 4
124
.pixloop1cont:
124
.pixloop1cont:
125
        inc     eax
125
        inc     eax
126
        jmp     .pixloop1
126
        jmp     .pixloop1
127
;--------------------------------------
127
;--------------------------------------
128
align 4
128
align 4
129
.pixloop1end:
129
.pixloop1end:
130
        sub     eax, 6
130
        sub     eax, 6
131
        inc     ebx
131
        inc     ebx
132
        inc     ebp
132
        inc     ebp
133
        dec     esi
133
        dec     esi
134
        jnz     .symloop1
134
        jnz     .symloop1
135
 
135
 
136
        popad
136
        popad
137
        add     eax, 6
137
        add     eax, 6
138
        jmp     .loop
138
        jmp     .loop
139
;--------------------------------------
139
;--------------------------------------
140
align 4
140
align 4
141
.font2:
141
.font2:
142
        add     edx, edx
142
        add     edx, edx
143
        lea     ebp, [FONT_II+4*edx+edx+1]
143
        lea     ebp, [FONT_II+4*edx+edx+1]
144
        push    9
144
        push    9
145
        movzx   esi, byte [ebp-1]
145
        movzx   esi, byte [ebp-1]
146
;--------------------------------------
146
;--------------------------------------
147
align 4
147
align 4
148
.symloop2:
148
.symloop2:
149
        mov     dl, byte [ebp]
149
        mov     dl, byte [ebp]
150
        push    esi
150
        push    esi
151
;--------------------------------------
151
;--------------------------------------
152
align 4
152
align 4
153
.pixloop2:
153
.pixloop2:
154
        shr     dl, 1
154
        shr     dl, 1
155
        jnc     .nopix2
155
        jnc     .nopix2
156
 
156
 
157
        test    ecx, 0x08000000  ; redirect the output to the user area
157
        test    ecx, 0x08000000  ; redirect the output to the user area
158
        jz      @f
158
        jz      @f
159
 
159
 
160
        call    draw_text_to_user_area
160
        call    draw_text_to_user_area
161
        jmp     .pixloop2cont
161
        jmp     .pixloop2cont
162
;--------------------------------------
162
;--------------------------------------
163
align 4
163
align 4
164
@@:
164
@@:
165
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
165
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
166
;        call    [putpixel]
166
;        call    [putpixel]
167
        call    __sys_putpixel
167
        call    __sys_putpixel
168
        jmp     .pixloop2cont
168
        jmp     .pixloop2cont
169
;--------------------------------------
169
;--------------------------------------
170
align 4
170
align 4
171
.nopix2:
171
.nopix2:
172
        test    ecx, 0x40000000
172
        test    ecx, 0x40000000
173
        jz      .pixloop2cont
173
        jz      .pixloop2cont
174
 
174
 
175
        push    ecx
175
        push    ecx
176
        mov     ecx, [esp+12+20h+20h]
176
        mov     ecx, [esp+12+20h+20h]
177
 
177
 
178
        test    ecx, 0x08000000  ; redirect the output to the user area
178
        test    ecx, 0x08000000  ; redirect the output to the user area
179
        jz      @f
179
        jz      @f
180
 
180
 
181
        call    draw_text_to_user_area
181
        call    draw_text_to_user_area
182
        pop     ecx
182
        pop     ecx
183
        jmp     .pixloop2cont
183
        jmp     .pixloop2cont
184
;--------------------------------------
184
;--------------------------------------
185
align 4
185
align 4
186
@@:
186
@@:
187
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
187
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
188
;        call    [putpixel]
188
;        call    [putpixel]
189
        call    __sys_putpixel
189
        call    __sys_putpixel
190
        pop     ecx
190
        pop     ecx
191
;--------------------------------------
191
;--------------------------------------
192
align 4
192
align 4
193
.pixloop2cont:
193
.pixloop2cont:
194
        inc     eax
194
        inc     eax
195
        dec     esi
195
        dec     esi
196
        jnz     .pixloop2
196
        jnz     .pixloop2
197
 
197
 
198
        pop     esi
198
        pop     esi
199
        sub     eax, esi
199
        sub     eax, esi
200
        inc     ebx
200
        inc     ebx
201
        inc     ebp
201
        inc     ebp
202
        dec     dword [esp]
202
        dec     dword [esp]
203
        jnz     .symloop2
203
        jnz     .symloop2
204
 
204
 
205
        pop     eax
205
        pop     eax
206
        add     dword [esp+28], esi
206
        add     dword [esp+28], esi
207
        popad
207
        popad
208
        jmp     .loop
208
        jmp     .loop
209
;--------------------------------------
209
;--------------------------------------
210
align 4
210
align 4
211
.end:
211
.end:
212
        popad
212
        popad
213
        pop     eax
213
        pop     eax
214
        ret
214
        ret
215
;------------------------------------------------------------------------------
215
;------------------------------------------------------------------------------
216
; eax = x coordinate
216
; eax = x coordinate
217
; ebx = y coordinate
217
; ebx = y coordinate
218
; ecx = ?? RR GG BB
218
; ecx = ?? RR GG BB
219
; edi = user area
219
; edi = user area
220
align 4
220
align 4
221
draw_text_to_user_area:
221
draw_text_to_user_area:
222
        pushad
222
        pushad
223
        imul    ebx, [edi+0]
223
        imul    ebx, [edi+0]
224
        add     eax, ebx
224
        add     eax, ebx
225
        shl     eax, 2
225
        shl     eax, 2
226
        add     eax, edi
226
        add     eax, edi
227
        add     eax, 8
227
        add     eax, 8
228
        and     ecx, 0xffffff
228
        and     ecx, 0xffffff
229
        or      ecx, 0xff000000  ; not transparent
229
        or      ecx, 0xff000000  ; not transparent
230
        mov     [eax], ecx       ; store  pixel
230
        mov     [eax], ecx       ; store  pixel
231
        popad
231
        popad
232
        ret
232
        ret
233
;------------------------------------------------------------------------------
233
;------------------------------------------------------------------------------
234
align 4
234
align 4
235
FONT_I:
235
FONT_I:
236
  if lang eq sp
236
  if lang eq sp
237
  file 'char_sp.mt'
237
  file 'char_sp.mt'
238
  else
238
  else
239
  file 'char.mt'
239
  file 'char.mt'
240
  end if
240
  end if
241
;------------------------------------------------------------------------------
241
;------------------------------------------------------------------------------
242
align 4
242
align 4
243
FONT_II:
243
FONT_II:
244
  if lang eq sp
244
  if lang eq sp
245
  file 'char2_sp.mt'
245
  file 'char2_sp.mt'
246
  else
246
  else
247
  file 'char2.mt'
247
  file 'char2.mt'
248
  end if
248
  end if
249
;------------------------------------------------------------------------------
249
;------------------------------------------------------------------------------