~疯子 发表于 2011-12-14 19:28:12

实验14

0地址是秒,2地址是分,4地址是时,7地址是日,8地址是月,9地址是年
那么年怎么计算啊 年是4个十进制 如2011年11可以读取20就没有了

三田学校 发表于 2012-8-5 00:18:00

都是一个字节

s0512 发表于 2012-11-24 21:24:33

assume cs:code
code segment
;初始化
start:      
            mov ax,0b800h
            mov es,ax
            mov di,160*12+24*2
            mov dh,9 ;年
            mov cx,3   
;读年月日
ymd:         
            push cx
            mov al,dh
            out 70h,al
            in al,71h
            
year:       mov ah,al
            and al,00001111b
            add al,30h
            mov cl,4
            shr ah,cl
            add ah,30h
            
            mov es:,ah
            inc di
            mov byte ptr es:,4
            inc di
            mov es:,al      
            inc di
            mov byte ptr es:,4
            inc di
            
            add di,4
            mov bp,sp
            cmp byte ptr ss:,1
            je y_end
            mov byte ptr es:,'/'
            inc di
            mov byte ptr es:,2
            inc di
            add di,4
            
            dec dh
y_end:      pop cx
            loop ymd
            
;以下读时间
            mov dh,4
            mov cx,3
fm:         
            push cx
            mov al,dh
            out 70h,al
            in al,71h
            
            mov ah,al
            and al,00001111b
            add al,30h
            mov cl,4
            shr ah,cl
            add ah,30h
            
            mov es:,ah
            inc di
            mov byte ptr es:,6
            inc di
            mov es:,al      
            inc di
            mov byte ptr es:,6
            inc di
            
            add di,4
            mov bp,sp
            cmp byte ptr ss:,1
            je fm_end
            mov byte ptr es:,':'
            inc di
            mov byte ptr es:,2
            inc di
            add di,4
            
            sub dh,2
fm_end:   pop cx
            loop fm

      
                        
            mov ah,01
            int 21h
            
            ;做一个循环,显示年月日
            
code ends
end start    嘻嘻
页: [1]
查看完整版本: 实验14