Subversion Repositories Kolibri OS

Rev

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

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