Subversion Repositories Kolibri OS

Rev

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

Rev 3896 Rev 3901
1
; Calendar for KolibriOS
1
; Calendar for KolibriOS
2
;
2
;
3
; v1.5 - time redesign by Heavyiron
3
; v1.5 - time redesign by Heavyiron
4
; v1.2 - v1.55 - new desighn and functionality by Leency
4
; v1.2 - v1.55 - new desighn and functionality by Leency
5
; v1.1 - add change time support by DedOK 
5
; v1.1 - add change time support by DedOK 
6
; v1.0 - written in pure assembler by Ivushkin Andrey aka Willow
6
; v1.0 - written in pure assembler by Ivushkin Andrey aka Willow
7
; also - diamond, spraid, fedesco
7
; also - diamond, spraid, fedesco
8
;
8
;
9
; Created: November 1, 2004
9
; Created: November 1, 2004
10
 
10
 
11
 
11
 
12
use32
12
use32
13
 
13
 
14
  org	 0x0
14
  org	 0x0
15
 
15
 
16
  db	 'MENUET01'
16
  db	 'MENUET01'
17
  dd	 0x01
17
  dd	 0x01
18
  dd	 START
18
  dd	 START
19
  dd	 I_END
19
  dd	 I_END
20
  dd	 0x1000
20
  dd	 0x1000
21
  dd	 0x1000
21
  dd	 0x1000
22
  dd	 0x0
22
  dd	 0x0
23
  dd	 0x0
23
  dd	 0x0
24
include '..\..\..\macros.inc'
24
include '..\..\..\macros.inc'
25
include 'lang.inc'
25
include 'lang.inc'
26
include 'data.inc'
26
include 'data.inc'
27
 
27
 
28
 
28
 
29
 
29
 
30
macro ShowFocus field,reg
30
macro ShowFocus field,reg
31
{
31
{
32
   local  .nofocus, .exit
32
   local  .nofocus, .exit
33
     cmp  [focus],field
33
     cmp  [focus],field
34
     jne  .nofocus
34
     jne  .nofocus
35
   if reg eq
35
   if reg eq
36
     mov  ecx,COL_ACTIVE_TEXT
36
     mov  ecx,COL_ACTIVE_TEXT
37
   else
37
   else
38
     mov  reg,COL_ACTIVE_TEXT
38
     mov  reg,COL_ACTIVE_TEXT
39
   end if
39
   end if
40
     jmp  .exit
40
     jmp  .exit
41
   .nofocus:
41
   .nofocus:
42
   if reg eq
42
   if reg eq
43
     mov  ecx,COL_DROPDOWN_T
43
     mov  ecx,COL_DROPDOWN_T
44
   else
44
   else
45
     mov  reg,COL_DROPDOWN_T
45
     mov  reg,COL_DROPDOWN_T
46
   end if
46
   end if
47
   .exit:
47
   .exit:
48
}
48
}
49
 
49
 
50
macro GetSkinHeight
50
macro GetSkinHeight
51
{
51
{
52
	mov  eax,48
52
	mov  eax,48
53
	mov  ebx,4
53
	mov  ebx,4
54
	int 0x40
54
	int 0x40
55
}
55
}
56
 
56
 
57
macro DrawRect color1,color2,color3,color4 ; pizdec... but optimized well
57
macro DrawRect color1,color2,color3,color4 ; pizdec... but optimized well
58
{
58
{
59
	; top border-outer
59
	; top border-outer
60
	push ebx
60
	push ebx
61
	push ecx
61
	push ecx
62
	mov eax,13
62
	mov eax,13
63
	mov bx,DATE_BUTTON_WIDTH
63
	mov bx,DATE_BUTTON_WIDTH
64
	mov edx,color1
64
	mov edx,color1
65
	mov cx,1
65
	mov cx,1
66
	mcall
66
	mcall
67
	; left border-outer
67
	; left border-outer
68
	mov bx,1
68
	mov bx,1
69
	mov cx,DATE_BUTTON_HEIGHT
69
	mov cx,DATE_BUTTON_HEIGHT
70
	mcall
70
	mcall
71
	; top border-inner
71
	; top border-inner
72
	mov edx,color2
72
	mov edx,color2
73
	add ebx,1 shl 16
73
	add ebx,1 shl 16
74
	add ecx,1 shl 16
74
	add ecx,1 shl 16
75
	mov bx,DATE_BUTTON_WIDTH-1
75
	mov bx,DATE_BUTTON_WIDTH-1
76
	mov cx,1
76
	mov cx,1
77
	; left border-inner
77
	; left border-inner
78
	mcall
78
	mcall
79
	mov bx,1
79
	mov bx,1
80
	mov cx,DATE_BUTTON_HEIGHT-2
80
	mov cx,DATE_BUTTON_HEIGHT-2
81
	mcall
81
	mcall
82
	; inner
82
	; inner
83
	mov edx,color3
83
	mov edx,color3
84
	add ebx,1 shl 16
84
	add ebx,1 shl 16
85
	add ecx,1 shl 16
85
	add ecx,1 shl 16
86
	mov bx,DATE_BUTTON_WIDTH-4
86
	mov bx,DATE_BUTTON_WIDTH-4
87
	mov cx,DATE_BUTTON_HEIGHT-4
87
	mov cx,DATE_BUTTON_HEIGHT-4
88
	mcall
88
	mcall
89
	; bottom border-inner
89
	; bottom border-inner
90
	mov edx,color4
90
	mov edx,color4
91
	add ebx,DATE_BUTTON_WIDTH shl 16
91
	add ebx,DATE_BUTTON_WIDTH shl 16
92
	sub ebx,4 shl 16
92
	sub ebx,4 shl 16
93
	mov bx,1
93
	mov bx,1
94
	mov cx,DATE_BUTTON_HEIGHT-3
94
	mov cx,DATE_BUTTON_HEIGHT-3
95
	mcall
95
	mcall
96
	; rgiht border-outer
96
	; rgiht border-outer
97
	mov edx,color2
97
	mov edx,color2
98
	add ebx,1 shl 16
98
	add ebx,1 shl 16
99
	sub ecx,1 shl 16
99
	sub ecx,1 shl 16
100
	add cx,1
100
	add cx,1
101
	mcall
101
	mcall
102
	; bottom border-outer
102
	; bottom border-outer
103
	mov edx,color2
103
	mov edx,color2
104
	pop ecx
104
	pop ecx
105
	pop ebx
105
	pop ebx
106
	add ecx,DATE_BUTTON_HEIGHT shl 16
106
	add ecx,DATE_BUTTON_HEIGHT shl 16
107
	sub ecx,1 shl 16
107
	sub ecx,1 shl 16
108
	add ebx,1 shl 16
108
	add ebx,1 shl 16
109
	mov cx,1
109
	mov cx,1
110
	mcall
110
	mcall
111
	; left border-outer
111
	; left border-outer
112
	mov edx,color4
112
	mov edx,color4
113
	add ebx,1 shl 16
113
	add ebx,1 shl 16
114
	sub ecx,1 shl 16
114
	sub ecx,1 shl 16
115
	sub bx,2
115
	sub bx,2
116
	mcall 
116
	mcall 
117
}
117
}
118
 
