Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
31 halyavin 1
;
2
; END
3
;
47 halyavin 4
;  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
748 heavyiron 7
;
8
; 15.02.2007 merge old END with new one (fron Veliant & Leency) by Heavyiron
31 halyavin 9
 
485 heavyiron 10
include "..\..\..\macros.inc"
31 halyavin 11
 
12
meos_app_start
13
code
14
 
748 heavyiron 15
draw:
31 halyavin 16
 
47 halyavin 17
    mov  al,12 		   ; eax=12 - tell os about redraw start
748 heavyiron 18
    mov  ebx,1
485 heavyiron 19
    mcall
31 halyavin 20
 
47 halyavin 21
    mov  al,14 		   ; eax=14 - get screen max x & max y
485 heavyiron 22
    mcall
31 halyavin 23
 
748 heavyiron 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
31 halyavin 35
 
341 heavyiron 36
    xor  eax,eax			   ; define and draw window
748 heavyiron 37
    mov  edx,0x41ffffff
485 heavyiron 38
    mcall
31 halyavin 39
 
748 heavyiron 40
    mov al, 7
41
    mov ebx, background
42
    mov ecx, 254 shl 16 + 155
43
    xor edx, edx
485 heavyiron 44
    mcall
31 halyavin 45
 
748 heavyiron 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
341 heavyiron 57
 
58
    mov  al,12 		   ;end of redraw
31 halyavin 59
    mov  ebx,2
485 heavyiron 60
    mcall
31 halyavin 61
 
47 halyavin 62
still:
31 halyavin 63
 
47 halyavin 64
    mov  eax,10 		; wait here for event
485 heavyiron 65
    mcall
31 halyavin 66
 
47 halyavin 67
    dec  eax
748 heavyiron 68
    jz   draw
47 halyavin 69
    dec  eax
70
    jnz  button
71
  key:
72
    mov  al,2	; now eax=2 - get key code
485 heavyiron 73
    mcall
47 halyavin 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
31 halyavin 84
 
47 halyavin 85
  button:
86
    mov  al,17	; now eax=17 - get pressed button id
485 heavyiron 87
    mcall
47 halyavin 88
    xchg al,ah
89
    dec  eax
748 heavyiron 90
    jz   restart_kernel
91
    dec  eax
47 halyavin 92
    jz   power_off
93
    dec  eax
94
    jz   restart
341 heavyiron 95
    dec  eax
96
    jnz   run_rdsave
47 halyavin 97
; we have only one button left, this is close button
98
;    dec  eax
99
;    jnz  still
100
close_1:
101
    or   eax,-1
485 heavyiron 102
    mcall
31 halyavin 103
 
47 halyavin 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
 
341 heavyiron 119
run_rdsave:
120
    mov eax,70
121
    mov ebx,rdsave
485 heavyiron 122
    mcall
341 heavyiron 123
    jmp still
124
 
31 halyavin 125
data
748 heavyiron 126
background	file 'back.raw'
341 heavyiron 127
rdsave:
128
        dd      7
129
        dd      0
130
        dd      0
131
        dd      0
132
        dd      0
529 spraid 133
        db      '/sys/rdsave',0
31 halyavin 134
udata
135
 
136
meos_app_end