- [rexic] 第(5)小题可精简为: assume cs:code a segment db 1 11/14 21:38
- [rexic] 用本章的转移指令来完成 assume cs:code,ds:data data seg 10/12 11:10
- [rexic] 使用 'div 内存单元' 操作时, 一定要指定操作长度类型, 否则报错, 10/09 13:45
[2015-11-01 13:18] 实验14 访问CMOS RAM
;编程,以“年/月/日 时:分:秒”的格式,显示当前的日期、时间。
;注意:CMOS RAM中存储着系统的配置信息,除了保存时间信息的单元
;外,不要向其他的单元中写入内容,否则将引起一些系统错误。
assume cs:code
code segment
begin:mov bx,9
mov si,7c0h ;屏幕中间,年开头,60×12+32×2
;=1984=7c0h
mov cx,6
push cx
s:push cx
mov al,bl
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 dx,0b800h
mov ds,dx
mov [si],ah
mov [si+2],al
jmp s1
s0:add si,6
pop cx
loop s
mov ax,4c00h
int 21h
s1:cmp bx,7
ja s2
je s3
jb s4
s2:dec bx
mov byte ptr [si+4],'/'
jmp short s0
s3:sub bx,3
jmp short s0
s4:cmp bx,0
je s5
sub bx,2
mov byte ptr [si+4],':'
jmp short s0
s5:jmp short s0
code ends
end begin
实验结果如图:
;注意:CMOS RAM中存储着系统的配置信息,除了保存时间信息的单元
;外,不要向其他的单元中写入内容,否则将引起一些系统错误。
assume cs:code
code segment
begin:mov bx,9
mov si,7c0h ;屏幕中间,年开头,60×12+32×2
;=1984=7c0h
mov cx,6
push cx
s:push cx
mov al,bl
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 dx,0b800h
mov ds,dx
mov [si],ah
mov [si+2],al
jmp s1
s0:add si,6
pop cx
loop s
mov ax,4c00h
int 21h
s1:cmp bx,7
ja s2
je s3
jb s4
s2:dec bx
mov byte ptr [si+4],'/'
jmp short s0
s3:sub bx,3
jmp short s0
s4:cmp bx,0
je s5
sub bx,2
mov byte ptr [si+4],':'
jmp short s0
s5:jmp short s0
code ends
end begin
实验结果如图:
评论次数(0) |
浏览次数(624) |
类型(实验) |
收藏此文 |