Subversion Repositories Kolibri OS

Rev

Rev 5565 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5565 Rev 5984
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. 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
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line -...
8
$Revision: 5565 $
-
 
9
 
-
 
10
;------------------------------------------------------------------------------
-
 
11
align 4
-
 
12
dtext_asciiz_esi:                          ; for skins title out
-
 
13
        push    eax
-
 
14
        xor     eax, eax
-
 
15
        inc     eax
-
 
16
        jmp     dtext.1
-
 
17
;------------------------------------------------------------------------------
8
$Revision: 5984 $
18
align 4
9
 
-
 
10
dtext:
19
dtext:
11
; edx -> string
20
; ebx x & y
12
; esi = number of characters
21
; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB )
13
; ebx = output coordinates XXXXYYYY h
22
; X = ABnnb:
14
; ecx = char color and flags flRRGGBB h
23
; nn = font
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
-
 
19
; FF=3: UTF-8 8x16, FF=2: UTF-16LE 8x16
24
; A = 0 <=> output esi characters; otherwise output ASCIIZ string
20
; FF=1: cp866 8x16, FF=0: cp866 6x9
25
; B = 1 <=> fill background with color eax
21
; SSS = (font multiplier)-1
-
 
22
; edi=1: force output
26
; edx start of text
23
        and     eax, 0xFFFFFF
27
; edi 1 force or user area for redirect
24
        bt      ecx, 30
28
        push    eax
-
 
29
        xor     eax, eax
25
        jc      @f
30
;--------------------------------------
26
        xor     eax, eax
31
align 4
27
        dec     eax
32
.1:
28
@@:
33
        pushad
-
 
34
        movsx   eax, bx         ; eax=y
-
 
35
        sar     ebx, 16         ; ebx=x
29
        pushd   0 0 0 eax
36
        xchg    eax, ebx        ; eax=x, ebx=y
30
        movsx   eax, bx
37
        cmp     esi, 255
-
 
38
        jb      .loop
31
        sar     ebx, 16
39
 
-
 
40
        mov     esi, 255
-
 
41
;--------------------------------------
-
 
42
align 4
32
        push    eax ebx edi
43
.loop:
33
        bt      ecx, 27
44
        test    ecx, ecx
-
 
45
        js      .test_asciiz
34
        jc      .redirect
46
 
-
 
47
        dec     esi
-
 
48
        js      .end
35
        mov     ebp, [_display.width]
-
 
36
        xor     edi, edi
49
 
37
        jmp     @f
50
        jmp     @f
38
.ret:
51
;--------------------------------------
39
        add     esp, 28
52
align 4
40
        ret
53
.test_asciiz:
41
.redirect:
54
        cmp     byte [edx], 0
42
        mov     ebp, [edi]
55
        jz      .end
43
        add     edi, 8
-
 
44
@@:
-
 
45
        shl     ebp, 2
-
 
46
        imul    eax, ebp
-
 
47
        shl     ebx, 2
-
 
48
        add     eax, ebx
-
 
49
        js      .ret
-
 
50
        add     edi, eax
-
 
51
        mov     eax, ecx
56
 
52
        mov     ebx, ecx
-
 
53
        test    ecx, ecx
57
        cmp     byte [esp+28], 1
54
        jns     @f
-
 
55
        mov     esi, 256
-
 
56
@@:
58
        jne     @f
57
        shr     ecx, 24
-
 
58
        and     cl, 7
-
 
59
        inc     ecx
-
 
60
        push    ebp ecx esi
59
 
61
        mov     esi, edx
-
 
62
        or      eax, 0xFF000000
-
 
63
        bt      ebx, 27
60
        dec     esi
64
        jc      .bufferReady
61
        js      .end
65
        mov     eax, 9
-
 
66
        test    ebx, 0x30000000
62
;--------------------------------------
67
        jz      @f
-
 
68
        add     eax, 7
-
 
69
@@:
-
 
70
        imul    eax, ecx
-
 
71
        mov     [esp+32], eax
-
 
72
        imul    ebp, eax
63
align 4
73
        stdcall kernel_alloc, ebp
-
 
74
        mov     ecx, ebp
64
@@:
75
        shr     ecx, 2
65
        inc     edx
76
        mov     [esp+36], eax
66
        pushad
77
        sub     edi, eax
-
 
78
        mov     edx, eax
67
        movzx   edx, byte [edx-1]
79
        mov     eax, [esp+24]
-
 
80
        cmp     eax, -1
68
        test    ecx, 0x10000000
81
        jnz     @f
69
        jnz     .font2
82
        mov     [esp+28], edi
-
 
83
@@:
70
 
84
        mov     edi, edx
71
        mov     esi, 9
85
        rep stosd
72
        lea     ebp, [FONT_I+8*edx+edx]
86
        mov     edi, edx
73
;--------------------------------------
87
        mov     eax, ebx
