flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Write/Read stuff from CMOS Or reset the CMOS

Author
Thread Post new topic Reply to topic
badc0de02



Joined: 25 Nov 2013
Posts: 216
Location: %x
badc0de02
hi, i have a qeustion how to write or read the CMOS
i know that the CMOS ports are I/O ports 70h and 71h.
but i dont know how to write to the CMOS.
need Help, im a beginner in OS Development
can some one Write a driver examnple or find a good example?
thanks in advance! Confused
Post 23 Dec 2013, 10:49
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
badc0de02,

First link in Google Search results for "read cmos" refers to all the necessary information.
Post 23 Dec 2013, 11:19
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 216
Location: %x
badc0de02
how about a example in ASM?
Post 23 Dec 2013, 14:20
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr
Code:
; Read date and time from RTC
        org     0x100
macro cmos_read index* {
        mov     al, index
        out     0x70, al
        in      al, 0x71
}
macro cmos_read_and_convert [index*] {
        cmos_read index
        aam     16
        xchg    ah, al
        or      ax, '00'
        stosw
        inc     di
}
        mov     dx, result
        mov     di, dx
        cmos_read_and_convert 9, 8, 7; date
        cmos_read_and_convert 4, 2, 0; time
        mov     ah, 9
        int     0x21
        ret

result  db      '00-00-00 00:00:00', 13, 10, '$'    
Post 23 Dec 2013, 14:51
View user's profile Send private message Reply with quote
badc0de02



Joined: 25 Nov 2013
Posts: 216
Location: %x
badc0de02
Thanks, baldr!
Post 23 Dec 2013, 17:18
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.