|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
实验 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,[si];
- 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:[di],ah;
- mov byte ptr es:[di+2],al
-
- cmp byte ptr [si],7
- ja s1
- je s2
- cmp byte ptr[si],0
- ja s3
- je s4
- s1:mov byte ptr es:[di+4],2fh; 添加斜杠‘/’的ascii码
- jmp s4
- s2:mov byte ptr es:[di+4],20h; 添加空格' '的ascii码
- jmp s4
- s3:mov byte ptr es:[di+4],3ah; 添加冒号':'的ascii码
-
- s4:
- add di,6
- inc si
- pop cx
- loop s
-
- mov ax,4c00h
- int 21h
-
- codesg ends
- end start
复制代码
|
|