;In this file content a macros need for compilation the scrshoot
evm_redraw equ 1
evm_key equ 10b
evm_button equ 100b
evm_mouse equ 100000b
evm_ipc equ 1000000b

;--- ñîîáùèòü ñèñòåìå î íà÷àëå ïåðåðèñîâêè îêíà ---
macro draw_status text_ptr
{
        mov     [status.text],dword text_ptr
        call    send_draw_status
}

macro start_draw_window
{
        ;mov     eax,12
        push    12
        pop     eax
        xor     ebx,ebx
        inc     ebx
        mcall
}

;--- ñîîáùèòü ñèñòåìå î çàâåðøåíèè ïåðåðèñîâêè îêíà ---
macro stop_draw_window
{
        ;mov     eax,12
        push    12
        pop     eax
        ;mov     ebx,2
        push    2
        pop     ebx
        mcall
}

;--- óñòàíîâèòü ìàñêó îæèäàåìûõ ñîáûòèé ---

;--- îæèäàòü ñîáûòèÿ ---
macro wait_event redraw,key,button,mouse,ipc,other
{
        mov     eax,10
        mcall
        dec     ax
if redraw eq
else
        jz      redraw
end if
        dec     ax
if key eq
else
        jz      key
end if
        dec     ax
if button eq
else
        jz      button
end if
        dec     ax
        dec     ax
        dec     ax
if mouse eq
else
        jz      mouse
end if
if ipc eq
else
        dec     ax
        jz      ipc
end if
if other eq
        jmp     still
else
        jmp     other
end if
}
;--- óñòàíîâèòü ìàñêó îæèäàåìûõ ñîáûòèé ---
macro set_events_mask mask
{
        ;mov     eax,40
        push    40
        pop     eax
        ;mov     ebx,mask
        push    mask
        pop     ebx
        mcall
}

;macro check_boxes_set_sys_color start,end,color_table
;{
;ch_left equ [edi]    ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî õ
;ch_top equ [edi+4]   ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî ó
;ch_text_margin equ [edi+8]      ;=4 ðàññòîÿíèå îò ïðÿìîóãîëüíèêà ÷åê áîêñà äî íàäïèñè 
;ch_size equ [edi+8]             ;12 ðàçìåð êâàäðàòà ÷åê áîêñà 
;ch_color equ [edi+12]           ;öâåò âíóòðè checkbox
;ch_border_color equ [edi+16] ; or [edi+4] ;öâåò ðàìêè checkbox åå ìîæíî çàäàòü ñàìîñòîÿòåëüíî
;ch_text_color equ   [edi+20];[edi+4]  ;öâåò òåêñòà
;ch_text_ptr equ [edi+24]    ;óêàçàòåëü íà íà÷àëî òåêñòîâîé ñòðîêè 
;ch_text_length equ [edi+28]
;ch_flags equ [edi+32]       ;ôëàãè 


;ch_left equ [edi]    ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî õ
;ch_top equ [edi+2]   ;êîîðäèíàòà íà÷àëà ðèñîâàíèÿ ïî ó
;ch_color equ [edi+4] ;öâåò âíóòðè checkbox
;ch_border_color equ [edi+8] ;öâåò ðàìêè checkbox
;ch_text_color equ [edi+12]  ;öâåò òåêñòà
;ch_text_ptr equ [edi+16]    ;óêàçàòåëü íà íà÷àëî òåêñòîâîé ñòðîêè
;ch_text_length equ [edi+20] ;äëèíà íàäïèñè (2^64 òàêîé äëèíû ìîæåò áûòü òåêñò)
;ch_flags equ [edi+24]       ;ôëàãè

;        mov     edi,start
;        mov     ecx,((end-start)/ch_struc_size)
;        mov     esi,color_table
;@@:
;        push    dword [esi+32]
;        pop     dword ch_text_color
;        push    dword [esi+36]
;        pop     dword ch_border_color
;        add     edi,ch_struc_size
;        loop    @b
;}
macro get_key
{
        ;mov     eax,2
        push    2
        pop     eax
        mcall
}
;--- ïîëó÷èòü êîä íàæàòîé êíîïêè ---
macro get_pressed_button
{
        ;mov     eax,17
        push    17
        pop     eax
        mcall
}
macro get_active_window
{
        mov     eax,18
        mov     ebx,7
        mcall
}
;--- ¯®«ãç¨âì ¨­ä®à¬ æ¨î ® ¯à®æ¥áᥠ---
macro get_procinfo proc_inf_buf,slot_num
{
        ;mov     eax,9
        push    9
        pop     eax
        ;mov     ebx,proc_inf_buf
        push    proc_inf_buf
        pop     ebx
if slot_num eq
        xor     ecx,ecx
        dec     ecx
else
        ;mov     ecx,slot_num
        push    slot_num
        pop     ecx
end if
        mcall
}
macro get_screen_prop  struc_ptr
{
        mov     eax,61
        push    eax eax
        xor     ebx,ebx
        inc     ebx
        mcall
        mov     [struc_ptr],eax
        pop     eax
        inc     ebx
        mcall
        mov     [struc_ptr+4],ax
        pop     eax
        inc     ebx
        mcall
        mov     [struc_ptr+6],eax
}
macro min_window
{
        mov     eax,18
        mov     ebx,10
        mcall
}
macro app_close
{
        or     eax,-1
        mcall
}
macro get_skin_height
{
        mov     eax,48
        mov     ebx,4
        mcall
}
macro delay time
{
        mov     eax,5
if time eq
else
        mov     ebx,time
end if
        mcall
}
macro activ_window slot_n
{
        mov     eax,18
        mov     ebx,3
if slot_n eq
else
        mov     ecx,slot_n
end if
        mcall
}
struc screen_prop
{
.height: dw ? ;+0
.width: dw ?  ;+2
.bitspp: dw ? ;+4
.bytesps: dd ?;+6
}
struc sys_color_table
{
.frames: dd ?  ;+0
.grab: dd ?    ;+4
.work_dark: dd ? ;+8
.work_light: dd ?  ;+12
.grab_text: dd ?  ;+16
.work: dd ?       ;+20
.work_button: dd ?;+24
.work_button_text: dd ? ;+28
.work_text: dd ?        ;+32
.work_graph: dd ?       ;+36
}
struc procinfo
{
.takts_per_second: dd ?
.window_stack_pos: dw ?
.slot_number: dw ?
dw ?
.name: rb 11
.align: db ?
.addres: dd ?
.use_mem: dd ?
.pid: dd ?
.left: dd ?
.top: dd ?
.width: dd ?
.height: dd ?
.slot_state: dw ?
rb (1024-56)
}



struc ipc_buffer size
{
.block: dd ?
.in_use: dd ?
.messages: rb size
}

;--- æ¢¥â  ---
cl_white=0xffffff
cl_black=0x000000

ch_struc_size=36