Subversion Repositories Kolibri OS

Rev

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

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