Subversion Repositories Kolibri OS

Rev

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

Rev 496 Rev 551
1
; CALENDAR FOR MENUET v1.0
1
; CALENDAR FOR MENUET v1.0
2
; Written in pure assembler by Ivushkin Andrey aka Willow
2
; Written in pure assembler by Ivushkin Andrey aka Willow
3
;
3
;
4
;
4
;
5
; Created:      November 1, 2004
5
; Created:      November 1, 2004
6
; Last changed: January 13, 2005
6
; Last changed: January 13, 2005
7
;
7
;
8
; COMPILE WITH FASM
8
; COMPILE WITH FASM
9
 
9
 
10
WIN_X equ (150 shl 16+270)
10
WIN_X equ (150 shl 16+270)
11
WIN_Y equ (100 shl 16+335)
11
WIN_Y equ (100 shl 16+335)
12
 
12
 
13
LINE1	  equ 27 shl 16+16
13
LINE1	  equ 27 shl 16+16
14
B_MONTH_X equ 10 shl 16+158
14
B_MONTH_X equ 10 shl 16+158
15
B_Y	  equ LINE1
15
B_Y	  equ LINE1
16
B_MONTH   equ 63 shl 16+32
16
B_MONTH   equ 63 shl 16+32
17
 
17
 
18
B_WBAR_X  equ 10 shl 16+250
18
B_WBAR_X  equ 10 shl 16+250
19
B_WBAR_Y  equ 64 shl 16+20
19
B_WBAR_Y  equ 64 shl 16+20
20
B_WEEK	  equ 30 shl 16+70
20
B_WEEK	  equ 30 shl 16+70
21
B_WX_SHIFT equ 32 shl 16
21
B_WX_SHIFT equ 32 shl 16
22
 
22
 
23
B_DBAR_X  equ B_WBAR_X
23
B_DBAR_X  equ B_WBAR_X
24
B_DBAR_Y  equ 85 shl 16+190
24
B_DBAR_Y  equ 85 shl 16+190
25
 
25
 
26
B_DROP	  equ B_MONTH+16
26
B_DROP	  equ B_MONTH+16
27
B_DAYS_Y  equ 100
27
B_DAYS_Y  equ 100
28
B_DAYS_SHIFT equ 30
28
B_DAYS_SHIFT equ 30
29
 
29
 
30
B_YEAR_X  equ 173 shl 16+58
30
B_YEAR_X  equ 173 shl 16+58
31
B_YEAR	  equ 188 shl 16+32
31
B_YEAR	  equ 188 shl 16+32
32
 
32
 
33
B_TODAY_X equ 25 shl 16
33
B_TODAY_X equ 25 shl 16
34
B_TODAY_Y equ 48 shl 16+10
34
B_TODAY_Y equ 48 shl 16+10
35
B_TODAY   equ 30 shl 16+50
35
B_TODAY   equ 30 shl 16+50
36
 
36
 
37
B_SPIN_WIDTH equ 13
37
B_SPIN_WIDTH equ 13
38
B_SPIN_X  equ 234 shl 16+B_SPIN_WIDTH
38
B_SPIN_X  equ 234 shl 16+B_SPIN_WIDTH
39
B_SPIN	  equ 238 shl 16+32
39
B_SPIN	  equ 238 shl 16+32
40
 
40
 
41
B_DATE_X  equ 26 shl 16+60
41
B_DATE_X  equ 26 shl 16+60
42
B_DATE_Y  equ 275 shl 16+16
42
B_DATE_Y  equ 275 shl 16+16
43
B_DATE_BSHIFT equ 80 shl 16
43
B_DATE_BSHIFT equ 80 shl 16
44
B_DATE	  equ 32 shl 16+280
44
B_DATE	  equ 32 shl 16+280
45
B_DATE_SHIFT equ 80 shl 16
45
B_DATE_SHIFT equ 80 shl 16
46
 
46
 
47
B_NS_X	  equ 185 shl 16+75
47
B_NS_X	  equ 185 shl 16+75
48
B_NS_Y	  equ 48 shl 16+10
48
B_NS_Y	  equ 48 shl 16+10
49
B_NS	  equ 190 shl 16+50
49
B_NS	  equ 190 shl 16+50
50
 
50
 
51
FOCUSABLE equ 5
51
FOCUSABLE equ 5
52
SKIP	  equ 1
52
SKIP	  equ 1
53
 
53
 
54
use32		     ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
54
use32		     ; ¢ª«îç¨âì 32-¡¨â­ë© ०¨¬  áᥬ¡«¥à 
55
 
55
 
56
  org	 0x0	     ;  ¤à¥á æ¨ï á ­ã«ï
56
  org	 0x0	     ;  ¤à¥á æ¨ï á ­ã«ï
57
 
57
 
58
  db	 'MENUET01'  ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
58
  db	 'MENUET01'  ; 8-¡ ©â­ë© ¨¤¥­â¨ä¨ª â®à MenuetOS
59
  dd	 0x01	     ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
59
  dd	 0x01	     ; ¢¥àá¨ï § £®«®¢ª  (¢á¥£¤  1)
60
  dd	 start	     ;  ¤à¥á ¬¥âª¨, á ª®â®à®© ­ ç¨­ ¥âáï ¢ë¯®«­¥­¨¥ ¯à®£à ¬¬
60
  dd	 start	     ;  ¤à¥á ¬¥âª¨, á ª®â®à®© ­ ç¨­ ¥âáï ¢ë¯®«­¥­¨¥ ¯à®£à ¬¬
61
  dd	 I_END	     ; à §¬¥à ¯à®£à ¬¬ë
61
  dd	 I_END	     ; à §¬¥à ¯à®£à ¬¬ë
62
  dd	 0x1000      ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
62
  dd	 0x1000      ; ª®«¨ç¥á⢮ ¯ ¬ïâ¨
63
  dd	 0x1000      ;  ¤à¥á ¢¥à設ë áâíª 
63
  dd	 0x1000      ;  ¤à¥á ¢¥à設ë áâíª 
64
  dd	 0x0	     ;  ¤à¥á ¡ãä¥à  ¤«ï áâப¨ ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
64
  dd	 0x0	     ;  ¤à¥á ¡ãä¥à  ¤«ï áâப¨ ¯ à ¬¥â஢ (­¥ ¨á¯®«ì§ã¥âáï)
65
  dd	 0x0	     ; § à¥§¥à¢¨à®¢ ­®
65
  dd	 0x0	     ; § à¥§¥à¢¨à®¢ ­®
66
include 'lang.inc'
66
include 'lang.inc'
67
include '..\..\..\macros.inc' ; 㬥­ìè ¥â à §¬¥à ¯à®£à ¬¬ë
67
include '..\..\..\macros.inc' ; 㬥­ìè ¥â à §¬¥à ¯à®£à ¬¬ë
68
 
68
 
69
 
69
 
70
 
70
 
71
macro  ShowFocus field,reg
71
macro  ShowFocus field,reg
72
{
72
{
73
   local  .nofocus, .exit
73
   local  .nofocus, .exit
74
     cmp  [focus],field
74
     cmp  [focus],field
75
     jne  .nofocus
75
     jne  .nofocus
76
   if reg eq
76
   if reg eq
77
     mov  ecx,0x10e7c750;0x10ddeeff
77
     mov  ecx,0x10e7c750;0x10ddeeff
78
   else
78
   else
79
     mov  reg,0x10e7c750;0x10ddeeff
79
     mov  reg,0x10e7c750;0x10ddeeff
80
   end if
80
   end if
81
     jmp  .exit
81
     jmp  .exit
82
   .nofocus:
82
   .nofocus:
83
   if reg eq
83
   if reg eq
84
     mov  ecx,0x10000000
84
     mov  ecx,0x10000000
85
   else
85
   else
86
     mov  reg,0x10000000
86
     mov  reg,0x10000000
87
   end if
87
   end if
88
   .exit:
88
   .exit:
89
}
89
}
90
 
90
 
91
month_name:
91
month_name:
92
if lang eq ru
92
if lang eq ru
93
     db   8
93
     db   8
94
     db   'Ÿ­¢ àì  '
94
     db   'Ÿ­¢ àì  '
95
     db   '”¥¢à «ì '
95
     db   '”¥¢à «ì '
96
     db   'Œ àâ    '
96
     db   'Œ àâ    '
97
     db   '€¯à¥«ì  '
97
     db   '€¯à¥«ì  '
98
     db   'Œ ©     '
98
     db   'Œ ©     '
99
     db   'ˆî­ì    '
99
     db   'ˆî­ì    '
100
     db   'ˆî«ì    '
100
     db   'ˆî«ì    '
101
     db   '€¢£ãáâ  '
101
     db   '€¢£ãáâ  '
102
     db   '‘¥­âï¡àì'
102
     db   '‘¥­âï¡àì'
103
     db   'Žªâï¡àì '
