Subversion Repositories Kolibri OS

Rev

Rev 316 | Rev 551 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 316 Rev 485
Line 13... Line 13...
13
         dd   0x1000               ; memory for app
13
         dd   0x1000               ; memory for app
14
         dd   0x1000               ; esp
14
         dd   0x1000               ; esp
15
         dd   0x0,0x0              ; I_Param , I_Icon
15
         dd   0x0,0x0              ; I_Param , I_Icon
Line 16... Line 16...
16
 
16
 
-
 
17
include 'lang.inc'
17
include 'lang.inc'
18
include '..\..\..\macros.inc'
18
wide:    dd   0                    ; screen pixels width
19
wide:    dd   0                    ; screen pixels width
Line 19... Line 20...
19
mouse:   dd   0                    ; 1=right,2=left [mouse click]
20
mouse:   dd   0                    ; 1=right,2=left [mouse click]
Line 20... Line 21...
20
 
21
 
21
 
22
 
22
start:
23
start:
23
 
24
 
24
    mov  eax,14                    ; get screen size
25
    mov  eax,14                    ; get screen size
Line 25... Line 26...
25
    int  0x40
26
    mcall
Line 26... Line 27...
26
    shr  eax,16                    ; get width into AX
27
    shr  eax,16                    ; get width into AX
27
    inc  eax                       ; not 0 based
28
    inc  eax                       ; not 0 based
28
    mov  [wide],eax
29
    mov  [wide],eax
29
 
30
 
Line 30... Line 31...
30
    call draw_window
31
    call draw_window
31
 
32
 
32
still:
33
still:
33
    mov  eax,23                    ; wait for event w/timeout
34
    mov  eax,23                    ; wait for event w/timeout
Line 44... Line 45...
44
    jne  s3
45
    jne  s3
45
    jmp   button
46
    jmp   button
46
s3: mov  eax,9                     ; process info function
47
s3: mov  eax,9                     ; process info function
47
    mov  ebx,stat_table            ; return data table
48
    mov  ebx,stat_table            ; return data table
48
    mov  ecx,-1                    ; who am i
49
    mov  ecx,-1                    ; who am i
49
    int  0x40
50
    mcall
50
    cmp  ax,[stat_table+4]         ; are we active?
51
    cmp  ax,[stat_table+4]         ; are we active?
51
    je   active                    ; yep
52
    je   active                    ; yep
52
    jmp  still
53
    jmp  still
Line 53... Line 54...
53
 
54
 
54
  active:
55
  active:
55
    mov  eax,37                    ; mouse info function
56
    mov  eax,37                    ; mouse info function
56
    mov  ebx,2                     ; get buttons
57
    mov  ebx,2                     ; get buttons
57
    int  0x40
58
    mcall
58
    cmp  eax,0                     ; mouse click?
59
    cmp  eax,0                     ; mouse click?
59
    jne  click
60
    jne  click
60
    jmp  still
61
    jmp  still
61
  click:
62
  click:
62
    mov  [mouse],eax               ; save mouse click
63
    mov  [mouse],eax               ; save mouse click
63
    mov  eax,37                    ; mouse info
64
    mov  eax,37                    ; mouse info
64
    xor  ebx,ebx                   ; get screen pos for mouse
65
    xor  ebx,ebx                   ; get screen pos for mouse
65
    int  0x40                      ; into EAX
66
    mcall                      ; into EAX
66
    xor  ebx,ebx
67
    xor  ebx,ebx
67
    mov  bx,ax                     ; BX=y screen position
68
    mov  bx,ax                     ; BX=y screen position
68
    shr  eax,16                    ; AX=x screen position
69
    shr  eax,16                    ; AX=x screen position
69
    xchg eax,ebx                   ; EAX=y, EBX=x
70
    xchg eax,ebx                   ; EAX=y, EBX=x
70
    dec  eax                       ; don't calc mouse scanline
71
    dec  eax                       ; don't calc mouse scanline
71
    mov  ecx,[wide]                ; get pixels wide
