讀取CMOS時鐘並顯示

2022-08-09 00:09:19 字數 4585 閱讀 3737

讀取年月日及當前時間

**

escape      equ 1bh

cmos_port equ 70h

cmos_rega equ 0ah

update_flag equ 80h

cmos_sec equ 00h

cmos_min equ 02h

cmos_hour equ 04h

cmos_day equ 07h

cmos_month equ 08h

cmos_year equ 09h

data segment

datetime db

'yy-mm-dd hh:mi:ss

'dt_len = $ - offset datetime

data ends

stack segment

db 16

dup(?)

stack ends

code segment

assume

cs:code,

ds:data,

ss:stack

start:

movax,data

movds,ax

movax,stack

movss,ax

addsp,-

16@@:

movsi,offset datetime

moval,cmos_rega

outcmos_port,al

jmp$+2in

al,cmos_port+

1test

al,update_flag

jnz@b

;get year

moval,cmos_year

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

get month

moval,cmos_month

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

get day

moval,cmos_day

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

get hour

moval,cmos_hour

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

get minute

moval,cmos_min

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

get second

moval,cmos_sec

outcmos_port,al

jmp$+2in

al,cmos_port+

1mov

ah,al

movcl,

4shr

ah,cl

andal,

00001111b

addah,30h

addal,30h

mov[si],ah

mov[si+

1],al

addsi,3;

movsi,offset datetime

call

display

;mov

ah,1

int16h

cmpal,escape

jz_exit

call

cleankbbuf

jmp@b

_exit:

movah,4ch

int21h

cleankbbuf proc

_again:

movah,

1int

16hjz

_over

movah,

0int

16hjmp

_again

_over:

retcleankbbuf endp

display proc

movax,0b800h

moves,ax

movah,0f4h

;087h ;此處設定顯示的屬性即顏色irgb

movdi,(80*

12+28)*2;

(80列*25行)12表示顯示的行(中間)/28表示顯示起始列

movcx,dt_len

s:mov

al,[si]

moves:

[di],ax

;ax中ah儲存顏色,al儲存輸出值/此處可以用ax或al

incsi

adddi,

2loop s

retdisplay endp

code ends

end start

cmos內容對照

位址   內容   位址   內容   位址   內容   位址   內容  

00h   time   -   seconds   20h   reserved   40h   extended   cmos   60h   user   password    

01h   alarm   -   seconds   21h   reserved   41h   extended   cmos   61h   user   password    

02h   time   -   minutes   22h   reserved   42h   extended   cmos   62h   extended   cmos  

03h   alarm   -   minutes   23h   reserved   43h   extended   cmos   63h   extended   cmos  

04h   time   -   hours   24h   reserved   44h   extended   cmos   64h   extended   cmos  

05h   alarm   -   hours   25h   reserved   45h   extended   cmos   65h   extended   cmos    

06h   date   -   day   of   the   week   26h   reserved   46h   extended   cmos   66h   extended   cmos  

07h   date   -   day   27h   reserved   47h   extended   cmos   67h   extended   cmos  

08h   date   -   month   28h   reserved   48h   extended   cmos   68h   extended   cmos  

09h   date   -   year   29h   reserved   49h   extended   cmos   69h   extended   cmos  

0ah   status   register   a   2ah   reserved   4ah   extended   cmos   6ah   extended   cmos

PCD檔案讀取並顯示

前面一段時間一直在寫 好久都沒有進行程式設計學習,突然覺得無從下手了,翻開以前寫的 練練手,順便記錄下來以便以後自己可以快速熟悉。乙個簡單的點雲pcd檔案讀取,並視覺化。filename pcd read date 2018 3 27 description read pcd files point...

CMOS 記憶體和實時時鐘

第15章 cmos 記憶體和實時時鐘 筆記 簡介 系統帶有乙個小型的cmos記憶體,其中儲存著系統斷電時的資料。該記憶體用來記錄軟盤的型別和數目 硬碟大小資訊 記憶體大小以及其他重要的系統資料。cmos晶元還含有乙個實時時鐘 rtc 用來保持當前時間。關掉電源時,rtc由計算機內部的電池供電。電池保...

Python讀取YUV檔案,並顯示

opencv可以讀取的型別比較多,但大多是比較常見的型別,比如 jpg 和 png 但它不能直接讀取yuv格式的檔案,需要通過python讀取yuv檔案,並進行相應的轉換後,才能被opencv讀取,並進行後續相應的處理.話不多說,直接上程式.import cv2 from numpy import ...