实验14 访问 CMOS RAM
互相学习加油加油加油assume cs:code,ds:data,ss:stack
data segment
db 64 dup(0)
ends data
stack segment
db 64 dup(0)
ends stack
code segment
s1: db 'NN/YY/RR SS:FF:MM',0
s2:db 9,8,7,4,2,0
start:
call r_screen ; 清屏
call ini_reg ;设置 数据从哪来 数据到哪里去
call show_style ;显示格式
call show_time ;显示时间
mov ax,4c00H
int 21H
;=======================================================
show_time:
mov si,offset s2
mov di,160*12+30*2
mov cx,6
gain_time: mov al,ds:
out 70H,al
inal,71H
mov ah,al
shr ah,1
shr ah,1
shr ah,1
shr ah,1
and al,00001111B
add ah,30H
add al,30H
mov es:,ah
mov es:,al
inc si
add di,6
loop gain_time ;循环获取时间
jmp show_time;跟随时间变化
ret
;=======================================================
show_style: push dx
push ds
push es
push si
push di
mov si,offset s1
mov di,160*12+30*2
infinite: mov dl,ds:
cmp dl,0
je return
mov es:,dl
mov byte ptr es:,2
inc si
add di,2
jmp infinite
return: pop di
pop si
pop es
pop ds
pop dx
ret
;=======================================================
ini_reg:
mov bx,cs
mov ds,bx
mov bx,0b800H
mov es,bx
ret
;=======================================================
r_screen:
mov bx,0b800H
mov es,bx
mov di,0
mov cx,2000
RSecreen: mov byte ptr es:,00000000B
mov byte ptr es:,000000010B
add di,2
loop RSecreen
ret
code ends
end start
页:
[1]