118
 
119
 
119
 
120
str2int:
120
str2int:
121
    xor  eax,eax
121
    xor  eax,eax
122
    lodsb
122
    lodsb
123
    mov  ebx,eax
123
    mov  ebx,eax
124
    shr  ebx,4
124
    shr  ebx,4
125
    and  eax,0xf
125
    and  eax,0xf
126
    imul ebx,10
126
    imul ebx,10
127
    add  al,bl
127
    add  al,bl
128
    ret
128
    ret
129
 
129
 
130
START:
130
START:
131
    mcall 29
131
    mcall 29
132
    mov  [datestr],eax
132
    mov  [datestr],eax
133
    mov  esi,datestr
133
    mov  esi,datestr
134
    call str2int
134
    call str2int
135
    add  eax,1900
135
    add  eax,1900
136
    mov  [Year],eax
136
    mov  [Year],eax
137
    call str2int
137
    call str2int
138
    dec  eax
138
    dec  eax
139
    mov  [Month],eax
139
    mov  [Month],eax
140
    call str2int
140
    call str2int
141
    mov  [day_sel],eax
141
    mov  [day_sel],eax
142
    test byte[esi],0
142
    test byte[esi],0
143
    jnz  .no2000
143
    jnz  .no2000
144
    add  [Year],100
144
    add  [Year],100
145
	mov eax,[Year]
145
	mov eax,[Year]
146
	mov [curYear], eax
146
	mov [curYear], eax
147
	mov eax,[Month]
147
	mov eax,[Month]
148
	mov [curMonth], eax
148
	mov [curMonth], eax
149
	mov eax,[day_sel]
149
	mov eax,[day_sel]
150
	mov [curDay], eax
150
	mov [curDay], eax
151
  .no2000:
151
  .no2000:
152
    jmp  upd
152
    jmp  upd
153
red:
153
red:
154
 
154
 
155
    call draw_window
155
    call draw_window
156
 
156
 
157
still:
157
still:
158
 
158
 
159
    mcall 23,50     ; wait here for event
159
    mcall 23,50     ; wait here for event
160
  .evt:
160
  .evt:
161
    mov  ebp,[focus]
161
    mov  ebp,[focus]
162
    cmp  eax,1
162
    cmp  eax,1
163
    je	 red
163
    je	 red
164
    cmp  eax,2
164
    cmp  eax,2
165
    je	 key
165
    je	 key
166
    cmp  eax,3
166
    cmp  eax,3
167
    je	 button
167
    je	 button
168
 
168
 
169
    call draw_clock
169
    call draw_clock
170
 
170
 
171
    jmp  still
171
    jmp  still
172
 
172
 
173
  key:
173
  key:
174
    mcall 2		; get pressed key
174
    mcall 2		; get pressed key
175
    cmp  ah,9
175
    cmp  ah,9
176
    jne  no_tab
176
    jne  no_tab
177
  .tab:
177
  .tab:
178
    cmp  ebp,FOCUSABLE
178
    cmp  ebp,FOCUSABLE
179
    JAE	 foc_cycle
179
    JAE	 foc_cycle
180
    inc  [focus]
180
    inc  [focus]
181
  upd:
181
  upd:
182
    call calculate
182
    call calculate
183
    jmp  red
183
    jmp  red
184
  foc_cycle:
184
  foc_cycle:
185
    mov  [focus],2
185
    mov  [focus],2
186
    jmp  upd
186
    jmp  upd
187
  no_tab:
187
  no_tab:
188
    push eax
188
    push eax
189
    shr  eax,8
189
    shr  eax,8
190
    mov  ecx,12
190
    mov  ecx,12
191
    mov  edi,Fkeys
191
    mov  edi,Fkeys
192
    repne scasb
192
    repne scasb
193
    pop  eax
193
    pop  eax
194
    jnz  .noFkey
194
    jnz  .noFkey
195
    sub  edi,Fkeys+1
195
    sub  edi,Fkeys+1
196
    mov  [Month],edi
196
    mov  [Month],edi
197
    jmp  upd
197
    jmp  upd
198
  .noFkey:
198
  .noFkey:
199
    cmp  ebp,2
199
    cmp  ebp,2
200
    jne  .nomonth
200
    jne  .nomonth
201
    cmp  ah,177
201
    cmp  ah,177
202
    je	 noclose.drop
202
    je	 noclose.drop
203
    jmp  still
203
    jmp  still
204
  .nomonth:
204
  .nomonth:
205
    cmp  ebp,3
205
    cmp  ebp,3
206
    je	 noy_up.year_evt
206
    je	 noy_up.year_evt
207
    cmp  ebp,4
207
    cmp  ebp,4
208
    jne  still
208
    jne  still
209
    mov  ebx,[day_sel]
209
    mov  ebx,[day_sel]
210
    cmp  ah,176 	; left arrow
210
    cmp  ah,176 	; left arrow
211
    jb	 still
211
    jb	 still
212
    cmp  ah,179
212
    cmp  ah,179
213
    ja	 still
213
    ja	 still
214
    shr  eax,8
214
    shr  eax,8
215
    sub  eax,176
215
    sub  eax,176
216
    movsx ecx,byte[day_bounds+eax*2]
216
    movsx ecx,byte[day_bounds+eax*2]
217
    movzx eax,byte[day_bounds+eax*2+1]
217
    movzx eax,byte[day_bounds+eax*2+1]
218
    add  ecx,ebx
218
    add  ecx,ebx
219
    test eax,eax
219
    test eax,eax
220
    jz	 .chk0
220
    jz	 .chk0
221
    cmp  ecx,eax
221
    cmp  ecx,eax
222
    ja	 still
222
    ja	 still
223
  .ok:
223
  .ok:
224
    mov  [day_sel],ecx
224
    mov  [day_sel],ecx
225
    call draw_days
225
    call draw_days
226
    jmp  still
226
    jmp  still
227
  .chk0:
227
  .chk0:
228
    cmp  ecx,eax
228
    cmp  ecx,eax
229
    jle  still
229
    jle  still
230
    jmp  .ok
230
    jmp  .ok
231
 
231
 
232
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
232
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
233
 
233
 
234
  button:
234
  button:
235
    mcall 17
235
    mcall 17
236
    movzx ebx,ah
236
    movzx ebx,ah
237
    cmp  ah,200
237
    cmp  ah,200
238
    jbe  nodayselect
238
    jbe  nodayselect
239
    sub  ah,200
239
    sub  ah,200
240
    mov  byte[day_sel],ah
240
    mov  byte[day_sel],ah
241
    cmp  ebp,5
241
    cmp  ebp,5
242
    jne  .redraw
242
    jne  .redraw
243
    call draw_days
243
    call draw_days
244
    jmp  still
244
    jmp  still
245
  .redraw:
245
  .redraw:
246
    mov  [focus],4
246
    mov  [focus],4
247
    jmp  red
247
    jmp  red
248
  nodayselect:
248
  nodayselect:
249
    cmp  ah,100
249
    cmp  ah,100
250
    jb	 no_list
250
    jb	 no_list
251
    sub  ah,100
251
    sub  ah,100
252
    mov  byte[Month],ah
252
    mov  byte[Month],ah
253
    mov  [focus],2
253
    mov  [focus],2
254
    jmp  upd
254
    jmp  upd
255
  no_list:
255
  no_list:
256
    cmp  ah,1
256
    cmp  ah,1
257
    jne  noclose
257
    jne  noclose
258
  close:
258
  close:
259
    mcall -1		; clore programm
259
    mcall -1		; clore programm
260
 
260
 
261
  noclose:
261
  noclose:
262
 
262
 
263
    cmp  ah,72
263
    cmp  ah,72
264
    je	 plus_he
264
    je	 plus_he
265
 
265
 
266
    cmp  ah,73
266
    cmp  ah,73
267
    je	 plus_hd
267
    je	 plus_hd
268
 
268
 
269
    cmp  ah,74
269
    cmp  ah,74
270
    je	 minus_he
270
    je	 minus_he
271
 
271
 
272
    cmp  ah,75
272
    cmp  ah,75
273
    je	 minus_hd
273
    je	 minus_hd
274
 
274
 
275
    cmp  ah,76
275
    cmp  ah,76
276
    je	 plus_me
276
    je	 plus_me
277
 
277
 
278
    cmp  ah,77
278
    cmp  ah,77
279
    je	 plus_md
279
    je	 plus_md
280
 
280
 
281
    cmp  ah,78
281
    cmp  ah,78
282
    je	 minus_me
282
    je	 minus_me
283
 
283
 
284
    cmp  ah,79
284
    cmp  ah,79
285
    je	 minus_md
285
    je	 minus_md
286
 
286
 
287
    cmp  ah,80
287
    cmp  ah,80
288
    je	 reset
288
    je	 reset
289
 
289
 
290
    cmp  ah,81
290
    cmp  ah,81
291
    je	 set_date
291
    je	 set_date
292
 
292
 
293
    cmp  ah,2		; drop down list
293
    cmp  ah,2		; drop down list
294
    jne  no_dropdn
294
    jne  no_dropdn
295
  .drop:
295
  .drop:
296
    mov  [focus],2
296
    mov  [focus],2
297
    cmp  [dropped],al	; ==0
297
    cmp  [dropped],al	; ==0
298
    jne  red
298
    jne  red
299
    call draw_window
299
    call draw_window
300
    mov  edx,1 shl 31+231
300
    mov  edx,1 shl 31+231
301
    mov  ecx,31
301
    mov  ecx,31
302
    mov  eax,8
302
    mov  eax,8
303
  .bremove:
303
  .bremove:
304
    mcall
304
    mcall
305
    dec  edx
305
    dec  edx
306
    loop .bremove
306
    loop .bremove
307
    call draw_dropdown
307
    call draw_dropdown
308
    jmp  still
308
    jmp  still
309
  no_dropdn:
309
  no_dropdn:
310
    cmp  ah,3		; year -1
310
    cmp  ah,3		; year -1
311
    jne  noy_dn
311
    jne  noy_dn
312
  year_dec:
312
  year_dec:
313
    dec  [Year]
313
    dec  [Year]
314
    mov  [focus],3
314
    mov  [focus],3
315
    jmp  upd
315
    jmp  upd
316
  noy_dn:
316
  noy_dn:
317
    cmp  ah,4		; year+1
317
    cmp  ah,4		; year+1
318
    jne  noy_up
318
    jne  noy_up
319
  year_inc:
319
  year_inc:
320
    inc  [Year]
320
    inc  [Year]
321
    mov  [focus],3
321
    mov  [focus],3
322
    jmp  upd
322
    jmp  upd
323
  noy_up:
323
  noy_up:
324
    cmp  ah,5
324
    cmp  ah,5
325
    jne  noy_click
325
    jne  noy_click
326
    mov  [focus],3
326
    mov  [focus],3
327
    call draw_window
327
    call draw_window
328
  .still:
328
  .still:
329
    mcall 10
329
    mcall 10
330
    cmp  eax,2
330
    cmp  eax,2
331
    jne  still.evt
331
    jne  still.evt
332
    mcall 2
332
    mcall 2
333
  .year_evt:
333
  .year_evt:
334
    cmp  ah,176
334
    cmp  ah,176
335
    je	 year_dec
335
    je	 year_dec
336
    cmp  ah,179
336
    cmp  ah,179
337
    je	 year_inc
337
    je	 year_inc
338
	
338
	
339
    mov  ebx,10
339
    mov  ebx,10
340
    cmp  ah,9
340
    cmp  ah,9
341
    je	 key.tab
341
    je	 key.tab
342
    cmp  ah,8		; backspace
342
    cmp  ah,8		; backspace
343
    jne  .nobsp
343
    jne  .nobsp
344
    mov  eax,[Year]
