Subversion Repositories Kolibri OS

Rev

Rev 6472 | Rev 6900 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2288 clevermous 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
5363 yogev_ezra 3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
2288 clevermous 4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
7
 
8
$Revision: 6899 $
9
 
2536 mario79 10
dtext:
5665 Pathoswith 11
; edx -> string
12
; esi = number of characters
13
; ebx = output coordinates XXXXYYYY h
14
; ecx = char color and flags flRRGGBB h
15
; fl = ZBFFRSSS b
16
; Z=1: edx -> zero terminated string, esi = ?
17
; B=1: fill background with color eax
18
; R=1: edi -> user area for redirect
5867 pathoswith 19
; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16
20
; FF=1: cp866 8x16, FF=0: cp866 6x9
5665 Pathoswith 21
; SSS = (font multiplier)-1
22
; edi=1: force output
23
        and     eax, 0xFFFFFF
24
        bt      ecx, 30
25
        jc      @f
2288 clevermous 26
        xor     eax, eax
5665 Pathoswith 27
        dec     eax
28
@@:
29
        pushd   0 0 0 eax
30
        movsx   eax, bx
31
        sar     ebx, 16
32
        push    eax ebx edi
33
        bt      ecx, 27
34
        jc      .redirect
35
        mov     ebp, [_display.width]
36
        xor     edi, edi
2288 clevermous 37
        jmp     @f
6899 pathoswith 38
 
5839 pathoswith 39
.ret:
40
        add     esp, 28
41
        ret
6899 pathoswith 42
 
5665 Pathoswith 43
.redirect:
44
        mov     ebp, [edi]
45
        add     edi, 8
2288 clevermous 46
@@:
5665 Pathoswith 47
        shl     ebp, 2
48
        imul    eax, ebp
49
        shl     ebx, 2
50
        add     eax, ebx
51
        js      .ret
5921 pathoswith 52
        add     edi, eax
5665 Pathoswith 53
        mov     eax, ecx
54
        mov     ebx, ecx
55
        test    ecx, ecx
56
        jns     @f
57
        mov     esi, 256
58
@@:
59
        shr     ecx, 24
60
        and     cl, 7
61
        inc     ecx
62
        push    ebp ecx esi
5921 pathoswith 63
        mov     esi, edx
5665 Pathoswith 64
        or      eax, 0xFF000000
65
        bt      ebx, 27
66
        jc      .bufferReady
67
        mov     eax, 9
5867 pathoswith 68
        test    ebx, 0x30000000
69
        jz      @f
5665 Pathoswith 70
        add     eax, 7
71
@@:
72
        imul    eax, ecx
73
        mov     [esp+32], eax
74
        imul    ebp, eax
75
        stdcall kernel_alloc, ebp
76
        mov     ecx, ebp
77
        shr     ecx, 2
78
        mov     [esp+36], eax
79
        sub     edi, eax
80
        mov     edx, eax
81
        mov     eax, [esp+24]
82
        cmp     eax, -1
5921 pathoswith 83
        jnz     @f
5665 Pathoswith 84
        mov     [esp+28], edi
5921 pathoswith 85
@@:
5665 Pathoswith 86
        mov     edi, edx
87
        rep stosd
88
        mov     edi, edx
89
        mov     eax, ebx
90
        and     eax, 0xFFFFFF
91
.bufferReady:
92
        mov     ebp, eax
6899 pathoswith 93
        mov     eax, [esp+8]
94
        shr     eax, 2
95
        sub     eax, [esp+16]
96
        shr     eax, 3
5665 Pathoswith 97
        xor     edx, edx
6899 pathoswith 98
        div     dword[esp+4]
99
        mov     ecx, [esp]
100
        cmp     eax, ecx
101
        jnc     @f
102
        mov     [esp], eax
103
@@:
104
        xor     edx, edx
5665 Pathoswith 105
        bt      ebx, 29
5867 pathoswith 106
        jc      @f
5665 Pathoswith 107
        bt      ebx, 28
5867 pathoswith 108
        jc      .draw866toUni
