彙編,實現顯示當前時間

2021-07-24 14:54:36 字數 1666 閱讀 2422

秒:0         分:2          時:4             日:7             月:8              年:9

這些資料以bcd碼的方式存放。

從cmos ram中讀取資訊的方法是:

out   70h,暫存器      ;暫存器中存放了要訪問的單元位址

in  暫存器,71h          ;從單元處讀取資料

接下來的是**:

;程式設計,以 "年:月:日  時:分:秒" 的格式,顯示當前的日期、時間。

assume cs:code

code segment

start:    ;設定顯示的位置

mov ax,0b800h

mov ds,ax

mov si,12*160+60

;讀取要顯示的內容

mov al,9

mov cx,3

;寫入年:月:日

r_1:push ax

out 70h,al

in     al,71h

push cx

mov bh,al

mov bl,al

mov cl,4

shr bh,cl        ;高位bcd碼

and bl,00001111b;低位bcd碼

pop cx

add bh,30h

add bl,30h

mov byte ptr [si],bh

add si,2

mov byte ptr [si],bl

add si,2

cmp cx,1

jz r_1ok        ;if cx=1  跳轉到r_ok處

mov byte ptr [si],':'

r_1ok:

pop ax

add si,2

dec al

loop r_1

;寫入兩個空格

mov byte ptr [si],' '

add si,2

mov byte ptr [si],' '

add si,2

;寫入時:分:秒

;---秒:0    分:2    時:4

mov al,4

mov cx,3

r_2:push ax

out 70h,al

in al,71h

mov bh,al

mov bl,al

pop ax

push cx

mov cl,4

shr bh,cl

and bl,00001111b

add bh,30h

add bl,30h

;寫入記憶體中

pop cx

mov byte ptr [si],bh

add si,2

mov byte ptr [si],bl

add si,2

cmp cx,1

jz r_2ok

mov byte ptr [si],':'

r_2ok:

add si,2

sub al,2

loop r_2

;程式結束

mov ah,4ch

int 21h

code ends

end start

vue實現當前時間動態顯示

如圖所示 注 這裡是vue的生命週期,生命週期函式圖示鏈結為 生命週期圖示 created 與 mounted 的區別就是 created 在模板渲染成html前呼叫,即通常初始化某些屬性值,然後再渲染成檢視 mounted在模板渲染成html後呼叫,通常是初始化頁面完成後,再對html的dom節點...

顯示當前時間(動態)

coding utf 8 time 2020 1 12 16 15 author liuze file time 3.py software pycharm import time 匯入時間模組 import sys def get hms loacal time time.localtime ti...

js顯示當前時間

閒著沒事在快閃儲存器裡看到有人需要js顯示當前時間,就一時興起寫了個。輸出格式 2013年12月18日 星期三 上午9 05 00 ps 感謝undefined的指點,簡化了很多。以上是客戶端時間,那麼要想顯示伺服器時間怎麼辦呢?對於精確度要求不高的情況有個方案 頁面第一次開啟時獲取一次伺服器時間,...