74
align 4
88
        and     eax, 0xFFFFFF
75
.symloop1:
89
.bufferReady:
76
        mov     dl, byte [ebp]
90
        mov     ebp, eax
77
        or      dl, 1 shl 6
91
        xor     edx, edx
-
 
92
        bt      ebx, 29
-
 
93
        jc      @f
-
 
94
        bt      ebx, 28
78
;--------------------------------------
95
        jc      .draw866toUni
79
align 4
96
        jmp     .draw866
80
.pixloop1:
97
@@:
Line 81... Line 98...
81
        shr     dl, 1
98
        bt      ebx, 28
-
 
99
        jc      .drawUTF8
-
 
100
 
-
 
101
; ebp = font color
-
 
102
; esi -> string
-
 
103
; edi -> buffer
-
 
104
 
-
 
105
; Stack map:
-
 
106
; char counter +0
-
 
107
fontMultiplier = 4
-
 
108
widthX = 8
-
 
109
; edi +12
-
 
110
; X +16
-
 
111
; Y +20
-
 
112
; background +24
Line -... Line 113...
-
 
113
deltaToScreen = 28
-
 
114
; temp buffer height +32
-
 
115
; temp buffer pointer +36
82
        jz      .pixloop1end
116
 
-
 
117
.drawUTF16:
-
 
118
        dec     dword [esp]
-
 
119
        js      .done
-
 
120
        movzx   ebx, word [esi]
-
 
121
        test    ebx, ebx
83
 
122
        jz      .done
-
 
123
        inc     esi
-
 
124
        inc     esi
-
 
125
        cmp     bx, 1419
-
 
126
        jc      @f
-
 
127
        xor     ebx, ebx
-
 
128
@@:
-
 
129
        pushd   esi edi 16
-
 
130
        shl     ebx, 4
-
 
131
        add     ebx, fontUni
-
 
132
        mov     esi, [esp+12+fontMultiplier]
-
 
133
        call    drawChar
-
 
134
        imul    esi, 8*4
-
 
135
        pop     edi
Line -... Line 136...
-
 
136
        pop     edi
84
        jnc     .nopix
137
        add     edi, esi
85
 
138
        pop     esi
86
        test    ecx, 0x08000000  ; redirect the output to the user area
-
 
87
        jz      @f
-
 
88
 
139
        jmp     .drawUTF16
89
        call    draw_text_to_user_area
140
 
-
 
141
.drawUTF8:
-
 
142
        dec     dword [esp]
-
 
143
        js      .done
-
 
144
@@:
-
 
145
        movzx   ebx, byte [esi]
-
 
146
        inc     esi
90
        jmp     .pixloop1cont
147
        test    bl, bl
-
 
148
        jz      .done
-
 
149
        jns     .valid
-
 
150
        shl     bx, 10
-
 
151
        jnc     @b
-
 
152
        mov     bl, [esi]
-
 
153
        test    bl, bl
91
;--------------------------------------
154
        jns     @b
92
align 4
155
        shl     bl, 2
93
@@:
156
        jc      @b
-
 
157
        shr     bh, 2
-
 
158
        shr     bx, 2
94
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
159
        inc     esi
-
 
160
        cmp     bx, 1419
-
 
161
        jc      .valid
-
 
162
        shl     bh, 4
-
 
163
        jns     @f
-
 
164
.tail:
-
 
165
        mov     bl, [esi]
-
 
166
        shl     bl, 1
-
 
167
        jnc     @b
-
 
168
        js      @b
95
;        call    [putpixel]
169
        inc     esi
-
 
170
        shl     bh, 1
96
        call    __sys_putpixel
171
        js      .tail
97
        jmp     .pixloop1cont
172
@@:
-
 
173
        xor     ebx, ebx
-
 
174
.valid:
-
 
175
        pushd   esi edi 16
-
 
176
        shl     ebx, 4
-
 
177
        add     ebx, fontUni
-
 
178
        mov     esi, [esp+12+fontMultiplier]
-
 
179
        call    drawChar
-
 
180
        imul    esi, 8*4
Line -... Line 181...
-
 
181
        pop     edi
-
 
182
        pop     edi
-
 
183
        add     edi, esi
-
 
184
        pop     esi
-
 
185
        jmp     .drawUTF8
-
 
186
 
98
;--------------------------------------
187
.draw866:
-
 
188
        dec     dword [esp]
99
align 4
189
        js      .done
-
 
190
        movzx   ebx, byte [esi]
-
 
191
        test    ebx, ebx
-
 
192
        jz      .done
-
 
193
        inc     esi
-
 
194
        pushd   esi edi 9
-
 
195
        lea     ebx, [ebx*8+ebx+font1]
-
 
196
        mov     esi, [esp+12+fontMultiplier]
-
 
197
        call    drawChar
Line -... Line 198...
-
 
198
        imul    esi, 6*4
