Subversion Repositories Kolibri OS

Rev

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

  1. ;
  2. ; END
  3. ; KolibriOS Team 2005-2010
  4. ;
  5. ; <diamond> note that 'mov al,xx' is shorter than 'mov eax,xx'
  6. ;           and if we know that high 24 bits of eax are zero, we can use 1st form
  7. ;           the same about ebx,ecx,edx
  8.  
  9. include "lang.inc"
  10. include "..\..\..\macros.inc"
  11.  
  12. meos_app_start
  13. code
  14.  
  15. do_draw:
  16.  
  17.     mov  al,12             ; eax=12 - tell os about redraw start
  18.     mov  bl,1
  19.     mcall
  20.  
  21.     mov  al,14             ; eax=14 - get screen max x & max y
  22.     mcall
  23.  
  24.     movzx ecx,ax
  25.  
  26.     shr  eax,17
  27.     shl  eax,16
  28.     lea  ebx,[eax-110*10000h+220]
  29.  
  30.     shr  ecx,1
  31.     shl  ecx,16
  32.     sub  ecx,50*10000h - 115
  33.  
  34.     xor  eax,eax                           ; define and draw window
  35.     mov  edx,0x00cccccc
  36.     mov  esi,edx
  37.     mov  edi,edx
  38.     mcall
  39.  
  40.    sub edx,0x555555
  41.    mov al,13
  42.    mcall ,19 shl 16+87,21 shl 16+24
  43.    push ebx
  44.    mcall ,122 shl 16+87
  45.    xchg ebx,[esp]
  46.    mcall ,,55 shl 16+24
  47.    pop  ebx
  48.    mcall
  49.  
  50.    xor edx,edx
  51.    mov al,8
  52.    inc edx
  53.    mcall ,15 shl 16+87,17 shl 16+24,,0xaa0044
  54.    inc edx
  55.    mcall ,118 shl 16+87,,,0xbb7700
  56.    inc edx
  57.    mcall ,15 shl 16+87,51 shl 16+24,,0x8800
  58.    inc edx
  59.    mcall ,118 shl 16+87,,,0x999999
  60.    mcall ,10 shl 16+200,88 shl 16+15,0x40000005
  61.    mcall 38,27 shl 16 +193,102 shl 16 +102,0x000000dd
  62.  
  63.     mov  al,4                      ; 0x00000004 = write text
  64.     mov  ebx,28*65536+93
  65.     mov  ecx,0x800000dd
  66.     mov  edx,label4
  67.     mcall
  68.  
  69.     mov  ecx,0x90eeeeee            ; 8b window nro - RR GG BB color
  70.     mov  ebx,24*65536+20
  71.     mov  edx,label2                  ; pointer to text beginning
  72.     mcall
  73.  
  74.     mov  ebx,19*65536+54
  75.     mov  edx,label3
  76.     mcall
  77.  
  78.     mov  ebx,44*65536+31
  79.     mov  edx,label5
  80.     mcall
  81.  
  82.     mov  ebx,39*65536+65
  83.     mov  edx,label6
  84.     mcall
  85.  
  86.     mov  al,12             ;end of redraw
  87.     mov  ebx,2
  88.     mcall
  89.  
  90. still:
  91.  
  92.     mov  eax,10                 ; wait here for event
  93.     mcall
  94.  
  95.     dec  eax
  96.     jz   do_draw
  97.     dec  eax
  98.     jnz  button
  99.   key:
  100.     mov  al,2   ; now eax=2 - get key code
  101.     mcall
  102.     mov  al,ah
  103.      cmp  al,13
  104.      jz   restart
  105.      cmp  al,19
  106.      jz   run_rdsave
  107.      cmp  al,27
  108.      jz   close_1
  109.      cmp  al,180
  110.      jz   restart_kernel
  111.      cmp  al,181
  112.      jz   power_off
  113.      jmp  still
  114.  
  115.   button:
  116.     mov  al,17  ; now eax=17 - get pressed button id
  117.     mcall
  118.     xchg al,ah
  119.     dec  eax
  120.     jz   power_off
  121.     dec  eax
  122.     jz   restart_kernel
  123.     dec  eax
  124.     jz   restart
  125.     dec  eax
  126.     jnz   run_rdsave
  127. ; we have only one button left, this is close button
  128. ;    dec  eax
  129. ;    jnz  still
  130. close_1:
  131.     or   eax,-1
  132.     mcall
  133.  
  134.  power_off:
  135.     push 2
  136.     jmp  mcall_and_close
  137.  
  138.  restart:
  139.     push 3
  140.     jmp  mcall_and_close
  141.  
  142.   restart_kernel:
  143.     push 4
  144. mcall_and_close:
  145.     pop  ecx
  146.     mcall 18,9
  147.     jmp  close_1
  148.  
  149. run_rdsave:
  150.     mov eax,70
  151.     mov ebx,rdsave
  152.     mcall
  153.     jmp still
  154.  
  155. data
  156.  
  157. if lang eq ru
  158.   label2:
  159.       db   '‚몫îç¨âì         Ÿ¤à®',0
  160.   label3:
  161.       db   '¥à¥§ ¯ã᪠      Žâ¬¥­ ',0
  162.   label4:
  163.       db   '‘®åà ­¨âì ­ áâனª¨ (Ctrl-S)',0
  164.  
  165. else if lang eq ge
  166.   label2:
  167.       db   '  Beenden         Kernel',0
  168.   label3:
  169.       db   '   Neustart      Abbrechen',0
  170.   label4:
  171.       db   'Save your settings (Ctrl-S)',0
  172.  
  173. else
  174.   label2:
  175.       db   'Power off          Kernel',0
  176.   label3:
  177.       db   '   Restart          Cancel',0
  178.   label4:
  179.       db   'Save your settings (Ctrl-S)',0
  180.  
  181. end if
  182.  
  183.   label5:
  184.       db   '(End)           (Home)',0
  185.   label6:
  186.       db   '(Enter)          (Esc)',0
  187.  
  188. rdsave:
  189.         dd      7
  190.         dd      0
  191.         dd      0
  192.         dd      0
  193.         dd      0
  194.         db      '/sys/rdsave',0
  195. udata
  196. meos_app_end
  197.