344
    mov  eax,[Year]
345
    xor  edx,edx
345
    xor  edx,edx
346
    div  ebx
346
    div  ebx
347
  .ch_year:
347
  .ch_year:
348
    mov  [Year],eax
348
    mov  [Year],eax
349
    call draw_year
349
    call draw_year
350
    jmp  .still
350
    jmp  .still
351
  .nobsp:
351
  .nobsp:
352
    cmp  ah,13		; enter
352
    cmp  ah,13		; enter
353
    je	 upd
353
    je	 upd
354
    cmp  ah,182
354
    cmp  ah,182
355
    jne  .noclear	; del
355
    jne  .noclear	; del
356
    xor  eax,eax
356
    xor  eax,eax
357
    jmp  .ch_year
357
    jmp  .ch_year
358
  .noclear:
358
  .noclear:
359
    cmp  ah,48
359
    cmp  ah,48
360
    jb	 .still
360
    jb	 .still
361
    cmp  ah,57
361
    cmp  ah,57
362
    ja	 .still
362
    ja	 .still
363
    cmp  [Year],1000
363
    cmp  [Year],1000
364
    jae  .still
364
    jae  .still
365
    shr  eax,8
365
    shr  eax,8
366
    lea  ecx,[eax-48]
366
    lea  ecx,[eax-48]
367
    mov  eax,[Year]
367
    mov  eax,[Year]
368
    imul eax,ebx
368
    imul eax,ebx
369
    add  eax,ecx
369
    add  eax,ecx
370
    jmp  .ch_year
370
    jmp  .ch_year
371
  noy_click:
371
  noy_click:
372
    cmp  ah,10
372
    cmp  ah,10
373
    jne  START
373
    jne  START
374
    xor  [new_style],1
374
    xor  [new_style],1
375
    jmp  upd
375
    jmp  upd
376
 
376
 
377
 
377
 
378
reset:
378
reset:
379
    mcall 3
379
    mcall 3
380
    mov  ecx,eax
380
    mov  ecx,eax
381
    shl  ecx,16
381
    shl  ecx,16
382
    shr  ecx,16
382
    shr  ecx,16
383
    mcall 22,0x00000000 
383
    mcall 22,0x00000000 
384
    jmp  still
384
    jmp  still
385
 
385
 
386
plus_hd:
386
plus_hd:
387
    mcall 3
387
    mcall 3
388
    mov  ecx,eax
388
    mov  ecx,eax
389
    add  ecx,1
389
    add  ecx,1
390
    mcall 22,0x00000000 
390
    mcall 22,0x00000000 
391
    jmp  still
391
    jmp  still
392
 
392
 
393
plus_he:
393
plus_he:
394
    mcall 3
394
    mcall 3
395
    mov  ecx,eax
395
    mov  ecx,eax
396
    add  ecx,16
396
    add  ecx,16
397
    mcall 22,0x00000000 
397
    mcall 22,0x00000000 
398
    jmp  still
398
    jmp  still
399
 
399
 
400
minus_hd:
400
minus_hd:
401
    mcall 3
401
    mcall 3
402
    mov  ecx,eax
402
    mov  ecx,eax
403
    sub  ecx,1
403
    sub  ecx,1
404
	mcall 22,0x00000000
404
	mcall 22,0x00000000
405
    jmp  still
405
    jmp  still
406
 
406
 
407
minus_he:
407
minus_he:
408
    mcall 3
408
    mcall 3
409
    mov  ecx,eax
409
    mov  ecx,eax
410
    sub  ecx,16
410
    sub  ecx,16
411
	mcall 22,0x00000000 
411
	mcall 22,0x00000000 
412
    jmp  still
412
    jmp  still
413
 
413
 
414
plus_md:
414
plus_md:
415
    mcall 3
415
    mcall 3
416
    mov  ecx,eax
416
    mov  ecx,eax
417
    add  ecx,256
417
    add  ecx,256
418
	mcall 22,0x00000000 
418
	mcall 22,0x00000000 
419
    jmp  still
419
    jmp  still
420
 
420
 
421
plus_me:
421
plus_me:
422
    mcall 3
422
    mcall 3
423
    mov  ecx,eax
423
    mov  ecx,eax
424
    add  ecx,4096
424
    add  ecx,4096
425
    mcall 22,0x00000000 
425
    mcall 22,0x00000000 
426
    jmp  still
426
    jmp  still
427
 
427
 
428
minus_md:
428
minus_md:
429
    mcall 3
429
    mcall 3
430
    mov  ecx,eax
430
    mov  ecx,eax
431
    sub  ecx,256
431
    sub  ecx,256
432
    mcall 22,0x00000000
432
    mcall 22,0x00000000
433
    jmp  still
433
    jmp  still
434
 
434
 
435
minus_me:
435
minus_me:
436
    mcall 3
436
    mcall 3
437
    mov  ecx,eax
437
    mov  ecx,eax
438
    sub  ecx,4096
438
    sub  ecx,4096
439
    mcall 22,0x00000000
439
    mcall 22,0x00000000
440
    jmp  still
440
    jmp  still
441
 
441
 
442
set_date:
442
set_date:
443
    mov  eax,0x00000000
443
    mov  eax,0x00000000
444
    mov ebx,[day_sel]
444
    mov ebx,[day_sel]
445
    call additem
445
    call additem
446
    shl  eax,8
446
    shl  eax,8
447
    mov  ebx,[Month]
447
    mov  ebx,[Month]
448
    add  ebx,1
448
    add  ebx,1
449
    call additem
449
    call additem
450
    shl  eax,8
450
    shl  eax,8
451
    mov  ebx,[Year]
451
    mov  ebx,[Year]
452
    call additem
452
    call additem
453
    mov  ecx,eax
453
    mov  ecx,eax
454
    mcall 22,1
454
    mcall 22,1
455
    jmp  START
455
    jmp  START
456
 
456
 
457
additem:
457
additem:
458
    add  eax,1
458
    add  eax,1
459
    daa
459
    daa
460
    sub  ebx,1
460
    sub  ebx,1
461
    cmp  ebx,0
461
    cmp  ebx,0
462
    jne  additem
462
    jne  additem
463
    ret
463
    ret
464
 
464
 
465
 
465
 
466
;   *********************************************
466
;   *********************************************
467
;   *******          DRAW WINDOW          *******
467
;   *******          DRAW WINDOW          *******
468
;   *********************************************
468
;   *********************************************
469
 