72
    mov  ecx,[wide]                ; get pixels wide
72
    mul  ecx
73
    mul  ecx
73
    add  ebx,eax                   ; add x
74
    add  ebx,eax                   ; add x
74
    mov  eax,35                    ; get mouse pos pixel
75
    mov  eax,35                    ; get mouse pos pixel
75
    int  0x40                      ; EAX=mouse pixel color
76
    mcall                      ; EAX=mouse pixel color
76
    mov  ebx,eax                   ; EBX has color
77
    mov  ebx,eax                   ; EBX has color
77
    mov  esi,colors                ; color table
78
    mov  esi,colors                ; color table
78
    mov  ecx,72                    ; total colors
79
    mov  ecx,72                    ; total colors
79
    xor  edx,edx                   ; init a counter
80
    xor  edx,edx                   ; init a counter
Line 108... Line 109...
108
    call draw_window
109
    call draw_window
109
    jmp  still
110
    jmp  still
Line 110... Line 111...
110
 
111
 
111
  key:                             ; key
112
  key:                             ; key
112
    mov  eax,2                     ; just read it and ignore
113
    mov  eax,2                     ; just read it and ignore
113
    int  0x40
114
    mcall
114
    cmp  al,0                      ; key in buffer?
115
    cmp  al,0                      ; key in buffer?
115
    je   k1                        ; yep
116
    je   k1                        ; yep
116
    jmp  still
117
    jmp  still
117
k1: cmp  ah,'H'                    ; cap H ?
118
k1: cmp  ah,'H'                    ; cap H ?
Line 122... Line 123...
122
k2: call help                      ; show help screen
123
k2: call help                      ; show help screen
123
    jmp  still
124
    jmp  still
Line 124... Line 125...
124
 
125
 
125
  button:                          ; button
126
  button:                          ; button
126
    mov  eax,17                    ; get id
127
    mov  eax,17                    ; get id
127
    int  0x40
128
    mcall
128
    cmp  ah,1                      ; button id=1 ?
129
    cmp  ah,1                      ; button id=1 ?
129
    je   close
130
    je   close
Line 130... Line 131...
130
    jmp  still
131
    jmp  still
131
 
132
 
132
  close:
133
  close:
Line 133... Line 134...
133
    mov  eax,-1                    ; close this program
134
    mov  eax,-1                    ; close this program
134
    int  0x40
135
    mcall
135
 
136
 
Line 141... Line 142...
141
 
142
 
Line 142... Line 143...
142
draw_window:
143
draw_window:
143
 
144
 
144
    mov  eax,12                    ; tell os about windowdraw
145
    mov  eax,12                    ; tell os about windowdraw
Line 145... Line 146...
145
    mov  ebx,1                     ; 1, start of draw
146
    mov  ebx,1                     ; 1, start of draw
146
    int  0x40
147
    mcall
147
 
148
 
148
    mov  eax,0                     ; DRAW WINDOW
149
    mov  eax,0                     ; DRAW WINDOW
149
    mov  ebx,1*65536+200           ; [x start] *65536 + [x size]
150
    mov  ebx,1*65536+200           ; [x start] *65536 + [x size]
150
    mov  ecx,200*65536+240         ; [y start] *65536 + [y size]
151
    mov  ecx,200*65536+240         ; [y start] *65536 + [y size]
Line 151... Line 152...
151
    mov  edx,0x13000000            ; work area color (type II)
152
    mov  edx,0x13000000            ; work area color (type II)
Line 152... Line 153...
152
    mov  edi,header                ; frame color
153
    mov  edi,title                ; frame color
153
    int  0x40
154
    mcall
154
   
155
   
Line 155... Line 156...
155
    call palette                   ; display color palette
156
    call palette                   ; display color palette
Line 156... Line 157...
156
 
157
 
Line 176... Line 177...
176
p2: push ecx
177
p2: push ecx
177
    push edx
178
    push edx
178
    mov  ecx,edx                   ; y coord
179
    mov  ecx,edx                   ; y coord