-
 
199
        pop     edi
-
 
200
        pop     edi
-
 
201
        add     edi, esi
-
 
202
        pop     esi
-
 
203
        jmp     .draw866
-
 
204
 
-
 
205
.draw866toUni:
-
 
206
        dec     dword [esp]
-
 
207
        js      .done
-
 
208
        movzx   eax, byte [esi]
100
.nopix:
209
        test    eax, eax
-
 
210
        jz      .done
-
 
211
        call    ansi2uni_char
-
 
212
        shl     eax, 4
-
 
213
        lea     ebx, [eax+fontUni]
-
 
214
        inc     esi
101
        test    ecx, 0x40000000
215
        pushd   esi edi 16
-
 
216
        mov     esi, [esp+12+fontMultiplier]
Line -... Line 217...
-
 
217
        call    drawChar
-
 
218
        imul    esi, 8*4
-
 
219
        pop     edi
102
        jz      .pixloop1cont
220
        pop     edi
-
 
221
        add     edi, esi
-
 
222
        pop     esi
103
 
223
        jmp     .draw866toUni
-
 
224
 
-
 
225
.done:
-
 
226
        mov     ecx, edi
104
        push    ecx
227
        pop     eax eax eax esi edx ebx ebp ebp ebp
-
 
228
        mov     edi, [esp]
105
        mov     ecx, [esp+4+20h+20h]
229
        test    edi, edi
-
 
230
        jnz     @f
-
 
231
        pop     eax
-
 
232
        ret
106
 
233
@@:         ; redraw from buffer to screen
-
 
234
        push    eax
-
 
235
        sub     ecx, edi
107
        test    ecx, 0x08000000  ; redirect the output to the user area
236
        shr     ecx, 2
-
 
237
        add     edx, ecx
-
 
238
        inc     ecx
-
 
239
        push    ecx
108
        jz      @f
240
        push    edi
109
 
241
.drawPicture:
110
        call    draw_text_to_user_area
242
        mov     eax, -1
-
 
243
        repz scasd
111
        pop     ecx
244
        jcxz    @f
112
        jmp     .pixloop1cont
245
        mov     eax, edx
113
;--------------------------------------
246
        sub     eax, ecx
114
align 4
-
 
115
@@:
247
        push    ecx
116
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
248
        mov     ecx, [edi-4]
117
;        call    [putpixel]
-
 
118
        call    __sys_putpixel
-
 
119
        pop     ecx
-
 
120
;--------------------------------------
249
        xchg    esi, edi
121
align 4
250
        call    __sys_putpixel
122
.pixloop1cont:
251
        xchg    esi, edi
123
        inc     eax
252
        pop     ecx
124
        jmp     .pixloop1
253
        jmp     .drawPicture
125
;--------------------------------------
-
 
126
align 4
-
 
127
.pixloop1end:
254
@@:
128
        sub     eax, 6
-
 
129
        inc     ebx
-
 
130
        inc     ebp
-
 
131
        dec     esi
-
 
132
        jnz     .symloop1
255
        pop     edi
133
 
-
 
134
        popad
256
        mov     ecx, [esp]
135
        add     eax, 6
-
 
136
        jmp     .loop
-
 
137
;--------------------------------------
-
 
138
align 4
-
 
139
.font2:
-
 
140
        add     edx, edx
-
 
141
        lea     ebp, [FONT_II+4*edx+edx+1]
-
 
142
        push    9
-
 
143
        movzx   esi, byte [ebp-1]
-
 
144
;--------------------------------------
-
 
145
align 4
-
 
Line -... Line 257...
-
 
257
        add     edi, [esp+4]
-
 
258
        inc     ebx
-
 
259
        push    edi
-
 
260
        dec     ebp
-
 
261
        jnz     .drawPicture
-
 
262
        add     esp, 12
-
 
263
        call    kernel_free
-
 
264
        ret
-
 
265
 
-
 
266
; scaling/smoothing algorithm
-
 
267
drawChar:
-
 
268
; ebp = font color
-
 
269
; esi = font multiplier
-
 
270
; edi -> buffer
-
 
271
; ebx -> char data
-
 
272
        mov     dl, [ebx]
-
 
273
.raw:
-
 
274
        bsf     eax, edx
-
 
275
        jz      .nextRaw
-
 
276
        imul    eax, esi
-
 
277
        shl     eax, 2
-
 
278
        push    edi
-
 
279
        add     edi, eax
-
 
280
        mov     ecx, esi
-
 
281
        dec     esi
-
 
282
        jnz     .square
-
 
283
        mov     [edi], ebp
-
 
284
        inc     esi
-
 
285
        cmp     [fontSmoothing], 0
-
 
286
        jz      .nextPixel
-
 
287
.checkLeftSM:     ; smoothing
-
 
288
        bsf     eax, edx
-
 
289
        dec     eax
