Merge pull request #10 from liujunming/rtc_refine

refine rtc.s
This commit is contained in:
Ciro Santilli,Opinions and content are my own, not my employer's,2020冠状病毒审查 2018新疆改造中心,1989六四事件,1999法轮功 ,2019 996.ICU, 2018包子露宪,2015 710律师劫,2015巴拿马文件 邓家贵,2017低端人口,2008西藏骚乱scriptalert(1)/script
2020-05-02 16:44:44 +01:00
committed by GitHub

21
rtc.S
View File

@@ -1,20 +1,35 @@
/* https://github.com/cirosantilli/x86-bare-metal-examples#rct */ /* https://github.com/cirosantilli/x86-bare-metal-examples#rct */
/* TODO what do those numbers mean? Where is this all documented? */ /*
* Reference: https://wiki.osdev.org/CMOS
Register Contents Range
0x00 Seconds 059
0x02 Minutes 059
0x04 Hours 023 in 24-hour mode,
112 in 12-hour mode, highest bit set if pm
0x07 Day of Month 131
0x08 Month 112
0x09 Year 099
0x0A Status Register A
RTC has an "Update in progress" flag (bit 7 of Status Register A).
To read the time and date properly you have to wait until
the "Update in progress" flag goes from "set" to "clear".
*/
.equ RTCaddress, 0x70 .equ RTCaddress, 0x70
.equ RTCdata, 0x71 .equ RTCdata, 0x71
#include "common.h" #include "common.h"
BEGIN BEGIN
update_in_progress: update_in_progress:
mov $10, %al mov $0x0A, %al
out %al, $RTCaddress out %al, $RTCaddress
in $RTCdata, %al in $RTCdata, %al
testb $0x80, %al testb $0x80, %al
jne update_in_progress jne update_in_progress
/* Second. */ /* Second. */
mov $0, %al mov $0x00, %al
out %al, $RTCaddress out %al, $RTCaddress
in $RTCdata, %al in $RTCdata, %al