469
 
470
draw_clock:
470
draw_clock:
471
 
471
 
472
    mcall 3
472
    mcall 3
473
    mov  ecx,eax
473
    mov  ecx,eax
474
    mcall 47,0x00020100, ,195*65536+287,0x50000000,COL_WINDOW_BG
474
    mcall 47,0x00020100, ,195*65536+287,0x50000000,COL_WINDOW_BG
475
 
475
 
476
    shr  ecx,8
476
    shr  ecx,8
477
    add  edx,22*65536
477
    add  edx,22*65536
478
    mcall
478
    mcall
479
 
479
 
480
    shr  ecx,8
480
    shr  ecx,8
481
    add  edx,22*65536
481
    add  edx,22*65536
482
    mcall
482
    mcall
483
    ret
483
    ret
484
 
484
 
485
draw_window:
485
draw_window:
486
 
486
 
487
    mcall 12,1
487
    mcall 12,1
488
	mcall 48,5 ;get screen size
488
	mcall 48,5 ;get screen size
489
	mov ecx, ebx
489
	mov ecx, ebx
490
	sub ecx, WIN_H
490
	sub ecx, WIN_H
491
	shl ecx, 16
491
	shl ecx, 16
492
	add ecx, WIN_H
492
	add ecx, WIN_H
493
	mov ebx, eax
493
	mov ebx, eax
494
	sub eax, WIN_W
494
	sub eax, WIN_W
495
	shl ebx, 16
495
	shl ebx, 16
496
	add ebx, WIN_W	
496
	add ebx, WIN_W	
497
    mcall 0,,,COL_WINDOW_BG, ,title ; define window
497
    mcall 0,,,COL_WINDOW_BG, ,title ; define window
498
	mcall 63,1,'Y'
-
 
499
	GetSkinHeight
498
	GetSkinHeight
500
	mov ecx, eax
499
	mov ecx, eax
501
	shl ecx, 16
500
	shl ecx, 16
502
	add ecx, 43
501
	add ecx, 43
503
	mcall 13,B_WBAR_X, ,COL_TOOLBAR_BG ; draw toolbar background
502
	mcall 13,B_WBAR_X, ,COL_TOOLBAR_BG ; draw toolbar background
504
    call draw_week
503
    call draw_week
505
    mcall 8,193*65536+8,272*65536+10,72,COL_DATE_BUTTONS
504
    mcall 8,193*65536+8,272*65536+10,72,COL_DATE_BUTTONS
506
    mov  ebx,202*65536+8
505
    mov  ebx,202*65536+8
507
    inc  edx ;73
506
    inc  edx ;73
508
    mcall
507
    mcall
509
    mov  ebx,193*65536+8
508
    mov  ebx,193*65536+8
510
    mov  ecx,298*65536+10
509
    mov  ecx,298*65536+10
511
    inc  edx ;74
510
    inc  edx ;74
512
    mcall
511
    mcall
513
    mov  ebx,202*65536+8
512
    mov  ebx,202*65536+8
514
    inc  edx ;75
513
    inc  edx ;75
515
    mcall
514
    mcall
516
    mov  ebx,215*65536+8
515
    mov  ebx,215*65536+8
517
    mov  ecx,272*65536+10
516
    mov  ecx,272*65536+10
518
    inc  edx ;76
517
    inc  edx ;76
519
    mcall
518
    mcall
520
    mov  ebx,224*65536+8
519
    mov  ebx,224*65536+8
521
    inc  edx ;77
520
    inc  edx ;77
522
    mcall
521
    mcall
523
    mov  ebx,215*65536+8
522
    mov  ebx,215*65536+8
524
    mov  ecx,298*65536+10
523
    mov  ecx,298*65536+10
525
    inc  edx ;78
524
    inc  edx ;78
526
    mcall
525
    mcall
527
    mov  ebx,224*65536+8
526
    mov  ebx,224*65536+8
528
    inc  edx ;79
527
    inc  edx ;79
529
    mcall
528
    mcall
530
    mov  ebx,237*65536+21
529
    mov  ebx,237*65536+21
531
    mov  ecx,273*65536+35
530
    mov  ecx,273*65536+35
532
    inc  edx ;80
531
    inc  edx ;80
533
    or   edx,0x40000000
532
    or   edx,0x40000000
534
    mcall
533
    mcall
535
    mov  ebx,25*65536+110
534
    mov  ebx,25*65536+110
536
    mov  ecx,285*65536+22
535
    mov  ecx,285*65536+22
537
    mov  esi,COL_DATE_BUTTONS
536
    mov  esi,COL_DATE_BUTTONS
538
    mov  edx,81
537
    mov  edx,81
539
    mcall
538
    mcall
540
 
539
 
541
    mov  esi,COL_MONTH_YEAR_B   ; new style
540
    mov  esi,COL_MONTH_YEAR_B   ; new style
542
    mov  edx,10
541
    mov  edx,10
543
    or	 edx,1 shl 29+1 shl 30
542
    or	 edx,1 shl 29+1 shl 30
544
    mov  ebx,B_NS_X
543
    mov  ebx,B_NS_X
545
    mov  ecx,B_NS_Y
544
    mov  ecx,B_NS_Y
546
    mcall
545
    mcall
547
    add  edx,1-1 shl 29
546
    add  edx,1-1 shl 29
548
    mov  ebx,B_TODAY_X+8*(today_end-today_msg)
547
    mov  ebx,B_TODAY_X+8*(today_end-today_msg)
549
    mov  ecx,B_TODAY_Y
548
    mov  ecx,B_TODAY_Y
550
    mcall
549
    mcall
551
    mov  ecx,B_Y
550
    mov  ecx,B_Y
552
    mov  ebx,B_MONTH_X
551
    mov  ebx,B_MONTH_X
553
    mov  edx,2
552
    mov  edx,2
554
    mcall
553
    mcall
555
    mov  ebx,B_SPIN_X ; <
554
    mov  ebx,B_SPIN_X ; <
556
    inc  edx
555
    inc  edx
557
    mcall
556
    mcall
558
    add  ebx,61 shl 16 ; >
557
    add  ebx,61 shl 16 ; >
559
    inc  edx
558
    inc  edx
560
    mcall
559
    mcall
561
    call draw_days
560
    call draw_days
562
 
561
 