103
     db   'Žªâï¡àì '
104
     db   '®ï¡àì  '
104
     db   '®ï¡àì  '
105
     db   '„¥ª ¡àì '
105
     db   '„¥ª ¡àì '
106
else if lang eq de
106
else if lang eq de
107
     db   9
107
     db   9
108
     db   'Januar   '
108
     db   'Januar   '
109
     db   'Februar  '
109
     db   'Februar  '
110
     db   'MÁrz     '
110
     db   'MÁrz     '
111
     db   'April    '
111
     db   'April    '
112
     db   'Mai      '
112
     db   'Mai      '
113
     db   'Juni     '
113
     db   'Juni     '
114
     db   'Juli     '
114
     db   'Juli     '
115
     db   'August   '
115
     db   'August   '
116
     db   'September'
116
     db   'September'
117
     db   'Oktober  '
117
     db   'Oktober  '
118
     db   'November '
118
     db   'November '
119
     db   'Dezember '
119
     db   'Dezember '
120
else if lang eq fr
120
else if lang eq fr
121
     db   9
121
     db   9
122
     db   'Janvier  '
122
     db   'Janvier  '
123
     db   'Fevrier  '
123
     db   'Fevrier  '
124
     db   'Mars     '
124
     db   'Mars     '
125
     db   'Avril    '
125
     db   'Avril    '
126
     db   'Mai      '
126
     db   'Mai      '
127
     db   'Juin     '
127
     db   'Juin     '
128
     db   'Juliet   '
128
     db   'Juliet   '
129
     db   'Aout     '
129
     db   'Aout     '
130
     db   'Septembre'
130
     db   'Septembre'
131
     db   'Octobre  '
131
     db   'Octobre  '
132
     db   'Novembre '
132
     db   'Novembre '
133
     db   'Decembre '
133
     db   'Decembre '
134
else if lang eq fi
134
else if lang eq fi
135
     db   9
135
     db   9
136
     db   'Tammikuu '
136
     db   'Tammikuu '
137
     db   'Helmikuu '
137
     db   'Helmikuu '
138
     db   'Maaliskuu'
138
     db   'Maaliskuu'
139
     db   'Huhtikuu '
139
     db   'Huhtikuu '
140
     db   'Toukokuu '
140
     db   'Toukokuu '
141
     db   'KesÁkuu  '
141
     db   'KesÁkuu  '
142
     db   'HeinÁkuu '
142
     db   'HeinÁkuu '
143
     db   'Elokuu   '
143
     db   'Elokuu   '
144
     db   'Syyskuu  '
144
     db   'Syyskuu  '
145
     db   'Lokakuu  '
145
     db   'Lokakuu  '
146
     db   'Marraskuu'
146
     db   'Marraskuu'
147
     db   'Joulukuu '
147
     db   'Joulukuu '
148
else if lang eq et
148
else if lang eq et
149
     db   9
149
     db   9
150
     db   'Jaanuar  '
150
     db   'Jaanuar  '
151
     db   'Veebruar '
151
     db   'Veebruar '
152
     db   'Märts    '
152
     db   'Märts    '
153
     db   'Aprill   '
153
     db   'Aprill   '
154
     db   'Mai      '
154
     db   'Mai      '
155
     db   'Juuni    '
155
     db   'Juuni    '
156
     db   'Juuli    '
156
     db   'Juuli    '
157
     db   'August   '
157
     db   'August   '
158
     db   'September'
158
     db   'September'
159
     db   'Oktoober '
159
     db   'Oktoober '
160
     db   'November '
160
     db   'November '
161
     db   'Detsember'
161
     db   'Detsember'
162
else
162
else
163
     db   9
163
     db   9
164
     db   'January  '
164
     db   'January  '
165
     db   'February '
165
     db   'February '
166
     db   'March    '
166
     db   'March    '
167
     db   'April    '
167
     db   'April    '
168
     db   'May      '
168
     db   'May      '
169
     db   'June     '
169
     db   'June     '
170
     db   'July     '
170
     db   'July     '
171
     db   'August   '
171
     db   'August   '
172
     db   'September'
172
     db   'September'
173
     db   'October  '
173
     db   'October  '
174
     db   'November '
174
     db   'November '
175
     db   'December '
175
     db   'December '
176
end if
176
end if
177
spinner db '< >'
177
spinner db '< >'
178
week_days:
178
week_days:
179
if lang eq ru
179
if lang eq ru
180
     db   2
180
     db   2
181
     db   1
181
     db   1
182
     db   '­'
182
     db   '­'
183
     db   '‚â'
183
     db   '‚â'
184
     db   '‘à'
184
     db   '‘à'
185
     db   '—â'
185
     db   '—â'
186
     db   'â'
186
     db   'â'
187
     db   '‘¡'
187
     db   '‘¡'
188
     db   '‚á'
188
     db   '‚á'
189
else if lang eq de
189
else if lang eq de
190
     db   2
190
     db   2
191
     db   7
191
     db   7
192
     db   'So'
192
     db   'So'
193
     db   'Mo'
193
     db   'Mo'
194
     db   'Di'
194
     db   'Di'
195
     db   'Mi'
195
     db   'Mi'
196
     db   'Do'
196
     db   'Do'
197
     db   'Fr'
197
     db   'Fr'
198
     db   'Sa'
198
     db   'Sa'
199
else if lang eq fr
199
else if lang eq fr
200
     db   3
200
     db   3
201
     db   7
201
     db   7
202
     db   'Dim'
202
     db   'Dim'
203
     db   'Lun'
203
     db   'Lun'
204
     db   'Mar'
204
     db   'Mar'
205
     db   'Mer'
205
     db   'Mer'
206
     db   'Jeu'
206
     db   'Jeu'
207
     db   'Ven'
207
     db   'Ven'
208
     db   'Sam'
208
     db   'Sam'
209
else if lang eq fi
209
else if lang eq fi
210
     db   2
210
     db   2
211
     db   7
211
     db   7
212
     db   'Su'
212
     db   'Su'
213
     db   'Ma'
213
     db   'Ma'
214
     db   'Ti'
214
     db   'Ti'
215
     db   'Ke'
215
     db   'Ke'
216
     db   'To'
216
     db   'To'
217
     db   'Pe'
217
     db   'Pe'
218
     db   'La'
218
     db   'La'
219
else if lang eq et
219
else if lang eq et
220
     db   3
220
     db   3
221
     db   7
221
     db   7
222
     db   'Esm'
222
     db   'Esm'
223
     db   'Tei'
223
     db   'Tei'
224
     db   'Kol'
224
     db   'Kol'
225
     db   'Nel'
225
     db   'Nel'
226
     db   'Ree'
226
     db   'Ree'
227
     db   'Lau'
227
     db   'Lau'
228
     db   'Püh'
228
     db   'Püh'
229
else
229
else
230
     db   3
230
     db   3
231
     db   7
231
     db   7
232
     db   'Sun'
232
     db   'Sun'
233
     db   'Mon'
233
     db   'Mon'
234
     db   'Tue'
234
     db   'Tue'
235
     db   'Wen'
235
     db   'Wen'
236
     db   'Thi'
236
     db   'Thi'
237
     db   'Fri'
237
     db   'Fri'
238
     db   'Sat'
238
     db   'Sat'
239
end if
239
end if
240
 
240
 
241
str2int:
241
str2int:
242
    xor  eax,eax
242
    xor  eax,eax
243
    lodsb
243
    lodsb
244
    mov  ebx,eax
244
    mov  ebx,eax
245
    shr  ebx,4
245
    shr  ebx,4
246
    and  eax,0xf
246
    and  eax,0xf
247
    imul ebx,10
247
    imul ebx,10
248
    add  al,bl
248
    add  al,bl
249
    ret
249
    ret
250
 
250
 
251
start:
251
start:
252
    mcall 29
252
    mcall 29
253
    mov  [datestr],eax
253
    mov  [datestr],eax
254
    mov  esi,datestr
254
    mov  esi,datestr
255
    call str2int
255
    call str2int
256
    add  eax,1900
256
    add  eax,1900
257
    mov  [Year],eax
257
    mov  [Year],eax
258
    call str2int
258
    call str2int
259
    dec  eax
259
    dec  eax
260
    mov  [Month],eax
260
    mov  [Month],eax
261
    call str2int
261
    call str2int
262
    mov  [day_sel],eax
262
    mov  [day_sel],eax
263
    test byte[esi],0
263
    test byte[esi],0
264
    jnz  .no2000
264
    jnz  .no2000
265
    add  [Year],100
265
    add  [Year],100
266
  .no2000:
266
  .no2000:
267
    jmp  upd		; §¤¥áì ­ ç¨­ ¥âáï ¢ë¯®«­¥­¨¥ ¯à®£à ¬¬ë
267
    jmp  upd		; §¤¥áì ­ ç¨­ ¥âáï ¢ë¯®«­¥­¨¥ ¯à®£à ¬¬ë