-
 
290
        js      .checkRightSM
-
 
291
        bt      [ebx], eax
-
 
292
        jc      .checkRightSM
-
 
293
        dec     eax
-
 
294
        js      .checkLeftDownSM
-
 
295
        bt      [ebx], eax
-
 
296
        jc      .checkRightSM
-
 
297
.checkLeftDownSM:
-
 
298
        inc     eax
-
 
299
        bt      [ebx+1], eax
-
 
300
        jnc     .checkLeftUpSM
-
 
301
        inc     eax
-
 
302
        bt      [ebx+1], eax
-
 
303
        jnc     @f
-
 
304
        bt      [ebx-1], eax
-
 
305
        jc      .checkRightSM
-
 
306
        dec     eax
-
 
307
        dec     eax
-
 
308
        js      @f
-
 
309
        bt      [ebx+1], eax
-
 
310
        jnc     @f
-
 
311
        inc     eax
-
 
312
.checkLeftUpSM:
-
 
313
        bt      [ebx-1], eax
-
 
314
        jnc     .checkRightSM
-
 
315
        inc     eax
-
 
316
        bt      [ebx-1], eax
146
.symloop2:
317
        jnc     @f
-
 
318
        bt      [ebx+1], eax
-
 
319
        jc      .checkRightSM
147
        mov     dl, byte [ebp]
320
        dec     eax
-
 
321
        dec     eax
-
 
322
        js      @f
-
 
323
        bt      [ebx-1], eax
-
 
324
        jc      .checkRightSM
-
 
325
@@:
-
 
326
        mov     ecx, [esp+20+deltaToScreen]
-
 
327
        mov     eax, [edi-4]
-
 
328
        test    ecx, ecx
-
 
329
        jz      @f
-
 
330
        pusha
-
 
331
        lea     ebx, [edi+ecx-4]
-
 
332
        shr     ebx, 2
-
 
333
        call    syscall_getpixel
-
 
334
        popa
-
 
335
@@:
-
 
336
        push    ebx edx
-
 
337
        mov     ebx, ebp
-
 
338
        xor     ecx, ecx
-
 
339
        cmp     [fontSmoothing], 1
-
 
340
        jnz     .subpixelLeft
-
 
341
        call    antiAliasing
-
 
342
        jmp     @f
-
 
343
.subpixelLeft:
-
 
344
        mov     cl, bl
-
 
345
        lea     edx, [ecx*8+ecx]
-
 
346
        lea     edx, [ecx*2+edx]
-
 
347
        mov     cl, al
-
 
348
        lea     ecx, [ecx*4+ecx]
-
 
349
        add     edx, ecx
-
 
350
        shr     edx, 4
-
 
351
        mov     al, dl
-
 
352
 
-
 
353
        xor     ecx, ecx
-
 
354
        mov     cl, ah
-
 
355
        lea     edx, [ecx*8+ecx]
-
 
356
        lea     edx, [ecx*2+edx]
-
 
357
        mov     cl, bh
-
 
358
        lea     ecx, [ecx*4+ecx]
-
 
359
        add     edx, ecx
-
 
360
        shr     edx, 4
-
 
361
        mov     ah, dl
-
 
362
 
-
 
363
        rol     eax, 16
-
 
364
        rol     ebx, 16
-
 
365
        xor     ecx, ecx
-
 
366
        mov     cl, al
-
 
367
        mov     edx, ecx
-
 
368
        shl     ecx, 3
-
 
369
        sub     ecx, edx
-
 
370
        mov     dl, bl
-
 
371
        add     ecx, edx
-
 
372
        shr     ecx, 3
-
 
373
        mov     al, cl
-
 
374
        rol     eax, 16
-
 
375
@@:
-
 
376
        mov     [edi-4], eax
-
 
377
        pop     edx ebx
-
 
378
.checkRightSM:
-
 
379
        bsf     eax, edx
-
 
380
        inc     eax
-
 
381
        bt      [ebx], eax
-
 
382
        jc      .nextPixel
-
 
383
        inc     eax
-
 
384
        bt      [ebx], eax
-
 
385
        jc      .nextPixel
-
 
386
        dec     eax
-
 
387
.checkRightDownSM:
-
 
388
        bt      [ebx+1], eax
-
 
389
        jnc     .checkRightUpSM
-
 
390
        dec     eax
-
 
391
        bt      [ebx+1], eax
-
 
392
        jnc     @f
-
 
393
        bt      [ebx-1], eax
-
 
394
        jc      .nextPixel
-
 
395
        inc     eax
-
 
396
        inc     eax
-
 
397
        bt      [ebx+1], eax
-
 
398
        jnc     @f
-
 
399
        dec     eax
-
 
400
.checkRightUpSM:
-
 
401
        bt      [ebx-1], eax
-
 
402
        jnc     .nextPixel
-
 
403
        dec     eax