563
	; draw text in window
562
	; draw text in window
564
    mcall 4,157*65536+287,0x80000000,sys_text
563
    mcall 4,157*65536+287,0x80000000,sys_text
565
    mcall  ,211*65536+287,,separator
564
    mcall  ,211*65536+287,,separator
566
    mcall  ,233*65536+287
565
    mcall  ,233*65536+287
567
    mcall  ,185*65536+274, ,plus
566
    mcall  ,185*65536+274, ,plus
568
    mcall  ,185*65536+300, ,minus
567
    mcall  ,185*65536+300, ,minus
569
    mcall  , 35*65536+292,0x00000000,set_date_t,15 ;set date text
568
    mcall  , 35*65536+292,0x00000000,set_date_t,15 ;set date text
570
 
569
 
571
 
570
 
572
    mov  ecx,0x10ddeeff
571
    mov  ecx,0x10ddeeff
573
    mov  edx,n_style
572
    mov  edx,n_style
574
    mov  esi,ns_end-n_style
573
    mov  esi,ns_end-n_style
575
    mov  ebx,B_NS
574
    mov  ebx,B_NS
576
    cmp  [new_style],1
575
    cmp  [new_style],1
577
    je	 .high
576
    je	 .high
578
    mov  ecx,0xa0a0a0
577
    mov  ecx,0xa0a0a0
579
    jmp  .int
578
    jmp  .int
580
  .high:
579
  .high:
581
    mov  ecx,COL_NEW_STYLE_T
580
    mov  ecx,COL_NEW_STYLE_T
582
  .int:
581
  .int:
583
    mcall
582
    mcall
584
 
583
 
585
    mov  ecx,COL_GO_TODAY_T
584
    mov  ecx,COL_GO_TODAY_T
586
    mov  edx,today_msg
585
    mov  edx,today_msg
587
    mov  ebx,B_TODAY
586
    mov  ebx,B_TODAY
588
    mov  esi,today_end-today_msg
587
    mov  esi,today_end-today_msg
589
    mcall
588
    mcall
590
 
589
 
591
    mov  ebx,B_SPIN
590
    mov  ebx,B_SPIN
592
    mov  edx,spinner
591
    mov  edx,spinner
593
    mov  esi,12
592
    mov  esi,12
594
	mov  ecx,COL_DROPDOWN_T
593
	mov  ecx,COL_DROPDOWN_T
595
    mcall
594
    mcall
596
 
595
 
597
    mov  edx,[Month]
596
    mov  edx,[Month]
598
    movzx  esi,byte[month_name]
597
    movzx  esi,byte[month_name]
599
    imul edx,esi
598
    imul edx,esi
600
    add  edx,month_name+1
599
    add  edx,month_name+1
601
    mov  ebx,B_MONTH
600
    mov  ebx,B_MONTH
602
    ShowFocus 2
601
    ShowFocus 2
603
    mcall
602
    mcall
604
 
603
 
605
    call draw_year
604
    call draw_year
606
    call draw_clock
605
    call draw_clock
607
    mov  [dropped],0
606
    mov  [dropped],0
608
    mcall 12,2
607
    mcall 12,2
609
    ret
608
    ret
610
 
609
 
611
draw_year:
610
draw_year:
612
    mcall 8,B_YEAR_X,B_Y,5,COL_MONTH_YEAR_B
611
    mcall 8,B_YEAR_X,B_Y,5,COL_MONTH_YEAR_B
613
    ShowFocus 3,esi
612
    ShowFocus 3,esi
614
    mcall 47,0x40001,Year,B_YEAR
613
    mcall 47,0x40001,Year,B_YEAR
615
    ret
614
    ret
616
 
615
 
617
draw_dropdown:
616
draw_dropdown:
618
    mov  [dropped],1
617
    mov  [dropped],1
619
    push [Month]
618
    push [Month]
620
    pop  [focus]
619
    pop  [focus]
621
    add  [focus],100
620
    add  [focus],100
622
    mov  ecx,12
621
    mov  ecx,12
623
    mov  edx,100
622
    mov  edx,100
624
    push dword month_name+1
623
    push dword month_name+1
625
    push dword B_DROP
624
    push dword B_DROP
626
    push dword B_Y+16 shl 16
625
    push dword B_Y+16 shl 16
627
  .ddd_loop:
626
  .ddd_loop:
628
    mov  edi,edx
627
    mov  edi,edx
629
    push ecx
628
    push ecx
630
    mov  esi,COL_DROPDOWN_BG
629
    mov  esi,COL_DROPDOWN_BG
631
    mcall 8,B_MONTH_X,[esp+4]
630
    mcall 8,B_MONTH_X,[esp+4]
632
    shr  eax,1
631
    shr  eax,1
633
    mov  ebx,[esp+8]
632
    mov  ebx,[esp+8]
634
    xchg edx,[esp+12]
633
    xchg edx,[esp+12]
635
    movzx esi,byte[month_name]
634
    movzx esi,byte[month_name]
636
    ShowFocus edi
635
    ShowFocus edi
637
    mcall
636
    mcall
638
    add  edx,esi
637
    add  edx,esi
639
    xchg edx,[esp+12]
638
    xchg edx,[esp+12]
640
    add  dword[esp+8],16
639
    add  dword[esp+8],16
641
    add  dword[esp+4],16 shl 16
640
    add  dword[esp+4],16 shl 16
642
    inc  edx
641
    inc  edx
643
    pop  ecx
642
    pop  ecx
644
    loop .ddd_loop
643
    loop .ddd_loop
645
    add  esp,12
644
    add  esp,12
646
    ret
645
    ret
647
 
646
 
648
draw_week:
647
draw_week:
649
    mov  eax,13
648
    mov  eax,13
650
    mov  ebx,B_WBAR_X
649
    mov  ebx,B_WBAR_X
651
    mov  ecx,B_WBAR_Y
650
    mov  ecx,B_WBAR_Y
652
    mov  edx,COL_WEEKDAY_BG
651
    mov  edx,COL_WEEKDAY_BG
653
    mcall
652
    mcall
654
    movzx esi,byte[week_days]
653
    movzx esi,byte[week_days]
655
    movzx edi,byte[week_days+1]
654
    movzx edi,byte[week_days+1]
656
    mov  ebx,B_WEEK
655
    mov  ebx,B_WEEK
657
    mov  ecx,7
656
    mov  ecx,7