268
red:			; ¯¥à¥à¨á®¢ âì ®ª­®
268
red:			; ¯¥à¥à¨á®¢ âì ®ª­®
269
 
269
 
270
    call draw_window	; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
270
    call draw_window	; ¢ë§ë¢ ¥¬ ¯à®æ¥¤ãàã ®âà¨á®¢ª¨ ®ª­ 
271
 
271
 
272
still:			; ƒ‹€‚›‰ –ˆŠ‹ Žƒ€ŒŒ›
272
still:			; ƒ‹€‚›‰ –ˆŠ‹ Žƒ€ŒŒ›
273
 
273
 
274
    mov  eax,23 		; wait here for event
274
    mov  eax,23 		; wait here for event
275
    mov  ebx,50
275
    mov  ebx,50
276
    mcall
276
    mcall
277
  .evt:
277
  .evt:
278
    mov  ebp,[focus]
278
    mov  ebp,[focus]
279
    cmp  eax,1		; ¯¥à¥à¨á®¢ âì ®ª­® ?
279
    cmp  eax,1		; ¯¥à¥à¨á®¢ âì ®ª­® ?
280
    je	 red		; ¥á«¨ ¤  - ­  ¬¥âªã red
280
    je	 red		; ¥á«¨ ¤  - ­  ¬¥âªã red
281
    cmp  eax,2		; ­ ¦ â  ª« ¢¨è  ?
281
    cmp  eax,2		; ­ ¦ â  ª« ¢¨è  ?
282
    je	 key		; ¥á«¨ ¤  - ­  key
282
    je	 key		; ¥á«¨ ¤  - ­  key
283
    cmp  eax,3		; ­ ¦ â  ª­®¯ª  ?
283
    cmp  eax,3		; ­ ¦ â  ª­®¯ª  ?
284
    je	 button 	; ¥á«¨ ¤  - ­  button
284
    je	 button 	; ¥á«¨ ¤  - ­  button
285
 
285
 
286
    call draw_clock
286
    call draw_clock
287
 
287
 
288
    jmp  still		; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
288
    jmp  still		; ¥á«¨ ¤à㣮¥ ᮡë⨥ - ¢ ­ ç «® 横« 
289
 
289
 
290
  key:			; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
290
  key:			; ­ ¦ â  ª« ¢¨è  ­  ª« ¢¨ âãà¥
291
    mov  eax,2		; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®« 
291
    mov  eax,2		; äã­ªæ¨ï 2 - áç¨â âì ª®¤ ᨬ¢®« 
292
    mcall		; ¢ë§®¢ á¨á⥬ë
292
    mcall		; ¢ë§®¢ á¨á⥬ë
293
    cmp  ah,9
293
    cmp  ah,9
294
    jne  no_tab
294
    jne  no_tab
295
  .tab:
295
  .tab:
296
    cmp  ebp,FOCUSABLE
296
    cmp  ebp,FOCUSABLE
297
    je	 foc_cycle
297
    je	 foc_cycle
298
    inc  [focus]
298
    inc  [focus]
299
  upd:
299
  upd:
300
    call calculate
300
    call calculate
301
    jmp  red
301
    jmp  red
302
  foc_cycle:
302
  foc_cycle:
303
    mov  [focus],2
303
    mov  [focus],2
304
    jmp  upd
304
    jmp  upd
305
  no_tab:
305
  no_tab:
306
    push eax
306
    push eax
307
    shr  eax,8
307
    shr  eax,8
308
    mov  ecx,12
308
    mov  ecx,12
309
    mov  edi,Fkeys
309
    mov  edi,Fkeys
310
    repne scasb
310
    repne scasb
311
    pop  eax
311
    pop  eax
312
    jnz  .noFkey
312
    jnz  .noFkey
313
    sub  edi,Fkeys+1
313
    sub  edi,Fkeys+1
314
    mov  [Month],edi
314
    mov  [Month],edi
315
    jmp  upd
315
    jmp  upd
316
  .noFkey:
316
  .noFkey:
317
    cmp  ebp,4
317
    cmp  ebp,4
318
    jne  no_spinner
318
    jne  no_spinner
319
    cmp  ah,176
319
    cmp  ah,176
320
    je	 year_dec
320
    je	 year_dec
321
    cmp  ah,179
321
    cmp  ah,179
322
    je	 year_inc
322
    je	 year_inc
323
  no_spinner:
323
  no_spinner:
324
    cmp  ebp,2
324
    cmp  ebp,2
325
    jne  .nomonth
325
    jne  .nomonth
326
    cmp  ah,177
326
    cmp  ah,177
327
    je	 noclose.drop
327
    je	 noclose.drop
328
    jmp  still
328
    jmp  still
329
  .nomonth:
329
  .nomonth:
330
    cmp  ebp,3
330
    cmp  ebp,3
331
    je	 noy_up.year_evt
331
    je	 noy_up.year_evt
332
    cmp  ebp,5
332
    cmp  ebp,5
333
    jne  still
333
    jne  still
334
    mov  ebx,[day_sel]
334
    mov  ebx,[day_sel]
335
    cmp  ah,176 	; left arrow
335
    cmp  ah,176 	; left arrow
336
    jb	 still
336
    jb	 still
337
    cmp  ah,179
337
    cmp  ah,179
338
    ja	 still
338
    ja	 still
339
    shr  eax,8
339
    shr  eax,8
340
    sub  eax,176
340
    sub  eax,176
341
    movsx ecx,byte[day_bounds+eax*2]
341
    movsx ecx,byte[day_bounds+eax*2]
342
    movzx eax,byte[day_bounds+eax*2+1]
342
    movzx eax,byte[day_bounds+eax*2+1]
343
    add  ecx,ebx
343
    add  ecx,ebx
344
    test eax,eax
344
    test eax,eax
345
    jz	 .chk0
345
    jz	 .chk0
346
    cmp  ecx,eax
346
    cmp  ecx,eax
347
    ja	 still
347
    ja	 still
348
  .ok:
348
  .ok:
349
    mov  [day_sel],ecx
349
    mov  [day_sel],ecx
350
    call draw_days
350
    call draw_days
351
    jmp  still		; ¢¥à­ãâìáï ª ­ ç «ã 横« 
351
    jmp  still		; ¢¥à­ãâìáï ª ­ ç «ã 横« 
352
  .chk0:
352
  .chk0:
353
    cmp  ecx,eax
353
    cmp  ecx,eax
354
    jle  still
354
    jle  still
355
    jmp  .ok
355
    jmp  .ok
356
 
356
 
357
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
357
day_bounds db -1,0,7,0,-7,0,1,0 ; left,down,up,right
358
 
358
 
359
  button:		; ­ ¦ â  ª­®¯ª  ¢ ®ª­¥ ¯à®£à ¬¬ë
359
  button:		; ­ ¦ â  ª­®¯ª  ¢ ®ª­¥ ¯à®£à ¬¬ë
360
    mov  eax,17 	; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
360
    mov  eax,17 	; 17 - ¯®«ãç¨âì ¨¤¥­â¨ä¨ª â®à ­ ¦ â®© ª­®¯ª¨
361
    mcall		; ¢ë§®¢ á¨á⥬ë
361
    mcall		; ¢ë§®¢ á¨á⥬ë
362
    movzx ebx,ah
362
    movzx ebx,ah
363
    cmp  ah,200
363
    cmp  ah,200
364
    jbe  nodayselect
364
    jbe  nodayselect
365
    sub  ah,200
365
    sub  ah,200
366
    mov  byte[day_sel],ah
366
    mov  byte[day_sel],ah
367
    cmp  ebp,5
367
    cmp  ebp,5
368
    jne  .redraw
368
    jne  .redraw
369
    call draw_days
369
    call draw_days
370
    jmp  still
370
    jmp  still
371
  .redraw:
371
  .redraw:
372
    mov  [focus],5
372
    mov  [focus],5
373
    jmp  red
373
    jmp  red
374
  nodayselect:
374
  nodayselect:
375
    cmp  ah,100
375
    cmp  ah,100
376
    jb	 no_list
376
    jb	 no_list
377
    sub  ah,100
377
    sub  ah,100
378
    mov  byte[Month],ah
378
    mov  byte[Month],ah
379
    mov  [focus],2
379
    mov  [focus],2
380
    jmp  upd
380
    jmp  upd
381
  no_list:
381
  no_list:
382
    cmp  ah,1		; ¨¤¥­â¨ä¨ª â®à == 1 ?
382
    cmp  ah,1		; ¨¤¥­â¨ä¨ª â®à == 1 ?
383
    jne  noclose	; ¥á«¨ ­¥â - ¨¤¨ ¢¯¥àñ¤ ­  noclose
383
    jne  noclose	; ¥á«¨ ­¥â - ¨¤¨ ¢¯¥àñ¤ ­  noclose
