Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------------------------
  2. align 4
  3. create_tone:
  4. ;-------------------------------------------
  5.         mov     ebx,[tone_SIZE_Y]
  6.         xor     eax,eax
  7.         dec     al
  8.         sub     al,[tone_color.red]
  9.         shl     eax,24
  10.         xor     edx,edx
  11.         div     ebx
  12.         mov     [offset_y.red],eax
  13.  
  14.         xor     eax,eax
  15.         dec     al
  16.         sub     al,[tone_color.green]
  17.         shl     eax,24
  18.         xor     edx,edx
  19.         div     ebx
  20.         mov     [offset_y.green],eax
  21.  
  22.         xor     eax,eax
  23.         dec     al
  24.         sub     al,[tone_color.blue]
  25.         shl     eax,24
  26.         xor     edx,edx
  27.         div     ebx
  28.         mov     [offset_y.blue],eax
  29. ;-------------------------------------------
  30.         mov     edi,[tone_area]
  31.         xor     ecx,ecx
  32. ;-------------------------------------------
  33. align 4
  34. @@:
  35.         mov     eax,[tone_color]
  36. ; blue
  37.         mov     edx,[offset_y.blue]
  38.         call    next_color_Y
  39.         ror     eax,8
  40. ; green
  41.         mov     edx,[offset_y.green]
  42.         call    next_color_Y
  43.         ror     eax,8
  44. ; red
  45.         mov     edx,[offset_y.red]
  46.         call    next_color_Y
  47.         rol     eax,16
  48.  
  49.         call    tone_put_line
  50.         add     ecx,1
  51.         cmp     ecx,[tone_SIZE_X]
  52.         jne     @b
  53.  
  54.         ret
  55. ;-----------------------------------------------------------------------------
  56. tone_put_line:
  57.         push    ecx
  58.  
  59.         mov     ecx,eax
  60.         mov     ebx,[tone_SIZE_X]
  61.         shl     eax,24
  62.         xor     edx,edx
  63.         div     ebx
  64.         mov     [offset_x.blue],eax
  65.  
  66.         mov     eax,ecx
  67.         shr     eax,8
  68.         shl     eax,24
  69.         xor     edx,edx
  70.         div     ebx
  71.         mov     [offset_x.green],eax
  72.  
  73.         mov     eax,ecx
  74.         shr     eax,16
  75.         shl     eax,24
  76.         xor     edx,edx
  77.         div     ebx
  78.         mov     [offset_x.red],eax
  79.         mov     eax,ecx
  80.  
  81.         push    ebx esi
  82.         mov     ecx,[tone_SIZE_X]
  83.         xor     edx,edx
  84.         xor     ebx,ebx
  85.         xor     esi,esi
  86. @@:
  87.         mov     eax,edx
  88.         shr     eax,24
  89.         add     edx,[offset_x.blue]
  90.         mov     [edi],al
  91.         mov     eax,ebx
  92.         shr     eax,24
  93.         add     ebx,[offset_x.green]
  94.         mov     [edi+1],al
  95.         mov     eax,esi
  96.         shr     eax,24
  97.         add     esi,[offset_x.red]
  98.         mov     [edi+2],al
  99.         add     edi,3
  100.         dec     ecx
  101.         jnz     @b
  102.         pop     esi ebx
  103.         pop     ecx
  104.         ret
  105. ;-----------------------------------------------------------------------------
  106. align 4
  107. next_color_Y:
  108.         imul    edx,ecx
  109.         rol     edx,8
  110.         add     al,dl
  111.         ret
  112. ;-----------------------------------------------------------------------------