179
    mov  edx,[ebp]                 ; color
180
    mov  edx,[ebp]                 ; color
180
    mov  eax,13                    ; draw bar function
181
    mov  eax,13                    ; draw bar function
181
    int  0x40
182
    mcall
182
    pop  edx
183
    pop  edx
183
    pop  ecx
184
    pop  ecx
184
    add  ebx,19*65536              ; next column
185
    add  ebx,19*65536              ; next column
185
    add  ebp,4                     ; next color
186
    add  ebp,4                     ; next color
186
p3: loop p2
187
p3: loop p2
Line 195... Line 196...
195
draw_picks:
196
draw_picks:
196
    mov  ebx,64*65536+24           ; draw x and width
197
    mov  ebx,64*65536+24           ; draw x and width
197
    mov  ecx,188*65536+42          ; draw y and depth
198
    mov  ecx,188*65536+42          ; draw y and depth
198
    mov  edx,0xc0c0c0              ; color grey
199
    mov  edx,0xc0c0c0              ; color grey
199
    mov  eax,13                    ; draw bar function
200
    mov  eax,13                    ; draw bar function
200
    int  0x40
201
    mcall
201
    mov  eax,[picks]               ; first picked color
202
    mov  eax,[picks]               ; first picked color
202
    mov  esi,22*65536+196          ; print at x and y
203
    mov  esi,22*65536+196          ; print at x and y
203
    call do_hex                    ; print color number
204
    call do_hex                    ; print color number
204
    mov  eax,[picks+4]             ; second picked color
205
    mov  eax,[picks+4]             ; second picked color
205
    mov  esi,22*65536+215          ; print at x and y
206
    mov  esi,22*65536+215          ; print at x and y
Line 230... Line 231...
230
    mov  ecx,[edi]                 ; save color 1
231
    mov  ecx,[edi]                 ; save color 1
231
    mov  ebx,0x60100               ; print 6 hex digits
232
    mov  ebx,0x60100               ; print 6 hex digits
232
    mov  edx,esi                   ; copy color
233
    mov  edx,esi                   ; copy color
233
    mov  esi,0xe1e1e1              ; use white
234
    mov  esi,0xe1e1e1              ; use white
234
    mov  eax,47                    ; print number function
235
    mov  eax,47                    ; print number function
235
    int  0x40
236
    mcall
Line 236... Line 237...
236
 
237
 
Line 237... Line 238...
237
    ret
238
    ret
238
 
239
 
Line 243... Line 244...
243
    mov  edi,colors                ; color table
244
    mov  edi,colors                ; color table
244
    add  edi,eax                   ; add offset
245
    add  edi,eax                   ; add offset
245
    mov  edx,[edi]                 ; color
246
    mov  edx,[edi]                 ; color
246
    mov  ecx,esi                   ; recover y an depth
247
    mov  ecx,esi                   ; recover y an depth
247
    mov  eax,13                    ; draw bar function
248
    mov  eax,13                    ; draw bar function
248
    int  0x40
249
    mcall
Line 249... Line 250...
249
 
250
 
Line 250... Line 251...
250
    ret
251
    ret
251
 
252
 
Line 256... Line 257...
256
    mov  edx,names                 ; color table
257
    mov  edx,names                 ; color table
257
    add  edx,eax                   ; add offset
258
    add  edx,eax                   ; add offset
258
    mov  ecx,0xe1e1e1              ; color
259
    mov  ecx,0xe1e1e1              ; color
259
    mov  esi,15
260
    mov  esi,15
260
    mov  eax,4                     ; print text function
261
    mov  eax,4                     ; print text function
261
    int  0x40
262
    mcall
Line 262... Line 263...
262
 
263
 
Line 263... Line 264...
263
    ret
264
    ret
264
 
265
 
265
clear:
266
clear:
266
    mov  ebx,22*65536+36           ; x and width
267
    mov  ebx,22*65536+36           ; x and width
267
    mov  ecx,196*65536+26          ; y and depth
268
    mov  ecx,196*65536+26          ; y and depth