-
 
404
        bt      [ebx-1], eax
-
 
405
        jnc     @f
-
 
406
        bt      [ebx+1], eax
-
 
407
        jc      .nextPixel
-
 
408
        inc     eax
-
 
409
        inc     eax
-
 
410
        bt      [ebx-1], eax
-
 
411
        jc      .nextPixel
-
 
412
@@:
-
 
413
        mov     ecx, [esp+20+deltaToScreen]
-
 
414
        mov     eax, [edi+4]
-
 
415
        test    ecx, ecx
-
 
416
        jz      @f
-
 
417
        pusha
-
 
418
        lea     ebx, [edi+ecx+4]
-
 
419
        shr     ebx, 2
-
 
420
        call    syscall_getpixel
-
 
421
        popa
-
 
422
@@:
-
 
423
        push    ebx edx
-
 
424
        mov     ebx, ebp
-
 
425
        xor     ecx, ecx
-
 
426
        cmp     [fontSmoothing], 1
-
 
427
        jnz     .subpixelRight
-
 
428
        call    antiAliasing
-
 
429
        jmp     @f
-
 
430
.subpixelRight:
-
 
431
        mov     cl, al
-
 
432
        mov     edx, ecx
-
 
433
        shl     ecx, 3
-
 
434
        sub     ecx, edx
-
 
435
        mov     dl, bl
-
 
436
        add     ecx, edx
-
 
437
        shr     ecx, 3
-
 
438
        mov     al, cl
-
 
439
 
-
 
440
        xor     ecx, ecx
-
 
441
        mov     cl, ah
-
 
442
        lea     edx, [ecx*8+ecx]
-
 
443
        lea     edx, [ecx*2+edx]
-
 
444
        mov     cl, bh
-
 
445
        lea     ecx, [ecx*4+ecx]
-
 
446
        add     edx, ecx
-
 
447
        shr     edx, 4
-
 
448
        mov     ah, dl
-
 
449
 
-
 
450
        rol     ebx, 16
-
 
451
        rol     eax, 16
-
 
452
        xor     ecx, ecx
-
 
453
        mov     cl, bl
-
 
454
        lea     edx, [ecx*8+ecx]
-
 
455
        lea     edx, [ecx*2+edx]
-
 
456
        mov     cl, al
Line 148... Line 457...
148
        push    esi
457
        lea     ecx, [ecx*4+ecx]
149
;--------------------------------------
458
        add     edx, ecx
150
align 4
-
 
151
.pixloop2:
-
 
152
        shr     dl, 1
459
        shr     edx, 4
-
 
460
        mov     al, dl
-
 
461
        rol     eax, 16
-
 
462
@@:
153
        jnc     .nopix2
463
        mov     [edi+4], eax
154
 
464
        pop     edx ebx
155
        test    ecx, 0x08000000  ; redirect the output to the user area
465
        jmp     .nextPixel
156
        jz      @f
466
 
157
 
467
.square:    ; scaling
158
        call    draw_text_to_user_area
468
        mov     eax, esi
-
 
469
@@:
-
 
470
        mov     [edi+eax*4], ebp
-
 
471
        dec     eax
-
 
472
        jns     @b
-
 
473
        add     edi, [esp+20+widthX]
159
        jmp     .pixloop2cont
474
        dec     ecx
-
 
475
        jnz     .square
-
 
476
        inc     esi
160
;--------------------------------------
477
        mov     edi, [esp]
-
 
478
.checkLeft:
-
 
479
        bsf     eax, edx
-
 
480
        dec     eax
-
 
481
        js      .checkRight
-
 
482
        bt      [ebx], eax
-
 
483
        jc      .checkRight
-
 
484
.checkLeftDown:
-
 
485
        bt      [ebx+1], eax
-
 
486
        jnc     .checkLeftUp
-
 
487
        mov     ecx, eax
-
 
488
        inc     eax
-
 
489
        bt      [ebx+1], eax
-
 
490
        jc      @f
161
align 4
491
        bt      [ebx-1], eax
-
 
492
        jnc     .downRightLow
Line -... Line 493...
-
 
493
        bt      [ebx-2], eax
-
 
494
        jc      .downRightLow
-
 
495
        dec     eax
-
 
496
        bt      [ebx-1], eax
-
 
497
        jc      .downRightLow
-
 
498
        dec     eax
-
 
499
        js      .downRightHigh
-
 
500
        bt      [ebx-2], eax
-
 
501
        jc      .downRightLow
-
 
502
        jmp     .downRightHigh
-
 
503
 
-
 
504
@@:
-
 
505
        bt      [ebx-1], eax
-
 
506
        jc      .checkLeftUp
-
 
507
        dec     eax
-
 
508
        dec     eax
-
 
509
        js      .downRightLow
-
 
510
        bt      [ebx+1], eax
162
@@:
511
        jc      .checkLeftUp