658
    mov  edx,week_days+2
657
    mov  edx,week_days+2
659
    mov  eax,4
658
    mov  eax,4
660
  .week:
659
  .week:
661
    push ecx
660
    push ecx
662
    cmp  ecx,edi
661
    cmp  ecx,edi
663
    je	 .holiday
662
    je	 .holiday
664
    mov  ecx,0x10000000
663
    mov  ecx,0x10000000
665
    jmp  .noholiday
664
    jmp  .noholiday
666
  .holiday:
665
  .holiday:
667
    mov  ecx,0x10cc1010
666
    mov  ecx,0x10cc1010
668
  .noholiday:
667
  .noholiday:
669
    mcall
668
    mcall
670
    add  edx,esi
669
    add  edx,esi
671
    add  ebx,B_WX_SHIFT
670
    add  ebx,B_WX_SHIFT
672
    pop  ecx
671
    pop  ecx
673
    loop .week
672
    loop .week
674
    ret
673
    ret
675
 
674
 
676
draw_days:
675
draw_days:
677
    call count_days
676
    call count_days
678
    cmp  ecx,[day_sel]
677
    cmp  ecx,[day_sel]
679
    jae  .ok
678
    jae  .ok
680
    mov  [day_sel],ecx
679
    mov  [day_sel],ecx
681
  .ok:
680
  .ok:
682
    mov  [number],0
681
    mov  [number],0
683
    mov  eax,47
682
    mov  eax,47
684
    mov  edx,B_DAYS_Y
683
    mov  edx,B_DAYS_Y
685
    mov  ebx,0x10001
684
    mov  ebx,0x10001
686
    mov  edi,[firstday]
685
    mov  edi,[firstday]
687
  .dayloop:
686
  .dayloop:
688
    push ecx
687
    push ecx
689
    movzx edx,dx
688
    movzx edx,dx
690
    mov  esi,edi
689
    mov  esi,edi
691
    shl  esi,21
690
    shl  esi,21
692
    lea  edx,[edx+esi+34 shl 16]
691
    lea  edx,[edx+esi+34 shl 16]
693
    mov  ecx,edi
692
    mov  ecx,edi
694
    add  cl,[week_days+1]
693
    add  cl,[week_days+1]
695
    cmp  ecx,7
694
    cmp  ecx,7
696
    je	 .holiday
695
    je	 .holiday
697
    mov  esi,0x10313138 ; COL_DATE_TEXT
696
    mov  esi,0x10313138 ; COL_DATE_TEXT
698
    jmp  .noholiday
697
    jmp  .noholiday
699
  .holiday:
698
  .holiday:
700
    mov  esi,0x10cc1010
699
    mov  esi,0x10cc1010
701
  .noholiday:
700
  .noholiday:
702
    mov  ecx,number
701
    mov  ecx,number
703
    inc  dword[ecx]
702
    inc  dword[ecx]
704
    pusha
703
    pusha
705
    mov  ebx,edx
704
    mov  ebx,edx
706
    mov  bx,DATE_BUTTON_WIDTH-1
705
    mov  bx,DATE_BUTTON_WIDTH-1
707
    sub  ebx,8 shl 16
706
    sub  ebx,8 shl 16
708
    shrd ecx,edx,16
707
    shrd ecx,edx,16
709
    mov  cx,DATE_BUTTON_HEIGHT-1
708
    mov  cx,DATE_BUTTON_HEIGHT-1
710
    sub  ecx,12 shl 16
709
    sub  ecx,12 shl 16
711
    mov  edx,[number]
710
    mov  edx,[number]
712
    cmp  edx,[day_sel]
711
    cmp  edx,[day_sel]
713
    je	 .draw_sel
712
    je	 .draw_sel
714
    mov  esi,COL_DATE_BUTTONS
713
    mov  esi,COL_DATE_BUTTONS
715
    jmp  .draw_but
714
    jmp  .draw_but
716
.draw_sel:                                  ;draw selected button
715
.draw_sel:                                  ;draw selected button
717
	add  edx,1 shl 30
716
	add  edx,1 shl 30
718
	add  edx,200+1 shl 29
717
	add  edx,200+1 shl 29
719
	mcall 8
718
	mcall 8
720
    cmp  [focus],4
719
    cmp  [focus],4
721
    jne  .not_active
720
    jne  .not_active
722
	DrawRect COL_DATE_ACTIVE_1,COL_DATE_ACTIVE_2,COL_DATE_ACTIVE_3,COL_DATE_ACTIVE_4
721
	DrawRect COL_DATE_ACTIVE_1,COL_DATE_ACTIVE_2,COL_DATE_ACTIVE_3,COL_DATE_ACTIVE_4
723
	jmp .out
722
	jmp .out
724
.not_active:
723
.not_active:
725
	DrawRect COL_DATE_INACTIVE_1,COL_DATE_INACTIVE_2,COL_DATE_INACTIVE_3,COL_DATE_INACTIVE_4
724
	DrawRect COL_DATE_INACTIVE_1,COL_DATE_INACTIVE_2,COL_DATE_INACTIVE_3,COL_DATE_INACTIVE_4
726
	jmp .out
725
	jmp .out
727
.draw_but:                                   ;draw non selected button
726
.draw_but:                                   ;draw non selected button
728
    add  edx,200+1 shl 29
727
    add  edx,200+1 shl 29
729
    mcall 8
728
    mcall 8
730
	mov eax,[Year]
729
	mov eax,[Year]
731
	cmp [curYear],eax
730
	cmp [curYear],eax
732
	jne .out
731
	jne .out
733
	mov eax,[Month]
732
	mov eax,[Month]
734
	cmp [curMonth],eax
733
	cmp [curMonth],eax
735
	jne .out
734
	jne .out
736
	mov eax,[number]
735
	mov eax,[number]
737
	cmp [curDay],eax
736
	cmp [curDay],eax
738
	jne .out
737
	jne .out
739
	mov edx,0xff0000
738
	mov edx,0xff0000
740
	mov bx,DATE_BUTTON_WIDTH-2
739
	mov bx,DATE_BUTTON_WIDTH-2
741
	mov cx,2
740
	mov cx,2
742
	add ebx,1 shl 16
741
	add ebx,1 shl 16
743
	add ecx,27 shl 16
742
	add ecx,27 shl 16
744
	mcall 13
743
	mcall 13
