Subversion Repositories Kolibri OS

Rev

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

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