-
 
512
.downRightLow:
-
 
513
        imul    ecx, esi
-
 
514
        shl     ecx, 2
-
 
515
        add     edi, ecx
-
 
516
        dec     esi
-
 
517
        mov     eax, [esp+20+widthX]
-
 
518
        imul    eax, esi
-
 
519
        add     edi, eax
-
 
520
        add     edi, 4
-
 
521
        mov     ecx, esi
-
 
522
        dec     ecx
-
 
523
.drawDownRight:
-
 
524
        mov     eax, ecx
-
 
525
@@:
-
 
526
        mov     [edi+eax*4], ebp
-
 
527
        dec     eax
-
 
528
        jns     @b
-
 
529
        sub     edi, [esp+20+widthX]
-
 
530
        add     edi, 4
163
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
531
        dec     ecx
-
 
532
        jns     .drawDownRight
-
 
533
        inc     esi
-
 
534
        mov     edi, [esp]
-
 
535
        jmp     .checkLeftUp
-
 
536
 
-
 
537
.downRightHigh:
-
 
538
        imul    ecx, esi
-
 
539
        shl     ecx, 2
-
 
540
        add     edi, ecx
-
 
541
        dec     esi
-
 
542
        mov     eax, [esp+20+widthX]
-
 
543
        imul    eax, esi
-
 
544
        add     edi, eax
-
 
545
        add     edi, 4
-
 
546
        mov     ecx, esi
-
 
547
        dec     ecx
-
 
548
.drawDownRightHigh:
-
 
549
        mov     eax, ecx
-
 
550
@@:
-
 
551
        mov     [edi+eax*4], ebp
-
 
552
        dec     eax
-
 
553
        jns     @b
-
 
554
        sub     edi, [esp+20+widthX]
-
 
555
        mov     eax, ecx
-
 
556
@@:
-
 
557
        mov     [edi+eax*4], ebp
-
 
558
        dec     eax
-
 
559
        jns     @b
-
 
560
        sub     edi, [esp+20+widthX]
-
 
561
        add     edi, 4
-
 
562
        dec     ecx
-
 
563
        jns     .drawDownRightHigh
-
 
564
        inc     esi
-
 
565
        mov     edi, [esp]
-
 
566
.checkLeftUp:
-
 
567
        bsf     eax, edx
-
 
568
        dec     eax
-
 
569
        bt      [ebx-1], eax
-
 
570
        jnc     .checkRight
-
 
571
        mov     ecx, eax
-
 
572
        inc     eax
-
 
573
        bt      [ebx-1], eax
-
 
574
        jc      @f
-
 
575
        bt      [ebx+1], eax
Line -... Line 576...
-
 
576
        jnc     .upRightLow
-
 
577
        bt      [ebx+2], eax
-
 
578
        jc      .upRightLow
-
 
579
        dec     eax
-
 
580
        bt      [ebx+1], eax
-
 
581
        jc      .upRightLow
-
 
582
        dec     eax
-
 
583
        js      .upRightHigh
-
 
584
        bt      [ebx+2], eax
-
 
585
        jc      .upRightLow
-
 
586
        jmp     .upRightHigh
-
 
587
 
-
 
588
@@:
-
 
589
        bt      [ebx+1], eax
-
 
590
        jc      .checkRight
-
 
591
        dec     eax
-
 
592
        dec     eax
-
 
593
        js      .upRightLow
-
 
594
        bt      [ebx-1], eax
-
 
595
        jc      .checkRight
-
 
596
.upRightLow:
-
 
597
        imul    ecx, esi
-
 
598
        shl     ecx, 2
-
 
599
        add     edi, ecx
-
 
600
        add     edi, 4
-
 
601
        mov     ecx, esi
-
 
602
        dec     ecx
-
 
603
        dec     ecx
-
 
604
.drawUpRight:
-
 
605
        mov     eax, ecx
-
 
606
@@:
-
 
607
        mov     [edi+eax*4], ebp
-
 
608
        dec     eax
-
 
609
        jns     @b
-
 
610
        add     edi, [esp+20+widthX]
-
 
611
        add     edi, 4
-
 
612
        dec     ecx
-
 
613
        jns     .drawUpRight
-
 
614
        mov     edi, [esp]
-
 
615
        jmp     .checkRight
-
 
616
 
-
 
617
.upRightHigh:
-
 
618
        imul    ecx, esi
-
 
619
        shl     ecx, 2
-
 
620
        add     edi, ecx
-
 
621
        add     edi, 4
-
 
622
        mov     ecx, esi
-
 
623
        dec     ecx
-
 
624
        dec     ecx
164
;        call    [putpixel]
625
.drawUpRightHigh:
-
 
626
        mov     eax, ecx
-
 
627
@@:
-
 
628
        mov     [edi+eax*4], ebp
-
 
629
        dec     eax
-
 
630
        jns     @b