745
.out:
744
.out:
746
	mov    eax, [number]
745
	mov    eax, [number]
747
    xor    edx, edx
746
    xor    edx, edx
748
    mov    ecx, 10
747
    mov    ecx, 10
749
    div    ecx
748
    div    ecx
750
    mov    [remainder], edx
749
    mov    [remainder], edx
751
    mov    [quotient],  eax
750
    mov    [quotient],  eax
752
	popa
751
	popa
753
	
752
	
754
	;first number
753
	;first number
755
	mov ecx,quotient
754
	mov ecx,quotient
756
    mcall 
755
    mcall 
757
	add edx,1 shl 16
756
	add edx,1 shl 16
758
	mcall
757
	mcall
759
	sub edx,1 shl 16
758
	sub edx,1 shl 16
760
	
759
	
761
	;second number
760
	;second number
762
	mov ecx,remainder
761
	mov ecx,remainder
763
	add edx,9 shl 16
762
	add edx,9 shl 16
764
    mcall 
763
    mcall 
765
	add edx,1 shl 16
764
	add edx,1 shl 16
766
	mcall
765
	mcall
767
	sub edx,10 shl 16
766
	sub edx,10 shl 16
768
	
767
	
769
	
768
	
770
    pop  ecx
769
    pop  ecx
771
    inc  edi
770
    inc  edi
772
    cmp  edi,7
771
    cmp  edi,7
773
    jne  .nowrap
772
    jne  .nowrap
774
    xor  edi,edi
773
    xor  edi,edi
775
    add  dx,B_DAYS_SHIFT
774
    add  dx,B_DAYS_SHIFT
776
  .nowrap:
775
  .nowrap:
777
    loop .eloop
776
    loop .eloop
778
    jmp  .ex
777
    jmp  .ex
779
  .eloop:
778
  .eloop:
780
    jmp  .dayloop
779
    jmp  .dayloop
781
  .ex:
780
  .ex:
782
    ret
781
    ret
783
 
782
 
784
count_days:    ; ecx -days in month
783
count_days:    ; ecx -days in month
785
    call is_leap_year
784
    call is_leap_year
786
    mov  ecx,[Month]
785
    mov  ecx,[Month]
787
    mov  eax,1
786
    mov  eax,1
788
    movzx ecx,byte[day_count+ecx]
787
    movzx ecx,byte[day_count+ecx]
789
    add  ecx,28
788
    add  ecx,28
790
    cmp  eax,[leap_year]
789
    cmp  eax,[leap_year]
791
    jne  .noleap
790
    jne  .noleap
792
    cmp  eax,[Month]
791
    cmp  eax,[Month]
793
    jne  .noleap
792
    jne  .noleap
794
    inc  ecx
793
    inc  ecx
795
  .noleap:
794
  .noleap:
796
    mov  [day_bounds+3],cl
795
    mov  [day_bounds+3],cl
797
    mov  [day_bounds+7],cl
796
    mov  [day_bounds+7],cl
798
    ret
797
    ret
799
 
798
 
800
is_leap_year:
799
is_leap_year:
801
    mov  [leap_year],0
800
    mov  [leap_year],0
802
    mov  eax,[Year]
801
    mov  eax,[Year]
803
    mov  bl,100
802
    mov  bl,100
804
    div  bl	     ; ah=Year mod 100, al=Year%100
803
    div  bl	     ; ah=Year mod 100, al=Year%100
805
    test ah,ah
804
    test ah,ah
806
    jz	.century
805
    jz	.century
807
    shr  ax,8	     ; ax - last 2 digits
806
    shr  ax,8	     ; ax - last 2 digits
808
  .century:
807
  .century:
809
    test al,11b
808
    test al,11b
810
    jnz  .noleap
809
    jnz  .noleap
811
    inc  [leap_year]
810
    inc  [leap_year]
812
  .noleap:
811
  .noleap:
813
    ret
812
    ret
814
 
813
 
815
calculate:
814
calculate:
816
    mov  ebx,[Year]
815
    mov  ebx,[Year]
817
    mov  eax,[Month]
816
    mov  eax,[Month]
818
    sub  eax,2
817
    sub  eax,2
819
    jge  .nojf
818
    jge  .nojf
820
    dec  ebx
819
    dec  ebx
821
    add  eax,12
820
    add  eax,12
822
  .nojf:
821
  .nojf:
823
    add  eax,4
822
    add  eax,4
824
    xor  edx,edx
823
    xor  edx,edx
825
    mov  ecx,153
824
    mov  ecx,153
826
    imul cx
825
    imul cx
827
    mov  ecx,5
826
    mov  ecx,5
828
    div  cx
827
    div  cx
829
    inc  eax
828
    inc  eax
830
    mov  ecx,365
829
    mov  ecx,365
831
    imul ecx,ebx
830
    imul ecx,ebx
832
    add  eax,ecx
831
    add  eax,ecx
833
    mov  ecx,ebx
832
    mov  ecx,ebx
834
    shr  ecx,2
833
    shr  ecx,2
835
    add  eax,ecx
834
    add  eax,ecx
836
    dec  eax
835
    dec  eax
837
    cmp  [new_style],0
836
    cmp  [new_style],0
838
    je	 .nonew
837
    je	 .nonew
839
    add  eax,2
838
    add  eax,2
840
    xchg eax,ebx
839
    xchg eax,ebx
841
    mov  ecx,100
840
    mov  ecx,100
842
    xor  edx,edx
841
    xor  edx,edx
843
    div  cx
842
    div  cx
844
    sub  ebx,eax
843
    sub  ebx,eax
845
    shr  eax,2
844
    shr  eax,2
846
    add  ebx,eax
845
    add  ebx,eax
847
  .nonew:
846
  .nonew:
848
    add  ebx,5
847
    add  ebx,5
849
    mov  eax,ebx
848
    mov  eax,ebx
850
    xor  edx,edx
849
    xor  edx,edx
851
    movzx ebx,byte[week_days+1]
850
    movzx ebx,byte[week_days+1]
852
    sub  eax,ebx
851
    sub  eax,ebx
853
    inc  eax
852
    inc  eax
854
    mov  ebx,7
853
    mov  ebx,7
855
    div  bx
854
    div  bx
856
    mov  [firstday],edx
855
    mov  [firstday],edx
857
    ret
856
    ret
858
 
857
 
859
I_END:
858
I_END:
860
>
859
>