Rev 31 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 31 | Rev 47 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ; |
1 | ; |
2 | ; END |
2 | ; END |
3 | ; |
3 | ; |
- | 4 | ; |
|
- | 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 |
|
Line 4... | Line -... | ||
4 | - | ||
5 | include "lang.inc" |
7 | |
Line 6... | Line 8... | ||
6 | include "macros.inc" |
8 | include "macros.inc" |
7 | 9 | ||
Line 8... | Line -... | ||
8 | meos_app_start |
- | |
9 | code |
- | |
10 | - | ||
11 | mov eax,40 |
- | |
12 | mov ebx,0111b |
- | |
13 | int 0x40 |
- | |
14 | - | ||
15 | call draw_window |
- | |
16 | - | ||
17 | still: |
- | |
18 | - | ||
19 | mov eax,10 ; wait here for event |
- | |
20 | ; mov ebx,100 |
- | |
21 | int 0x40 |
- | |
22 | - | ||
23 | cmp eax,1 |
- | |
24 | jz red |
- | |
25 | cmp eax,2 |
- | |
26 | jz key |
- | |
27 | cmp eax,3 |
- | |
28 | jz button |
- | |
29 | - | ||
30 | jmp still |
- | |
31 | - | ||
32 | red: |
- | |
33 | call draw_window |
- | |
34 | jmp still |
- | |
35 | - | ||
36 | key: |
- | |
37 | mcall 2 |
- | |
38 | cmp ah,13 |
- | |
39 | jz restart |
- | |
40 | cmp ah,27 |
- | |
41 | jz close_1 |
- | |
42 | cmp ah,180 |
- | |
43 | jz restart_kernel |
- | |
44 | cmp ah,181 |
- | |
45 | jz power_off |
- | |
46 | jmp red |
- | |
47 | - | ||
48 | button: |
- | |
49 | mov eax,17 |
- | |
50 | int 0x40 |
- | |
51 | - | ||
52 | cmp ah,1 |
- | |
53 | jne no_1 |
- | |
54 | power_off: |
- | |
55 | mcall 18,9,2 |
- | |
56 | jmp close_1 |
- | |
57 | - | ||
58 | no_1: |
- | |
59 | cmp ah,3 |
- | |
60 | jne no_2 |
- | |
61 | restart: |
- | |
62 | mcall 18,9,3 |
- | |
63 | jmp close_1 |
- | |
64 | - | ||
65 | no_2: |
- | |
66 | cmp ah,2 |
- | |
67 | jne no_4 |
- | |
68 | - | ||
69 | restart_kernel: |
10 | meos_app_start |
70 | mcall 18,9,4 |
- | |
71 | - | ||
72 | no_4: |
- | |
73 | cmp ah,4 |
- | |
74 | jne still |
- | |
75 | - | ||
76 | close_1: |
- | |
77 | or eax,-1 ; close this program |
- | |
78 | int 0x40 |
- | |
79 | - | ||
80 | - | ||
Line 81... | Line 11... | ||
81 | draw_window: |
11 | code |
82 | 12 | ||
83 | pusha |
13 | do_draw: |
84 | 14 | ||
85 | mov eax,48 |
15 | mov eax,48 |
Line 86... | Line 16... | ||
86 | mov ebx,3 |
16 | mov ebx,3 |
87 | mov ecx,sc |
17 | mov ecx,sc |
88 | mov edx,sizeof.system_colors |
18 | mov edx,sizeof.system_colors |
Line 89... | Line 19... | ||
89 | int 0x40 |
19 | int 0x40 |
90 | 20 | ||
Line 91... | Line -... | ||
91 | mov eax,12 ; tell os about redraw start |
- | |
92 | mov ebx,1 |
21 | mov al,12 ; eax=12 - tell os about redraw start |
Line 93... | Line 22... | ||
93 | int 0x40 |
22 | mov bl,1 |
94 | 23 | int 0x40 |
|
95 | mov eax,14 ; get screen max x & max y |
24 | |
96 | int 0x40 |
25 | mov al,14 ; eax=14 - get screen max x & max y |
97 | 26 | int 0x40 |
|
- | 27 | ||
Line 98... | Line 28... | ||
98 | xor ecx,ecx |
28 | movzx ecx,ax |
99 | mov cx,ax |
29 | |
100 | 30 | shr eax,17 |
|
101 | shr eax,17 |
31 | ; sub eax,110 |
- | 32 | shl eax,16 |
|
Line 102... | Line 33... | ||
102 | sub eax,110 |
33 | ; mov ebx,eax |
103 | shl eax,16 |
34 | ; add ebx,220 |
104 | mov ebx,eax |
35 | lea ebx,[eax-110*10000h+220] |
105 | add ebx,220 |
36 | |
106 | 37 | shr ecx,1 |
|
Line 107... | Line 38... | ||
107 | shr ecx,1 |
38 | ; sub ecx,50 |
- | 39 | shl ecx,16 |
|
108 | sub ecx,50 |
40 | ; add ecx,100 |
- | 41 | sub ecx,50*10000h - 100 |
|
109 | shl ecx,16 |
42 | |
110 | add ecx,100 |
43 | mov eax,0 ; define and draw window |
111 | 44 | mov edx,[sc.work_button] |
|
- | 45 | mov esi,edx ;[sc.work_button] |
|
- | 46 | xor edi,edi |
|
112 | mov eax,0 ; define and draw window |
47 | int 0x40 |
- | 48 | ||
- | 49 | xor edx,edx |
|
113 | mov edx,[sc.work_button] |
50 | mov al,13 |
114 | mov esi,edx ;[sc.work_button] |
51 | mcall ,14 shl 16+90,25 shl 16+27 |
115 | xor edi,edi |
52 | push ebx |
116 | int 0x40 |
53 | mcall ,117 shl 16+90, |
117 | 54 | xchg ebx,[esp] |
|
118 | xor edx,edx |
55 | mcall ,,59 shl 16+27 |
119 | mcall 13,14 shl 16+90,25 shl 16+27 |
56 | pop ebx |
Line 120... | Line 57... | ||
120 | mcall 13,117 shl 16+90, |
57 | mcall |
121 | mcall 13,14 shl 16+90,59 shl 16+27 |
58 | |
122 | mcall 13,117 shl 16+90, |
59 | mov al,8 |
123 | 60 | inc edx |
|
124 | mcall 8,15 shl 16+87,26 shl 16+24,1,0xdd7700 |
61 | mcall ,15 shl 16+87,26 shl 16+24,,0xdd7700 |
125 | inc dl |
62 | inc edx |
Line 157... | Line 94... | ||
157 | mov ebx,40*65536+75 |
94 | mov ebx,40*65536+75 |
158 | mov edx,label5 ; pointer to text beginning |
95 | mov edx,label5 ; pointer to text beginning |
159 | mov esi,label5_len ; text length |
96 | mov esi,label5_len ; text length |
160 | int 0x40 |
97 | int 0x40 |
Line 161... | Line 98... | ||
161 | 98 | ||
162 | mov eax,12 ; tell os about redraw end |
99 | mov al,12 ; tell os about redraw end |
163 | mov ebx,2 |
100 | mov ebx,2 |
Line 164... | Line 101... | ||
164 | int 0x40 |
101 | int 0x40 |
Line -... | Line 102... | ||
- | 102 | ||
165 | 103 | still: |
|
Line -... | Line 104... | ||
- | 104 | ||
- | 105 | mov eax,10 ; wait here for event |
|
- | 106 | int 0x40 |
|
- | 107 | ||
- | 108 | dec eax |
|
- | 109 | jz do_draw |
|
- | 110 | dec eax |
|
- | 111 | jnz button |
|
- | 112 | key: |
|
- | 113 | mov al,2 ; now eax=2 - get key code |
|
- | 114 | int 40h |
|
- | 115 | mov al,ah |
|
- | 116 | cmp al,13 |
|
- | 117 | jz restart |
|
- | 118 | cmp al,27 |
|
- | 119 | jz close_1 |
|
- | 120 | cmp al,180 |
|
- | 121 | jz restart_kernel |
|
- | 122 | cmp al,181 |
|
- | 123 | jz power_off |
|
- | 124 | jmp still |
|
- | 125 | ||
- | 126 | button: |
|
- | 127 | mov al,17 ; now eax=17 - get pressed button id |
|
- | 128 | int 0x40 |
|
- | 129 | xchg al,ah |
|
- | 130 | dec eax |
|
- | 131 | jz power_off |
|
- | 132 | dec eax |
|
- | 133 | jz restart_kernel |
|
- | 134 | dec eax |
|
- | 135 | jz restart |
|
- | 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 | int 40h |
|
Line -... | Line 142... | ||
- | 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: |
|
Line 166... | Line 152... | ||
166 | popa |
152 | push 4 |
Line 167... | Line 153... | ||
167 | 153 | mcall_and_close: |