Subversion Repositories Kolibri OS

Rev

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