Subversion Repositories Kolibri OS

Rev

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. ; 15.02.2007 merge old END with new one (fron Veliant & Leency) by Heavyiron
  9.  
  10. include "..\..\..\macros.inc"
  11.  
  12. meos_app_start
  13. code
  14.  
  15. draw:
  16.  
  17.     mov  al,12             ; eax=12 - tell os about redraw start
  18.     mov  ebx,1
  19.     mcall
  20.  
  21.     mov  al,14             ; eax=14 - get screen max x & max y
  22.     mcall
  23.  
  24.     movzx ecx, ax
  25.     shr eax, 16
  26.     shr ecx, 1
  27.     shr eax, 1
  28.     sub eax, 157
  29.     sub ecx, 100
  30.     mov ebx, eax
  31.     shl ebx, 16
  32.     add ebx, 253
  33.     shl ecx, 16
  34.     add ecx, 154
  35.  
  36.     xor  eax,eax                           ; define and draw window
  37.     mov  edx,0x41ffffff
  38.     mcall
  39.  
  40.     mov al, 7
  41.     mov ebx, background
  42.     mov ecx, 254 shl 16 + 155
  43.     xor edx, edx
  44.     mcall
  45.  
  46.    
  47.     mov al,8
  48.     mcall ,58 shl 16 + 32,59 shl 16 + 34, 1 shl 30 + 1
  49.     inc edx
  50.     mcall ,110 shl 16 + 32,54 shl 16 + 32
  51.     inc edx
  52.     mcall ,161 shl 16 + 32,59 shl 16 + 34
  53.     inc edx
  54.     mcall ,193 shl 16 + 43,125 shl 16 + 16,
  55.     inc edx
  56.     mcall ,144 shl 16 + 43
  57.  
  58.     mov  al,12             ;end of redraw
  59.     mov  ebx,2
  60.     mcall
  61.  
  62. still:
  63.  
  64.     mov  eax,10                 ; wait here for event
  65.     mcall
  66.  
  67.     dec  eax
  68.     jz   draw
  69.     dec  eax
  70.     jnz  button
  71.   key:
  72.     mov  al,2   ; now eax=2 - get key code
  73.     mcall
  74.     mov  al,ah
  75.      cmp  al,13
  76.      jz   restart
  77.      cmp  al,27
  78.      jz   close_1
  79.      cmp  al,180
  80.      jz   restart_kernel
  81.      cmp  al,181
  82.      jz   power_off
  83.      jmp  still
  84.  
  85.   button:
  86.     mov  al,17  ; now eax=17 - get pressed button id
  87.     mcall
  88.     xchg al,ah
  89.     dec  eax
  90.     jz   restart_kernel
  91.     dec  eax
  92.     jz   power_off
  93.     dec  eax
  94.     jz   restart
  95.     dec  eax
  96.     jnz   run_rdsave
  97. ; we have only one button left, this is close button
  98. ;    dec  eax
  99. ;    jnz  still
  100. close_1:
  101.     or   eax,-1
  102.     mcall
  103.  
  104.  power_off:
  105.     push 2
  106.     jmp  mcall_and_close
  107.  
  108.  restart:
  109.     push 3
  110.     jmp  mcall_and_close
  111.  
  112.   restart_kernel:
  113.     push 4
  114. mcall_and_close:
  115.     pop  ecx
  116.     mcall 18,9
  117.     jmp  close_1
  118.  
  119. run_rdsave:
  120.     mov eax,70
  121.     mov ebx,rdsave
  122.     mcall
  123.     jmp still
  124.  
  125. data
  126. background      file 'back.raw'
  127. rdsave:
  128.         dd      7
  129.         dd      0
  130.         dd      0
  131.         dd      0
  132.         dd      0
  133.         db      '/sys/rdsave',0
  134. udata
  135.  
  136. meos_app_end
  137.