384
  close:
384
  close:
385
    or	 eax,-1 	; ¢ë室 ¨§ ¯à®£à ¬¬ë
385
    or	 eax,-1 	; ¢ë室 ¨§ ¯à®£à ¬¬ë
386
    mcall		; ¢ë§®¢ á¨á⥬ë
386
    mcall		; ¢ë§®¢ á¨á⥬ë
387
 
387
 
388
  noclose:
388
  noclose:
389
 
389
 
390
    cmp  ah,72
390
    cmp  ah,72
391
    je	 plus_he
391
    je	 plus_he
392
 
392
 
393
    cmp  ah,73
393
    cmp  ah,73
394
    je	 plus_hd
394
    je	 plus_hd
395
 
395
 
396
    cmp  ah,74
396
    cmp  ah,74
397
    je	 minus_he
397
    je	 minus_he
398
 
398
 
399
    cmp  ah,75
399
    cmp  ah,75
400
    je	 minus_hd
400
    je	 minus_hd
401
 
401
 
402
    cmp  ah,76
402
    cmp  ah,76
403
    je	 plus_me
403
    je	 plus_me
404
 
404
 
405
    cmp  ah,77
405
    cmp  ah,77
406
    je	 plus_md
406
    je	 plus_md
407
 
407
 
408
    cmp  ah,78
408
    cmp  ah,78
409
    je	 minus_me
409
    je	 minus_me
410
 
410
 
411
    cmp  ah,79
411
    cmp  ah,79
412
    je	 minus_md
412
    je	 minus_md
413
 
413
 
414
    cmp  ah,80
414
    cmp  ah,80
415
    je	 reset
415
    je	 reset
416
 
416
 
417
    cmp  ah,81
417
    cmp  ah,81
418
    je	 set_date
418
    je	 set_date
419
 
419
 
420
    cmp  ah,2		; drop down list
420
    cmp  ah,2		; drop down list
421
    jne  no_dropdn
421
    jne  no_dropdn
422
  .drop:
422
  .drop:
423
    mov  [focus],2
423
    mov  [focus],2
424
    cmp  [dropped],al	; ==0
424
    cmp  [dropped],al	; ==0
425
    jne  red
425
    jne  red
426
    call draw_window
426
    call draw_window
427
    mov  edx,1 shl 31+231
427
    mov  edx,1 shl 31+231
428
    mov  ecx,31
428
    mov  ecx,31
429
    mov  eax,8
429
    mov  eax,8
430
  .bremove:
430
  .bremove:
431
    mcall
431
    mcall
432
    dec  edx
432
    dec  edx
433
    loop .bremove
433
    loop .bremove
434
    call draw_dropdown
434
    call draw_dropdown
435
    jmp  still
435
    jmp  still
436
  no_dropdn:
436
  no_dropdn:
437
    cmp  ah,3		; year -1
437
    cmp  ah,3		; year -1
438
    jne  noy_dn
438
    jne  noy_dn
439
  year_dec:
439
  year_dec:
440
    dec  [Year]
440
    dec  [Year]
441
    mov  [focus],4
441
    mov  [focus],4
442
    jmp  upd
442
    jmp  upd
443
  noy_dn:
443
  noy_dn:
444
    cmp  ah,4		; year+1
444
    cmp  ah,4		; year+1
445
    jne  noy_up
445
    jne  noy_up
446
  year_inc:
446
  year_inc:
447
    inc  [Year]
447
    inc  [Year]
448
    mov  [focus],4
448
    mov  [focus],4
449
    jmp  upd
449
    jmp  upd
450
  noy_up:
450
  noy_up:
451
    cmp  ah,5
451
    cmp  ah,5
452
    jne  noy_click
452
    jne  noy_click
453
    mov  [focus],3
453
    mov  [focus],3
454
    call draw_window
454
    call draw_window
455
  .still:
455
  .still:
456
    mcall 10
456
    mcall 10
457
    cmp  eax,2
457
    cmp  eax,2
458
    jne  still.evt
458
    jne  still.evt
459
    mcall 2
459
    mcall 2
460
  .year_evt:
460
  .year_evt:
461
    mov  ebx,10
461
    mov  ebx,10
462
    cmp  ah,9
462
    cmp  ah,9
463
    je	 key.tab
463
    je	 key.tab
464
    cmp  ah,8		; backspace
464
    cmp  ah,8		; backspace
465
    jne  .nobsp
465
    jne  .nobsp
466
    mov  eax,[Year]
466
    mov  eax,[Year]
467
    xor  edx,edx
467
    xor  edx,edx
468
    div  ebx
468
    div  ebx
469
  .ch_year:
469
  .ch_year:
470
    mov  [Year],eax
470
    mov  [Year],eax
471
    call draw_year
471
    call draw_year
472
    jmp  .still
472
    jmp  .still
473
  .nobsp:
473
  .nobsp:
474
    cmp  ah,13		; enter
474
    cmp  ah,13		; enter
475
    je	 upd
475
    je	 upd
476
    cmp  ah,182
476
    cmp  ah,182
477
    jne  .noclear	; del
477
    jne  .noclear	; del
478
    xor  eax,eax
478
    xor  eax,eax
479
    jmp  .ch_year
479
    jmp  .ch_year
480
  .noclear:
480
  .noclear:
481
    cmp  ah,48
481
    cmp  ah,48
482
    jb	 .still
482
    jb	 .still
483
    cmp  ah,57
483
    cmp  ah,57
484
    ja	 .still
484
    ja	 .still
485
    cmp  [Year],1000
485
    cmp  [Year],1000
486
    jae  .still
486
    jae  .still
487
    shr  eax,8
487
    shr  eax,8
488
    lea  ecx,[eax-48]
488
    lea  ecx,[eax-48]
489
    mov  eax,[Year]
489
    mov  eax,[Year]
490
    imul eax,ebx
490
    imul eax,ebx
491
    add  eax,ecx
491
    add  eax,ecx
492
    jmp  .ch_year
492
    jmp  .ch_year
493
  noy_click:
493
  noy_click:
494
    cmp  ah,10
494
    cmp  ah,10
495
    jne  start
495
    jne  start
496
    xor  [new_style],1
496
    xor  [new_style],1
497
    jmp  upd
497
    jmp  upd
498
 
498
 
499
 
499
 
500
reset:
500
reset:
501
 
501
 
502
    mov  eax,3
502
    mov  eax,3
503
    mcall
503
    mcall
504
    mov  ecx,eax
504
    mov  ecx,eax
505
    shl  ecx,16
505
    shl  ecx,16
506
    shr  ecx,16
506
    shr  ecx,16
507
    mov  eax,22
507
    mov  eax,22
508
    mov  ebx,0x00000000
508
    mov  ebx,0x00000000
509
    mcall
509
    mcall
510
 
510
 
511
    jmp  still
511
    jmp  still
512
 
512
 
513
plus_hd:
513
plus_hd:
514
 
514
 
515
    mov  eax,3
515
    mov  eax,3
516
    mcall
516
    mcall
517
    mov  ecx,eax
517
    mov  ecx,eax
518
    add  ecx,1
518
    add  ecx,1
519
    mov  eax,22
519
    mov  eax,22
520
    mov  ebx,0x00000000
520
    mov  ebx,0x00000000
521
    mcall
521
    mcall
522
 
522
 
523
    jmp  still
523
    jmp  still
524
 
524
 
525
plus_he:
525
plus_he:
526
 
526
 
527
    mov  eax,3
527
    mov  eax,3
528
    mcall
528
    mcall
529
    mov  ecx,eax
529
    mov  ecx,eax
530
    add  ecx,16
530
    add  ecx,16
531
    mov  eax,22
531
    mov  eax,22
532
    mov  ebx,0x00000000
532
    mov  ebx,0x00000000
533
    mcall
533
    mcall
534
 
534
 
535
    jmp  still
535
    jmp  still
536
 
536
 
537
minus_hd:
537
minus_hd:
538
 
538
 
539
    mov  eax,3
539
    mov  eax,3
540
    mcall
540
    mcall
541
    mov  ecx,eax
541
    mov  ecx,eax
542
    sub  ecx,1
542
    sub  ecx,1
543
    mov  eax,22
543
    mov  eax,22
544
    mov  ebx,0x00000000
544
    mov  ebx,0x00000000
545
    mcall
545
    mcall
546
 
546
 
547
    jmp  still
547
    jmp  still
548
 
548
 
549
minus_he:
549
minus_he:
550
 
550
 
551
    mov  eax,3
551
    mov  eax,3
552
    mcall
552
    mcall
553
    mov  ecx,eax
553
    mov  ecx,eax
554
    sub  ecx,16
554
    sub  ecx,16
555
    mov  eax,22
555
    mov  eax,22
556
    mov  ebx,0x00000000
556
    mov  ebx,0x00000000
557
    mcall
557
    mcall
558
 
558
 
559
    jmp  still
559
    jmp  still
560
 
560
 
561
plus_md:
561
plus_md:
562
 
562
 
563
    mov  eax,3
563
    mov  eax,3
564
    mcall
564
    mcall
565
    mov  ecx,eax
565
    mov  ecx,eax
566
    add  ecx,256
566
    add  ecx,256
567
    mov  eax,22
567
    mov  eax,22
568
    mov  ebx,0x00000000
568
    mov  ebx,0x00000000
569
    mcall
569
    mcall
570
 
570
 
571
    jmp  still
571
    jmp  still
572
 
572
 
573
plus_me:
573
plus_me:
574
 
574
 
575
    mov  eax,3
575
    mov  eax,3
576
    mcall
576
    mcall
577
    mov  ecx,eax
577
    mov  ecx,eax
578
    add  ecx,4096
578
    add  ecx,4096
579
    mov  eax,22
579
    mov  eax,22
580
    mov  ebx,0x00000000
580
    mov  ebx,0x00000000
581
    mcall
581
    mcall
582
 
582
 
583
    jmp  still
583
    jmp  still
584
 
584
 
585
minus_md:
585
minus_md:
586
 
586
 
587
    mov  eax,3
587
    mov  eax,3
588
    mcall
588
    mcall
589
    mov  ecx,eax
589
    mov  ecx,eax
590
    sub  ecx,256
590
    sub  ecx,256
591
    mov  eax,22
591
    mov  eax,22
592
    mov  ebx,0x00000000
592
    mov  ebx,0x00000000
593
    mcall
593
    mcall
594
 
594
 
595
    jmp  still
595
    jmp  still
596
 
596
 
597
minus_me:
597
minus_me:
598
 
598
 
599
    mov  eax,3
599
    mov  eax,3
600
    mcall
600
    mcall
601
    mov  ecx,eax
601
    mov  ecx,eax
602
    sub  ecx,4096
602
    sub  ecx,4096
603
    mov  eax,22
603
    mov  eax,22
604
    mov  ebx,0x00000000
604
    mov  ebx,0x00000000
605
    mcall
605
    mcall
606
 
606
 
607
    jmp  still
607
    jmp  still
608
 
608
 
609
set_date:
609
set_date:
610
 
610
 
611
    mov  eax,0x00000000
611
    mov  eax,0x00000000
612
    mov ebx,[day_sel]
612
    mov ebx,[day_sel]
613
    call additem
613
    call additem
614
    shl  eax,8
614
    shl  eax,8
615
    mov  ebx,[Month]
615
    mov  ebx,[Month]
616
    add  ebx,1
616
    add  ebx,1
617
    call additem
617
    call additem
618
    shl  eax,8
618
    shl  eax,8
619
    mov  ebx,[Year]
619
    mov  ebx,[Year]
620
    call additem
620
    call additem
621
    mov  ecx,eax
621
    mov  ecx,eax
622
    mov  eax,22
622
    mov  eax,22
623
    mov  ebx,1
623
    mov  ebx,1
624
    mcall
624
    mcall
625
 
625
 
626
    jmp  still
626
    jmp  still
627
 
627
 
628
additem:
628
additem:
629
 
629
 
630
    add  eax,1
630
    add  eax,1
631
    daa
631
    daa
632
    sub  ebx,1
632
    sub  ebx,1
633
    cmp  ebx,0
633
    cmp  ebx,0
634
    jne  additem
634
    jne  additem
635
 
635
 
636
    ret
636
    ret
637
 
637
 
638
 
638
 
639
;   *********************************************
639
;   *********************************************
640
;   *******  Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€ *******
640
;   *******  Ž…„…‹…ˆ… ˆ Ž’ˆ‘Ž‚Š€ ŽŠ€ *******
641
;   *********************************************
641
;   *********************************************
642
 
642
 
643
draw_clock:
643
draw_clock:
644
 
644
 
645
    mov  eax,3
645
    mov  eax,3
646
    mcall
646
    mcall
647
    mov  ecx,eax
647
    mov  ecx,eax
648
    mov  eax,47
648
    mov  eax,47
649
    mov esi,0x50000000
649
    mov esi,0x50000000
650
    mov  edi,0xaabbcc
650
    mov  edi,0xaabbcc
651
    mov  ebx,0x00020100
651
    mov  ebx,0x00020100
652
    mov  edx,205*65536+280
652
    mov  edx,205*65536+280
653
    mcall
653
    mcall
654
 
654
 
655
    shr  ecx,8
655
    shr  ecx,8
656
    add  edx,20*65536
656
    add  edx,20*65536
657
    mcall
657
    mcall
658
 
658
 
659
    shr  ecx,8
659
    shr  ecx,8
660
    add  edx,20*65536
660
    add  edx,20*65536
661
    mcall
661
    mcall
662
    ret
662
    ret
663
 
663
 
664
draw_window:
664
draw_window:
665
 
665
 
666
 
666
 
667
    mov  eax,12 		   ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
667
    mov  eax,12 		   ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
668
    mov  ebx,1			   ; 1 - ­ ç¨­ ¥¬ à¨á®¢ âì
668
    mov  ebx,1			   ; 1 - ­ ç¨­ ¥¬ à¨á®¢ âì
669
    mcall
669
    mcall
670
				   ; ‘Ž‡„€ðŒ ŽŠŽ
670
				   ; ‘Ž‡„€ðŒ ŽŠŽ
671
    xor  eax,eax		   ; äã­ªæ¨ï 0 : ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª­®
671
    xor  eax,eax		   ; äã­ªæ¨ï 0 : ®¯à¥¤¥«¨âì ¨ ®âà¨á®¢ âì ®ª­®
672
    mov  ebx,WIN_X
672
    mov  ebx,WIN_X
673
  if SKIP eq 0
673
  if SKIP eq 0
674
    mov  ecx,WIN_Y
674
    mov  ecx,WIN_Y
675
  else
675
  else
676
    mov  ecx,WIN_Y-15
676
    mov  ecx,WIN_Y-15
677
  end if
677
  end if
678
    mov  edx,0x13aabbcc 	   ; 梥â à ¡®ç¥© ®¡« á⨠ RRGGBB,8->color gl
678
    mov  edx,0x14aabbcc 	   ; 梥â à ¡®ç¥© ®¡« á⨠ RRGGBB,8->color gl
679
    mov  edi,title		   ; § £®«®¢®ª
679
    mov  edi,title		   ; § £®«®¢®ª
680
    mcall
680
    mcall
681
    call draw_week
681
    call draw_week
682
 
682
 
683
    mov  eax,8
683
    mov  eax,8
684
    mov  ebx,205*65536+7
684
    mov  ebx,205*65536+7
685
    mov  ecx,290*65536+10
685
    mov  ecx,290*65536+10
686
    mov  esi,0x005555dd
686
    mov  esi,0x005555dd
687
    mov  edx,72
687
    mov  edx,72
688
    mcall
688
    mcall
689
 
689
 
690
    mov  ebx,212*65536+7
690
    mov  ebx,212*65536+7
691
    inc  edx
691
    inc  edx
692
    mcall
692
    mcall
693
 
693
 
694
    mov  ebx,205*65536+7
694
    mov  ebx,205*65536+7
695
    mov  ecx,300*65536+10
695
    mov  ecx,300*65536+10
696
    inc  edx
696
    inc  edx
697
    mcall
697
    mcall
698
 
698
 
699
    mov  ebx,212*65536+7
699
    mov  ebx,212*65536+7
700
    inc  edx
700
    inc  edx
701
    mcall
701
    mcall
702
 
702
 
703
    mov  ebx,224*65536+7
703
    mov  ebx,224*65536+7
704
    mov  ecx,290*65536+10
704
    mov  ecx,290*65536+10
705
    inc  edx
705
    inc  edx
706
    mcall
706
    mcall
707
 
707
 
708
    mov  ebx,231*65536+7
708
    mov  ebx,231*65536+7
709
    inc  edx
709
    inc  edx
710
    mcall
710
    mcall
711
 
711
 
712
    mov  ebx,224*65536+7
712
    mov  ebx,224*65536+7
713
    mov  ecx,300*65536+10
713
    mov  ecx,300*65536+10
714
    inc  edx
714
    inc  edx
715
    mcall
715
    mcall
716
 
716
 
717
    mov  ebx,231*65536+7
717
    mov  ebx,231*65536+7
718
    inc  edx
718
    inc  edx
719
    mcall
719
    mcall
720
 
720
 
721
    mov  ebx,243*65536+14
721
    mov  ebx,243*65536+14
722
    mov  ecx,290*65536+20
722
    mov  ecx,290*65536+20
723
    mov  esi,0x00dd7777
723
    mov  esi,0x00dd7777
724
    inc  edx
724
    inc  edx
725
    mcall
725
    mcall
726
 
726
 
727
    mov  ebx,10*65536+100
727
    mov  ebx,10*65536+100
728
    mov  ecx,290*65536+20
728
    mov  ecx,290*65536+20
729
    mov  esi,0x00d5d5d5
729
    mov  esi,0x00d5d5d5
730
    inc  edx
730
    inc  edx
731
    mcall
731
    mcall
732
 
732
 
733
    mov  esi,0x05080d0
733
    mov  esi,0x05080d0
734
  if SKIP eq 0
734
  if SKIP eq 0
735
    mov  ebx,B_DATE_X
735
    mov  ebx,B_DATE_X
736
    mov  ecx,B_DATE_Y
736
    mov  ecx,B_DATE_Y
737
    mov  edx,eax
737
    mov  edx,eax
738
    mcall
738
    mcall
739
    inc  edx
739
    inc  edx
740
    add  ebx,B_DATE_BSHIFT
740
    add  ebx,B_DATE_BSHIFT
741
    mcall
741
    mcall
742
    inc  edx
742
    inc  edx
743
  else
743
  else
744
    mov  edx,10
744
    mov  edx,10
745
  end if
745
  end if
746
    or	 edx,1 shl 29+1 shl 30
746
    or	 edx,1 shl 29+1 shl 30
747
    mov  ebx,B_NS_X
747
    mov  ebx,B_NS_X
748
    mov  ecx,B_NS_Y
748
    mov  ecx,B_NS_Y
749
    mcall
749
    mcall
750
    add  edx,1-1 shl 29
750
    add  edx,1-1 shl 29
751
    mov  ebx,B_TODAY_X+8*(today_end-today_msg)
751
    mov  ebx,B_TODAY_X+8*(today_end-today_msg)
752
    mov  ecx,B_TODAY_Y
752
    mov  ecx,B_TODAY_Y
753
    mcall
753
    mcall
754
    mov  ecx,B_Y
754
    mov  ecx,B_Y
755
    mov  ebx,B_MONTH_X
755
    mov  ebx,B_MONTH_X
756
    mov  edx,2
756
    mov  edx,2
757
    mcall
757
    mcall
758
    mov  ebx,B_SPIN_X
758
    mov  ebx,B_SPIN_X
759
    inc  edx
759
    inc  edx
760
    mcall
760
    mcall
761
    add  ebx,B_SPIN_WIDTH shl 16
761
    add  ebx,B_SPIN_WIDTH shl 16
762
    inc  edx
762
    inc  edx
763
    mcall
763
    mcall
764
    call draw_days
764
    call draw_days
765
 
765
 
766
    mov  eax,4			   ; äã­ªæ¨ï 4 : ­ ¯¨á âì ¢ ®ª­¥ ⥪áâ
766
    mov  eax,4			   ; äã­ªæ¨ï 4 : ­ ¯¨á âì ¢ ®ª­¥ ⥪áâ
767
    mov  ebx,110*65536+280
767
    mov  ebx,110*65536+280
768
    mov  ecx,0x800000ff
768
    mov  ecx,0x800000ff
769
    mov  edx,sys_text
769
    mov  edx,sys_text
770
    mcall
770
    mcall
771
 
771
 
772
    mov  ebx,149*65536+302
772
    mov  ebx,149*65536+302
773
    mov  edx,minus
773
    mov  edx,minus
774
    mcall
774
    mcall
775
 
775
 
776
    mov  ebx,137*65536+292
776
    mov  ebx,137*65536+292
777
    mov  ecx,0x80ff0000
777
    mov  ecx,0x80ff0000
778
    mov  edx,plus
778
    mov  edx,plus
779
    mcall
779
    mcall
780
 
780
 
781
    mov  ebx,15*65536+298
781
    mov  ebx,15*65536+298
782
    mov  ecx,0x00000000
782
    mov  ecx,0x00000000
783
    mov  esi,15
783
    mov  esi,15
784
    mov  edx,setd
784
    mov  edx,setd
785
    mcall
785
    mcall
786
 
786
 
787
    mov  ecx,0x10ddeeff 	   ; èà¨äâ 1 ¨ 梥â ( 0xF0RRGGBB )
787
    mov  ecx,0x10ddeeff 	   ; èà¨äâ 1 ¨ 梥â ( 0xF0RRGGBB )
788
 
788
 
789
 if SKIP eq 0
789
 if SKIP eq 0
790
    mov  ebx,B_DATE
790
    mov  ebx,B_DATE
791
    mov  edx,datebut
791
    mov  edx,datebut
792
    mov  esi,9
792
    mov  esi,9
793
    btc  ecx,28
793
    btc  ecx,28
794
    mcall
794
    mcall
795
    add  ebx,B_DATE_SHIFT
795
    add  ebx,B_DATE_SHIFT
796
    add  edx,esi
796
    add  edx,esi
797
    mcall
797
    mcall
798
 end if
798
 end if
799
    mov  edx,n_style
799
    mov  edx,n_style
800
    mov  esi,ns_end-n_style
800
    mov  esi,ns_end-n_style
801
    mov  ebx,B_NS
801
    mov  ebx,B_NS
802
    cmp  [new_style],1
802
    cmp  [new_style],1
803
    je	 .high
803
    je	 .high
804
    mov  ecx,0xa0a0a0
804
    mov  ecx,0xa0a0a0
805
    jmp  .int
805
    jmp  .int
806
  .high:
806
  .high:
807
    mov  ecx,0xac0000;d048c8
807
    mov  ecx,0xac0000;d048c8
808
  .int:
808
  .int:
809
    mcall
809
    mcall
810
 
810
 
811
    mov  ecx,0xd048c8
811
    mov  ecx,0xd048c8
812
    mov  edx,today_msg
812
    mov  edx,today_msg
813
    mov  ebx,B_TODAY
813
    mov  ebx,B_TODAY
814
    mov  esi,today_end-today_msg
814
    mov  esi,today_end-today_msg
815
    mcall
815
    mcall
816
 
816
 
817
    mov  ebx,B_SPIN
817
    mov  ebx,B_SPIN
818
    mov  edx,spinner
818
    mov  edx,spinner
819
    mov  esi,3
819
    mov  esi,3
820
    ShowFocus 4
820
    ShowFocus 4
821
    mcall
821
    mcall
822
 
822
 
823
    mov  edx,[Month]
823
    mov  edx,[Month]
824
    movzx  esi,byte[month_name]
824
    movzx  esi,byte[month_name]
825
    imul edx,esi
825
    imul edx,esi
826
    add  edx,month_name+1
826
    add  edx,month_name+1
827
    mov  ebx,B_MONTH
827
    mov  ebx,B_MONTH
828
    ShowFocus 2
828
    ShowFocus 2
829
    mcall
829
    mcall
830
 
830
 
831
    call draw_year
831
    call draw_year
832
    mov  [dropped],0
832
    mov  [dropped],0
833
    mov  eax,12 		   ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
833
    mov  eax,12 		   ; äã­ªæ¨ï 12: á®®¡é¨âì Ž‘ ®¡ ®âà¨á®¢ª¥ ®ª­ 
834
    mov  ebx,2			   ; 2, § ª®­ç¨«¨ à¨á®¢ âì
834
    mov  ebx,2			   ; 2, § ª®­ç¨«¨ à¨á®¢ âì
835
    mcall
835
    mcall
836
    ret 			   ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
836
    ret 			   ; ¢ë室¨¬ ¨§ ¯à®æ¥¤ãàë
837
 
837
 
838
draw_year:
838
draw_year:
839
    mcall 8,B_YEAR_X,B_Y,5,0x05080d0
839
    mcall 8,B_YEAR_X,B_Y,5,0x05080d0
840
    ShowFocus 3,esi
840
    ShowFocus 3,esi
841
    mcall 47,0x40001,Year,B_YEAR
841
    mcall 47,0x40001,Year,B_YEAR
842
    ret
842
    ret
843
 
843
 
844
draw_dropdown:
844
draw_dropdown:
845
    mov  [dropped],1
845
    mov  [dropped],1
846
    push [Month]
846
    push [Month]
847
    pop  [focus]
847
    pop  [focus]
848
    add  [focus],100
848
    add  [focus],100
849
    mov  ecx,12
849
    mov  ecx,12
850
    mov  edx,100
850
    mov  edx,100
851
    push dword month_name+1
851
    push dword month_name+1
852
    push dword B_DROP
852
    push dword B_DROP
853
    push dword B_Y+16 shl 16
853
    push dword B_Y+16 shl 16
854
  .ddd_loop:
854
  .ddd_loop:
855
    mov  edi,edx
855
    mov  edi,edx
856
    push ecx
856
    push ecx
857
    mov  ebx,B_MONTH_X
857
    mov  ebx,B_MONTH_X
858
    mov  ecx,[esp+4]
858
    mov  ecx,[esp+4]
859
    mov  esi,0x6f9fef
