Subversion Repositories Kolibri OS

Rev

Rev 3380 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. ;-----------------------------------------------------------------------------
  2. align 4
  3. create_palette:
  4. ;-------------------------------------------
  5.         mov     eax,[palette_SIZE_Y]
  6.         mov     ebx,6
  7.         xor     edx,edx
  8.         div     ebx
  9.         mov     [part_of_size_y],eax
  10. ;-------------------------------------------
  11.         mov     ebx,eax
  12.         mov     eax,255 shl 24
  13.         xor     edx,edx
  14.         div     ebx
  15.         mov     [offset_y],eax
  16. ;-------------------------------------------
  17.         mov     edi,[palette_area]
  18.         mov     edx,[offset_y]
  19. ;-------------------------------------------
  20.         xor     ecx,ecx
  21.         mov     eax,0xFF0000 ;there was [tone_area] which seems to be a bug
  22. ;-------------------------------------------
  23. align 4
  24. @@:
  25.         call    palette_put_line
  26. ; blue
  27.         call    next_color
  28.         add     ecx,1
  29.         cmp     ecx,[part_of_size_y]
  30.         jne     @b
  31. ;-------------------------------------------
  32.         mov     ecx,[part_of_size_y]
  33. ;-------------------------------------------
  34. align 4
  35. @@:
  36.         call    palette_put_line
  37. ; red
  38.         ror     eax,16
  39.         call    next_color
  40.         rol     eax,16
  41.         sub     ecx,1
  42.         jne     @b
  43. ;-------------------------------------------
  44.         xor     ecx,ecx
  45. ;-------------------------------------------
  46. align 4
  47. @@:
  48.         call    palette_put_line
  49. ; green
  50.         ror     eax,8
  51.         call    next_color
  52.         rol     eax,8
  53.         add     ecx,1
  54.         cmp     ecx,[part_of_size_y]
  55.         jne     @b
  56. ;-------------------------------------------
  57.         mov     ecx,[part_of_size_y]
  58. ;-------------------------------------------
  59. align 4
  60. @@:
  61.         call    palette_put_line
  62. ; blue
  63.         call    next_color
  64.         sub     ecx,1
  65.         jne     @b
  66. ;-------------------------------------------
  67.         xor     ecx,ecx
  68. ;-------------------------------------------
  69. align 4
  70. @@:
  71.         call    palette_put_line
  72. ; red
  73.         ror     eax,16
  74.         call    next_color
  75.         rol     eax,16
  76.         add     ecx,1
  77.         cmp     ecx,[part_of_size_y]
  78.         jne     @b
  79. ;-------------------------------------------
  80.         mov     ecx,[part_of_size_y]
  81. ;-------------------------------------------
  82. align 4
  83. @@:
  84.         call    palette_put_line
  85. ; green
  86.         ror     eax,8
  87.         call    next_color
  88.         rol     eax,8
  89.         sub     ecx,1
  90.         jne     @b
  91. ;-------------------------------------------
  92.         mov     edx,[part_of_size_y]
  93.         lea     edx,[edx*3]
  94.         shl     edx,1
  95.         mov     ecx,[palette_SIZE_Y]
  96.         sub     ecx,edx
  97.         test    ecx,ecx
  98.         jz      .end
  99. ;-------------------------------------------
  100. align 4
  101. @@:
  102.         call    palette_put_line
  103.         loop    @b
  104. ;-------------------------------------------
  105. align 4
  106. .end:
  107.         ret
  108. ;---------------------------------------------------------------------
  109. align 4
  110. next_color:
  111.         mov     ebx,ecx
  112.         imul    ebx,edx
  113.         rol     ebx,8
  114.         mov     al,bl
  115.         ret
  116. ;---------------------------------------------------------------------
  117. align 4
  118. palette_put_line:
  119.         push    ecx
  120.         mov     ecx,[palette_SIZE_X]
  121.         cld
  122. ;-------------------------------------------
  123. align 4
  124. .loop:
  125.         stosd
  126.         dec     edi
  127.         loop    .loop
  128.         pop     ecx
  129.         ret
  130. ;---------------------------------------------------------------------