268
    mov  edx,0x000000              ; color
269
    mov  edx,0x000000              ; color
269
    mov  eax,13                    ; draw bar funx
270
    mov  eax,13                    ; draw bar funx
270
    int  0x40
271
    mcall
271
    mov  ebx,96*65536+90           ; x and width
272
    mov  ebx,96*65536+90           ; x and width
272
    mov  ecx,196*65536+26          ; y and depth
273
    mov  ecx,196*65536+26          ; y and depth
273
    mov  edx,0x000000              ; color
274
    mov  edx,0x000000              ; color
Line 274... Line 275...
274
    mov  eax,13                    ; draw bar funx
275
    mov  eax,13                    ; draw bar funx
Line 275... Line 276...
275
    int  0x40
276
    mcall
276
 
277
 
277
    ret
278
    ret
278
 
279
 
279
help:
280
help:
280
    mov  ebx,4*65536+192           ; x and width
281
    mov  ebx,4*65536+192           ; x and width
281
    mov  ecx,20*65536+216          ; y and depth
282
    mov  ecx,20*65536+216          ; y and depth
282
    mov  edx,0x465e8f              ; dark denim color
283
    mov  edx,0x465e8f              ; dark denim color
283
    mov  eax,13                    ; write text funx
284
    mov  eax,13                    ; write text funx
284
    int  0x40
285
    mcall
285
    mov  ebx,20*65536+40           ; starting x and y
286
    mov  ebx,20*65536+40           ; starting x and y
286
    mov  edx,text                  ; start of text
287
    mov  edx,text                  ; start of text
287
    mov  esi,27                    ; width of text
288
    mov  esi,27                    ; width of text
288
    mov  ecx,14                    ; 14 text lines to do
289
    mov  ecx,14                    ; 14 text lines to do
289
    mov  eax,4                     ; write text funx
290
    mov  eax,4                     ; write text funx
290
h1: push ecx
291
h1: push ecx
291
    sub  ebx,65537                 ; drop shadow x and y
292
    sub  ebx,65537                 ; drop shadow x and y
292
    mov  ecx,0x000000              ; black shadow
293
    mov  ecx,0x000000              ; black shadow
293
    int  0x40
294
    mcall
294
    add  ebx,65537                 ; original x and y
295
    add  ebx,65537                 ; original x and y
295
    mov  ecx,0xefefef              ; white text
296
    mov  ecx,0xefefef              ; white text
296
    int  0x40
297
    mcall
297
    add  edx,27                    ; next line of text
298
    add  edx,27                    ; next line of text
298
    add  bx,12                     ; next row
299
    add  bx,12                     ; next row
299
    pop  ecx
300
    pop  ecx
300
    loop h1
301
    loop h1
301
    mov  eax,10                    ; wait on event
302
    mov  eax,10                    ; wait on event
302
    int  0x40
303
    mcall
303
    cmp  eax,2                     ; got a key?
304
    cmp  eax,2                     ; got a key?
304
    jne  h2                        ; nope
305
    jne  h2                        ; nope
305
    mov  eax,2                     ; yep, burn it
306
    mov  eax,2                     ; yep, burn it
306
    int  0x40
307
    mcall
307
h2: mov  ebx,4*65536+192           ; y and width
308
h2: mov  ebx,4*65536+192           ; y and width
308
    mov  ecx,20*65536+216          ; x and depth
309
    mov  ecx,20*65536+216          ; x and depth
Line 309... Line 310...
309
    mov  edx,0x00000               ; restore black bkg
310
    mov  edx,0x00000               ; restore black bkg
Line 310... Line 311...
310
    mov  eax,13                    ; draw bar funx
311
    mov  eax,13                    ; draw bar funx
311
    int  0x40
312
    mcall
312
    call palette                   ; redraw color palette
313
    call palette                   ; redraw color palette
Line 313... Line 314...
313
 
314
 
Line 314... Line 315...
314
    ret
315
    ret
315
 
316
 
Line 316... Line 317...
316
 
317