6899 pathoswith 109
        lea     eax, [eax*4+eax]
110
        shr     eax, 2
111
        inc     eax
112
        mov     [esp], ecx
113
        cmp     eax, ecx
114
        jnc     .draw866
115
        mov     [esp], eax
5867 pathoswith 116
        jmp     .draw866
6899 pathoswith 117
 
5867 pathoswith 118
@@:
119
        bt      ebx, 28
5665 Pathoswith 120
        jc      .drawUTF8
2536 mario79 121
 
5921 pathoswith 122
; ebp = font color
123
; esi -> string
124
; edi -> buffer
125
 
5839 pathoswith 126
; Stack map:
5665 Pathoswith 127
; char counter +0
128
fontMultiplier = 4
129
widthX = 8
130
; edi +12
131
; X +16
132
; Y +20
133
; background +24
134
deltaToScreen = 28
135
; temp buffer height +32
5839 pathoswith 136
; temp buffer pointer +36
2536 mario79 137
 
5665 Pathoswith 138
.drawUTF16:
139
        dec     dword [esp]
140
        js      .done
5921 pathoswith 141
        movzx   ebx, word [esi]
5665 Pathoswith 142
        test    ebx, ebx
143
        jz      .done
144
        inc     esi
145
        inc     esi
146
        cmp     bx, 1419
147
        jc      @f
148
        xor     ebx, ebx
2536 mario79 149
@@:
5665 Pathoswith 150
        pushd   esi edi 16
151
        shl     ebx, 4
152
        add     ebx, fontUni
153
        mov     esi, [esp+12+fontMultiplier]
154
        call    drawChar
155
        imul    esi, 8*4
156
        pop     edi
157
        pop     edi
158
        add     edi, esi
159
        pop     esi
160
        jmp     .drawUTF16
5839 pathoswith 161
 
5665 Pathoswith 162
.drawUTF8:
163
        dec     dword [esp]
164
        js      .done
6462 pathoswith 165
        xor     eax, eax
166
        call    utf8to16
6472 pathoswith 167
        test    eax, eax
5665 Pathoswith 168
        jz      .done
6462 pathoswith 169
        cmp     eax, 1419
170
        jc      @f
171
        xor     eax, eax
5665 Pathoswith 172
@@:
6462 pathoswith 173
        shl     eax, 4
174
        lea     ebx, [eax+fontUni]
5665 Pathoswith 175
        pushd   esi edi 16
176
        mov     esi, [esp+12+fontMultiplier]
177
        call    drawChar
178
        imul    esi, 8*4
179
        pop     edi
180
        pop     edi
181
        add     edi, esi
182
        pop     esi
183
        jmp     .drawUTF8
5839 pathoswith 184
 
5665 Pathoswith 185
.draw866:
186
        dec     dword [esp]
187
        js      .done
5921 pathoswith 188
        movzx   ebx, byte [esi]
5665 Pathoswith 189
        test    ebx, ebx
190
        jz      .done
191
        inc     esi
192
        pushd   esi edi 9
193
        lea     ebx, [ebx*8+ebx+font1]
194
        mov     esi, [esp+12+fontMultiplier]
195
        call    drawChar
196
        imul    esi, 6*4
197
        pop     edi
198
        pop     edi
199
        add     edi, esi
200
        pop     esi
201
        jmp     .draw866
5839 pathoswith 202
 
5867 pathoswith 203
.draw866toUni:
204
        dec     dword [esp]
205
        js      .done
5921 pathoswith 206
        movzx   eax, byte [esi]
5867 pathoswith 207
        test    eax, eax
208
        jz      .done
209
        call    ansi2uni_char
210
        shl     eax, 4
211
        lea     ebx, [eax+fontUni]
212
        inc     esi
213
        pushd   esi edi 16
214
        mov     esi, [esp+12+fontMultiplier]
215
        call    drawChar
216
        imul    esi, 8*4
217
        pop     edi
218
        pop     edi
219
        add     edi, esi
220
        pop     esi
221
        jmp     .draw866toUni
222
 
5665 Pathoswith 223
.done: