upgrade sys_settime.

git-svn-id: svn://kolibrios.org@1279 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-11-20 18:50:43 +00:00
parent 2584ef3609
commit d0ea66e57f
2 changed files with 63 additions and 61 deletions

View File

@ -125,7 +125,7 @@ iglobal
dd 0 dd 0
dd 0 dd 0
dd 0 dd 0
dd sys_settime dd 0
dd 0 dd 0
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd 0 ; 25 dd 0 ; 25
@ -204,7 +204,7 @@ iglobal
dd paleholder ; 19-reserved dd paleholder ; 19-reserved
dd sys_midi ; 20-ResetMidi and OutputMidi dd sys_midi ; 20-ResetMidi and OutputMidi
dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,. dd sys_setup ; 21-SetMidiBase,SetKeymap,SetShiftKeymap,.
dd cross_order ; 22-setting date,time,clock and alarm-clock dd sys_settime ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd undefined_syscall ; 25-reserved dd undefined_syscall ; 25-reserved

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -17,157 +17,159 @@ $Revision$
; ebx =3 - set alarm-clock ecx - 00SSMMHH ; ebx =3 - set alarm-clock ecx - 00SSMMHH
; out: 0 -Ok 1 -wrong format 2 -battery low ; out: 0 -Ok 1 -wrong format 2 -battery low
sys_settime: sys_settime:
mov ecx,eax
cli cli
mov al,0x0d mov al,0x0d
out 0x70,al out 0x70,al
in al,0x71 in al,0x71
bt ax,7 bt ax,7
jnc bat_low jnc bat_low
cmp ecx,2 ;day of week cmp ebx,2 ;day of week
jne nosetweek jne nosetweek
test ebx,ebx ;test day of week test ecx,ecx ;test day of week
je wrongtime je wrongtime
cmp ebx,7 cmp ecx,7
ja wrongtime ja wrongtime
mov dx,0x70 mov edx,0x70
call startstopclk call startstopclk
dec edx dec edx
mov al,6 mov al,6
out dx,al out dx,al
inc edx inc edx
mov al,bl mov al,cl
out dx,al out dx,al
jmp endsettime jmp endsettime
nosetweek: ;set date nosetweek: ;set date
cmp ecx,1 cmp ebx,1
jne nosetdate jne nosetdate
cmp bl,0x99 ;test year cmp cl,0x99 ;test year
ja wrongtime ja wrongtime
shl ebx,4 shl ecx,4
cmp bl,0x90 cmp cl,0x90
ja wrongtime ja wrongtime
cmp bh,0x99 ;test month cmp ch,0x99 ;test month
ja wrongtime ja wrongtime
shr ebx,4 shr ecx,4
test bh,bh test ch,ch
je wrongtime je wrongtime
cmp bh,0x12 cmp ch,0x12
ja wrongtime ja wrongtime
shl ebx,8 shl ecx,8
bswap ebx ;ebx=00YYMMDD bswap ecx ;ebx=00YYMMDD
test bl,bl ;test day test cl,cl ;test day
je wrongtime je wrongtime
shl ebx,4 shl ecx,4
cmp bl,0x90 cmp cl,0x90
ja wrongtime ja wrongtime
shr ebx,4 shr ecx,4
cmp bh,2 ;February cmp ch,2 ;February
jne testday jne testday
cmp bl,0x29 cmp cl,0x29
ja wrongtime ja wrongtime
jmp setdate jmp setdate
testday: testday:
cmp bh,8 cmp ch,8
jb testday1 ;Aug-Dec jb testday1 ;Aug-Dec
bt bx,8 bt cx,8
jnc days31 jnc days31
jmp days30 jmp days30
testday1: testday1:
bt bx,8 ;Jan-Jul ex.Feb bt cx,8 ;Jan-Jul ex.Feb
jnc days30 jnc days30
days31: days31:
cmp bl,0x31 cmp cl,0x31
ja wrongtime ja wrongtime
jmp setdate jmp setdate
days30: days30:
cmp bl,0x30 cmp cl,0x30
ja wrongtime ja wrongtime
setdate: setdate:
mov dx,0x70 mov edx,0x70
call startstopclk call startstopclk
dec edx dec edx
mov al,7 ;set days mov al,7 ;set days
out dx,al out dx,al
inc edx inc edx
mov al,bl mov al,cl
out dx,al out dx,al
dec edx dec edx
mov al,8 ;set months mov al,8 ;set months
out dx,al out dx,al
inc edx inc edx
mov al,bh mov al,ch
out dx,al out dx,al
dec edx dec edx
mov al,9 ;set years mov al,9 ;set years
out dx,al out dx,al
inc edx inc edx
shr ebx,8 shr ecx,8
mov al,bh mov al,ch
out dx,al out dx,al
jmp endsettime jmp endsettime
nosetdate: ;set time or alarm-clock nosetdate: ;set time or alarm-clock
cmp ecx,3 cmp ebx,3
ja wrongtime ja wrongtime
cmp bl,0x23 cmp cl,0x23
ja wrongtime ja wrongtime
cmp bh,0x59 cmp ch,0x59
ja wrongtime ja wrongtime
shl ebx,4 shl ecx,4
cmp bl,0x90 cmp cl,0x90
ja wrongtime ja wrongtime
cmp bh,0x92 cmp ch,0x92
ja wrongtime ja wrongtime
shl ebx,4 shl ecx,4
bswap ebx ;00HHMMSS bswap ecx ;00HHMMSS
cmp bl,0x59 cmp cl,0x59
ja wrongtime ja wrongtime
shl ebx,4 shl ecx,4
cmp bl,0x90 cmp cl,0x90
ja wrongtime ja wrongtime
shr ebx,4 shr ecx,4
mov dx,0x70
mov edx,0x70
call startstopclk call startstopclk
dec edx dec edx
cmp ecx,3 cmp ebx,3
je setalarm je setalarm
xor eax,eax ;al=0-set seconds xor eax,eax ;al=0-set seconds
out dx,al out dx,al
inc edx inc edx
mov al,bl mov al,cl
out dx,al out dx,al
dec edx dec edx
mov al,2 ;set minutes mov al,2 ;set minutes
out dx,al out dx,al
inc edx inc edx
mov al,bh mov al,ch
out dx,al out dx,al
dec edx dec edx
mov al,4 ;set hours mov al,4 ;set hours
out dx,al out dx,al
inc edx inc edx
shr ebx,8 shr ecx,8
mov al,bh mov al,ch
out dx,al out dx,al
jmp endsettime jmp endsettime
setalarm: setalarm:
mov al,1 ;set seconds for al. mov al,1 ;set seconds for al.
out dx,al out dx,al
inc edx inc edx
mov al,bl mov al,cl
out dx,al out dx,al
dec edx dec edx
mov al,3 ;set minutes for al. mov al,3 ;set minutes for al.
out dx,al out dx,al
inc edx inc edx
mov al,bh mov al,ch
out dx,al out dx,al
dec edx dec edx
mov al,5 ;set hours for al. mov al,5 ;set hours for al.
out dx,al out dx,al
inc edx inc edx
shr ebx,8 shr ecx,8
mov al,bh mov al,ch
out dx,al out dx,al
dec edx dec edx
mov al,0x0b ;enable irq's mov al,0x0b ;enable irq's
@ -180,15 +182,15 @@ sys_settime:
dec edx dec edx
call startstopclk call startstopclk
sti sti
mov [esp+36],dword 0 and [esp+36-4],dword 0
ret ret
bat_low: bat_low:
sti sti
mov [esp+36],dword 2 mov [esp+36-4],dword 2
ret ret
wrongtime: wrongtime:
sti sti
mov [esp+36],dword 1 mov [esp+36-4],dword 1
ret ret
startstopclk: startstopclk: