Subversion Repositories Kolibri OS

Rev

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