Subversion Repositories Kolibri OS

Rev

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

  1. ; draw main window
  2. align 4
  3. proc draw_main_window stdcall
  4.         DEBUGF  DBG_INFO, "draw_main_window() start\n"
  5.         mcall   12, 1       ; notify about draw beginning
  6.         mcall   48, 3, sys_colors, sizeof.system_colors
  7.        
  8.         mov     edx, [sys_colors.work]         ; background color
  9.         or      edx, 0x74000000                ; window type
  10.         ; DEBUGF  DBG_INFO, "mainwindow w, h  = %u, %u", GFX_COLS*GFX_PIX_SIZE + 8, GFX_ROWS*GFX_PIX_SIZE + 28
  11.         mcall   0, <50, GFX_COLS*GFX_PIX_SIZE + 9>, <50, GFX_ROWS*GFX_PIX_SIZE + 28>, , , main_window_title ;
  12.  
  13.         stdcall draw_screen
  14.  
  15.         mcall   12, 2                  ; notify about draw ending
  16.         DEBUGF  DBG_INFO, "draw_main_window() end\n"
  17.         ret
  18. endp
  19.  
  20. ; draw screen
  21. align 4
  22. proc draw_screen stdcall
  23.         pushad
  24.         locals
  25.             row_ind dd ?
  26.             col_ind dd ?
  27.             color   dd ?
  28.         endl
  29.  
  30.         xor     esi, esi
  31. .loop1:
  32.         cmp     esi, GFX_SIZE
  33.         jae     .loop1_end
  34.         xor     edx, edx
  35.         mov     eax, esi
  36.         mov     ecx, GFX_COLS
  37.         div     ecx ; eax = row index, edx = col index
  38.         mov     dword [row_ind], eax
  39.         mov     dword [col_ind], edx
  40.         mov     dword [color], 0x80FFFFFF ; white
  41.         cmp     byte [esi + gfx], 0 ; check if cell is 0 or not 0
  42.         jne     @f
  43.         mov     dword [color], 0x80000000 ;  black
  44.     @@:
  45.         mov     ebx, dword [col_ind]
  46.         imul    ebx, GFX_PIX_SIZE
  47.         ;add     ebx, WINDOW_BORDER
  48.         shl     ebx, 16
  49.         add     ebx, GFX_PIX_SIZE
  50.  
  51.         mov     ecx, dword [row_ind]
  52.         imul    ecx, GFX_PIX_SIZE
  53.         ;add     ecx, WINDOW_BORDER
  54.         shl     ecx, 16
  55.         add     ecx, GFX_PIX_SIZE
  56.  
  57.         mov     eax, 13
  58.         mov     edx, dword [color]
  59.         int     0x40
  60.  
  61.         inc     esi
  62.         jmp     .loop1
  63.  
  64. .loop1_end:
  65.         popad
  66.         ret
  67. endp