汇编程序49:实验14 访问CMOS RAM(显示系统时间)

时间:2023-03-09 05:03:15
汇编程序49:实验14 访问CMOS RAM(显示系统时间)
 assume cs:code
;安装程序,使用指令out和in指令
code segment
start:
mov ax,cs
mov ds,ax
mov si,offset sub1
mov ax,0020h
mov es,ax
mov di,
mov cx,offset sub2 - offset sub1
cld
rep movsb ;复制程序 mov ax,
mov es,ax
mov word ptr es:[7ch*],200h
mov word ptr es:[7ch*+],
mov ax,4c00h
int 21h ;入口地址附加
sub1:
out 70h,al ;向端口70h写入字节数据al
in al,71h ;向端口71h读入字节数据al mov ah,al
mov cl,
shr ah,cl ;高位BCD码
and al,00001111b ;低位BCD码 add ah,30h
add al,30h ;转化为ASCLL码 mov bx,0b800h
mov es,bx
mov byte ptr es:[*+*+di],ah
mov byte ptr es:[*+*+di],al ;向显示屏写入数据 add di, ;每次偏移+
iret
sub2:
nop
code ends end start
 assume cs:code
;测试程序
code segment
start:
mov di,
mov al,
int 7ch
mov byte ptr es:[*+*+di],'/'
add di,
mov al,
int 7ch
mov byte ptr es:[*+*+di],'/'
add di,
mov al,
int 7ch
mov byte ptr es:[*+*+di],' '
add di,
mov al,
int 7ch
mov byte ptr es:[*+*+di],':'
add di,
mov al,
int 7ch
mov byte ptr es:[*+*+di],':'
add di,
mov al,
int 7ch
mov ax,4c00h
int 21h
code ends end start