当前位置:首页 > 我的程序 > 正文内容

贴一个CMOS时钟硬件的RTC内容读取

Peirre3年前 (2023-03-27)我的程序356

这段代码是电脑主板电池附近的模块。

这是一组独立的数据区,通过IO读取,有两段。

其中一组备用的有些主板有,有些主板是不可读的,两份数据没意义。

上一部分可寻找以前的文件例子和源码。

程序编译后在DOSBOX下运行正常,使用32位以上的指令非法。

data segment
_title db 'CMOS Reader ver 1.00',0dh,0ah,
'Author Jacky fu',0dh,0ah,
'Base CMOS Buffer',0dh,0ah,
' 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F',0dh,0ah,
' -----------------------------------------------',0dh,0ah,'$'
counter db 00h
_high db 'High CMOS Buffer',0dh,0ah,'$'
data ends

code segment
assume cs:code,ds:data,es:data
start:

mov ax,data		; 数据段定义
mov ds,ax
xor ax,ax

lea dx,_title		;显示程序提示
mov ah,09h
int 21h

mov cx,00h
loop2:
mov dl,cl
call printdl
mov dl,':'
mov ah,02h
int 21h
call fun2
inc cx
cmp cl,10h
jl loop2

lea dx,_high
mov ah,09h
int 21h

mov al,056h
mov dx,0cd6h
out dx,al
mov dx,0cd7h
in ax,dx
or ax,1000000000000b
out dx,ax

mov cx,00h
mov counter,00h
loop3:
mov dl,cl
call printdl
mov dl,':'
mov ah,02h
int 21h
call fun3
inc cx
cmp cl,10h
jl loop3

mov al,0eh
out 70,al
in al,71
mov dl,al
call printdl 

mov ah,4ch
int 21h

fun4 proc near
push dx
push ax

mov dx,72h
mov al,counter
out dx,al
mov dx,73h
in al,dx
mov dl,al
call printdl
add counter,1

pop dx
pop ax
ret
fun4 endp

fun3 proc near
push cx
push dx
push ax
mov cl,00h
loop4:
call fun4
inc cl
cmp cl,10h
jl loop4
mov dl,0dh
mov ah,02h
int 21h
mov dl,0ah
int 21h
pop ax
pop dx
pop cx
ret
fun3 endp

fun2 proc near
push cx
push dx
push ax
mov cl,00h
loop1:
call fun1
inc cl
cmp cl,10h
jl loop1
mov dl,0dh
mov ah,02h
int 21h
mov dl,0ah
int 21h
pop ax
pop dx
pop cx
ret
fun2 endp

fun1 proc near
push dx
push ax

;mov dx,70h
;mov al,counter
;out dx,al
;mov dx,71h
;in al,dx
;mov dl,al
;call printdl
;add counter,1

mov al,counter
;mov dx,70h
out 70h,al
in al,71h
mov dl,al
call printdl 
inc counter

pop dx
pop ax
ret
fun1 endp

;input dl such as xxh,out put as xxh
printdl proc near
push ax
push cx

mov al,dl
mov cl,04h
sar dl,cl
and dl,0fh
call printdlhalf

mov dl,al
and dl,0fh
call printdlhalf

mov dl,' '
mov ah,02h
int 21h

pop cx
pop ax
ret
printdl endp

printdlhalf proc near
push ax
cmp dl,09h
ja largerthan9
add dl,30h
jmp print
largerthan9:
add dl,37h
print:
mov ah,02h
int 21h
pop ax
ret
printdlhalf endp
code ends

end start

9417512.jpg

注:RTC是个硬件芯片,有时集成在南桥中,先的文章源码有注解,留意了。

http://www.nantz.top/zblog/?id=157


分享给朋友:

相关文章

一个易语言写的函数信号发生器。

一个易语言写的函数信号发生器。

易语言写的函数信号发生器,编写的想法是准备应用“雷达”的信号发射源。本来包含声音部分,有待继续完善。下载地址:https://pan.baidu.com/s/1mi22Ico...

随手写的时间设置程序,主要是防止系统时间无故修改。

随手写的时间设置程序,主要是防止系统时间无故修改。

程序说明:测试版程序功能。同步系统时间数据可选月历,手工输入可自动识别时间修改,修改后一分钟报警。测试版没有恢复时间功能。以后会增加。欢迎下载的朋友帮助我找程序问题,没有花多少功夫,请多多原谅。这个程...

阿里云后台的一个身份证信息查询工具。

阿里云后台的一个身份证信息查询工具。

注:此软件时效性已过,只在此陈列,没有什么意义。工具主图形界面有时会欠费,查不了时,请付1分钱给阿里云。下载地址:个人身份证阿里云查询.rar...

关于ch341驱动,联动3D打印机USB串口通讯.

关于ch341驱动,联动3D打印机USB串口通讯.

手上有个3D打印机,搬家的原因,好久没用.天气热了,打印温度很适合,正好可以使用.又过了一年.发现linux 版本内核已经升级,和原来的系统不一样了. 按照3D打印机的说明,和寻找它的程序,原来的方法...

linux mint 20 下编译最新内核所添加的文件。

linux mint 20 下编译最新内核所添加的文件。

linux mint 20 下编译最新内核文件所需要的两个文件包。sudo apt-get install libncurses5-devsudo apt-get install libssl-dev...

linux 下的《仙剑奇侠传》

linux 下的《仙剑奇侠传》

以前的DOS游戏《仙剑奇侠传》是炙制人口的一个很容易上手的游戏。这个游戏流行了很多年。很多人在玩过多年以后,重温旧梦,回味游戏之中的情感。这个游戏再版了很多次了。现在linux 下也可以直接玩这个游戏...