-
 
631
        add     edi, [esp+20+widthX]
-
 
632
        mov     eax, ecx
-
 
633
@@:
-
 
634
        mov     [edi+eax*4], ebp
-
 
635
        dec     eax
-
 
636
        jns     @b
-
 
637
        add     edi, [esp+20+widthX]
-
 
638
        add     edi, 4
-
 
639
        dec     ecx
-
 
640
        jns     .drawUpRightHigh
165
        call    __sys_putpixel
641
        mov     edi, [esp]
-
 
642
.checkRight:
-
 
643
        bsf     eax, edx
-
 
644
        inc     eax
-
 
645
        bt      [ebx], eax
-
 
646
        jc      .nextPixel
-
 
647
.checkRightDown:
-
 
648
        bt      [ebx+1], eax
-
 
649
        jnc     .checkRightUp
-
 
650
        mov     ecx, eax
-
 
651
        dec     eax
-
 
652
        bt      [ebx+1], eax
Line 166... Line -...
166
        jmp     .pixloop2cont
-
 
167
;--------------------------------------
-
 
168
align 4
-
 
169
.nopix2:
-
 
170
        test    ecx, 0x40000000
-
 
171
        jz      .pixloop2cont
653
        jc      @f
172
 
-
 
173
        push    ecx
654
        bt      [ebx-1], eax
174
        mov     ecx, [esp+12+20h+20h]
-
 
175
 
655
        jnc     .downLeftLow
176
        test    ecx, 0x08000000  ; redirect the output to the user area
-
 
177
        jz      @f
-
 
178
 
-
 
179
        call    draw_text_to_user_area
656
        bt      [ebx-2], eax
-
 
657
        jc      .downLeftLow
-
 
658
        inc     eax
-
 
659
        bt      [ebx-1], eax
-
 
660
        jc      .downLeftLow
-
 
661
        inc     eax
-
 
662
        bt      [ebx-2], eax
-
 
663
        jc      .downLeftLow
-
 
664
        jmp     .downLeftHigh
-
 
665
 
-
 
666
@@:
-
 
667
        bt      [ebx-1], eax
-
 
668
        jc      .checkRightUp
-
 
669
        inc     eax
-
 
670
        inc     eax
-
 
671
        bt      [ebx+1], eax
-
 
672
        jc      .checkRightUp
-
 
673
.downLeftLow:
-
 
674
        imul    ecx, esi
-
 
675
        shl     ecx, 2
-
 
676
        add     edi, ecx
-
 
677
        dec     esi
-
 
678
        mov     eax, [esp+20+widthX]
-
 
679
        imul    eax, esi
-
 
680
        add     edi, eax
-
 
681
        mov     ecx, esi
-
 
682
        dec     ecx
-
 
683
.drawDownLeft:
-
 
684
        mov     eax, ecx
-
 
685
@@:
-
 
686
        mov     [edi+eax*4], ebp
180
        pop     ecx
687
        dec     eax
-
 
688
        jns     @b
-
 
689
        sub     edi, [esp+20+widthX]
-
 
690
        dec     ecx
-
 
691
        jns     .drawDownLeft
-
 
692
        inc     esi
-
 
693
        mov     edi, [esp]
-
 
694
        jmp     .checkRightUp
-
 
695
 
-
 
696
.downLeftHigh:
-
 
697
        imul    ecx, esi
-
 
698
        shl     ecx, 2
-
 
699
        add     edi, ecx
-
 
700
        dec     esi
-
 
701
        mov     eax, [esp+20+widthX]
-
 
702
        imul    eax, esi
-
 
703
        add     edi, eax
-
 
704
        mov     ecx, esi
-
 
705
        dec     ecx
-
 
706
.drawDownLeftHigh:
-
 
707
        mov     eax, ecx
-
 
708
@@:
-
 
709
        mov     [edi+eax*4], ebp
-
 
710
        dec     eax
-
 
711
        jns     @b
-
 
712
        sub     edi, [esp+20+widthX]
-
 
713
        mov     eax, ecx
-
 
714
@@:
-
 
715
        mov     [edi+eax*4], ebp
-
 
716
        dec     eax
-
 
717
        jns     @b
-
 
718
        sub     edi, [esp+20+widthX]
-
 
719
        dec     ecx
181
        jmp     .pixloop2cont
720
        jns     .drawDownLeftHigh
-
 
721
        inc     esi
-
 
722
        mov     edi, [esp]
-
 
723
.checkRightUp:
-
 
724
        bsf     eax, edx
-
 
725
        inc     eax
-
 
726
        bt      [ebx-1], eax
-
 
727
        jnc     .nextPixel
-
 
728
        mov     ecx, eax
-
 
729
        dec     eax
Line -... Line 730...
-
 
730
        bt      [ebx-1], eax
-
 
731
        jc      @f
-
 
732
        bt      [ebx+1], eax
