Subversion Repositories Kolibri OS

Rev

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

  1. ;
  2. ; END
  3. ; KolibriOS Team 2005-2013
  4. ;
  5. include "lang.inc"
  6. include "..\..\..\macros.inc"
  7. ; <diamond> note that 'mov al,xx' is shorter than 'mov eax,xx'
  8. ;           and if we know that high 24 bits of eax are zero, we can use 1st form
  9. ;           the same about ebx,ecx,edx
  10.  
  11. meos_app_start
  12. code
  13. draw_window:
  14.     mov   al,12
  15.     mcall ,1
  16.  
  17.     mov  al,14
  18.     mcall                                    ;eax=14 - get screen max x & max y
  19.     movzx ecx,ax
  20.     shr  eax,17
  21.     shl  eax,16
  22.     lea  ebx,[eax-110 shl 16+222]
  23.     shr  ecx,1
  24.     shl  ecx,16
  25.     lea  ecx,[ecx-65 shl 16+137]
  26.  
  27.     xor eax,eax
  28.     mcall  , , ,0x019098b0,0x01000000        ;define and draw window
  29.  
  30.     mov   al,13
  31.     mcall   ,<0,223> ,<0,275>
  32.     mcall   ,<1,221>,<1,136>,0xffffff
  33.     mcall   ,<2,220>,<2,135>,0xe4dfe1
  34.     mcall   ,<16,189>,<97,23>,0x9098b0
  35.  
  36.     mov    al,8
  37.     mcall   ,<16,90> ,<20,27>,4,0x990022     ;eax=8 - draw buttons
  38.     mcall   ,<113,90>,       ,2,0xaa7700
  39.     mcall   ,        ,<54,27>,1,0x777777
  40.     mcall   ,<16,90> ,       ,3,0x007700
  41.     mcall   ,<17,186>,<98,20>,5,0xe4dfe1
  42.  
  43.     mov   al,4
  44.     mcall  ,<28,105>,0x80000000,label4        ;eax=4 - write text
  45.     mcall  ,<35,24> ,0x80ffffff,label2
  46.     mcall  ,<34,58> ,          ,label3
  47.     mcall  ,<47,37> ,          ,label5
  48.     mcall  ,<43,71> ,          ,label6
  49.  
  50.     mov   al,12
  51.     mcall   ,2
  52.  
  53. still:
  54.     mov  al,10
  55.     mcall                                    ;wait here for event
  56.     dec  eax
  57.     jz   draw_window
  58.     dec  eax
  59.     jnz  button
  60.  
  61.     mov  al,2
  62.     mcall                                    ;eax=2 - get key code
  63.     mov  al,ah
  64.      cmp  al,13
  65.      jz   restart
  66.      cmp  al,19
  67.      jz   run_rdsave
  68.      cmp  al,27
  69.      jz   close_1
  70.      cmp  al,180
  71.      jz   restart_kernel
  72.      cmp  al,181
  73.      jz   power_off
  74.      jmp  still
  75.  
  76. button:
  77.     mov  al,17
  78.     mcall                                    ;eax=17 - get pressed button id
  79.     xchg al,ah
  80.     dec  eax
  81.     jz   close_1
  82.     dec  eax
  83.     jz   restart_kernel
  84.     dec  eax
  85.     jz   restart
  86.     dec  eax
  87.     jnz   run_rdsave
  88. ;    dec  eax                                ; we have only one button left, this is close button
  89. ;    jnz  still
  90.  
  91. power_off:
  92.     push 2
  93.     jmp  mcall_and_close
  94. restart:
  95.     push 3
  96.     jmp  mcall_and_close
  97. restart_kernel:
  98.     push 4
  99. mcall_and_close:
  100.     pop  ecx
  101.     mov  al,18
  102.     mcall   ,9
  103.  
  104. close_1:
  105.     or  eax,-1
  106.     mcall  
  107.  
  108. run_rdsave:
  109.     mov  al,70
  110.     mcall   ,rdsave
  111.     jmp still
  112.  
  113. data
  114. include 'data.inc'
  115.  
  116. udata
  117.  
  118. meos_app_end