assume cs:codesg datasg segment format db 'yy/MM/dd HH:mm:ss','$' yMdHms db 9, 8, 7, 4, 2, 0 datasg ends codesg segment start: mov ax, datasg mov ds, ax mov si, offset format mov di, offset yMdHms mov cx, 6 deal: push cx mov al, [di] ;指定要访问的内存地址,处理年份 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 byte ptr [si], ah mov byte ptr [si+1], al add si, 3 inc di pop cx loop deal mov dx, offset format mov ah, 09H int 21H mov ax, 4c00H int 21H codesg ends end start