Subversion Repositories Kolibri OS

Rev

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

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