Subversion Repositories Kolibri OS

Rev

Rev 4944 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4944 Rev 5098
1
;   This program shows  state of mouse buttons   ;
1
;   This program shows  state of mouse buttons   ;
2
;  to compile: nasm -f bin mstate.asm -o mstate  ;
2
;  to compile: nasm -f bin mstate.asm -o mstate  ;
3
ORG 0
3
ORG 0
4
BITS 32
4
BITS 32
5
; ---------------------------------------------------------------------------- ;
5
; ---------------------------------------------------------------------------- ;
6
PATH_SIZE                         equ 256
6
PATH_SIZE                         equ 256
7
PARAMS_SIZE                       equ 256
7
PARAMS_SIZE                       equ 256
8
STACK_SIZE                        equ 256
8
STACK_SIZE                        equ 256
9
; ---------------------------------------------------------------------------- ;
9
; ---------------------------------------------------------------------------- ;
10
TEXT_WIDTH                        equ 6
10
TEXT_WIDTH                        equ 6
11
TEXT_HEIGHT                       equ 9
11
TEXT_HEIGHT                       equ 9
12
; ---------------------------------------------------------------------------- ;
12
; ---------------------------------------------------------------------------- ;
13
MOUSE_LEFT_BUTTON_MASK            equ         1b
13
MOUSE_LEFT_BUTTON_MASK            equ         1b
14
MOUSE_RIGHT_BUTTON_MASK           equ        10b
14
MOUSE_RIGHT_BUTTON_MASK           equ        10b
15
MOUSE_MIDDLE_BUTTON_MASK          equ       100b
15
MOUSE_MIDDLE_BUTTON_MASK          equ       100b
16
; ---------------------------------------------------------------------------- ;
16
; ---------------------------------------------------------------------------- ;
17
EM_REDRAW                         equ         1b
17
EM_REDRAW                         equ         1b
18
EM_KEY                            equ        10b
18
EM_KEY                            equ        10b
19
EM_BUTTON                         equ       100b
19
EM_BUTTON                         equ       100b
20
EM_RESERVED0                      equ      1000b
20
EM_RESERVED0                      equ      1000b
21
EM_REDRAW_BACKGROUND              equ     10000b
21
EM_REDRAW_BACKGROUND              equ     10000b
22
EM_MOUSE                          equ    100000b
22
EM_MOUSE                          equ    100000b
23
EM_IPC                            equ   1000000b
23
EM_IPC                            equ   1000000b
24
EM_NETWORK                        equ  10000000b
24
EM_NETWORK                        equ  10000000b
25
EM_DEBUG                          equ 100000000b
25
EM_DEBUG                          equ 100000000b
26
; ---------------------------------------------------------------------------- ;
26
; ---------------------------------------------------------------------------- ;
27
WINDOW_STYLE_SKINNED_FIXED        equ 0x4000000
27
WINDOW_STYLE_SKINNED_FIXED        equ 0x4000000
28
WINDOW_STYLE_COORD_CLIENT         equ 0x20000000
28
WINDOW_STYLE_COORD_CLIENT         equ 0x20000000
29
WINDOW_STYLE_CAPTION              equ 0x10000000
29
WINDOW_STYLE_CAPTION              equ 0x10000000
30
; ---------------------------------------------------------------------------- ;
30
; ---------------------------------------------------------------------------- ;
31
WINDOW_BORDER_SIZE                equ 5
31
WINDOW_BORDER_SIZE                equ 5
32
; ---------------------------------------------------------------------------- ;
32
; ---------------------------------------------------------------------------- ;
33
WINDOW_STYLE                      equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION
33
WINDOW_STYLE                      equ WINDOW_STYLE_SKINNED_FIXED | WINDOW_STYLE_COORD_CLIENT | WINDOW_STYLE_CAPTION
34
; ---------------------------------------------------------------------------- ;
34
; ---------------------------------------------------------------------------- ;
35
MOUSE_BODY_COLOR                  equ 0x007C7C96
35
MOUSE_BODY_COLOR                  equ 0x007C7C96
36
MOUSE_LEFT_BUTTON_COLOR           equ 0x008293A4
36
MOUSE_LEFT_BUTTON_COLOR           equ 0x008293A4
37
MOUSE_RIGHT_BUTTON_COLOR          equ 0x008293A4
37
MOUSE_RIGHT_BUTTON_COLOR          equ 0x008293A4
38
MOUSE_MIDDLE_BUTTON_COLOR         equ 0x00A48293
38
MOUSE_MIDDLE_BUTTON_COLOR         equ 0x00A48293
39
MOUSE_LEFT_BUTTON_PRESSED_COLOR   equ 0x00568EC7
39
MOUSE_LEFT_BUTTON_PRESSED_COLOR   equ 0x00568EC7
40
MOUSE_RIGHT_BUTTON_PRESSED_COLOR  equ 0x00568EC7
40
MOUSE_RIGHT_BUTTON_PRESSED_COLOR  equ 0x00568EC7
41
MOUSE_MIDDLE_BUTTON_PRESSED_COLOR equ 0x00C7568E
41
MOUSE_MIDDLE_BUTTON_PRESSED_COLOR equ 0x00C7568E
42
WINDOW_BACK_COLOR                 equ 0x00EFEFEF
42
WINDOW_BACK_COLOR                 equ 0x00EFEFEF
43
; ---------------------------------------------------------------------------- ;
43
; ---------------------------------------------------------------------------- ;
44
MOUSE_WIDTH                       equ 120
44
MOUSE_WIDTH                       equ 120
45
MOUSE_HEIGHT                      equ 240
45
MOUSE_HEIGHT                      equ 240
46
MOUSE_MARGIN                      equ 4
46
MOUSE_MARGIN                      equ 4
47
BUTTONS_MARGIN                    equ 2
47
BUTTONS_MARGIN                    equ 2
48
; ---------------------------------------------------------------------------- ;
48
; ---------------------------------------------------------------------------- ;
49
MOUSE_LEFT                        equ MOUSE_MARGIN
49
MOUSE_LEFT                        equ MOUSE_MARGIN
50
MOUSE_TOP                         equ MOUSE_MARGIN
50
MOUSE_TOP                         equ MOUSE_MARGIN
51
WINDOW_WIDTH                      equ MOUSE_WIDTH + WINDOW_BORDER_SIZE * 2 + MOUSE_MARGIN * 2
51
WINDOW_WIDTH                      equ MOUSE_WIDTH + WINDOW_BORDER_SIZE * 2 + MOUSE_MARGIN * 2
52
MOUSE_BODY_HEIGHT                 equ (MOUSE_HEIGHT - BUTTONS_MARGIN) / 2
52
MOUSE_BODY_HEIGHT                 equ (MOUSE_HEIGHT - BUTTONS_MARGIN) / 2
53
MOUSE_BODY_TOP                    equ MOUSE_HEIGHT  - MOUSE_BODY_HEIGHT + MOUSE_TOP
53
MOUSE_BODY_TOP                    equ MOUSE_HEIGHT  - MOUSE_BODY_HEIGHT + MOUSE_TOP
54
LEFT_BUTTON_HEIGHT                equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
54
LEFT_BUTTON_HEIGHT                equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
55
RIGHT_BUTTON_HEIGHT               equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
55
RIGHT_BUTTON_HEIGHT               equ MOUSE_HEIGHT - MOUSE_BODY_HEIGHT - BUTTONS_MARGIN
56
LEFT_BUTTON_WIDTH                 equ (MOUSE_WIDTH  - BUTTONS_MARGIN) / 2
56
LEFT_BUTTON_WIDTH                 equ (MOUSE_WIDTH  - BUTTONS_MARGIN) / 2
57
RIGHT_BUTTON_WIDTH                equ MOUSE_WIDTH  - LEFT_BUTTON_WIDTH - BUTTONS_MARGIN
57
RIGHT_BUTTON_WIDTH                equ MOUSE_WIDTH  - LEFT_BUTTON_WIDTH - BUTTONS_MARGIN
58
LEFT_BUTTON_LEFT                  equ MOUSE_LEFT
58
LEFT_BUTTON_LEFT                  equ MOUSE_LEFT
59
RIGHT_BUTTON_LEFT                 equ LEFT_BUTTON_LEFT + LEFT_BUTTON_WIDTH + BUTTONS_MARGIN
59
RIGHT_BUTTON_LEFT                 equ LEFT_BUTTON_LEFT + LEFT_BUTTON_WIDTH + BUTTONS_MARGIN
60
MIDDLE_BUTTON_WIDTH               equ MOUSE_WIDTH / 10
60
MIDDLE_BUTTON_WIDTH               equ MOUSE_WIDTH / 10
61
MIDDLE_BUTTON_HEIGHT              equ MOUSE_HEIGHT / 6
61
MIDDLE_BUTTON_HEIGHT              equ MOUSE_HEIGHT / 6
62
MIDDLE_BUTTON_LEFT                equ (MOUSE_WIDTH - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_LEFT
62
MIDDLE_BUTTON_LEFT                equ (MOUSE_WIDTH - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_LEFT
63
MIDDLE_BUTTON_TOP                 equ (MOUSE_WIDTH / 2 - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_TOP
63
MIDDLE_BUTTON_TOP                 equ (MOUSE_WIDTH / 2 - MIDDLE_BUTTON_WIDTH) / 2 + MOUSE_TOP
64
; ---------------------------------------------------------------------------- ;
64
; ---------------------------------------------------------------------------- ;
65
%define SZ_BUTTONS_STATE "Buttons state:"
65
%define SZ_BUTTONS_STATE "Buttons state:"
66
%define SZ_BIN "bin:"
66
%define SZ_BIN "bin:"
67
%define SZ_HEX "hex:0x"
67
%define SZ_HEX "hex:0x"
68
%strlen LEN_SZ_BUTTONS_STATE SZ_BUTTONS_STATE
68
%strlen LEN_SZ_BUTTONS_STATE SZ_BUTTONS_STATE
69
%strlen LEN_SZ_BIN SZ_BIN
69
%strlen LEN_SZ_BIN SZ_BIN
70
%strlen LEN_SZ_HEX SZ_HEX
70
%strlen LEN_SZ_HEX SZ_HEX
71
; ---------------------------------------------------------------------------- ;
71
; ---------------------------------------------------------------------------- ;
72
STATE_VALUES_HEIGHT               equ 3 * TEXT_HEIGHT ; we have three lines of text
72
STATE_VALUES_HEIGHT               equ 3 * TEXT_HEIGHT ; we have three lines of text
73
STATE_VALUES_WIDTH                equ LEN_SZ_BUTTONS_STATE * TEXT_WIDTH
73
STATE_VALUES_WIDTH                equ LEN_SZ_BUTTONS_STATE * TEXT_WIDTH
74
STATE_VALUES_TOP                  equ (MOUSE_BODY_HEIGHT - STATE_VALUES_HEIGHT) / 2 + MOUSE_BODY_TOP
74
STATE_VALUES_TOP                  equ (MOUSE_BODY_HEIGHT - STATE_VALUES_HEIGHT) / 2 + MOUSE_BODY_TOP
75
STATE_VALUES_LEFT                 equ (MOUSE_WIDTH - STATE_VALUES_WIDTH) / 2 + MOUSE_LEFT
75
STATE_VALUES_LEFT                 equ (MOUSE_WIDTH - STATE_VALUES_WIDTH) / 2 + MOUSE_LEFT
76
; ---------------------------------------------------------------------------- ;
76
; ---------------------------------------------------------------------------- ;
77
MENUET01                          db 'MENUET01'
77
MENUET01                          db 'MENUET01'
78
version                           dd 1
78
version                           dd 1
79
program.start                     dd START
79
program.start                     dd START
80
program.end                       dd END
80
program.end                       dd _END
81
program.memory                    dd END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
81
program.memory                    dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
82
program.stack                     dd END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
82
program.stack                     dd _END + PATH_SIZE + PARAMS_SIZE + STACK_SIZE
83
program.params                    dd END + PATH_SIZE
83
program.params                    dd _END + PATH_SIZE
84
program.path                      dd END
84
program.path                      dd _END
85
; ---------------------------------------------------------------------------- ;
85
; ---------------------------------------------------------------------------- ;
86
mouse_body_color                  dd MOUSE_BODY_COLOR
86
mouse_body_color                  dd MOUSE_BODY_COLOR
87
mouse_left_button_color           dd MOUSE_LEFT_BUTTON_COLOR
87
mouse_left_button_color           dd MOUSE_LEFT_BUTTON_COLOR
88
mouse_right_button_color          dd MOUSE_RIGHT_BUTTON_COLOR
88
mouse_right_button_color          dd MOUSE_RIGHT_BUTTON_COLOR
89
mouse_middle_button_color         dd MOUSE_MIDDLE_BUTTON_COLOR
89
mouse_middle_button_color         dd MOUSE_MIDDLE_BUTTON_COLOR
90
; ---------------------------------------------------------------------------- ;
90
; ---------------------------------------------------------------------------- ;
91
mouse.button                      dd 0
91
mouse.button                      dd 0
92
; ---------------------------------------------------------------------------- ;
92
; ---------------------------------------------------------------------------- ;
93
sz_caption                        db "MouseState",0
93
sz_caption                        db "MouseState",0
94
; ---------------------------------------------------------------------------- ;
94
; ---------------------------------------------------------------------------- ;
95
sz_button_state                   db SZ_BUTTONS_STATE,0
95
sz_button_state                   db SZ_BUTTONS_STATE,0
96
sz_bin                            db SZ_BIN,0
96
sz_bin                            db SZ_BIN,0
97
sz_hex                            db SZ_HEX,0
97
sz_hex                            db SZ_HEX,0
98
; ---------------------------------------------------------------------------- ;
98
; ---------------------------------------------------------------------------- ;
99
%macro DrawMouseBody 0
99
%macro DrawMouseBody 0
100
; draw.rectangle
100
; draw.rectangle
101
        mov    eax, 13
101
        mov    eax, 13
102
        mov    ebx, MOUSE_LEFT         << 16 | MOUSE_WIDTH
102
        mov    ebx, MOUSE_LEFT         << 16 | MOUSE_WIDTH
103
        mov    ecx, MOUSE_BODY_TOP     << 16 | MOUSE_BODY_HEIGHT
103
        mov    ecx, MOUSE_BODY_TOP     << 16 | MOUSE_BODY_HEIGHT
104
        mov    edx, [mouse_body_color]
104
        mov    edx, [mouse_body_color]
105
        int    64
105
        int    64
106
; texts
106
; texts
107
        mov    eax, 4
107
        mov    eax, 4
108
        mov    ecx, 1100b << 28 | WINDOW_BACK_COLOR
108
        mov    ecx, 1100b << 28 | WINDOW_BACK_COLOR
109
        mov    edi, [mouse_body_color]
109
        mov    edi, [mouse_body_color]
110
; draw.text
110
; draw.text
111
        mov    ebx, (STATE_VALUES_LEFT << 16) | STATE_VALUES_TOP
111
        mov    ebx, (STATE_VALUES_LEFT << 16) | STATE_VALUES_TOP
112
        mov    edx, sz_button_state
112
        mov    edx, sz_button_state
113
        int    64
113
        int    64
114
; draw.text
114
; draw.text
115
        add    ebx, TEXT_HEIGHT
115
        add    ebx, TEXT_HEIGHT
116
        mov    edx, sz_bin
116
        mov    edx, sz_bin
117
        int    64
117
        int    64
118
; draw.text
118
; draw.text
119
        add    ebx, TEXT_HEIGHT
119
        add    ebx, TEXT_HEIGHT
120
        mov    edx, sz_hex
120
        mov    edx, sz_hex
121
        int    64
121
        int    64
122
%endmacro
122
%endmacro
123
; ---------------------------------------------------------------------------- ;
123
; ---------------------------------------------------------------------------- ;
124
align 4
124
align 4
125
DrawMouseButtons:
125
DrawMouseButtons:
126
        mov    eax, 13
126
        mov    eax, 13
127
; draw.rectangle
127
; draw.rectangle
128
        mov    ebx, LEFT_BUTTON_LEFT   << 16 | LEFT_BUTTON_WIDTH
128
        mov    ebx, LEFT_BUTTON_LEFT   << 16 | LEFT_BUTTON_WIDTH
129
        mov    ecx, MOUSE_TOP          << 16 | LEFT_BUTTON_HEIGHT
129
        mov    ecx, MOUSE_TOP          << 16 | LEFT_BUTTON_HEIGHT
130
        mov    edx, [mouse_left_button_color]
130
        mov    edx, [mouse_left_button_color]
131
        int    64
131
        int    64
132
; draw.rectangle
132
; draw.rectangle
133
        mov    ebx, RIGHT_BUTTON_LEFT  << 16 | RIGHT_BUTTON_WIDTH
133
        mov    ebx, RIGHT_BUTTON_LEFT  << 16 | RIGHT_BUTTON_WIDTH
134
        mov    ecx, MOUSE_TOP          << 16 | RIGHT_BUTTON_HEIGHT
134
        mov    ecx, MOUSE_TOP          << 16 | RIGHT_BUTTON_HEIGHT
135
        mov    edx, [mouse_right_button_color]
135
        mov    edx, [mouse_right_button_color]
136
        int    64
136
        int    64
137
; draw.rectangle
137
; draw.rectangle
138
        mov    ebx, MIDDLE_BUTTON_LEFT << 16 | MIDDLE_BUTTON_WIDTH
138
        mov    ebx, MIDDLE_BUTTON_LEFT << 16 | MIDDLE_BUTTON_WIDTH
139
        mov    ecx, MIDDLE_BUTTON_TOP  << 16 | MIDDLE_BUTTON_HEIGHT
139
        mov    ecx, MIDDLE_BUTTON_TOP  << 16 | MIDDLE_BUTTON_HEIGHT
140
        mov    edx, [mouse_middle_button_color]
140
        mov    edx, [mouse_middle_button_color]
141
        int    64
141
        int    64
142
; Draw State Values
142
; Draw State Values
143
        mov    eax, 47
143
        mov    eax, 47
144
        mov    esi, 0100b << 28 | WINDOW_BACK_COLOR
144
        mov    esi, 0100b << 28 | WINDOW_BACK_COLOR
145
        mov    ecx, [mouse.button]
145
        mov    ecx, [mouse.button]
146
        mov    edi, [mouse_body_color]
146
        mov    edi, [mouse_body_color]
147
; draw.number
147
; draw.number
148
        mov    ebx, (10 << 16) | (2 << 8) ; 10 digits, base2
148
        mov    ebx, (10 << 16) | (2 << 8) ; 10 digits, base2
149
        mov    edx, (LEN_SZ_BIN * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT)
149
        mov    edx, (LEN_SZ_BIN * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT)
150
        int    64
150
        int    64
151
; draw.number
151
; draw.number
152
        mov    ebx, (8 << 16) | (1 << 8) ; 8 digits, base16
152
        mov    ebx, (8 << 16) | (1 << 8) ; 8 digits, base16
153
        mov    edx, (LEN_SZ_HEX * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT * 2)
153
        mov    edx, (LEN_SZ_HEX * TEXT_WIDTH + STATE_VALUES_LEFT) << 16 | (STATE_VALUES_TOP + TEXT_HEIGHT * 2)
154
        int    64
154
        int    64
155
        ret
155
        ret
156
; ---------------------------------------------------------------------------- ;
156
; ---------------------------------------------------------------------------- ;
157
align 4
157
align 4
158
START:
158
START:
159
; get.screen.size
159
; get.screen.size
160
        mov    eax, 61
160
        mov    eax, 61
161
        mov    ebx, 1
161
        mov    ebx, 1
162
        int    64        
162
        int    64        
163
        mov    edx, eax
163
        mov    edx, eax
164
        movzx  ecx, ax
164
        movzx  ecx, ax
165
        shr    edx, 16
165
        shr    edx, 16
166
; skin.height
166
; skin.height
167
        mov    eax, 48
167
        mov    eax, 48
168
        mov    ebx, 4
168
        mov    ebx, 4
169
        int    64
169
        int    64
170
        add    eax, MOUSE_HEIGHT + WINDOW_BORDER_SIZE + MOUSE_MARGIN * 2 - 1
170
        add    eax, MOUSE_HEIGHT + WINDOW_BORDER_SIZE + MOUSE_MARGIN * 2 - 1
171
        mov    esi, eax
171
        mov    esi, eax
172
        sub    edx, (WINDOW_WIDTH - 1)
172
        sub    edx, (WINDOW_WIDTH - 1)
173
        sub    ecx, eax
173
        sub    ecx, eax
174
        shr    edx, 1
174
        shr    edx, 1
175
        shr    ecx, 1
175
        shr    ecx, 1
176
; set.event
176
; set.event
177
        mov    eax, 40
177
        mov    eax, 40
178
        mov    ebx, EM_REDRAW | EM_BUTTON | EM_MOUSE
178
        mov    ebx, EM_REDRAW | EM_BUTTON | EM_MOUSE
179
        int    64
179
        int    64
180
; ---------------------------------------------------------------------------- ;
180
; ---------------------------------------------------------------------------- ;
181
align 4
181
align 4
182
on_redraw:
182
on_redraw:
183
; redraw.start
183
; redraw.start
184
        mov    eax, 12
184
        mov    eax, 12
185
        mov    ebx, 1
185
        mov    ebx, 1
186
        int    64
186
        int    64
187
; draw.window
187
; draw.window
188
        xor    eax, eax
188
        xor    eax, eax
189
        mov    ebx, edx ; window.left
189
        mov    ebx, edx ; window.left
190
; ecx = window.top
190
; ecx = window.top
191
        shl    ebx, 16
191
        shl    ebx, 16
192
        shl    ecx, 16
192
        shl    ecx, 16
193
        or     ebx, (WINDOW_WIDTH - 1)
193
        or     ebx, (WINDOW_WIDTH - 1)
194
        or     ecx, esi ; window.height
194
        or     ecx, esi ; window.height
195
        mov    edx, WINDOW_STYLE | WINDOW_BACK_COLOR
195
        mov    edx, WINDOW_STYLE | WINDOW_BACK_COLOR
196
        mov    edi, sz_caption
196
        mov    edi, sz_caption
197
        xor    esi, esi
197
        xor    esi, esi
198
        int    64
198
        int    64
199
; redraw.finish
199
; redraw.finish
200
        mov    eax, 12
200
        mov    eax, 12
201
        mov    ebx, 2
201
        mov    ebx, 2
202
        int    64
202
        int    64
203
        DrawMouseBody
203
        DrawMouseBody
204
        call   DrawMouseButtons
204
        call   DrawMouseButtons
205
align 4
205
align 4
206
wait.event:
206
wait.event:
207
        mov    eax, 10    ; redraw = 001b; 001b & 110b = 000b
207
        mov    eax, 10    ; redraw = 001b; 001b & 110b = 000b
208
        int    64         ; button = 011b; 011b & 110b = 010b
208
        int    64         ; button = 011b; 011b & 110b = 010b
209
        test   eax, 110b  ; mouse  = 110b; 110b & 110b = 110b
209
        test   eax, 110b  ; mouse  = 110b; 110b & 110b = 110b
210
        jz     on_redraw
210
        jz     on_redraw
211
        jnp    on_button
211
        jnp    on_button
212
; get.mouse.button
212
; get.mouse.button
213
        mov    eax, 37
213
        mov    eax, 37
214
        mov    ebx, 2
214
        mov    ebx, 2
215
        int    64
215
        int    64
216
        cmp    [mouse.button], eax ;      if equal
216
        cmp    [mouse.button], eax ;      if equal
217
        je     wait.event          ; then no need update
217
        je     wait.event          ; then no need update
218
        mov    ebx, dword MOUSE_LEFT_BUTTON_COLOR
218
        mov    ebx, dword MOUSE_LEFT_BUTTON_COLOR
219
        mov    ecx, dword MOUSE_RIGHT_BUTTON_COLOR
219
        mov    ecx, dword MOUSE_RIGHT_BUTTON_COLOR
220
        mov    edx, dword MOUSE_MIDDLE_BUTTON_COLOR
220
        mov    edx, dword MOUSE_MIDDLE_BUTTON_COLOR
221
.left:
221
.left:
222
        test   eax, MOUSE_LEFT_BUTTON_MASK
222
        test   eax, MOUSE_LEFT_BUTTON_MASK
223
        jz     .right
223
        jz     .right
224
        mov    ebx, dword MOUSE_LEFT_BUTTON_PRESSED_COLOR
224
        mov    ebx, dword MOUSE_LEFT_BUTTON_PRESSED_COLOR
225
.right:
225
.right:
226
        test   eax, MOUSE_RIGHT_BUTTON_MASK
226
        test   eax, MOUSE_RIGHT_BUTTON_MASK
227
        jz     .middle
227
        jz     .middle
228
        mov    ecx, dword MOUSE_RIGHT_BUTTON_PRESSED_COLOR
228
        mov    ecx, dword MOUSE_RIGHT_BUTTON_PRESSED_COLOR
229
.middle:
229
.middle:
230
        test   eax, MOUSE_MIDDLE_BUTTON_MASK
230
        test   eax, MOUSE_MIDDLE_BUTTON_MASK
231
        jz     .other
231
        jz     .other
232
        mov    edx, dword MOUSE_MIDDLE_BUTTON_PRESSED_COLOR
232
        mov    edx, dword MOUSE_MIDDLE_BUTTON_PRESSED_COLOR
233
.other:
233
.other:
234
        mov    [mouse_left_button_color], ebx
234
        mov    [mouse_left_button_color], ebx
235
        mov    [mouse_right_button_color], ecx
235
        mov    [mouse_right_button_color], ecx
236
        mov    [mouse_middle_button_color], edx
236
        mov    [mouse_middle_button_color], edx
237
        mov    [mouse.button], eax
237
        mov    [mouse.button], eax
238
        call   DrawMouseButtons
238
        call   DrawMouseButtons
239
        jmp    wait.event
239
        jmp    wait.event
240
align 4
240
align 4
241
on_button: ; terminate because we have only one button(close button)
241
on_button: ; terminate because we have only one button(close button)
242
        or     eax, -1
242
        or     eax, -1
243
        int    64
243
        int    64
244
; ---------------------------------------------------------------------------- ;
244
; ---------------------------------------------------------------------------- ;
245
align 4
245
align 4
246
END:
-
 
247
246
_END:
-
 
247