182
;--------------------------------------
733
        jnc     .upLeftLow
-
 
734
        bt      [ebx+2], eax
-
 
735
        jc      .upLeftLow
-
 
736
        inc     eax
-
 
737
        bt      [ebx+1], eax
-
 
738
        jc      .upLeftLow
-
 
739
        inc     eax
-
 
740
        bt      [ebx+2], eax
183
align 4
741
        jc      .upLeftLow
184
@@:
742
        jmp     .upLeftHigh
-
 
743
 
-
 
744
@@:
-
 
745
        bt      [ebx+1], eax
-
 
746
        jc      .nextPixel
-
 
747
        inc     eax
185
        and     ecx, 0xFBFFFFFF  ;negate 0x04000000 save to mouseunder area
748
        inc     eax
-
 
749
        bt      [ebx-1], eax
-
 
750
        jc      .nextPixel
186
;        call    [putpixel]
751
.upLeftLow:
187
        call    __sys_putpixel
752
        imul    ecx, esi
-
 
753
        shl     ecx, 2
-
 
754
        add     edi, ecx
-
 
755
        mov     ecx, esi
-
 
756
        dec     ecx
-
 
757
        dec     ecx
-
 
758
.drawUpLeft:
-
 
759
        mov     eax, ecx
-
 
760
@@:
-
 
761
        mov     [edi+eax*4], ebp
-
 
762
        dec     eax
-
 
763
        jns     @b
-
 
764
        add     edi, [esp+20+widthX]
-
 
765
        dec     ecx
-
 
766
        jns     .drawUpLeft
-
 
767
        jmp     .nextPixel
-
 
768
 
-
 
769
.upLeftHigh:
-
 
770
        imul    ecx, esi
-
 
771
        shl     ecx, 2
-
 
772
        add     edi, ecx
-
 
773
        mov     ecx, esi
-
 
774
        dec     ecx
-
 
775
        dec     ecx
-
 
776
.drawUpLeftHigh:
-
 
777
        mov     eax, ecx
-
 
778
@@:
-
 
779
        mov     [edi+eax*4], ebp
-
 
780
        dec     eax
-
 
781
        jns     @b
Line -... Line 782...
-
 
782
        add     edi, [esp+20+widthX]
188
        pop     ecx
783
        mov     eax, ecx
189
;--------------------------------------
784
@@:
190
align 4
785
        mov     [edi+eax*4], ebp
191
.pixloop2cont:
786
        dec     eax
192
        inc     eax
-
 
193
        dec     esi
-
 
194
        jnz     .pixloop2
-
 
195
 
787
        jns     @b
196
        pop     esi
788
        add     edi, [esp+20+widthX]
197
        sub     eax, esi
789
        dec     ecx
198
        inc     ebx
-
 
-
 
790
        jns     .drawUpLeftHigh
199
        inc     ebp
791
.nextPixel:
200
        dec     dword [esp]
792
        bsf     eax, edx
-
 
793
        btr     edx, eax
201
        jnz     .symloop2
794
        pop     edi
202
 
795
        jmp     .raw
203
        pop     eax
-
 
204
        add     dword [esp+28], esi
796
 
205
        popad
797
.nextRaw:
206
        jmp     .loop
798
        inc     ebx
207
;--------------------------------------
799
        mov     eax, [esp+16+widthX]
208
align 4
800
        imul    eax, esi
209
.end:
801
        add     edi, eax
210
        popad
802
        dec     dword [esp+4]
211
        pop     eax
803
        jnz     drawChar
212
        ret
804
        ret
213
;------------------------------------------------------------------------------
805
 
214
; eax = x coordinate
806
antiAliasing:
215
; ebx = y coordinate
807
        mov     bp, 3
-
 
808
@@:
216
; ecx = ?? RR GG BB
809
        mov     cl, al
217
; edi = user area
810
        mov     dl, bl
218
align 4
811
        lea     ecx, [ecx*2+ecx]
219
draw_text_to_user_area:
812
        add     ecx, edx
220
        pushad
813
        shr     ecx, 2
221
        imul    ebx, [edi+0]
814
        mov     al, cl
222
        add     eax, ebx
815
        ror     eax, 8
223
        shl     eax, 2
816
        ror     ebx, 8
224
        add     eax, edi
817
        dec     bp
225
        add     eax, 8
818
        jnz     @b
226
        and     ecx, 0xffffff
-
 
227
        or      ecx, 0xff000000  ; not transparent
-
 
228
        mov     [eax], ecx       ; store  pixel
819
        ror     eax, 8
229
        popad
-
 
230
        ret
-
 
231
;------------------------------------------------------------------------------
-
 
232
align 4
-
 
233
FONT_I:
-
 
234
  if lang eq sp
820
        ror     ebx, 8
235
  file 'char_sp.mt'
-
 
236
  else if lang eq et
-