Subversion Repositories Kolibri OS

Rev

Rev 5839 | Rev 5867 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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