     " ",  1.

==============================================================================
===    Kolibri OS.  .  1 ========
==============================================================================

0.    
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  db 'MENUET01'  ; 1.    (8 )
  dd 0x01        ; 2.     
  dd START       ; 3. ,     
                 ;        
  dd I_END       ; 4.  

;  1. -    ,  
;         .   
;     ,    
;    .  I_END    ,
;      .
; .    -   
;      ,      0.

  dd 0x100000    ; 5.    
                 ;           0x0
                 ;     ,  

;  2.     0x100000  = 1 .  
; . ,      
;       .
;  .   1     
;         -
;  (Ville Turjanmaa),    MenuetOS - 
; KolibriOS.       
;         Mario79.

  dd 0x100000    ; 6.     ,  
  dd 0x0         ; 7.     .
                 ;        ,  
                 ;         
;  3.   .    
;    (  ,   ?),   
;     0 (  ,   
;   ). ,   ,
; ,     .

  dd 0x0         ; 8.   ,    ,
                 ;      
;  4. .  3   " "  " 
;  ".

1.  
~~~~~~~~~~~~~~~~

    2 ( )     ,   
  . 

 5.
.   ,      ,    .
  ,      ,    
   . ,     ,  
     .    
, ,   2  ,   -
     100%,     
   ,    (  ,  
 )      .

   :
START:                       ;       
        call    draw_window  ;    
    
;      
event_wait:
        mov     eax,10       ;  10:  
        int     0x40

;     eax,  ,   
        cmp     eax,1        ;   ?
        je      redraw    
        cmp     eax,2        ;  ?
        je      key
        cmp     eax,3        ;     ?
        je      button

        jmp     event_wait   ;      

;  ,   ,   
redraw:                      ;    !
        call    draw_window  ;   draw_window 
        jmp     event_wait   ;     
    
key:                         ;   !
        mov     eax,2        ;    .   ah.
        int     0x40         ;      
                             ;  .
        jmp     event_wait   ;   event_wait
    
button:                      ;     !
        mov     eax,17       ;    
        int     0x40         ;   ah.

; ,        .
        cmp     ah,1         ;   id=1("")?
        jne     noclose
        mov     eax,-1       ;  -1:  
        int     0x40
  noclose:
;     (  )
        jmp     event_wait   ; , ,     :)

 .        
  .       .

 6.    ,    redraw.
      START.  ,
" 10 "...  !      ,
   redraw (  key),    redraw 
     draw_window.

 7.
-    jmp' ?
-     ...
 10    eax     .
(   ?   ,     
  ,     --  
  .   ,   
  .)     eax  1   2,    3  
   . ,      eax 
 1 (    redraw,    ),
  3 (    button),    
 eax=2,      key      
,    jmp   . ( ? 
,      .)

 8.  , , .    
( )        ( 
       ,   
     ?     
   ,     ).
 :  dec eax   , 
cmp al,1  2 ,  cmp eax,1  3 .
    ,   :
START:                       ;   
; ...      ...
redraw:
        call    draw_window  ;    

;      
event_wait:
        mov     eax,10       ;  10:  
        int     0x40

;     eax,  ,   
        dec     eax          ; eax=1?   ?
        je      redraw
        dec     eax
        jne     button
;   ,   10  eax=2 -  
key:                         ;   !
; ,     eax=0,     
;     ,     eax 
;     mov al,2  mov eax,2 , 
:  ,     3  !
        mov     al,2         ;    .   ah.
        int     0x40         ;      
                             ;  .
        jmp     event_wait   ;   event_wait

;   ,   10   1   2 -     3
button:                      ;     !
;    eax=1,       
; jne   ,     eax=3-2=1
; ,  ,     key
        mov     al,17        ;    
        int     0x40         ;   ah.

; ,        .
        cmp     ah,1         ;   id=1("")?
        jne     noclose
        or      eax,-1       ;  -1:  
        int     0x40
  noclose:
;     (  )
        jmp     event_wait   ; , ,     :)

 9.         
.    , ,    , 
    (   : 
   -  ).    
inc/dec     (   add/sub xxx,1).
  : ...    CF,  
      .
   ,   :
