Rev 593 | Rev 2288 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 593 | Rev 1279 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
2 | ;; ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2009. 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: 593 $ |
8 | $Revision: 1279 $ |
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 | mov ecx,eax |
- | |
- | 20 | ||
21 | cli |
21 | cli |
22 | mov al,0x0d |
22 | mov al,0x0d |
23 | out 0x70,al |
23 | out 0x70,al |
24 | in al,0x71 |
24 | in al,0x71 |
25 | bt ax,7 |
25 | bt ax,7 |
26 | jnc bat_low |
26 | jnc bat_low |
27 | cmp ecx,2 ;day of week |
27 | cmp ebx,2 ;day of week |
28 | jne nosetweek |
28 | jne nosetweek |
29 | test ebx,ebx ;test day of week |
29 | test ecx,ecx ;test day of week |
30 | je wrongtime |
30 | je wrongtime |
31 | cmp ebx,7 |
31 | cmp ecx,7 |
32 | ja wrongtime |
32 | ja wrongtime |
33 | mov dx,0x70 |
33 | mov edx,0x70 |
34 | call startstopclk |
34 | call startstopclk |
35 | dec edx |
35 | dec edx |
36 | mov al,6 |
36 | mov al,6 |
37 | out dx,al |
37 | out dx,al |
38 | inc edx |
38 | inc edx |
39 | mov al,bl |
39 | mov al,cl |
40 | out dx,al |
40 | out dx,al |
41 | jmp endsettime |
41 | jmp endsettime |
42 | nosetweek: ;set date |
42 | nosetweek: ;set date |
43 | cmp ecx,1 |
43 | cmp ebx,1 |
44 | jne nosetdate |
44 | jne nosetdate |
45 | cmp bl,0x99 ;test year |
45 | cmp cl,0x99 ;test year |
46 | ja wrongtime |
46 | ja wrongtime |
47 | shl ebx,4 |
47 | shl ecx,4 |
48 | cmp bl,0x90 |
48 | cmp cl,0x90 |
49 | ja wrongtime |
49 | ja wrongtime |
50 | cmp bh,0x99 ;test month |
50 | cmp ch,0x99 ;test month |
51 | ja wrongtime |
51 | ja wrongtime |
52 | shr ebx,4 |
52 | shr ecx,4 |
53 | test bh,bh |
53 | test ch,ch |
54 | je wrongtime |
54 | je wrongtime |
55 | cmp bh,0x12 |
55 | cmp ch,0x12 |
56 | ja wrongtime |
56 | ja wrongtime |
57 | shl ebx,8 |
57 | shl ecx,8 |
58 | bswap ebx ;ebx=00YYMMDD |
58 | bswap ecx ;ebx=00YYMMDD |
59 | test bl,bl ;test day |
59 | test cl,cl ;test day |
60 | je wrongtime |
60 | je wrongtime |
61 | shl ebx,4 |
61 | shl ecx,4 |
62 | cmp bl,0x90 |
62 | cmp cl,0x90 |
63 | ja wrongtime |
63 | ja wrongtime |
64 | shr ebx,4 |
64 | shr ecx,4 |
65 | cmp bh,2 ;February |
65 | cmp ch,2 ;February |
66 | jne testday |
66 | jne testday |
67 | cmp bl,0x29 |
67 | cmp cl,0x29 |
68 | ja wrongtime |
68 | ja wrongtime |
69 | jmp setdate |
69 | jmp setdate |
70 | testday: |
70 | testday: |
71 | cmp bh,8 |
71 | cmp ch,8 |
72 | jb testday1 ;Aug-Dec |
72 | jb testday1 ;Aug-Dec |
73 | bt bx,8 |
73 | bt cx,8 |
74 | jnc days31 |
74 | jnc days31 |
75 | jmp days30 |
75 | jmp days30 |
76 | testday1: |
76 | testday1: |
77 | bt bx,8 ;Jan-Jul ex.Feb |
77 | bt cx,8 ;Jan-Jul ex.Feb |
78 | jnc days30 |
78 | jnc days30 |
79 | days31: |
79 | days31: |
80 | cmp bl,0x31 |
80 | cmp cl,0x31 |
81 | ja wrongtime |
81 | ja wrongtime |
82 | jmp setdate |
82 | jmp setdate |
83 | days30: |
83 | days30: |
84 | cmp bl,0x30 |
84 | cmp cl,0x30 |
85 | ja wrongtime |
85 | ja wrongtime |
86 | setdate: |
86 | setdate: |
87 | mov dx,0x70 |
87 | mov edx,0x70 |
88 | call startstopclk |
88 | call startstopclk |
89 | dec edx |
89 | dec edx |
90 | mov al,7 ;set days |
90 | mov al,7 ;set days |
91 | out dx,al |
91 | out dx,al |
92 | inc edx |
92 | inc edx |
93 | mov al,bl |
93 | mov al,cl |
94 | out dx,al |
94 | out dx,al |
95 | dec edx |
95 | dec edx |
96 | mov al,8 ;set months |
96 | mov al,8 ;set months |
97 | out dx,al |
97 | out dx,al |
98 | inc edx |
98 | inc edx |
99 | mov al,bh |
99 | mov al,ch |
100 | out dx,al |
100 | out dx,al |
101 | dec edx |
101 | dec edx |
102 | mov al,9 ;set years |
102 | mov al,9 ;set years |
103 | out dx,al |
103 | out dx,al |
104 | inc edx |
104 | inc edx |
105 | shr ebx,8 |
105 | shr ecx,8 |
106 | mov al,bh |
106 | mov al,ch |
107 | out dx,al |
107 | out dx,al |
108 | jmp endsettime |
108 | jmp endsettime |
109 | nosetdate: ;set time or alarm-clock |
109 | nosetdate: ;set time or alarm-clock |
110 | cmp ecx,3 |
110 | cmp ebx,3 |
111 | ja wrongtime |
111 | ja wrongtime |
112 | cmp bl,0x23 |
112 | cmp cl,0x23 |
113 | ja wrongtime |
113 | ja wrongtime |
114 | cmp bh,0x59 |
114 | cmp ch,0x59 |
115 | ja wrongtime |
115 | ja wrongtime |
116 | shl ebx,4 |
116 | shl ecx,4 |
117 | cmp bl,0x90 |
117 | cmp cl,0x90 |
118 | ja wrongtime |
118 | ja wrongtime |
119 | cmp bh,0x92 |
119 | cmp ch,0x92 |
120 | ja wrongtime |
120 | ja wrongtime |
121 | shl ebx,4 |
121 | shl ecx,4 |
122 | bswap ebx ;00HHMMSS |
122 | bswap ecx ;00HHMMSS |
123 | cmp bl,0x59 |
123 | cmp cl,0x59 |
124 | ja wrongtime |
124 | ja wrongtime |
125 | shl ebx,4 |
125 | shl ecx,4 |
126 | cmp bl,0x90 |
126 | cmp cl,0x90 |
127 | ja wrongtime |
127 | ja wrongtime |
128 | shr ebx,4 |
128 | shr ecx,4 |
- | 129 | ||
129 | mov dx,0x70 |
130 | mov edx,0x70 |
130 | call startstopclk |
131 | call startstopclk |
131 | dec edx |
132 | dec edx |
132 | cmp ecx,3 |
133 | cmp ebx,3 |
- | 134 | ||
133 | je setalarm |
135 | je setalarm |
134 | xor eax,eax ;al=0-set seconds |
136 | xor eax,eax ;al=0-set seconds |
135 | out dx,al |
137 | out dx,al |
136 | inc edx |
138 | inc edx |
137 | mov al,bl |
139 | mov al,cl |
138 | out dx,al |
140 | out dx,al |
139 | dec edx |
141 | dec edx |
140 | mov al,2 ;set minutes |
142 | mov al,2 ;set minutes |
141 | out dx,al |
143 | out dx,al |
142 | inc edx |
144 | inc edx |
143 | mov al,bh |
145 | mov al,ch |
144 | out dx,al |
146 | out dx,al |
145 | dec edx |
147 | dec edx |
146 | mov al,4 ;set hours |
148 | mov al,4 ;set hours |
147 | out dx,al |
149 | out dx,al |
148 | inc edx |
150 | inc edx |
149 | shr ebx,8 |
151 | shr ecx,8 |
150 | mov al,bh |
152 | mov al,ch |
151 | out dx,al |
153 | out dx,al |
152 | jmp endsettime |
154 | jmp endsettime |
153 | setalarm: |
155 | setalarm: |
154 | mov al,1 ;set seconds for al. |
156 | mov al,1 ;set seconds for al. |
155 | out dx,al |
157 | out dx,al |
156 | inc edx |
158 | inc edx |
157 | mov al,bl |
159 | mov al,cl |
158 | out dx,al |
160 | out dx,al |
159 | dec edx |
161 | dec edx |
160 | mov al,3 ;set minutes for al. |
162 | mov al,3 ;set minutes for al. |
161 | out dx,al |
163 | out dx,al |
162 | inc edx |
164 | inc edx |
163 | mov al,bh |
165 | mov al,ch |
164 | out dx,al |
166 | out dx,al |
165 | dec edx |
167 | dec edx |
166 | mov al,5 ;set hours for al. |
168 | mov al,5 ;set hours for al. |
167 | out dx,al |
169 | out dx,al |
168 | inc edx |
170 | inc edx |
169 | shr ebx,8 |
171 | shr ecx,8 |
170 | mov al,bh |
172 | mov al,ch |
171 | out dx,al |
173 | out dx,al |
172 | dec edx |
174 | dec edx |
173 | mov al,0x0b ;enable irq's |
175 | mov al,0x0b ;enable irq's |
174 | out dx,al |
176 | out dx,al |
175 | inc dx |
177 | inc dx |
Line 178... | Line 180... | ||
178 | out dx,al |
180 | out dx,al |
179 | endsettime: |
181 | endsettime: |
180 | dec edx |
182 | dec edx |
181 | call startstopclk |
183 | call startstopclk |
182 | sti |
184 | sti |
183 | mov [esp+36],dword 0 |
185 | and [esp+36-4],dword 0 |
184 | ret |
186 | ret |
185 | bat_low: |
187 | bat_low: |
186 | sti |
188 | sti |
187 | mov [esp+36],dword 2 |
189 | mov [esp+36-4],dword 2 |
188 | ret |
190 | ret |
189 | wrongtime: |
191 | wrongtime: |
190 | sti |
192 | sti |
191 | mov [esp+36],dword 1 |
193 | mov [esp+36-4],dword 1 |
192 | ret |
194 | ret |
Line 193... | Line 195... | ||
193 | 195 | ||
194 | startstopclk: |
196 | startstopclk: |
195 | mov al,0x0b |
197 | mov al,0x0b |