汇编语言第十四章 实验14
实验 14 访问CMOS RAM编程,以“年/月/日 时:分:秒”的格式,显示当前的日期、时间。
assume cs:codesg
datasg segment
db 9,8,7,4,2,0
datasg ends
codesg segment
start:
mov ax,datasg;
mov ds,ax;
mov si,0;
mov di,160*12+40*2-8; 计算居中的位置信息
mov cx,6
;处理数据读取
s:
push cx
mov al,;
out 70h,al;
in al,71h;
mov ah,al
mov cl,4
shr ah,cl; 高位数据
and al,00001111b; 低位数据
add ah,30h
add al,30h
mov bx,0b800h;
mov es,bx;
mov byte ptr es:,ah;
mov byte ptr es:,al
cmp byte ptr ,7
ja s1
je s2
cmp byte ptr,0
ja s3
je s4
s1:mov byte ptr es:,2fh; 添加斜杠‘/’的ascii码
jmp s4
s2:mov byte ptr es:,20h; 添加空格' '的ascii码
jmp s4
s3:mov byte ptr es:,3ah; 添加冒号':'的ascii码
s4:
add di,6
inc si
pop cx
loop s
mov ax,4c00h
int 21h
codesg ends
end start
以“年/月/日 时:分:秒”的格式,显示当前的日期、时间
页:
[1]