START:                       ;   
; ...      ...
redraw:
        call    draw_window  ;    

;      
event_wait:
        mov     eax,10       ;  10:  
        int     0x40

;     eax,  ,   
        cmp     al, 1
        je      redraw       ;   ?
        cmp     al, 2
        jne     button
;   ,   10  eax=2 -  
key:                         ;   !
; ,     eax=2,     
;     
;       mov     eax,2        ;   
        int     0x40         ;      
                             ;  .
        jmp     event_wait   ;   event_wait

;   ,   10   1   2 -     3
button:                      ;     !
;    eax=3,       
; jne   ,     eax=3
; ,   mov al,17  mov eax,17
        mov     al,17        ;    
        int     0x40         ;   ah.

; ,        .
        cmp     ah,1         ;   id=1("")?
        jne     noclose
        or      eax,-1       ;  -1:  
        int     0x40
  noclose:
;     (  )
        jmp     event_wait   ; , ,     :)

==============================================================================
===   checkbox ========================================
==============================================================================

  dd i_end          ;  
  dd i_end+0x100    ;   ,    0100 
  dd i_end+0x100    ;      

 1.   ,   ,
      ,  
i_end (  )   
   ,   ,   0x100  
i_end     .      
    !

 2.        ,
   ( esp)    4 .
       :
  dd (i_end+0x100) and not 3
  dd (i_end+0x100) and not 3

        xor     ebx,ebx        ;   ebx
        add     ebx,2          ;    ebx  =2

 3.       .
   5    2  (  
1    ,     ).
      mov (    ):
        mov     ebx, 2
      
        push    2
        pop     ebx
-  3     2 .   -  .
    ,     
    ""  "int 0x40".
       ,      
 .

        cmp     eax,0x1        ;    
        jz      red_win
        cmp     eax,0x2        ;     
        jz      key
        cmp     eax,0x3        ;     
        jz      button

mouse_check_boxes check_boxes,check_boxes_end  ;   

        jmp     still          ;        

 4.     ,    23,
    0   .    
     1,2,3.
 5.        ,  
al,   eax.
 6.  ""  2/100    ,
   .        
 .      
    ( 6) ( 40),   10- ,
      6.

        xor     eax,eax         ;     eax
        add     eax,12          ;     eax 12
        xor     ebx,ebx         ;   ebx
        add     ebx,1           ;      1
    
        xor     eax,eax          ;  eax

 7.   -   "int 0x40"   4- .

        mov     bx,ch_left    ;   
        mov     cx,bx         ;    cx  bx

 8.  checkbox.inc     16-
.  32-        .
mov ecx,ebx   .       32-
 16- - ,      ,
       .

==============================================================================
=== H   "" ========================================
==============================================================================
 .

==============================================================================
===   Kolibri OS.  1.      ====
==============================================================================

  ,               
,   :

        mov     esi,[0x3010]    ;   EAX   
        mov     edi,[esi+0x10]  ;   EDI   
                                ;   

 1.
 ,     .   :
; ,  eax user-mode  (  )
        add     eax, std_application_base_address
;   eax kernel-mode .    .

==============================================================================
===   Kolibri OS.  2.    ======
==============================================================================
,    ,  "       ?   
,            ,     
    .           
  ".  - .

 1.        -  
  ""   .      -
:        (:
 esi     - (-1)),    
 -.

        ,     (Lrz,    ;),
.  ,  ,      , 
 ,  .     , 
  .

 2.      ,   
        .  
   (       
)         ,
      386-  486-.
 3.        .
       svn-    
 ...       
(      ).  
 .

==============================================================================
===    .   1 =========================
==============================================================================
      ,      
...   :
*   stack_ru.txt    sysfuncr.txt -  
       
* UDP-   .   "  "
    TCP-.   ,    
*   'mov ebx,0'.   (  ,   )
   'xor ebx,ebx'.    macros.inc   
   'purge mov',     .
   ,  'mov ebx,0'  -    -
          eflags - mov   ,
      xor.
*   'cmp eax,0'.   (  ,   )
   'test eax,eax'.