2000-05-06 21:34:20 +02:00
|
|
|
;
|
|
|
|
; File:
|
|
|
|
; rdatclk.asm
|
|
|
|
; Description:
|
|
|
|
; read the AT style clock from bios
|
|
|
|
;
|
|
|
|
; Copyright (c) 1995
|
|
|
|
; Pasquale J. Villani
|
|
|
|
; All Rights Reserved
|
|
|
|
;
|
|
|
|
; This file is part of DOS-C.
|
|
|
|
;
|
|
|
|
; DOS-C is free software; you can redistribute it and/or
|
|
|
|
; modify it under the terms of the GNU General Public License
|
|
|
|
; as published by the Free Software Foundation; either version
|
|
|
|
; 2, or (at your option) any later version.
|
|
|
|
;
|
|
|
|
; DOS-C is distributed in the hope that it will be useful, but
|
|
|
|
; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
|
|
|
|
; the GNU General Public License for more details.
|
|
|
|
;
|
|
|
|
; You should have received a copy of the GNU General Public
|
|
|
|
; License along with DOS-C; see the file COPYING. If not,
|
|
|
|
; write to the Free Software Foundation, 675 Mass Ave,
|
|
|
|
; Cambridge, MA 02139, USA.
|
|
|
|
;
|
2001-11-18 00:26:45 +01:00
|
|
|
; Logfile: C:/dos-c/src/drivers/rdatclk.asv
|
2000-05-06 21:34:20 +02:00
|
|
|
;
|
2001-11-18 00:26:45 +01:00
|
|
|
; $Header$
|
2000-05-06 21:34:20 +02:00
|
|
|
;
|
|
|
|
|
2003-06-15 13:46:51 +02:00
|
|
|
%include "../kernel/segs.inc"
|
2000-05-06 21:34:20 +02:00
|
|
|
|
2003-03-12 23:43:53 +01:00
|
|
|
segment HMA_TEXT
|
2000-05-06 21:34:20 +02:00
|
|
|
|
|
|
|
;
|
|
|
|
;COUNT ReadATClock(bcdDays, bcdHours, bcdMinutes, bcdSeconds)
|
|
|
|
;BYTE *bcdDays;
|
|
|
|
;BYTE *bcdHours;
|
|
|
|
;BYTE *bcdMinutes;
|
|
|
|
;BYTE *bcdSeconds;
|
|
|
|
;
|
|
|
|
global _ReadATClock
|
|
|
|
_ReadATClock:
|
2001-11-04 20:47:39 +01:00
|
|
|
push bp
|
|
|
|
mov bp, sp
|
|
|
|
xor cx, cx ; cx=dx=0 check if present
|
|
|
|
xor dx, dx ; if it returns non-zero
|
|
|
|
clc ; necessary according to RBIL
|
|
|
|
mov ah,4
|
2001-04-15 05:21:50 +02:00
|
|
|
int 1ah
|
2001-11-04 20:47:39 +01:00
|
|
|
jc @RdATerror
|
|
|
|
|
|
|
|
or cx, cx
|
|
|
|
jnz @RdAT1140
|
|
|
|
or dx, dx
|
|
|
|
jnz @RdAT1140
|
|
|
|
@RdATerror: mov ax, 1
|
|
|
|
pop bp
|
2001-04-15 05:21:50 +02:00
|
|
|
ret
|
|
|
|
@RdAT1140:
|
2001-11-04 20:47:39 +01:00
|
|
|
clc
|
|
|
|
mov ah, 2
|
|
|
|
int 1ah
|
|
|
|
jc @RdATerror
|
2000-05-06 21:34:20 +02:00
|
|
|
; bcdSeconds = 10
|
|
|
|
; bcdMinutes = 8
|
|
|
|
; bcdHours = 6
|
|
|
|
; bcdDays = 4
|
|
|
|
mov bx,word [bp+6] ;bcdHours
|
2001-04-15 05:21:50 +02:00
|
|
|
mov byte [bx],ch ;Hours
|
2000-05-06 21:34:20 +02:00
|
|
|
mov bx,word [bp+8] ;bcdMinutes
|
2001-04-15 05:21:50 +02:00
|
|
|
mov byte [bx],cl ;Minutes
|
2000-05-06 21:34:20 +02:00
|
|
|
mov bx,word [bp+10] ;bcdSeconds
|
2001-04-15 05:21:50 +02:00
|
|
|
mov byte [bx],dh ;Seconds
|
2001-11-04 20:47:39 +01:00
|
|
|
clc
|
2001-04-15 05:21:50 +02:00
|
|
|
mov ah,4
|
|
|
|
int 1ah
|
2001-11-04 20:47:39 +01:00
|
|
|
jc @RdATerror
|
2001-04-15 05:21:50 +02:00
|
|
|
mov bx,word [bp+4] ;bcdDays
|
|
|
|
mov word [bx],dx ;Days
|
|
|
|
mov word [bx+2],cx
|
2000-05-06 21:34:20 +02:00
|
|
|
sub ax,ax
|
2001-11-04 20:47:39 +01:00
|
|
|
pop bp
|
2000-05-06 21:34:20 +02:00
|
|
|
ret
|
2001-11-18 00:26:45 +01:00
|
|
|
|