欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

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

程序员文章站 2022-06-07 09:46:22
...

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

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

王爽 汇编语言 第十四章 实验十四 访问CMOS RAM
其他实验题答案:实验题答案合集