Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
1742 mario79 1
;
2
; END
3443 leency 3
; KolibriOS Team 2005-2013
1742 mario79 4
;
5
include "lang.inc"
6
include "..\..\..\macros.inc"
4051 heavyiron 7
;  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
1742 mario79 10
 
11
meos_app_start
12
code
4044 heavyiron 13
draw_window:
4051 heavyiron 14
    mov   al,12
15
    mcall ,1
1742 mario79 16
 
4051 heavyiron 17
    mov  al,14
18
    mcall                                    ;eax=14 - get screen max x & max y
1742 mario79 19
    movzx ecx,ax
20
    shr  eax,17
21
    shl  eax,16
4044 heavyiron 22
    lea  ebx,[eax-110 shl 16+222]
1742 mario79 23
    shr  ecx,1
24
    shl  ecx,16
4051 heavyiron 25
    lea  ecx,[ecx-65 shl 16+137]
1742 mario79 26
 
4051 heavyiron 27
    xor eax,eax
28
    mcall  , , ,0x019098b0,0x01000000        ;define and draw window
1742 mario79 29
 
4051 heavyiron 30
    mov   al,13
31
    mcall   ,<0,223> ,<0,275>
4044 heavyiron 32
    mcall   ,<1,221>,<1,136>,0xffffff
33
    mcall   ,<2,220>,<2,135>,0xe4dfe1
34
    mcall   ,<16,189>,<97,23>,0x9098b0
1742 mario79 35
 
4051 heavyiron 36
    mov    al,8
37
    mcall   ,<16,90> ,<20,27>,4,0x990022     ;eax=8 - draw buttons
4044 heavyiron 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
1742 mario79 42
 
4051 heavyiron 43
    mov   al,4
44
    mcall  ,<28,105>,0x80000000,label4        ;eax=4 - write text
4044 heavyiron 45
    mcall  ,<35,24> ,0x80ffffff,label2
46
    mcall  ,<34,58> ,          ,label3
47
    mcall  ,<47,37> ,          ,label5
48
    mcall  ,<43,71> ,          ,label6
1742 mario79 49
 
4051 heavyiron 50
    mov   al,12
51
    mcall   ,2
1742 mario79 52
 
53
still:
4051 heavyiron 54
    mov  al,10
55
    mcall                                    ;wait here for event
1742 mario79 56
    dec  eax
4044 heavyiron 57
    jz   draw_window
1742 mario79 58
    dec  eax
59
    jnz  button
4044 heavyiron 60
 
4051 heavyiron 61
    mov  al,2
62
    mcall                                    ;eax=2 - get key code
1742 mario79 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
 
4044 heavyiron 76
button:
4051 heavyiron 77
    mov  al,17
78
    mcall                                    ;eax=17 - get pressed button id
1742 mario79 79
    xchg al,ah
80
    dec  eax
2676 leency 81
    jz   close_1
1742 mario79 82
    dec  eax
83
    jz   restart_kernel
84
    dec  eax
85
    jz   restart
86
    dec  eax
87
    jnz   run_rdsave
4051 heavyiron 88
;    dec  eax                                ; we have only one button left, this is close button
89
;    jnz  still
4044 heavyiron 90
 
2676 leency 91
power_off:
92
    push 2
93
    jmp  mcall_and_close
94
restart:
1742 mario79 95
    push 3
96
    jmp  mcall_and_close
4044 heavyiron 97
restart_kernel:
1742 mario79 98
    push 4
99
mcall_and_close:
100
    pop  ecx
4051 heavyiron 101
    mov  al,18
102
    mcall   ,9
1742 mario79 103
 
4044 heavyiron 104
close_1:
4051 heavyiron 105
    or  eax,-1
106
    mcall
4044 heavyiron 107
 
1742 mario79 108
run_rdsave:
4051 heavyiron 109
    mov  al,70
110
    mcall   ,rdsave
1742 mario79 111
    jmp still
112
 
113
data
4044 heavyiron 114
include 'data.inc'
1742 mario79 115
 
4044 heavyiron 116
udata
1742 mario79 117
 
4044 heavyiron 118
meos_app_end