859
    mov  esi,0x6f9fef
860
    mov  eax,8
860
    mov  eax,8
861
    mcall
861
    mcall
862
    shr  eax,1
862
    shr  eax,1
863
    mov  ebx,[esp+8]
863
    mov  ebx,[esp+8]
864
    xchg edx,[esp+12]
864
    xchg edx,[esp+12]
865
    movzx esi,byte[month_name]
865
    movzx esi,byte[month_name]
866
    ShowFocus edi
866
    ShowFocus edi
867
    mcall
867
    mcall
868
    add  edx,esi
868
    add  edx,esi
869
    xchg edx,[esp+12]
869
    xchg edx,[esp+12]
870
    add  dword[esp+8],16
870
    add  dword[esp+8],16
871
    add  dword[esp+4],16 shl 16
871
    add  dword[esp+4],16 shl 16
872
    inc  edx
872
    inc  edx
873
    pop  ecx
873
    pop  ecx
874
    loop .ddd_loop
874
    loop .ddd_loop
875
    add  esp,12
875
    add  esp,12
876
    ret
876
    ret
877
 
877
 
878
draw_week:
878
draw_week:
879
    mov  eax,13
879
    mov  eax,13
880
    mov  ebx,B_WBAR_X
880
    mov  ebx,B_WBAR_X
881
    mov  ecx,B_WBAR_Y
881
    mov  ecx,B_WBAR_Y
882
    mov  edx,0x90a0b0
882
    mov  edx,0x90a0b0
883
    mcall
883
    mcall
884
    movzx esi,byte[week_days]
884
    movzx esi,byte[week_days]
885
    movzx edi,byte[week_days+1]
885
    movzx edi,byte[week_days+1]
886
    mov  ebx,B_WEEK
886
    mov  ebx,B_WEEK
887
    mov  ecx,7
887
    mov  ecx,7
888
    mov  edx,week_days+2
888
    mov  edx,week_days+2
889
    mov  eax,4
889
    mov  eax,4
890
  .week:
890
  .week:
891
    push ecx
891
    push ecx
892
    cmp  ecx,edi
892
    cmp  ecx,edi
893
    je	 .holiday
893
    je	 .holiday
894
    mov  ecx,0x10000000
894
    mov  ecx,0x10000000
895
    jmp  .noholiday
895
    jmp  .noholiday
896
  .holiday:
896
  .holiday:
897
    mov  ecx,0x10cc1010
897
    mov  ecx,0x10cc1010
898
  .noholiday:
898
  .noholiday:
899
    mcall
899
    mcall
900
    add  edx,esi
900
    add  edx,esi
901
    add  ebx,B_WX_SHIFT
901
    add  ebx,B_WX_SHIFT
902
    pop  ecx
902
    pop  ecx
903
    loop .week
903
    loop .week
904
    ret
904
    ret
905
 
905
 
906
draw_days:
906
draw_days:
907
    mov  eax,13
907
    mov  eax,13
908
    mov  ebx,B_DBAR_X
908
    mov  ebx,B_DBAR_X
909
    mov  ecx,B_DBAR_Y
909
    mov  ecx,B_DBAR_Y
910
    mov  edx,0xe0e0e0
910
    mov  edx,0xe0e0e0
911
    mcall
911
    mcall
912
    call count_days
912
    call count_days
913
    cmp  ecx,[day_sel]
913
    cmp  ecx,[day_sel]
914
    jae  .ok
914
    jae  .ok
915
    mov  [day_sel],ecx
915
    mov  [day_sel],ecx
916
  .ok:
916
  .ok:
917
    mov  [number],0
917
    mov  [number],0
918
    mov  eax,47
918
    mov  eax,47
919
    mov  edx,B_DAYS_Y
919
    mov  edx,B_DAYS_Y
920
    mov  ebx,0x20001
920
    mov  ebx,0x20001
921
    mov  edi,[firstday]
921
    mov  edi,[firstday]
922
  .dayloop:
922
  .dayloop:
923
    push ecx
923
    push ecx
924
    movzx edx,dx
924
    movzx edx,dx
925
    mov  esi,edi
925
    mov  esi,edi
926
    shl  esi,21
926
    shl  esi,21
927
    lea  edx,[edx+esi+30 shl 16]
927
    lea  edx,[edx+esi+30 shl 16]
928
    mov  ecx,edi
928
    mov  ecx,edi
929
    add  cl,[week_days+1]
929
    add  cl,[week_days+1]
930
    cmp  ecx,7
930
    cmp  ecx,7
931
    je	 .holiday
931
    je	 .holiday
932
    mov  esi,0x10000000
932
    mov  esi,0x10000000
933
    jmp  .noholiday
933
    jmp  .noholiday
934
  .holiday:
934
  .holiday:
935
    mov  esi,0x10cc1010
935
    mov  esi,0x10cc1010
936
  .noholiday:
936
  .noholiday:
937
    mov  ecx,number
937
    mov  ecx,number
938
    inc  dword[ecx]
938
    inc  dword[ecx]
939
    pusha
939
    pusha
940
    mov  ebx,edx
940
    mov  ebx,edx
941
    mov  bx,20
941
    mov  bx,20
942
    sub  ebx,3 shl 16
942
    sub  ebx,3 shl 16
943
    shrd ecx,edx,16
943
    shrd ecx,edx,16
944
    mov  cx,20
944
    mov  cx,20
945
    sub  ecx,7 shl 16
945
    sub  ecx,7 shl 16
946
    mov  edx,[number]
946
    mov  edx,[number]
947
    cmp  edx,[day_sel]
947
    cmp  edx,[day_sel]
948
    je	 .draw_sel
948
    je	 .draw_sel
949
    mov  esi,0xe0e0e0
949
    mov  esi,0xe0e0e0
950
    jmp  .draw_but
950
    jmp  .draw_but
951
  .draw_sel:
951
  .draw_sel:
952
    mov  esi,0x5080d0
952
    mov  esi,0x5080d0
953
    cmp  [focus],5
953
    cmp  [focus],5
954
    jne  .draw_but
954
    jne  .draw_but
955
    mov  esi,0xef7840;0xe26830
955
    mov  esi,0xef7840;0xe26830
956
  .draw_but:
956
  .draw_but:
957
    add  edx,200+1 shl 29
957
    add  edx,200+1 shl 29
958
    mov  eax,8
958
    mov  eax,8
959
    mcall
959
    mcall
960
    popa
960
    popa
961
    mcall
961
    mcall
962
    pop  ecx
962
    pop  ecx
963
    inc  edi
963
    inc  edi
964
    cmp  edi,7
964
    cmp  edi,7
965
    jne  .nowrap
965
    jne  .nowrap
966
    xor  edi,edi
966
    xor  edi,edi
967
    add  dx,B_DAYS_SHIFT
967
    add  dx,B_DAYS_SHIFT
968
  .nowrap:
968
  .nowrap:
969
    loop .eloop
969
    loop .eloop
970
    jmp  .ex
970
    jmp  .ex
971
  .eloop:
971
  .eloop:
972
    jmp  .dayloop
972
    jmp  .dayloop
973
  .ex:
973
  .ex:
974
    ret
974
    ret
975
 
975
 
976
count_days:    ; ecx -days in month
976
count_days:    ; ecx -days in month
977
    call is_leap_year
977
    call is_leap_year
978
    mov  ecx,[Month]
978
    mov  ecx,[Month]
979
    mov  eax,1
979
    mov  eax,1
980
    movzx ecx,byte[day_count+ecx]
980
    movzx ecx,byte[day_count+ecx]
981
    add  ecx,28
981
    add  ecx,28
982
    cmp  eax,[leap_year]
982
    cmp  eax,[leap_year]
983
    jne  .noleap
983
    jne  .noleap
984
    cmp  eax,[Month]
984
    cmp  eax,[Month]
985
    jne  .noleap
985
    jne  .noleap
986
    inc  ecx
986
    inc  ecx
987
  .noleap:
987
  .noleap:
988
    mov  [day_bounds+3],cl
988
    mov  [day_bounds+3],cl
989
    mov  [day_bounds+7],cl
989
    mov  [day_bounds+7],cl
990
    ret
990
    ret
991
 
991
 
992
is_leap_year:
992
is_leap_year:
993
    mov  [leap_year],0
993
    mov  [leap_year],0
994
    mov  eax,[Year]
994
    mov  eax,[Year]
995
    mov  bl,100
995
    mov  bl,100
996
    div  bl	     ; ah=Year mod 100, al=Year%100
996
    div  bl	     ; ah=Year mod 100, al=Year%100
997
    test ah,ah
997
    test ah,ah
998
    jz	.century
998
    jz	.century
999
    shr  ax,8	     ; ax - last 2 digits
999
    shr  ax,8	     ; ax - last 2 digits
1000
  .century:
1000
  .century:
1001
    test al,11b
1001
    test al,11b
1002
    jnz  .noleap
1002
    jnz  .noleap
1003
    inc  [leap_year]
1003
    inc  [leap_year]
1004
  .noleap:
1004
  .noleap:
1005
    ret
1005
    ret
1006
 
1006
 
1007
calculate:
1007
calculate:
1008
    mov  ebx,[Year]
1008
    mov  ebx,[Year]
1009
    mov  eax,[Month]
1009
    mov  eax,[Month]
1010
    sub  eax,2
1010
    sub  eax,2
1011
    jge  .nojf
1011
    jge  .nojf
1012
    dec  ebx
1012
    dec  ebx
1013
    add  eax,12
1013
    add  eax,12
1014
  .nojf:
1014
  .nojf:
1015
    add  eax,4
1015
    add  eax,4
1016
    xor  edx,edx
1016
    xor  edx,edx
1017
    mov  ecx,153
1017
    mov  ecx,153
1018
    imul cx
1018
    imul cx
1019
    mov  ecx,5
1019
    mov  ecx,5
1020
    div  cx
1020
    div  cx
1021
    inc  eax
1021
    inc  eax
1022
    mov  ecx,365
1022
    mov  ecx,365
1023
    imul ecx,ebx
1023
    imul ecx,ebx
1024
    add  eax,ecx
1024
    add  eax,ecx
1025
    mov  ecx,ebx
1025
    mov  ecx,ebx
1026
    shr  ecx,2
1026
    shr  ecx,2
1027
    add  eax,ecx
1027
    add  eax,ecx
1028
    dec  eax
1028
    dec  eax
1029
    cmp  [new_style],0
1029
    cmp  [new_style],0
1030
    je	 .nonew
1030
    je	 .nonew
1031
    add  eax,2
1031
    add  eax,2
1032
    xchg eax,ebx
1032
    xchg eax,ebx
1033
    mov  ecx,100
1033
    mov  ecx,100
1034
    xor  edx,edx
1034
    xor  edx,edx
1035
    div  cx
1035
    div  cx
1036
    sub  ebx,eax
1036
    sub  ebx,eax
1037
    shr  eax,2
1037
    shr  eax,2
1038
    add  ebx,eax
1038
    add  ebx,eax
1039
  .nonew:
1039
  .nonew:
1040
    add  ebx,5
1040
    add  ebx,5
1041
    mov  eax,ebx
1041
    mov  eax,ebx
1042
    xor  edx,edx
1042
    xor  edx,edx
1043
    movzx ebx,byte[week_days+1]
1043
    movzx ebx,byte[week_days+1]
1044
    sub  eax,ebx
1044
    sub  eax,ebx
1045
    inc  eax
1045
    inc  eax
1046
    mov  ebx,7
1046
    mov  ebx,7
1047
    div  bx
1047
    div  bx
1048
    mov  [firstday],edx
1048
    mov  [firstday],edx
1049
    ret
1049
    ret
1050
 
1050
 
1051
; ‡¤¥áì ­ å®¤ïâáï ¤ ­­ë¥ ¯à®£à ¬¬ë:
1051
; ‡¤¥áì ­ å®¤ïâáï ¤ ­­ë¥ ¯à®£à ¬¬ë:
1052
 
1052
 
1053
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë© - § ¤ ©â¥ ï§ëª ¢ lang.inc
1053
; ¨­â¥àä¥©á ¯à®£à ¬¬ë ¬­®£®ï§ëç­ë© - § ¤ ©â¥ ï§ëª ¢ lang.inc
1054
day_count db 3,0,3,2,3,2,3,3,2,3,2,3
1054
day_count db 3,0,3,2,3,2,3,3,2,3,2,3
1055
Fkeys	  db 210,211,212,213,214,215,216,217,208,209,228,159
1055
Fkeys	  db 210,211,212,213,214,215,216,217,208,209,228,159
1056
 
1056
 
1057
title: 	 ; áâப  § £®«®¢ª 
1057
title: 	 ; áâப  § £®«®¢ª 
1058
if lang eq ru
1058
if lang eq ru
1059
     db   'Š€‹…„€œ',0
1059
     db   'Š€‹…„€œ',0
1060
else if lang eq ge
1060
else if lang eq ge
1061
     db   'KALENDER',0
1061
     db   'KALENDER',0
1062
else if lang eq fr
1062
else if lang eq fr
1063
     db   'CALENDRIER',0
1063
     db   'CALENDRIER',0
1064
else if lang eq et
1064
else if lang eq et
1065
     db   'KALENDER',0
1065
     db   'KALENDER',0
1066
else
1066
else
1067
     db   'CALENDAR',0
1067
     db   'CALENDAR',0
1068
end if
1068
end if
1069
 
1069
 
1070
if SKIP eq 0
1070
if SKIP eq 0
1071
datebut:
1071
datebut:
1072
if lang eq ru
1072
if lang eq ru
1073
     db   '1-ï ¤ â  '
1073
     db   '1-ï ¤ â  '
1074
     db   '2-ï ¤ â  '
1074
     db   '2-ï ¤ â  '
1075
else if lang eq fr
1075
else if lang eq fr
1076
     db   '1ere date'
1076
     db   '1ere date'
1077
     db   '2eme date'
1077
     db   '2eme date'
1078
else if lang eq ge
1078
else if lang eq ge
1079
     db   ' Datum 1 '
1079
     db   ' Datum 1 '
1080
     db   ' Datum 2 '
1080
     db   ' Datum 2 '
1081
else if lang eq et
1081
else if lang eq et
1082
     db   'Kuupäev 1'
1082
     db   'Kuupäev 1'
1083
     db   'Kuupäev 2'
1083
     db   'Kuupäev 2'
1084
else
1084
else
1085
     db   '1st date '
1085
     db   '1st date '
1086
     db   '2nd date '
1086
     db   '2nd date '
1087
end if
1087
end if
1088
end if
1088
end if
1089
n_style:
1089
n_style:
1090
if lang eq ru
1090
if lang eq ru
1091
     db   '®¢ë© á⨫ì'
1091
     db   '®¢ë© á⨫ì'
1092
else if lang eq de
1092
else if lang eq de
1093
     db   'Neuer Stil'
1093
     db   'Neuer Stil'
1094
else if lang eq fr
1094
else if lang eq fr
1095
     db   'Nouveau'
1095
     db   'Nouveau'
1096
else if lang eq et
1096
else if lang eq et
1097
     db   'Uus stiil'
1097
     db   'Uus stiil'
1098
else
1098
else
1099
     db   'New style'
1099
     db   'New style'
1100
end if
1100
end if
1101
ns_end:
1101
ns_end:
1102
today_msg:
1102
today_msg:
1103
if lang eq ru
1103
if lang eq ru
1104
     db   '‘¥£®¤­ï'
1104
     db   '‘¥£®¤­ï'
1105
else if lang eq ge
1105
else if lang eq ge
1106
     db   'Heute'
1106
     db   'Heute'
1107
else if lang eq fr
1107
else if lang eq fr
1108
     db   "Aujourd'hui"
1108
     db   "Aujourd'hui"
1109
else if lang eq et
1109
else if lang eq et
1110
     db   'Täna'
1110
     db   'Täna'
1111
else
1111
else
1112
     db   'Today'
1112
     db   'Today'
1113
end if
1113
end if
1114
today_end:
1114
today_end:
1115
focus dd  3
1115
focus dd  3
1116
new_style dd 1
1116
new_style dd 1
1117
dropped db 0
1117
dropped db 0
1118
 
1118
 
1119
sys_text:  db  'á¨á⥬­®¥ ¢à¥¬ï',0
1119
sys_text:  db  'á¨á⥬­®¥ ¢à¥¬ï',0
1120
plus:  db  '¤®¡ ¢¨âì(+)',0
1120
plus:  db  '¤®¡ ¢¨âì(+)',0
1121
minus:	db  'ã¡à âì(-)',0
1121
minus:	db  'ã¡à âì(-)',0
1122
setd:	db  '“áâ ­®¢¨âì ¤ âã',0
1122
setd:	db  '“áâ ­®¢¨âì ¤ âã',0
1123
 
1123
 
1124
I_END:	; ª®­¥æ ¯à®£à ¬¬ë
1124
I_END:	; ª®­¥æ ¯à®£à ¬¬ë
1125
firstday  dd ?
1125
firstday  dd ?
1126
Year dd   ?
1126
Year dd   ?
1127
Month dd  ?
1127
Month dd  ?
1128
day_sel   dd ?
1128
day_sel   dd ?
1129
all_days  dd ?
1129
all_days  dd ?
1130
 
1130
 
1131
datestr   dd  ?
1131
datestr   dd  ?
1132
leap_year dd ?
1132
leap_year dd ?
1133
number	  dd ?
1133
number	  dd ?
1134
year_input dd ?
1134
year_input dd ?