王爽 汇编语言 第十四章 实验十四 访问CMOS RAM

很简单啦,就把书上给的复制几遍改一改就好了

assume cs:code

code segment
start:
	;年份 
	mov al,9
	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:[160*12+30*2],ah
	mov byte ptr es:[160*12+30*2+2],al
	mov byte ptr es:[160*12+30*2+4],'/'
	
	;月份	 
	mov al,8
	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:[160*12+30*2+6],ah
	mov byte ptr es:[160*12+30*2+8],al
	mov byte ptr es:[160*12+30*2+10],'/'
	
	;日期
	mov al,7
	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:[160*12+30*2+12],ah
	mov byte ptr es:[160*12+30*2+14],al
	mov byte ptr es:[160*12+30*2+16],' '
	
	;时
	mov al,4
	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:[160*12+30*2+18],ah
	mov byte ptr es:[160*12+30*2+20],al
	mov byte ptr es:[160*12+30*2+22],':'
	
	;分
	mov al,2
	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:[160*12+30*2+24],ah
	mov byte ptr es:[160*12+30*2+26],al
	mov byte ptr es:[160*12+30*2+28],':'
	
	;秒
	mov al,0
	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:[160*12+30*2+30],ah
	mov byte ptr es:[160*12+30*2+32],al
	
	
	mov ax,4c00h
	int 21h
		
code ends
end start

在这里插入图片描述
其他实验题答案:实验题答案合集

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值