Rev 9715 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9715 | Rev 9910 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2022. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 9715 $ |
8 | $Revision: 9910 $ |
9 | 9 | ||
10 | 10 | ||
Line 15... | Line 15... | ||
15 | ; ebx =1 - set date ecx=00DDMMYY |
15 | ; ebx =1 - set date ecx=00DDMMYY |
16 | ; ebx =2 - set day of week ecx- 1-7 |
16 | ; ebx =2 - set day of week ecx- 1-7 |
17 | ; ebx =3 - set alarm-clock ecx - 00SSMMHH |
17 | ; ebx =3 - set alarm-clock ecx - 00SSMMHH |
18 | ; out: 0 -Ok 1 -wrong format 2 -battery low |
18 | ; out: 0 -Ok 1 -wrong format 2 -battery low |
19 | sys_settime: |
19 | sys_settime: |
20 | - | ||
21 | cli |
20 | cli |
22 | mov al, 0x0d |
21 | mov al, 0x0d |
23 | out 0x70, al |
22 | out 0x70, al |
24 | in al, 0x71 |
23 | in al, 0x71 |
25 | bt ax, 7 |
24 | bt ax, 7 |
26 | jnc bat_low |
25 | jnc .bat_low |
27 | cmp ebx, 2;day of week |
26 | cmp ebx, 2 ;day of week |
28 | jne nosetweek |
27 | jne .nosetweek |
29 | test ecx, ecx ;test day of week |
28 | test ecx, ecx ;test day of week |
30 | je wrongtime |
29 | je .wrongtime |
31 | cmp ecx, 7 |
30 | cmp ecx, 7 |
32 | ja wrongtime |
31 | ja .wrongtime |
33 | mov edx, 0x70 |
32 | mov edx, 0x70 |
34 | call startstopclk |
33 | call startstopclk |
35 | dec edx |
34 | dec edx |
36 | mov al, 6 |
35 | mov al, 6 |
37 | out dx, al |
36 | out dx, al |
38 | inc edx |
37 | inc edx |
39 | mov al, cl |
38 | mov al, cl |
40 | out dx, al |
39 | out dx, al |
41 | jmp endsettime |
40 | jmp .endsettime |
42 | nosetweek: ;set date |
41 | .nosetweek: ;set date |
43 | cmp ebx, 1 |
42 | cmp ebx, 1 |
44 | jne nosetdate |
43 | jne .nosetdate |
45 | cmp cl, 0x99;test year |
44 | cmp cl, 0x99;test year |
46 | ja wrongtime |
45 | ja .wrongtime |
47 | shl ecx, 4 |
46 | shl ecx, 4 |
48 | cmp cl, 0x90 |
47 | cmp cl, 0x90 |
49 | ja wrongtime |
48 | ja .wrongtime |
50 | cmp ch, 0x99;test month |
49 | cmp ch, 0x99;test month |
51 | ja wrongtime |
50 | ja .wrongtime |
52 | shr ecx, 4 |
51 | shr ecx, 4 |
53 | test ch, ch |
52 | test ch, ch |
54 | je wrongtime |
53 | je .wrongtime |
55 | cmp ch, 0x12 |
54 | cmp ch, 0x12 |
56 | ja wrongtime |
55 | ja .wrongtime |
57 | shl ecx, 8 |
56 | shl ecx, 8 |
58 | bswap ecx ;ebx=00YYMMDD |
57 | bswap ecx ;ebx=00YYMMDD |
59 | test cl, cl ;test day |
58 | test cl, cl ;test day |
60 | je wrongtime |
59 | je .wrongtime |
61 | shl ecx, 4 |
60 | shl ecx, 4 |
62 | cmp cl, 0x90 |
61 | cmp cl, 0x90 |
63 | ja wrongtime |
62 | ja .wrongtime |
64 | shr ecx, 4 |
63 | shr ecx, 4 |
65 | cmp ch, 2 ;February |
64 | cmp ch, 2 ;February |
66 | jne testday |
65 | jne .testday |
67 | cmp cl, 0x29 |
66 | cmp cl, 0x29 |
68 | ja wrongtime |
67 | ja .wrongtime |
69 | jmp setdate |
68 | jmp .setdate |
70 | testday: |
69 | .testday: |
71 | cmp ch, 8 |
70 | cmp ch, 8 |
72 | jb testday1;Aug-Dec |
71 | jb .testday1 ;Aug-Dec |
73 | bt cx, 8 |
72 | bt cx, 8 |
74 | jnc days31 |
73 | jnc .days31 |
75 | jmp days30 |
74 | jmp .days30 |
76 | testday1: |
75 | .testday1: |
77 | bt cx, 8 ;Jan-Jul ex.Feb |
76 | bt cx, 8 ;Jan-Jul ex.Feb |
78 | jnc days30 |
77 | jnc .days30 |
79 | days31: |
78 | .days31: |
80 | cmp cl, 0x31 |
79 | cmp cl, 0x31 |
81 | ja wrongtime |
80 | ja .wrongtime |
82 | jmp setdate |
81 | jmp .setdate |
83 | days30: |
82 | .days30: |
84 | cmp cl, 0x30 |
83 | cmp cl, 0x30 |
85 | ja wrongtime |
84 | ja .wrongtime |
86 | setdate: |
85 | .setdate: |
87 | mov edx, 0x70 |
86 | mov edx, 0x70 |
88 | call startstopclk |
87 | call startstopclk |
89 | dec edx |
88 | dec edx |
90 | mov al, 7 ;set days |
89 | mov al, 7 ;set days |
91 | out dx, al |
90 | out dx, al |
Line 103... | Line 102... | ||
103 | out dx, al |
102 | out dx, al |
104 | inc edx |
103 | inc edx |
105 | shr ecx, 8 |
104 | shr ecx, 8 |
106 | mov al, ch |
105 | mov al, ch |
107 | out dx, al |
106 | out dx, al |
108 | jmp endsettime |
107 | jmp .endsettime |
109 | nosetdate: ;set time or alarm-clock |
108 | .nosetdate: ;set time or alarm-clock |
110 | cmp ebx, 3 |
109 | cmp ebx, 3 |
111 | ja wrongtime |
110 | ja .wrongtime |
112 | cmp cl, 0x23 |
111 | cmp cl, 0x23 |
113 | ja wrongtime |
112 | ja .wrongtime |
114 | cmp ch, 0x59 |
113 | cmp ch, 0x59 |
115 | ja wrongtime |
114 | ja .wrongtime |
116 | shl ecx, 4 |
115 | shl ecx, 4 |
117 | cmp cl, 0x90 |
116 | cmp cl, 0x90 |
118 | ja wrongtime |
117 | ja .wrongtime |
119 | cmp ch, 0x92 |
118 | cmp ch, 0x92 |
120 | ja wrongtime |
119 | ja .wrongtime |
121 | shl ecx, 4 |
120 | shl ecx, 4 |
122 | bswap ecx ;00HHMMSS |
121 | bswap ecx ;00HHMMSS |
123 | cmp cl, 0x59 |
122 | cmp cl, 0x59 |
124 | ja wrongtime |
123 | ja .wrongtime |
125 | shl ecx, 4 |
124 | shl ecx, 4 |
126 | cmp cl, 0x90 |
125 | cmp cl, 0x90 |
127 | ja wrongtime |
126 | ja .wrongtime |
128 | shr ecx, 4 |
127 | shr ecx, 4 |
Line 129... | Line 128... | ||
129 | 128 | ||
130 | mov edx, 0x70 |
129 | mov edx, 0x70 |
131 | call startstopclk |
130 | call startstopclk |
132 | dec edx |
131 | dec edx |
Line 133... | Line 132... | ||
133 | cmp ebx, 3 |
132 | cmp ebx, 3 |
134 | 133 | ||
135 | je setalarm |
134 | je .setalarm |
136 | xor eax, eax;al=0-set seconds |
135 | xor eax, eax;al=0-set seconds |
137 | out dx, al |
136 | out dx, al |
138 | inc edx |
137 | inc edx |
Line 149... | Line 148... | ||
149 | out dx, al |
148 | out dx, al |
150 | inc edx |
149 | inc edx |
151 | shr ecx, 8 |
150 | shr ecx, 8 |
152 | mov al, ch |
151 | mov al, ch |
153 | out dx, al |
152 | out dx, al |
154 | jmp endsettime |
153 | jmp .endsettime |
155 | setalarm: |
154 | .setalarm: |
156 | mov al, 1;set seconds for al. |
155 | mov al, 1;set seconds for al. |
157 | out dx, al |
156 | out dx, al |
158 | inc edx |
157 | inc edx |
159 | mov al, cl |
158 | mov al, cl |
160 | out dx, al |
159 | out dx, al |
Line 176... | Line 175... | ||
176 | out dx, al |
175 | out dx, al |
177 | inc dx |
176 | inc dx |
178 | in al, dx |
177 | in al, dx |
179 | bts ax, 5;set bit 5 |
178 | bts ax, 5;set bit 5 |
180 | out dx, al |
179 | out dx, al |
181 | endsettime: |
180 | .endsettime: |
182 | dec edx |
181 | dec edx |
183 | call startstopclk |
182 | call startstopclk |
184 | sti |
183 | sti |
185 | and [esp+36-4], dword 0 |
184 | and [esp + SYSCALL_STACK.eax], dword 0 |
186 | ret |
185 | ret |
187 | bat_low: |
186 | .bat_low: |
188 | sti |
187 | sti |
189 | mov [esp+36-4], dword 2 |
188 | mov [esp + SYSCALL_STACK.eax], dword 2 |
190 | ret |
189 | ret |
191 | wrongtime: |
190 | .wrongtime: |
192 | sti |
191 | sti |
193 | mov [esp+36-4], dword 1 |
192 | mov [esp + SYSCALL_STACK.eax], dword 1 |
194 | ret |
193 | ret |
Line 195... | Line 194... | ||
195 | 194 | ||
196 | startstopclk: |
195 | startstopclk: |
197 | mov al, 0x0b |
196 | mov al, 0x0b |
Line 233... | Line 232... | ||
233 | in al, 0x71 |
232 | in al, 0x71 |
234 | add ecx, edx |
233 | add ecx, edx |
235 | movzx edx, al |
234 | movzx edx, al |
236 | add ecx, edx |
235 | add ecx, edx |
237 | sti |
236 | sti |
238 | mov [esp + 32], ecx |
237 | mov [esp + SYSCALL_STACK.eax], ecx |
239 | ret |
238 | ret |
Line 240... | Line -... | ||
240 | - | ||
241 | 239 | ||
242 | align 4 |
- | |
243 | 240 | align 4 |
|
244 | sys_date: |
- | |
245 | 241 | sys_date: |
|
246 | cli |
242 | cli |
247 | @@: |
243 | @@: |
248 | mov al, 10 |
244 | mov al, 10 |
249 | out 0x70, al |
245 | out 0x70, al |
Line 252... | Line 248... | ||
252 | jns @f |
248 | jns @f |
253 | mov esi, 1 |
249 | mov esi, 1 |
254 | call delay_ms |
250 | call delay_ms |
255 | jmp @b |
251 | jmp @b |
256 | @@: |
252 | @@: |
257 | - | ||
258 | mov ch, 0 |
253 | mov ch, 0 |
259 | mov al, 7 ; date |
254 | mov al, 7 ; date |
260 | out 0x70, al |
255 | out 0x70, al |
261 | in al, 0x71 |
256 | in al, 0x71 |
262 | mov cl, al |
257 | mov cl, al |
Line 268... | Line 263... | ||
268 | mov al, 9 ; year |
263 | mov al, 9 ; year |
269 | out 0x70, al |
264 | out 0x70, al |
270 | in al, 0x71 |
265 | in al, 0x71 |
271 | mov cl, al |
266 | mov cl, al |
272 | sti |
267 | sti |
273 | mov [esp+32], ecx |
268 | mov [esp + SYSCALL_STACK.eax], ecx |
274 | ret |
269 | ret |