源程序
assume cs:code
code segment
unit: db 9,8,7,4,2,0 ;要访问的内存单元
mark: db '// :: '
start:
call init_seg
call visit_port_and_show ;访问端口数据显示日期,时间
mov ax,4c00h
int 21h
;======================================
init_seg:
mov ax,cs
mov ds,ax
mov bx,offset unit
mov si,offset mark
mov ax,0B800H
mov es,ax
mov di,160*12+30*2
mov cx,6 ;循环次数
ret
;======================================
visit_port_and_show:
push cx ;后面要用到cl,所以先放栈中
mov al,ds:[bx]
out 70h,al ;首先要向地址端口70h写入要访问的单元的地址
in al,71h ;从数据端口71h中取得指定单元中的数据
mov ah,al ;从单元中读取一个字节,分为两个表示BCD码值的数据
mov cl,4
s