From d0ea66e57f4489a1c05719b2acb2a1f02bccc634 Mon Sep 17 00:00:00 2001 From: "Alexey Teplov (" Date: Fri, 20 Nov 2009 18:50:43 +0000 Subject: [PATCH] upgrade sys_settime. git-svn-id: svn://kolibrios.org@1279 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/core/syscall.inc | 4 +- kernel/trunk/hid/set_dtc.inc | 120 +++++++++++++++++----------------- 2 files changed, 63 insertions(+), 61 deletions(-) diff --git a/kernel/trunk/core/syscall.inc b/kernel/trunk/core/syscall.inc index b0448a4fd9..139dd61171 100644 --- a/kernel/trunk/core/syscall.inc +++ b/kernel/trunk/core/syscall.inc @@ -125,7 +125,7 @@ iglobal dd 0 dd 0 dd 0 - dd sys_settime + dd 0 dd 0 dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd 0 ; 25 @@ -204,7 +204,7 @@ iglobal dd paleholder ; 19-reserved dd sys_midi ; 20-ResetMidi and OutputMidi 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 cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd undefined_syscall ; 25-reserved diff --git a/kernel/trunk/hid/set_dtc.inc b/kernel/trunk/hid/set_dtc.inc index 53539700eb..abaa3eddf1 100644 --- a/kernel/trunk/hid/set_dtc.inc +++ b/kernel/trunk/hid/set_dtc.inc @@ -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 ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -17,157 +17,159 @@ $Revision$ ; ebx =3 - set alarm-clock ecx - 00SSMMHH ; out: 0 -Ok 1 -wrong format 2 -battery low sys_settime: - mov ecx,eax + cli mov al,0x0d out 0x70,al in al,0x71 bt ax,7 jnc bat_low - cmp ecx,2 ;day of week + cmp ebx,2 ;day of week jne nosetweek - test ebx,ebx ;test day of week + test ecx,ecx ;test day of week je wrongtime - cmp ebx,7 + cmp ecx,7 ja wrongtime - mov dx,0x70 + mov edx,0x70 call startstopclk dec edx mov al,6 out dx,al inc edx - mov al,bl + mov al,cl out dx,al jmp endsettime nosetweek: ;set date - cmp ecx,1 + cmp ebx,1 jne nosetdate - cmp bl,0x99 ;test year + cmp cl,0x99 ;test year ja wrongtime - shl ebx,4 - cmp bl,0x90 + shl ecx,4 + cmp cl,0x90 ja wrongtime - cmp bh,0x99 ;test month + cmp ch,0x99 ;test month ja wrongtime - shr ebx,4 - test bh,bh + shr ecx,4 + test ch,ch je wrongtime - cmp bh,0x12 + cmp ch,0x12 ja wrongtime - shl ebx,8 - bswap ebx ;ebx=00YYMMDD - test bl,bl ;test day + shl ecx,8 + bswap ecx ;ebx=00YYMMDD + test cl,cl ;test day je wrongtime - shl ebx,4 - cmp bl,0x90 + shl ecx,4 + cmp cl,0x90 ja wrongtime - shr ebx,4 - cmp bh,2 ;February + shr ecx,4 + cmp ch,2 ;February jne testday - cmp bl,0x29 + cmp cl,0x29 ja wrongtime jmp setdate testday: - cmp bh,8 + cmp ch,8 jb testday1 ;Aug-Dec - bt bx,8 + bt cx,8 jnc days31 jmp days30 testday1: - bt bx,8 ;Jan-Jul ex.Feb + bt cx,8 ;Jan-Jul ex.Feb jnc days30 days31: - cmp bl,0x31 + cmp cl,0x31 ja wrongtime jmp setdate days30: - cmp bl,0x30 + cmp cl,0x30 ja wrongtime setdate: - mov dx,0x70 + mov edx,0x70 call startstopclk dec edx mov al,7 ;set days out dx,al inc edx - mov al,bl + mov al,cl out dx,al dec edx mov al,8 ;set months out dx,al inc edx - mov al,bh + mov al,ch out dx,al dec edx mov al,9 ;set years out dx,al inc edx - shr ebx,8 - mov al,bh + shr ecx,8 + mov al,ch out dx,al jmp endsettime nosetdate: ;set time or alarm-clock - cmp ecx,3 + cmp ebx,3 ja wrongtime - cmp bl,0x23 + cmp cl,0x23 ja wrongtime - cmp bh,0x59 + cmp ch,0x59 ja wrongtime - shl ebx,4 - cmp bl,0x90 + shl ecx,4 + cmp cl,0x90 ja wrongtime - cmp bh,0x92 + cmp ch,0x92 ja wrongtime - shl ebx,4 - bswap ebx ;00HHMMSS - cmp bl,0x59 + shl ecx,4 + bswap ecx ;00HHMMSS + cmp cl,0x59 ja wrongtime - shl ebx,4 - cmp bl,0x90 + shl ecx,4 + cmp cl,0x90 ja wrongtime - shr ebx,4 - mov dx,0x70 + shr ecx,4 + + mov edx,0x70 call startstopclk dec edx - cmp ecx,3 - je setalarm + cmp ebx,3 + + je setalarm xor eax,eax ;al=0-set seconds out dx,al inc edx - mov al,bl + mov al,cl out dx,al dec edx mov al,2 ;set minutes out dx,al inc edx - mov al,bh + mov al,ch out dx,al dec edx mov al,4 ;set hours out dx,al inc edx - shr ebx,8 - mov al,bh + shr ecx,8 + mov al,ch out dx,al jmp endsettime setalarm: mov al,1 ;set seconds for al. out dx,al inc edx - mov al,bl + mov al,cl out dx,al dec edx mov al,3 ;set minutes for al. out dx,al inc edx - mov al,bh + mov al,ch out dx,al dec edx mov al,5 ;set hours for al. out dx,al inc edx - shr ebx,8 - mov al,bh + shr ecx,8 + mov al,ch out dx,al dec edx mov al,0x0b ;enable irq's @@ -180,15 +182,15 @@ sys_settime: dec edx call startstopclk sti - mov [esp+36],dword 0 + and [esp+36-4],dword 0 ret bat_low: sti - mov [esp+36],dword 2 + mov [esp+36-4],dword 2 ret wrongtime: sti - mov [esp+36],dword 1 + mov [esp+36-4],dword 1 ret startstopclk: